done with loan offers

This commit is contained in:
lennyaiko
2025-03-27 11:41:10 +01:00
parent a0fa8d30ab
commit 7fc5474f98
9 changed files with 86 additions and 7 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
./vscode
.vscode/
__pycache__/
.env
+2 -2
View File
@@ -1,7 +1,7 @@
from flask import Flask
from flask_cors import CORS
from app.config import Config
from app.routes import auth_bp, eligibility_bp
from app.routes import auth_bp, eligibility_bp, loan_bp
from app.errors import method_not_allowed, unsupported_media_type
@@ -16,7 +16,7 @@ def create_app():
# Register blueprints
app.register_blueprint(auth_bp)
# app.register_blueprint(loan_bp)
app.register_blueprint(loan_bp, url_prefix="/loans")
app.register_blueprint(eligibility_bp, url_prefix="/eligibility")
# app.register_blueprint(repayment_bp)
Binary file not shown.
+3 -2
View File
@@ -1,4 +1,5 @@
from .authentication import auth_bp
from .eligibility import eligibility_bp
# from .loan import loan_bp
# from .repayment import repayment_bp
from .loan import loan_bp
# from .repayment import repayment_bp
Binary file not shown.
Binary file not shown.
-2
View File
@@ -10,8 +10,6 @@ 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 = {
+43
View File
@@ -0,0 +1,43 @@
from flask import Blueprint, request, jsonify, current_app
import requests
from app.utils.auth import get_headers
loan_bp = Blueprint("loan", __name__)
@loan_bp.route("/select-offer", methods=["POST"])
def select_offer():
data = request.json
api_url = f"{current_app.config['API_BASE_URL']}/SelectOffer"
# response = requests.post(api_url, json=data, headers=get_headers())
# return jsonify(response.json()), response.status_code
response = {
"transactionId": "1231231321232",
"customerId": "1256907",
"accountId": "5948306019",
"outstandingDebtAmount": 0,
"loan": [
{
"offerId": "14451",
"productId": "2030",
"amount": 10000,
"upfrontPayment": 1000,
"interestRate": 3,
"Interest": 300,
"ManagementRate": 1,
"ManagementFee": 100,
"InsuranceRate": 1,
"InsuranceFee": 100,
"VATRate": 7.5,
"VATamount": 100,
"recommendedRepaymentDates": ["2022-11-30"],
"installmentAmount": 11000,
"totalRepaymentAmount": 11000,
}
],
"resultCode": "00",
"resultDescription": "Successful",
}
return jsonify(response), 200
+37
View File
@@ -58,3 +58,40 @@ paths:
responses:
200:
description: A successful response
/loans/select-offer:
post:
summary: Selects an offer for a loan
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
requestId:
type: string
example: "202111170001371256908"
transactionId:
type: string
example: "1231231321232"
customerId:
type: string
example: "1256907"
accountId:
type: string
example: "5948306019"
msisdn:
type: string
example: "123456789"
requestedAmount:
type: integer
example: 10000
productId:
type: string
example: "101"
channel:
type: string
example: "USSD"
responses:
200:
description: A successful response