Track transaction before create loan
This commit is contained in:
@@ -36,8 +36,17 @@ class ProvideLoanService(BaseService):
|
||||
|
||||
if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):
|
||||
|
||||
|
||||
# Save the loan details
|
||||
# Log Transaction
|
||||
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(
|
||||
customer_id = customer_id,
|
||||
account_id = account_id,
|
||||
@@ -53,17 +62,17 @@ class ProvideLoanService(BaseService):
|
||||
return jsonify({
|
||||
"message": "Failed to save loan details."
|
||||
}), 400
|
||||
|
||||
|
||||
logger.error(f"********* We need to develop the fee array here")
|
||||
|
||||
# Log Transaction
|
||||
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
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
else:
|
||||
return jsonify({
|
||||
|
||||
Reference in New Issue
Block a user