[add]: Loan details and repayment fix

This commit is contained in:
VivianDee
2025-04-10 12:20:57 +01:00
parent edd19b9a39
commit 1b973322c9
6 changed files with 80 additions and 33 deletions
+4 -2
View File
@@ -21,10 +21,12 @@ class RepaymentService(BaseService):
"""
try:
validated_data = RepaymentService.validate_data(data, RepaymentSchema())
account_id = validated_data.get('accountId')
customer_id = validated_data.get('customerId')
customer = RepaymentService.get_or_create_customer(validated_data)
account = customer.accounts[0]
if (RepaymentService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):
if (RepaymentService.validate_account_ownership(account_id = account.id, customer_id = customer_id)):
transaction = RepaymentService.log_transaction(validated_data = validated_data)
if not transaction: