Added routes
This commit is contained in:
+3
-4
@@ -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, loan_bp
|
||||
from app.routes import auth_bp, autocall_bp
|
||||
from app.errors import method_not_allowed, unsupported_media_type
|
||||
|
||||
|
||||
@@ -16,9 +16,8 @@ def create_app():
|
||||
|
||||
# Register blueprints
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(loan_bp, url_prefix="/loans")
|
||||
app.register_blueprint(eligibility_bp, url_prefix="/eligibility")
|
||||
# app.register_blueprint(repayment_bp)
|
||||
app.register_blueprint(autocall_bp, url_prefix="/autocall")
|
||||
|
||||
|
||||
# Error Handlers
|
||||
app.register_error_handler(405, method_not_allowed)
|
||||
|
||||
@@ -16,12 +16,22 @@ class SimbrellaClient:
|
||||
logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}")
|
||||
logger.info(f"Calling disbursement endpoint with data: {data}")
|
||||
|
||||
data1 ={
|
||||
"requestId": "7876786",
|
||||
"transactionId": "T001",
|
||||
data={
|
||||
"requestId": "RQID1743987402764",
|
||||
"transactionId": "24",
|
||||
"customerId": "CN437703",
|
||||
"accountId": "ACN2167485",
|
||||
"msisdn": "3451342",
|
||||
"resultCode": "00",
|
||||
"resultDescription": "Successful"
|
||||
}
|
||||
|
||||
disbursement_data ={
|
||||
"requestId": data['requestId'],
|
||||
"transactionId": data['transactionId'],
|
||||
"debtId": "273194670",
|
||||
"customerId": "CN621868",
|
||||
"accountId": "2017821799",
|
||||
"customerId": data['customerId'],
|
||||
"accountId": data['accountId'],
|
||||
"productId": "101",
|
||||
"provideAmount": 100000,
|
||||
"collectAmountInterest": 5000,
|
||||
@@ -29,24 +39,13 @@ class SimbrellaClient:
|
||||
"collectAmountInsurance": 1000,
|
||||
"collectAmountVAT": 75,
|
||||
"countryId": "01",
|
||||
"comment": "Testing LoanRequest"
|
||||
"comment": "Loan Disbursement",
|
||||
}
|
||||
try:
|
||||
# response = requests.post(
|
||||
# api_url,
|
||||
# json=data1,
|
||||
# headers=get_headers()
|
||||
# )
|
||||
|
||||
# headers = {
|
||||
# 'Content-Type': 'application/json',
|
||||
# 'x-api_key': f'{settings.VALID_API_KEY}',
|
||||
# 'App-Id': f'{settings.VALID_APP_ID}'
|
||||
# }
|
||||
#
|
||||
response = requests.post(api_url, json=data1, timeout=10, headers=get_headers())
|
||||
logger.info(f"Here is your Disbursement Request data ****** : {disbursement_data}")
|
||||
response = requests.post(api_url, json=disbursement_data, timeout=10, headers=get_headers())
|
||||
logger.info(f"Disbursement response: {response.json()}")
|
||||
logger.info(f"Here is your disbursement data: {data1}")
|
||||
|
||||
except Exception as e:
|
||||
logger.info(f"Failed to call disbursement endpoint: {e}")
|
||||
#raise
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from .authentication import auth_bp
|
||||
from .eligibility import eligibility_bp
|
||||
from .loan import loan_bp
|
||||
|
||||
# from .repayment import repayment_bp
|
||||
from .autocall import autocall_bp
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
from flask import Blueprint, request, jsonify, current_app
|
||||
import requests
|
||||
from app.config import settings
|
||||
from app.utils.auth import get_headers
|
||||
from app.utils.logger import logger
|
||||
|
||||
autocall_bp = Blueprint("autocall", __name__)
|
||||
|
||||
@autocall_bp.route("/refresh-verify-disbursement", methods=["GET"])
|
||||
def verify_transaction():
|
||||
data = request.json()
|
||||
api_url = f"{BASE_URL}/Disbursement"
|
||||
logger.info(f"Calling Verify Components")
|
||||
return jsonify(data), 200
|
||||
|
||||
@autocall_bp.route("/refresh-disbursement", methods=["GET"])
|
||||
def disbursement():
|
||||
data = request.json()
|
||||
api_url = f"{BASE_URL}/Disbursement"
|
||||
logger.info(f"Calling Disbursement Components")
|
||||
return jsonify(data), 200
|
||||
|
||||
|
||||
Reference in New Issue
Block a user