retry loans

This commit is contained in:
CHIEFSOFT\ameye
2025-11-02 15:34:55 -05:00
parent 8ffac10cd3
commit c88e85eda1
4 changed files with 122 additions and 10 deletions
+27 -1
View File
@@ -31,7 +31,7 @@ def verify_transaction():
data = {
"transactionId": loan_data.get('transactionId'),
"FbnTransactionId": loan_data.get('transactionId'),
"fbnTransactionId": loan_data.get('transactionId'),
"debtId": str(loan_data.get('debtId')),
"customerId": loan_data.get('customerId'),
"accountId": loan_data.get('accountId'),
@@ -64,6 +64,32 @@ def disbursement():
response = SimbrellaClient.disburse_loan(data)
return response
@autocall_bp.route("/retry-disbursement", methods=["POST"])
def retry_disbursement():
data = request.get_json()
logger.info(f"Data received: {data}")
transactionId = data["transactionId"]
logger.info(f"Calling Disbursement Components")
loan = LoanService.get_loan_by_transaction_id(transactionId)
if not loan:
logger.info(f"No loan found without disbursement date")
return 0
logger.info(f"Calling DisburseLoan endpoint with data: {loan}")
loan_data = loan.to_dict()
data = {
"transactionId": loan_data.get('transactionId'),
"FbnTransactionId": loan_data.get('transactionId'),
"debtId": str(loan_data.get('debtId')),
"customerId": loan_data.get('customerId'),
"accountId": loan_data.get('accountId'),
"productId": str(loan_data.get('productId', "")),
"provideAmount": loan_data.get('currentLoanAmount'),
}
response = SimbrellaClient.disburse_loan(data)
return response
@autocall_bp.route("/direct/loan", methods=["POST"])