done with status call

This commit is contained in:
lennyaiko
2025-03-27 12:28:36 +01:00
parent d5a749470c
commit 6bb84fed78
2 changed files with 59 additions and 3 deletions
+28 -3
View File
@@ -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
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
+31
View File
@@ -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