Update provide_loan.py

This commit is contained in:
VivianDee
2025-04-10 12:40:19 +01:00
parent 87f1fa2152
commit f13ca508c2
+12 -8
View File
@@ -35,7 +35,13 @@ class ProvideLoanService(BaseService):
if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):
transaction = ProvideLoanService.log_transaction(validated_data = validated_data)
if not transaction:
logger.error(f"Failed to log transaction")
return jsonify({
"message": "Failed to log transaction."
}), 400
# Save the loan details here
loan_id = f"loan_{transaction.id}"
@@ -48,15 +54,13 @@ class ProvideLoanService(BaseService):
status="active"
)
if not transaction:
logger.error(f"Failed to log transaction")
if not loan:
logger.error(f"Failed to save loan details")
return jsonify({
"message": "Failed to log transaction."
"message": "Failed to save loan details."
}), 400
else:
return jsonify({
"message": "Invalid Customer or Account"