[add]: Bank to simbrella calls
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from .routes import api
|
||||
@@ -0,0 +1,111 @@
|
||||
from flask import Blueprint, request, jsonify, send_from_directory
|
||||
from app.api.services import (
|
||||
EligibilityCheckService,
|
||||
SelectOfferService,
|
||||
ProvideLoanService,
|
||||
LoanInformationService,
|
||||
RepaymentService,
|
||||
CustomerConsentService,
|
||||
NotificationCallbackService
|
||||
)
|
||||
from app.utils.logger import logger
|
||||
from app.api.middlewares import enforce_json, require_auth
|
||||
import os
|
||||
|
||||
|
||||
api = Blueprint("api", __name__)
|
||||
|
||||
|
||||
@api.before_request
|
||||
def cors_middleware():
|
||||
"""Middleware applied globally to all API routes in this blueprint"""
|
||||
return enforce_json()
|
||||
|
||||
|
||||
# Swagger JSON file
|
||||
@api.route("/swagger.json", methods=['GET'])
|
||||
def swagger_json():
|
||||
swagger_dir = os.path.join("swagger")
|
||||
return send_from_directory(swagger_dir, "digifi_swagger.json")
|
||||
|
||||
|
||||
|
||||
@api.route('/swagger/<path:filename>')
|
||||
def serve_paths(filename):
|
||||
swagger_dir = os.path.join("swagger")
|
||||
return send_from_directory(swagger_dir, filename)
|
||||
|
||||
|
||||
# EligibilityCheck Endpoint
|
||||
@api.route('/EligibilityCheck', methods=['POST'])
|
||||
@require_auth
|
||||
def eligibility_check():
|
||||
data = request.get_json()
|
||||
# logger.info(f"EligibilityCheck request received: {data}")
|
||||
response = EligibilityCheckService.process_request(data)
|
||||
return response
|
||||
|
||||
# SelectOffer Endpoint
|
||||
@api.route('/SelectOffer', methods=['POST'])
|
||||
@require_auth
|
||||
def select_offer():
|
||||
data = request.get_json()
|
||||
# logger.info(f"SelectOffer request received: {data}")
|
||||
response = SelectOfferService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# ProvideLoan Endpoint
|
||||
@api.route('/ProvideLoan', methods=['POST'])
|
||||
@require_auth
|
||||
def provide_loan():
|
||||
data = request.get_json()
|
||||
# logger.info(f"ProvideLoan request received: {data}")
|
||||
response = ProvideLoanService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# LoanInformation Endpoint
|
||||
@api.route('/LoanInformation', methods=['GET'])
|
||||
@require_auth
|
||||
def loan_information():
|
||||
data = request.args.to_dict()
|
||||
# logger.info(f"LoanInformation request received: {data}")
|
||||
response = LoanInformationService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# Repayment Endpoint
|
||||
@api.route('/Repayment', methods=['POST'])
|
||||
@require_auth
|
||||
def repayment():
|
||||
data = request.get_json()
|
||||
# logger.info(f"Repayment request received: {data}")
|
||||
response = RepaymentService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# CustomerConsent Endpoint
|
||||
@api.route('/CustomerConsent', methods=['POST'])
|
||||
@require_auth
|
||||
def customer_consent():
|
||||
data = request.get_json()
|
||||
# logger.info(f"CustomerConsent request received: {data}")
|
||||
response = CustomerConsentService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# NotificationCallback Endpoint
|
||||
@api.route('/NotificationCallback', methods=['POST'])
|
||||
@require_auth
|
||||
def notification_callback():
|
||||
data = request.get_json()
|
||||
# logger.info(f"NotificationCallback request received: {data}")
|
||||
response = NotificationCallbackService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# Health Check Endpoint
|
||||
@api.route('/health', methods=['GET'])
|
||||
def health_check():
|
||||
return {"status": "ok"} , 200
|
||||
Reference in New Issue
Block a user