[fix]: loan charges and instalment amount
This commit is contained in:
@@ -52,3 +52,7 @@ class SimbrellaIntegration:
|
||||
except Exception as e:
|
||||
logger.error(f"RACCheck API call failed: {str(e)}", exc_info=True)
|
||||
raise Exception(f"RACCheck API call failed: {str(e)}")
|
||||
# return httpx.Response(
|
||||
# status_code=200,
|
||||
# json={}
|
||||
# )
|
||||
|
||||
@@ -58,7 +58,7 @@ class SelectOfferService(BaseService):
|
||||
logger.error(f"No charges found for offer ID {offer.id}")
|
||||
return jsonify({"message": "No charges found for the offer"}), 404
|
||||
|
||||
# logger.error(f"{loan_charges}")
|
||||
logger.error(f"{loan_charges}")
|
||||
|
||||
fees_and_dues = {
|
||||
charge.code: {
|
||||
@@ -88,6 +88,9 @@ class SelectOfferService(BaseService):
|
||||
(start_date + relativedelta(months=i + 1)).isoformat()
|
||||
for i in range(tenor)
|
||||
]
|
||||
|
||||
# Calculate the installment amount
|
||||
installment_amount = total_amount / tenor
|
||||
|
||||
|
||||
offers = [
|
||||
@@ -96,15 +99,15 @@ class SelectOfferService(BaseService):
|
||||
"productId": product_id,
|
||||
"amount": amount,
|
||||
"upfrontPayment": upfront_payment,
|
||||
"interestRate": 3.0,
|
||||
"managementRate": fees_and_dues["management"]["rate"],
|
||||
"managementFee": fees_and_dues["management"]["fee"],
|
||||
"insuranceRate": fees_and_dues["insurance"]["rate"],
|
||||
"insuranceFee": fees_and_dues["insurance"]["fee"],
|
||||
"interestRate": fees_and_dues["INTEREST"]["rate"],
|
||||
"managementRate": fees_and_dues["MGTFEE"]["rate"],
|
||||
"managementFee": fees_and_dues["MGTFEE"]["fee"],
|
||||
"insuranceRate": fees_and_dues["INSURANCE"]["rate"],
|
||||
"insuranceFee": fees_and_dues["INSURANCE"]["fee"],
|
||||
"VATRate": fees_and_dues["VAT"]["rate"],
|
||||
"VATAmount": fees_and_dues["VAT"]["fee"],
|
||||
"recommendedRepaymentDates": ["2022-11-30"],
|
||||
"installmentAmount": recommended_repayment_dates,
|
||||
"recommendedRepaymentDates": recommended_repayment_dates,
|
||||
"installmentAmount": installment_amount,
|
||||
"totalRepaymentAmount": total_amount,
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user