initial commit

This commit is contained in:
lennyaiko
2025-03-27 11:29:36 +01:00
commit 8e2d371218
35 changed files with 548 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
from .authentication import auth_bp
from .eligibility import eligibility_bp
# from .loan import loan_bp
# from .repayment import repayment_bp
Binary file not shown.
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
from flask import Blueprint, request, jsonify
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
+42
View File
@@ -0,0 +1,42 @@
from flask import Blueprint, request, jsonify, current_app
import requests
from app.utils.auth import get_headers
eligibility_bp = Blueprint("eligibility", __name__)
@eligibility_bp.route("/check", methods=["POST"])
def eligibility_check():
data = request.json
api_url = f"{current_app.config['API_BASE_URL']}/EligibilityCheck"
print(api_url)
# response = requests.post(api_url, json=data, headers=get_headers())
# return jsonify(response.json()), response.status_code
response = {
"customerId": "CN621868",
"transactionId": "Tr201712RK9232P115",
"countryCode": "NGR",
"msisdn": "2348012345678",
"eligibleOffers": [
{
"offerId": 101,
"minAmount": 5000,
"maxAmount": 20000,
"productId": 2030,
"tenor": 30,
},
{
"offerId": 102,
"minAmount": 20000,
"maxAmount": 50000,
"productId": 2090,
"tenor": 90,
},
],
"resultCode": "00",
"resultDescription": "Successful",
}
return jsonify(response), 200
View File
View File