diff --git a/app/routes/authentication.py b/app/routes/authentication.py index d8e3524..4fe5726 100644 --- a/app/routes/authentication.py +++ b/app/routes/authentication.py @@ -1,19 +1,44 @@ -from flask import Blueprint, request, jsonify +from flask import Blueprint, request, jsonify, current_app import requests from app.utils.auth import get_headers auth_bp = Blueprint("auth", __name__) + @auth_bp.route("/health", methods=["GET"]) def health(): return jsonify({"status": "Up"}) + @auth_bp.route("/login", methods=["POST"]) def login(): data = request.json api_url = "https://coreapi.dev.simbrellang.net/api/auth/login" - + response = requests.post(api_url, json=data) if response.status_code == 200: return jsonify(response.json()), 200 - return jsonify({"error": "Invalid credentials"}), response.status_code \ No newline at end of file + return jsonify({"error": "Invalid credentials"}), response.status_code + + +@auth_bp.route("/status-call", methods=["POST"]) +def status_call(): + data = request.json + api_url = f"{current_app.config['API_BASE_URL']}/StatusCall" + + # response = requests.post(api_url, json=data, headers=get_headers()) + # return jsonify(response.json()), response.status_code + response = { + "transactionId": "24110114545374721", + "data": { + "transactionId": "241101", + "providedAmount": 1000, + "collectedAmount": 0, + "resultCode": "00", + "resultDescription": "Loan Provision is successful", + }, + "resultCode": "00", + "resultDescription": "SUCCESS", + } + + return jsonify(response), 200 diff --git a/openapi.yml b/openapi.yml index c01887f..20e7c77 100644 --- a/openapi.yml +++ b/openapi.yml @@ -21,6 +21,37 @@ paths: responses: 200: description: A successful response + /status-call: + post: + summary: Perform a status call + 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: "173021" + transactionType: + type: string + example: "Disbursement" + customerId: + type: string + example: "CN621868" + responses: + 200: + description: A successful response /eligibility/check: post: summary: Performs eligibility check on a user