From 1da03e41f9015798b99a80df8419fc6d27d1cbc2 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Tue, 10 Feb 2026 21:26:30 +0100 Subject: [PATCH] fix(routing): register merchant page routes in main.py The auto-discovery system and get_merchant_page_routes() were already implemented but never called in main.py, so merchant portal HTML pages at /merchants/billing/* returned 404. Add the missing import and registration block alongside admin, store, and storefront pages. Co-Authored-By: Claude Opus 4.6 --- main.py | 18 ++++++++++++++++++ tests/integration/api/v1/loyalty/__init__.py | 0 tests/unit/models/database/__init__.py | 2 -- 3 files changed, 18 insertions(+), 2 deletions(-) delete mode 100644 tests/integration/api/v1/loyalty/__init__.py delete mode 100644 tests/unit/models/database/__init__.py diff --git a/main.py b/main.py index fa5ddd54..2bf7caaf 100644 --- a/main.py +++ b/main.py @@ -64,6 +64,7 @@ from app.exceptions.handler import setup_exception_handlers # Module route auto-discovery - all page routes now come from modules from app.modules.routes import ( get_admin_page_routes, + get_merchant_page_routes, get_platform_page_routes, get_storefront_page_routes, get_store_page_routes, @@ -358,6 +359,23 @@ for route_info in admin_page_routes: include_in_schema=route_info.include_in_schema, ) +# ============================================================================= +# MERCHANT PAGES (Merchant billing portal) +# ============================================================================= +logger.info("Auto-discovering merchant page routes...") +merchant_page_routes = get_merchant_page_routes() +logger.info(f" Found {len(merchant_page_routes)} merchant page route modules") + +for route_info in merchant_page_routes: + prefix = f"/merchants{route_info.custom_prefix}" if route_info.custom_prefix else "/merchants" + logger.info(f" Registering {route_info.module_code} merchant pages at {prefix}") + app.include_router( + route_info.router, + prefix=prefix, + tags=route_info.tags, + include_in_schema=route_info.include_in_schema, + ) + # ============================================================================= # STORE PAGES # ============================================================================= diff --git a/tests/integration/api/v1/loyalty/__init__.py b/tests/integration/api/v1/loyalty/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/unit/models/database/__init__.py b/tests/unit/models/database/__init__.py deleted file mode 100644 index 5e3668c5..00000000 --- a/tests/unit/models/database/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# tests/unit/models/database/__init__.py -"""Database model unit tests."""