Loan Reference added
This commit is contained in:
@@ -42,6 +42,7 @@ class ProvideLoanService(BaseService):
|
||||
offer_id = validated_data.get('offerId')
|
||||
amount = validated_data.get("requestedAmount")
|
||||
product_id = validated_data.get("productId")
|
||||
channel = validated_data.get('channel')
|
||||
|
||||
customer = Customer.is_valid_customer(customer_id)
|
||||
|
||||
@@ -132,7 +133,7 @@ class ProvideLoanService(BaseService):
|
||||
}), 400
|
||||
|
||||
db.session.flush()
|
||||
|
||||
current_product_id = offer.product_id
|
||||
schedule = LoanRepaymentSchedule.add_repayment_schedule(loan = loan, num_schedules = num_schedules, transaction_id = transaction_id)
|
||||
|
||||
|
||||
@@ -156,7 +157,9 @@ class ProvideLoanService(BaseService):
|
||||
return jsonify({
|
||||
"message": "Invalid Customer or Account"
|
||||
}), 400
|
||||
|
||||
|
||||
padded_loan_id = str(loan_id).zfill(9)
|
||||
loanRef = f"LID{padded_loan_id}{channel}{current_product_id}"
|
||||
|
||||
response_data = {
|
||||
"requestId": request_id,
|
||||
@@ -164,6 +167,7 @@ class ProvideLoanService(BaseService):
|
||||
"customerId": customer_id,
|
||||
"accountId": account_id,
|
||||
"msisdn": customer.msisdn,
|
||||
"loanRef": loanRef,
|
||||
"resultCode": "00",
|
||||
"resultDescription": "Successful"
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
"type": "string",
|
||||
"example": "Tr201712RK9232P115"
|
||||
},
|
||||
"loanRef": {
|
||||
"type": "string",
|
||||
"example": "1620029887USSDAMPC"
|
||||
},
|
||||
"customerId": {
|
||||
"type": "string",
|
||||
"example": "CN621868"
|
||||
|
||||
Reference in New Issue
Block a user