From bcb4ae183d9c13cc68571dc95cb5b8bb50080606 Mon Sep 17 00:00:00 2001 From: VivianDee <115420678+VivianDee@users.noreply.github.com> Date: Wed, 30 Jul 2025 09:19:43 +0100 Subject: [PATCH] [add]: eco models --- README.md | 2 + app/__init__.py | 10 +- app/models/__init__.py | 7 + app/{eco/models => models/eco}/account.py | 0 app/{eco/models => models/eco}/customer.py | 0 app/{eco/models => models/eco}/installment.py | 0 app/{eco/models => models/eco}/loan.py | 0 app/{eco/models => models/eco}/offer.py | 0 app/{eco/models => models/eco}/session.py | 0 app/swagger/eco_digifi_swagger.json | 180 ++++++++++++++++++ 10 files changed, 198 insertions(+), 1 deletion(-) rename app/{eco/models => models/eco}/account.py (100%) rename app/{eco/models => models/eco}/customer.py (100%) rename app/{eco/models => models/eco}/installment.py (100%) rename app/{eco/models => models/eco}/loan.py (100%) rename app/{eco/models => models/eco}/offer.py (100%) rename app/{eco/models => models/eco}/session.py (100%) create mode 100644 app/swagger/eco_digifi_swagger.json diff --git a/README.md b/README.md index 76963e2..6389ea2 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ You can check if the Flask application is running by accessing the `/health` end ```bash curl http://localhost:4500/health +curl http://localhost:4500/eco/health ``` If the application is running properly, you should receive a response similar to this: @@ -87,6 +88,7 @@ You can check the Swagger Doc by accessing the `/documentation` endpoint. Run th ```bash curl http://localhost:4500/documentation +curl http://localhost:4500/eco/documentation ``` diff --git a/app/__init__.py b/app/__init__.py index 52dec1f..bbaf952 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,3 +1,4 @@ +from re import U from flask import Flask from flask_mail import Mail import os @@ -40,11 +41,18 @@ def create_app(): # Register blueprints app.register_blueprint(api) - app.register_blueprint(eco) + app.register_blueprint(eco, url_prefix="/eco") swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL) app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL) + # Second UI (ECO) + eco_docs = "/eco" + SWAGGER_URL + eco_api = "/eco" + API_URL + swagger_ui_eco = get_swaggerui_blueprint(eco_docs, eco_api) + swagger_ui_eco.name = 'swagger_ui_eco' # Rename blueprint + app.register_blueprint(swagger_ui_eco, url_prefix=eco_docs) + # Error Handlers register_error_handlers(app) diff --git a/app/models/__init__.py b/app/models/__init__.py index 6331244..feb3205 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -11,6 +11,13 @@ from .loan_repayment_schedule import LoanRepaymentSchedule from .transaction_offers import TransactionOffer from .repayments_data import RepaymentsData from .salary import Salary +from .eco.account import EcoAccount +from .eco.customer import EcoCustomer +from .eco.loan import EcoLoan +from .eco.session import EcoSession +from .eco.installment import EcoInstallment +from .eco.offer import EcoOffer + __all__ = ['Customer', 'Account', 'Loan', 'Transaction', 'Repayment', 'LoanCharge', 'Offer', 'Charge', 'RACCheck', 'LoanRepaymentSchedule', 'TransactionOffer', 'RepaymentsData', 'Salary'] \ No newline at end of file diff --git a/app/eco/models/account.py b/app/models/eco/account.py similarity index 100% rename from app/eco/models/account.py rename to app/models/eco/account.py diff --git a/app/eco/models/customer.py b/app/models/eco/customer.py similarity index 100% rename from app/eco/models/customer.py rename to app/models/eco/customer.py diff --git a/app/eco/models/installment.py b/app/models/eco/installment.py similarity index 100% rename from app/eco/models/installment.py rename to app/models/eco/installment.py diff --git a/app/eco/models/loan.py b/app/models/eco/loan.py similarity index 100% rename from app/eco/models/loan.py rename to app/models/eco/loan.py diff --git a/app/eco/models/offer.py b/app/models/eco/offer.py similarity index 100% rename from app/eco/models/offer.py rename to app/models/eco/offer.py diff --git a/app/eco/models/session.py b/app/models/eco/session.py similarity index 100% rename from app/eco/models/session.py rename to app/models/eco/session.py diff --git a/app/swagger/eco_digifi_swagger.json b/app/swagger/eco_digifi_swagger.json new file mode 100644 index 0000000..436abcf --- /dev/null +++ b/app/swagger/eco_digifi_swagger.json @@ -0,0 +1,180 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Swagger Bank Channel to Simbrella FirstAdvance - OpenAPI 3.0", + "description": "This is a Simbrella FirstAdvance Backend Server with the OpenAPI 3.0 specification. \n\n\nSome useful links:\n- [Web Simulated Demo Page](https://digifi-salaryloan.chiefsoft.net/)\n- [Web Management Support Portal](https://digifi-office.chiefsoft.net/auth/login)", + "termsOfService": "http://swagger.io/terms/", + "contact": { + "email": "support@chiefsoft.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0.11" + }, + "servers": [ + { + "url": "http://localhost:4500" + }, + { + "url": "http://api.dev.simbrellang.net:4500" + }, + { + "url": "https://api.dev.simbrellang.net" + } + ], + "tags": [ + { + "name": "Authorize", + "description": "This feature will be used for authorizing customers.", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + }, + { + "name": "AuthorizeRefresh", + "description": "This feature will be used for refreshing authorized customers.", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + }, + { + "name": "EligibilityCheck", + "description": "Eligibility Check Request", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + }, + { + "name": "SelectOffer", + "description": "This method is used the send the offer the customer selected to Simbrella.", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + }, + { + "name": "ProvideLoan", + "description": "Provide Loan Request.", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + }, + { + "name": "LoanStatus", + "description": "Loan Information Request.", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + }, + { + "name": "Repayment", + "description": "Repayment Request.", + "externalDocs": { + "description": "Find out more", + "url": "https://www.simbrellang.net" + } + } + ], + "paths": { + "/Authorize": { + "$ref": "swagger/paths/Authorize.json" + }, + "/AuthorizeRefresh": { + "$ref": "swagger/paths/AuthorizeRefresh.json" + }, + "/EligibilityCheck": { + "$ref": "swagger/paths/EligibilityCheck.json" + }, + "/SelectOffer": { + "$ref": "swagger/paths/SelectOffer.json" + }, + "/ProvideLoan": { + "$ref": "swagger/paths/ProvideLoan.json" + }, + "/LoanStatus": { + "$ref": "swagger/paths/LoanStatus.json" + }, + "/Repayment": { + "$ref": "swagger/paths/Repayment.json" + } + }, + "components": { + "schemas": { + "EligibilityCheckRequest": { + "$ref": "swagger/schemas/EligibilityCheckRequest.json" + }, + "EligibilityCheckResponse": { + "$ref": "swagger/schemas/EligibilityCheckResponse.json" + }, + "SelectOfferRequest": { + "$ref": "swagger/schemas/SelectOfferRequest.json" + }, + "SelectOfferResponse": { + "$ref": "swagger/schemas/SelectOfferResponse.json" + }, + "LoanStatusRequest": { + "$ref": "swagger/schemas/LoanStatusRequest.json" + }, + "LoanStatusResponse": { + "$ref": "swagger/schemas/LoanStatusResponse.json" + }, + "RepaymentRequest": { + "$ref": "swagger/schemas/RepaymentRequest.json" + }, + "RepaymentResponse": { + "$ref": "swagger/schemas/RepaymentResponse.json" + }, + "CustomerConsentRequest": { + "$ref": "swagger/schemas/CustomerConsentRequest.json" + }, + "CustomerConsentResponse": { + "$ref": "swagger/schemas/CustomerConsentResponse.json" + }, + "NotificationCallbackRequest": { + "$ref": "swagger/schemas/NotificationCallbackRequest.json" + }, + "NotificationCallbackResponse": { + "$ref": "swagger/schemas/NotificationCallbackResponse.json" + }, + "ApiResponse": { + "$ref": "swagger/schemas/ApiResponse.json" + }, + "AuthorizeResponse": { + "$ref": "swagger/schemas/AuthorizeResponse.json" + }, + "AuthorizeRequest": { + "$ref": "swagger/schemas/AuthorizeRequest.json" + }, + "AuthorizeRefreshResponse": { + "$ref": "swagger/schemas/AuthorizeRefreshResponse.json" + }, + "AuthorizeRefreshRequest": { + "$ref": "swagger/schemas/AuthorizeRefreshRequest.json" + } + }, + "securitySchemes": { + "basicAuth": { + "type": "http", + "scheme": "basic" + }, + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "security": [ + { + "basicAuth": [], + "bearerAuth": [] + } + ] +}