layered found loan

This commit is contained in:
CHIEFSOFT\ameye
2025-11-07 18:36:18 -05:00
parent 9292b9dd62
commit 8323075ff7
+11 -5
View File
@@ -125,12 +125,18 @@ def direct_loan():
loan = LoanService.get_loan_by_transaction_id(transaction_id=transaction_id)
if not loan:
logger.warning(f"Loan with transaction id {transaction_id} does not exist")
return jsonify({
"status": "error",
"message": f"Loan with transaction id {transaction_id} does not exist"
}), 400
first_error = f"Loan with transaction id {transaction_id} does not exist"
logger.warning(first_error)
loan = LoanService.get_latest_loan_without_disburse_date()
if not loan:
logger.info(f"No loan found without disbursement date")
return jsonify({
"status": "error",
"first_error": first_error,
"message": f"No loan found without disbursement date"
}), 400
# Tried 2 method to get the loan record at this point
loan_data = loan.to_dict()
# Prevent double disbursement