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