added failed loans endpoint

This commit was merged in pull request #70.
This commit is contained in:
Chinenye Nmoh
2026-04-05 16:53:02 +01:00
parent f1db12c7f2
commit c32c2502cc
7 changed files with 183 additions and 2 deletions
+4
View File
@@ -137,6 +137,8 @@ class SimbrellaClient:
logger.error("")
LoanService.set_disbursement_loan_description(loan_data['debtId'],
"Disbursement Service url not found (404)")
logger.info(f"Loan status updated to {LoanStatus.FAILED} for loan ID {loan_data['debtId']} due to disbursement failure")
LoanService.update_status(loan_data['debtId'], LoanStatus.FAILED)
return ResponseHelper.error("Disbursement Service url not found (404)", status_code=404)
logger.info(f"Disbursement response: {response.json()}")
@@ -165,6 +167,8 @@ class SimbrellaClient:
errorMessage = "Unable to complete Disbursement Service with HTTP status code: " + str(
response.status_code)
LoanService.set_disbursement_loan_description(loan_data['debtId'], errorMessage)
updatedLoan = LoanService.update_status(loan_data['debtId'], LoanStatus.FAILED)
logger.info(f"Loan status updated to {updatedLoan.get('status')} for loan ID {loan_data['debtId']} due to disbursement failure")
return ResponseHelper.error(errorMessage, status_code=response.status_code)
except requests.exceptions.HTTPError as errh: