[update]: loan status response

This commit was merged in pull request #37.
This commit is contained in:
VivianDee
2025-05-27 02:02:22 +01:00
parent 7a2ff6586f
commit 65472d3f07
7 changed files with 51 additions and 5 deletions
+1
View File
@@ -10,3 +10,4 @@ class RepaymentSchema(Schema):
accountId = fields.Str(required=True)
customerId = fields.Str(required=True)
channel = fields.Str(required=True)
initiatedBy = fields.Str(required=False)
+2
View File
@@ -30,8 +30,10 @@ class LoanStatusService(BaseService):
validated_data = LoanStatusService.validate_data(data, LoanStatusSchema())
customer_id = validated_data.get('customerId')
logger.info(f"Looking for customer *** {customer_id}")
customer = Customer.get_customer_with_loan_list(customer_id)
transactionId = validated_data.get('transactionId')
account_id = validated_data.get('accountId')
+6 -4
View File
@@ -109,6 +109,9 @@ class ProvideLoanService(BaseService):
insurance = charges["insurance"]
vat = charges["vat"]
padded_id = str(transaction_id).zfill(12)
loan_ref = f"{padded_id}{channel}{offer.product_id}"
# Save the loan details
loan = Loan.create_loan(
@@ -126,6 +129,7 @@ class ProvideLoanService(BaseService):
eligible_amount=eligible_amount,
status = LoanStatus.ACTIVE,
tenor = offer.tenor,
reference = loan_ref
)
if not loan:
@@ -155,14 +159,12 @@ class ProvideLoanService(BaseService):
else:
return ResponseHelper.error(result_description="Invalid Customer or Account")
padded_id = str(transaction_id).zfill(12)
loanref = f"{padded_id}{channel}{offer.product_id}"
response_data = {
"requestId": request_id,
"transactionId": transaction_id,
"loanRef": loanref,
"loanRef": loan_ref,
"customerId": customer_id,
"accountId": account_id,
"msisdn": customer.msisdn
+1
View File
@@ -36,6 +36,7 @@ class RepaymentService(BaseService):
account_id = validated_data.get('accountId')
customer = Customer.get_customer_with_loan_list(customer_id)
transaction_id = validated_data.get('transactionId')
initiated_by = validated_data.get('initiatedBy')
if(RepaymentService.validate_account_ownership(account_id = account_id, customer_id = customer_id)):