diff --git a/app/routes/loan.py b/app/routes/loan.py index 409246b..28178bc 100644 --- a/app/routes/loan.py +++ b/app/routes/loan.py @@ -177,3 +177,28 @@ def disbursement(): } return jsonify(response), 200 + + +@loan_bp.route("/collect-loan", methods=["POST"]) +def collect_loan(): + data = request.json + api_url = f"{current_app.config['API_BASE_URL']}/CollectLoan" + + # response = requests.post(api_url, json=data, headers=get_headers()) + # return jsonify(response.json()), response.status_code + response = { + "transactionId": "T002", + "debtId": "273194670", + "customerId": "CN621868", + "accountId": "2017821799", + "productId": "101", + "collectAmount": 60000, + "penalCharge": 0, + "lienAmount": 20000, + "countryId": "01", + "comment": "Testing CollectionLoanRequest", + "resultCode": "00", + "resultDescription": "Loan Collection Successful", + } + + return jsonify(response), 200 diff --git a/openapi.yml b/openapi.yml index 03d733b..a616719 100644 --- a/openapi.yml +++ b/openapi.yml @@ -308,3 +308,52 @@ paths: responses: 200: description: A successful response + /loans/collect-loan: + post: + summary: Collect loan from a customer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + transactionId: + type: string + example: "T002" + fbnTransactionId: + type: string + example: "Tr201712RK9232P115" + debtId: + type: string + example: "273194670" + customerId: + type: string + example: "CN621868" + accountId: + type: string + example: "2017821799" + productId: + type: string + example: "101" + collectAmount: + type: integer + example: 80000 + penalCharge: + type: integer + example: 0 + collectionMethod: + type: integer + example: 1 + lienAmount: + type: integer + example: 80000 + countryId: + type: string + example: "01" + comment: + type: string + example: "Testing CollectionLoanRequest" + responses: + 200: + description: A successful response