From a352449800e586e3a68ceb672d9f7ad8c9aa491d Mon Sep 17 00:00:00 2001 From: lennyaiko Date: Thu, 27 Mar 2025 12:16:04 +0100 Subject: [PATCH] done with disbursement --- app/routes/loan.py | 30 +++++++++++++++++++++++++ openapi.yml | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/app/routes/loan.py b/app/routes/loan.py index f95ca5b..409246b 100644 --- a/app/routes/loan.py +++ b/app/routes/loan.py @@ -147,3 +147,33 @@ def rac_check(): } return jsonify(response), 200 + + +@loan_bp.route("/disbursement", methods=["POST"]) +def disbursement(): + data = request.json + api_url = f"{current_app.config['API_BASE_URL']}/Disbursement" + + # response = requests.post(api_url, json=data, headers=get_headers()) + # return jsonify(response.json()), response.status_code + response = { + "requestId": "R02802", + "countryCode": "NGR", + "transactionId": "Tr201712RK9232P115", + "debtId": "273194670", + "customerId": "CN621868", + "accountId": "2017821799", + "productId": "101", + "provideAmount": 100000, + "totalFees": 7075, + "feesDetails": { + "collectAmountInterest": 5000, + "collectAmountMgtFee": 1000, + "collectAmountInsurance": 1000, + "collectAmountVAT": 75, + }, + "resultCode": "00", + "resultDescription": "Loan Request Completed Successfully!", + } + + return jsonify(response), 200 diff --git a/openapi.yml b/openapi.yml index 6901425..03d733b 100644 --- a/openapi.yml +++ b/openapi.yml @@ -253,3 +253,58 @@ paths: responses: 200: description: A successful response + /loans/disbursement: + post: + summary: Disburse a loan + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + requestId: + type: string + example: "R02802" + countryCode: + type: string + example: "NGR" + transactionId: + type: string + example: "Tr201712RK9232P115" + debtId: + type: string + example: "273194670" + customerId: + type: string + example: "CN621868" + accountId: + type: string + example: "2017821799" + productId: + type: string + example: "101" + provideAmount: + type: integer + example: 100000 + totalFees: + type: integer + example: 7075 + feesDetails: + type: object + properties: + collectAmountInterest: + type: integer + example: 5000 + collectAmountMgtFee: + type: integer + example: 1000 + collectAmountInsurance: + type: integer + example: 1000 + collectAmountVAT: + type: integer + example: 75 + responses: + 200: + description: A successful response