[add]: eco routes, services and enums
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from .routes import eco
|
||||
@@ -0,0 +1,109 @@
|
||||
from flask import Blueprint, request, jsonify, send_from_directory
|
||||
from app.eco.services import (
|
||||
AuthorizationService,
|
||||
EligibilityCheckService,
|
||||
GetOfferService,
|
||||
ProvideLoanService,
|
||||
LoanInformationService,
|
||||
RepaymentService,
|
||||
InflowNotificationService,
|
||||
LowBalanceNotificationService
|
||||
)
|
||||
from app.utils.logger import logger
|
||||
from flask_jwt_extended import jwt_required
|
||||
import os
|
||||
|
||||
eco = Blueprint("eco", __name__)
|
||||
|
||||
# Swagger JSON file
|
||||
@eco.route("/swagger.json", methods=["GET"])
|
||||
def swagger_json():
|
||||
swagger_dir = os.path.join("swagger")
|
||||
return send_from_directory(swagger_dir, "digifi_swagger.json")
|
||||
|
||||
@eco.route("/swagger/<path:filename>")
|
||||
def serve_paths(filename):
|
||||
swagger_dir = os.path.join("swagger")
|
||||
return send_from_directory(swagger_dir, filename)
|
||||
|
||||
|
||||
|
||||
|
||||
# Simbrella Request API Endpoints
|
||||
@eco.route("/EligibilityCheck", methods=["POST"])
|
||||
@jwt_required()
|
||||
def eligibility_check():
|
||||
data = request.get_json()
|
||||
response = EligibilityCheckService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
@eco.route("/GetOffers", methods=["POST"])
|
||||
@jwt_required()
|
||||
def get_offers():
|
||||
data = request.get_json()
|
||||
response = GetOfferService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
@eco.route("/ProvideLoan", methods=["POST"])
|
||||
@jwt_required()
|
||||
def provide_loan():
|
||||
data = request.get_json()
|
||||
response = ProvideLoanService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
@eco.route("/LoanInformation", methods=["POST"])
|
||||
@jwt_required()
|
||||
def loan_information():
|
||||
data = request.get_json()
|
||||
response = LoanInformationService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
@eco.route("/Repayment", methods=["POST"])
|
||||
@jwt_required()
|
||||
def repayment():
|
||||
data = request.get_json()
|
||||
response = RepaymentService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
@eco.route("/InflowNotification", methods=["POST"])
|
||||
@jwt_required()
|
||||
def inflow_notification():
|
||||
data = request.get_json()
|
||||
response = InflowNotificationService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
@eco.route("/LowBalanceNotification", methods=["POST"])
|
||||
@jwt_required()
|
||||
def low_balance_notification():
|
||||
data = request.get_json()
|
||||
response = LowBalanceNotificationService.process_request(data)
|
||||
return jsonify(response)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Health Check
|
||||
@eco.route("/health", methods=["GET"])
|
||||
def health_check():
|
||||
return jsonify({"status": "ok"}), 200
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Authorize endpoint
|
||||
@eco.route("/Authorize", methods=["POST"])
|
||||
def authorize():
|
||||
data = request.get_json()
|
||||
response = AuthorizationService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# Authorize refresh endpoint
|
||||
@eco.route("/AuthorizeRefresh", methods=["POST"])
|
||||
@jwt_required(refresh=True)
|
||||
def refresh():
|
||||
response = AuthorizationService.process_refresh_request()
|
||||
return response
|
||||
Reference in New Issue
Block a user