Update provide_loan.py
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user