retry loans
This commit is contained in:
+27
-1
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user