1
0
This commit is contained in:
VivianDee
2025-10-20 16:49:11 +01:00
6 changed files with 68 additions and 19 deletions
+14 -11
View File
@@ -22,19 +22,17 @@ def create_app():
# import oracledb
# oracledb.init_oracle_client(lib_dir=None)
app = Flask(__name__)
# Load configuration
app.config.from_object(Config)
CORS(app)
JWTManager(app)
CORS(app, supports_credentials=True)
try:
app = Flask(__name__)
# Load configuration
app.config.from_object(Config)
CORS(app)
JWTManager(app)
CORS(app, supports_credentials=True)
# Swagger Doc
SWAGGER_URL = app.config.get("SWAGGER_URL")
API_URL = app.config.get("API_URL")
@@ -45,6 +43,11 @@ def create_app():
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
except Exception as e:
print(f"Swagger Unexpected error occurred: {e}")
try:
# Error Handlers
register_error_handlers(app)
+5 -5
View File
@@ -42,10 +42,10 @@ def swagger_json():
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)
@api.route("/swagger/<path:filename>")
def serve_paths(filename):
swagger_dir = os.path.join("swagger")
return send_from_directory(swagger_dir, filename)
# EligibilityCheck Endpoint
@@ -140,7 +140,7 @@ def health_check():
# Check database connection
try:
logger.info(f"Database Health == : {SQLALCHEMY_DATABASE_URI}")
db.session.execute(text("SELECT 1"))
db.session.execute(text("SELECT table_name FROM user_tables ORDER BY table_name"))
except Exception as e:
db_status = "Connection Failed"
errors.append(f"Database Error: {str(e)}")
+1 -1
View File
@@ -17,6 +17,7 @@ from app.api.integrations import EventServiceIntegration
from app.models import LoanRepaymentSchedule
from app.api.services.offer_analysis import OfferAnalysis
from app.api.helpers.response_helper import ResponseHelper
from datetime import datetime, timezone, timedelta
class ProvideLoanService(BaseService):
TRANSACTION_TYPE = TransactionType.PROVIDE_LOAN
@@ -229,7 +230,6 @@ class ProvideLoanService(BaseService):
"startDate": now.isoformat(),
})
for idx, charge in enumerate(loan_charges, start=len(charge_schedule_items) + 1):
item = {
"id": idx,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"post": {
"tags": ["Authorize Refresh"],
"tags": ["AuthorizeRefresh"],
"summary": "Customer Authorize Refresh Request",
"description": "Customer Authorize Refresh Request",
"operationId": "AuthorizeRefresh",
@@ -25,6 +25,41 @@
"type": "string",
"example": "98016510058"
},
"schedule": {
"type": "array",
"description": "List of loan repayment components with due dates and amounts.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"amountDue": {
"type": "number",
"example": 2000.0
},
"componentName": {
"type": "string",
"example": "INTEREST"
},
"dueDate": {
"type": "string",
"format": "date-time",
"example": "2026-01-13T11:36:39.890747+00:00"
},
"startDate": {
"type": "string",
"format": "date-time",
"example": "2025-10-15T11:36:39.890747+00:00"
},
"loanRef": {
"type": "string",
"example": "TRX1760528156816285USSD3MPC"
}
}
}
},
"resultCode": {
"type": "string",
"example": "00"
+12 -1
View File
@@ -1,3 +1,4 @@
version: '3.8'
services:
digifi-bank-to-product-core:
build: .
@@ -11,4 +12,14 @@ services:
- DATABASE_URL=postgresql+psycopg2://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}
volumes:
- .:/app
restart: always
restart: always
networks:
- my_custom_network
networks:
my_custom_network:
driver: bridge
ipam:
config:
- subnet: 10.244.0.0/26