progress on JWT
This commit is contained in:
+22
-14
@@ -6,10 +6,10 @@ from app.api.services import (
|
||||
LoanStatusService,
|
||||
RepaymentService,
|
||||
CustomerConsentService,
|
||||
NotificationCallbackService
|
||||
NotificationCallbackService,
|
||||
)
|
||||
from app.utils.logger import logger
|
||||
from app.api.middlewares import enforce_json, require_auth
|
||||
from app.api.middlewares import enforce_json, require_auth
|
||||
import os
|
||||
|
||||
|
||||
@@ -23,21 +23,20 @@ def cors_middleware():
|
||||
|
||||
|
||||
# Swagger JSON file
|
||||
@api.route("/swagger.json", methods=['GET'])
|
||||
@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>')
|
||||
@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'])
|
||||
@api.route("/EligibilityCheck", methods=["POST"])
|
||||
@require_auth
|
||||
def eligibility_check():
|
||||
data = request.get_json()
|
||||
@@ -45,8 +44,9 @@ def eligibility_check():
|
||||
response = EligibilityCheckService.process_request(data)
|
||||
return response
|
||||
|
||||
|
||||
# SelectOffer Endpoint
|
||||
@api.route('/SelectOffer', methods=['POST'])
|
||||
@api.route("/SelectOffer", methods=["POST"])
|
||||
@require_auth
|
||||
def select_offer():
|
||||
data = request.get_json()
|
||||
@@ -56,7 +56,7 @@ def select_offer():
|
||||
|
||||
|
||||
# ProvideLoan Endpoint
|
||||
@api.route('/ProvideLoan', methods=['POST'])
|
||||
@api.route("/ProvideLoan", methods=["POST"])
|
||||
@require_auth
|
||||
def provide_loan():
|
||||
data = request.get_json()
|
||||
@@ -66,7 +66,7 @@ def provide_loan():
|
||||
|
||||
|
||||
# LoanStatus Endpoint
|
||||
@api.route('/LoanStatus', methods=['POST'])
|
||||
@api.route("/LoanStatus", methods=["POST"])
|
||||
@require_auth
|
||||
def loan_status():
|
||||
data = request.get_json()
|
||||
@@ -76,7 +76,7 @@ def loan_status():
|
||||
|
||||
|
||||
# Repayment Endpoint
|
||||
@api.route('/Repayment', methods=['POST'])
|
||||
@api.route("/Repayment", methods=["POST"])
|
||||
@require_auth
|
||||
def repayment():
|
||||
data = request.get_json()
|
||||
@@ -86,7 +86,7 @@ def repayment():
|
||||
|
||||
|
||||
# CustomerConsent Endpoint
|
||||
@api.route('/CustomerConsent', methods=['POST'])
|
||||
@api.route("/CustomerConsent", methods=["POST"])
|
||||
@require_auth
|
||||
def customer_consent():
|
||||
data = request.get_json()
|
||||
@@ -96,7 +96,7 @@ def customer_consent():
|
||||
|
||||
|
||||
# NotificationCallback Endpoint
|
||||
@api.route('/NotificationCallback', methods=['POST'])
|
||||
@api.route("/NotificationCallback", methods=["POST"])
|
||||
@require_auth
|
||||
def notification_callback():
|
||||
data = request.get_json()
|
||||
@@ -106,6 +106,14 @@ def notification_callback():
|
||||
|
||||
|
||||
# Health Check Endpoint
|
||||
@api.route('/health', methods=['GET'])
|
||||
@api.route("/health", methods=["GET"])
|
||||
def health_check():
|
||||
return {"status": "ok"} , 200
|
||||
return {"status": "ok"}, 200
|
||||
|
||||
|
||||
# Authorize endpoint
|
||||
@api.route("/Authorize", methods=["POST"])
|
||||
def authorize():
|
||||
data = request.get_json()
|
||||
# logger.info(f"Authorize request received: {data}")
|
||||
return jsonify(data)
|
||||
|
||||
Reference in New Issue
Block a user