Track transaction before create loan

This commit is contained in:
2025-04-15 20:22:47 -04:00
parent 9df8e31fdd
commit 8ab485d920
+21 -12
View File
@@ -36,8 +36,17 @@ class ProvideLoanService(BaseService):
if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)): if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):
# Log Transaction
# Save the loan details 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
loan = Loan.create_loan( loan = Loan.create_loan(
customer_id = customer_id, customer_id = customer_id,
account_id = account_id, account_id = account_id,
@@ -53,17 +62,17 @@ class ProvideLoanService(BaseService):
return jsonify({ return jsonify({
"message": "Failed to save loan details." "message": "Failed to save loan details."
}), 400 }), 400
logger.error(f"********* We need to develop the fee array here")
# Log Transaction # Log Transaction
transaction = ProvideLoanService.log_transaction(validated_data = validated_data) # transaction = ProvideLoanService.log_transaction(validated_data = validated_data)
#
if not transaction: # if not transaction:
logger.error(f"Failed to log transaction") # logger.error(f"Failed to log transaction")
return jsonify({ # return jsonify({
"message": "Failed to log transaction." # "message": "Failed to log transaction."
}), 400 # }), 400
else: else:
return jsonify({ return jsonify({