[update]: loan status response
This commit was merged in pull request #37.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user