2 new endpoint
This commit is contained in:
@@ -98,6 +98,70 @@ def retry_disbursement():
|
|||||||
logger.error(f"Failed to call retry disbursement {data}: {e}")
|
logger.error(f"Failed to call retry disbursement {data}: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
@autocall_bp.route("/verify-disbursement", methods=["POST"])
|
||||||
|
def retry_verify_disbursement():
|
||||||
|
try:
|
||||||
|
data = request.get_json()
|
||||||
|
logger.info(f"Verify Disbursement Transaction ID Data Received for :::: {data}")
|
||||||
|
|
||||||
|
transactionId = data["transactionId"]
|
||||||
|
logger.info(f"Starting Transaction ID Data Received for :::: {transactionId}")
|
||||||
|
|
||||||
|
logger.info(f"Calling Disbursement Components for Retry Transaction ID Data Received for :::: {transactionId}")
|
||||||
|
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)
|
||||||
|
# logger.info(f"Retry Disbursement Transaction ID Result Received for :::: {response}")
|
||||||
|
return ResponseHelper.success(message="Retry Disbursement Request Sent Successfully", status_code=200)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to call retry disbursement {data}: {e}")
|
||||||
|
|
||||||
|
@autocall_bp.route("/start-repayment", methods=["POST"])
|
||||||
|
def start_repayment():
|
||||||
|
try:
|
||||||
|
data = request.get_json()
|
||||||
|
logger.info(f"Start Repay Transaction ID Data Received for :::: {data}")
|
||||||
|
|
||||||
|
transactionId = data["transactionId"]
|
||||||
|
logger.info(f"Starting Transaction ID Data Received for :::: {transactionId}")
|
||||||
|
|
||||||
|
logger.info(f"Calling Disbursement Components for Retry Transaction ID Data Received for :::: {transactionId}")
|
||||||
|
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)
|
||||||
|
# logger.info(f"Retry Disbursement Transaction ID Result Received for :::: {response}")
|
||||||
|
return ResponseHelper.success(message="Retry Disbursement Request Sent Successfully", status_code=200)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to call retry disbursement {data}: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user