corrected interest charges on 3 months loan and made loan schedule active by default
This commit was merged in pull request #65.
This commit is contained in:
@@ -92,9 +92,8 @@ class SimbrellaClient:
|
||||
vat_fee = loan_charges.get("VAT")['amount']
|
||||
interest_fee = loan_charges.get("INTEREST")['amount']
|
||||
insurance_fee = loan_charges.get("INSURANCE")['amount']
|
||||
|
||||
product_id = str(loan_data.get('productId', ""))
|
||||
debtId = str(loan_data.get('debtId', "")).strip().zfill(6)
|
||||
product_id = str(loan_data.get('productId', ''))
|
||||
disbursement_data = {
|
||||
"transactionId": loan_data.get('transactionId'),
|
||||
"fbnTransactionId": loan_data.get('transactionId'),
|
||||
@@ -103,10 +102,10 @@ class SimbrellaClient:
|
||||
"accountId": loan_data.get('accountId'),
|
||||
"productId": str(loan_data.get('productId', "")),
|
||||
"provideAmount": loan_data.get('currentLoanAmount'),
|
||||
"collectAmountInterest": interest_fee if product_id != '3MPC' else 0, #send charges for only 1 month loan
|
||||
"collectAmountMgtFee": mgt_fee if product_id != '3MPC' else 0,
|
||||
"collectAmountInsurance": insurance_fee if product_id != '3MPC' else 0,
|
||||
"collectAmountVAT": vat_fee if product_id != '3MPC' else 0,
|
||||
"collectAmountInterest": interest_fee if product_id != '3MPC' else 0,
|
||||
"collectAmountMgtFee": mgt_fee,
|
||||
"collectAmountInsurance": insurance_fee,
|
||||
"collectAmountVAT": vat_fee,
|
||||
"countryId": "01",
|
||||
"comment": "Loan Disbursement",
|
||||
}
|
||||
@@ -148,7 +147,17 @@ class SimbrellaClient:
|
||||
result.get('responseMessage', ''))
|
||||
reload_loan = LoanService.get_loan_by_transaction_id(transaction_id=data['transactionId'])
|
||||
reload_loan_data = reload_loan.to_dict()
|
||||
#mark repayment schedule as active
|
||||
repayment_schedule = LoanRepaymentScheduleService.get_repayment_schedule_by_loan_id(
|
||||
reload_loan_data['debtId'], include_paid=False)
|
||||
logger.info(f'Loan repayment schedule: {repayment_schedule}')
|
||||
if repayment_schedule:
|
||||
for schedule in repayment_schedule:
|
||||
logger.info(f"Updating repayment schedule ID {schedule.id} status to ACTIVE")
|
||||
LoanRepaymentScheduleService.update_repayment_schedule_status_to_active(schedule.id)
|
||||
|
||||
SimbrellaClient.verify_disbursement_transaction(reload_loan_data)
|
||||
|
||||
return ResponseHelper.success(response.json(), "Successful")
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user