diff --git a/app/modules/core/tests/integration/test_merchant_menu_routes.py b/app/modules/core/tests/integration/test_merchant_menu_routes.py index 376975f9..e992a1f7 100644 --- a/app/modules/core/tests/integration/test_merchant_menu_routes.py +++ b/app/modules/core/tests/integration/test_merchant_menu_routes.py @@ -278,7 +278,7 @@ class TestMerchantMenuModuleGating: s for s in data["sections"] if s["id"] == platform_section_id ) item_ids = {i["id"] for i in platform_section["items"]} - assert "loyalty-overview" in item_ids + assert "loyalty-program" in item_ids def test_loyalty_hidden_when_module_not_enabled( self, client, db, menu_auth, menu_merchant, menu_subscription, @@ -296,7 +296,7 @@ class TestMerchantMenuModuleGating: self, client, db, menu_auth, menu_merchant, menu_subscription, menu_loyalty_module, menu_platform, ): - """Loyalty overview item has the correct URL.""" + """Loyalty program item has the correct URL.""" response = client.get(BASE, headers=menu_auth) data = response.json() platform_section_id = f"platform-{menu_platform.code}" @@ -304,9 +304,9 @@ class TestMerchantMenuModuleGating: s for s in data["sections"] if s["id"] == platform_section_id ) overview = next( - i for i in platform_section["items"] if i["id"] == "loyalty-overview" + i for i in platform_section["items"] if i["id"] == "loyalty-program" ) - assert overview["url"] == "/merchants/loyalty/overview" + assert overview["url"] == "/merchants/loyalty/program" @pytest.mark.integration @@ -498,7 +498,7 @@ class TestMerchantMenuMultiPlatform: s for s in data["sections"] if s["id"] == platform_a_section_id ) item_ids = {i["id"] for i in pa_section["items"]} - assert "loyalty-overview" in item_ids + assert "loyalty-program" in item_ids # Core sections always present assert "main" in section_ids assert "billing" in section_ids diff --git a/app/modules/core/tests/unit/test_menu_discovery_service.py b/app/modules/core/tests/unit/test_menu_discovery_service.py index 33f3cf34..42366e2e 100644 --- a/app/modules/core/tests/unit/test_menu_discovery_service.py +++ b/app/modules/core/tests/unit/test_menu_discovery_service.py @@ -61,12 +61,12 @@ class TestMenuDiscoveryService: assert "profile" in item_ids def test_merchant_loyalty_section_items(self): - """Loyalty section contains loyalty-overview.""" + """Loyalty section contains loyalty-program.""" menus = self.service.discover_all_menus() loyalty_sections = [s for s in menus[FrontendType.MERCHANT] if s.id == "loyalty"] assert len(loyalty_sections) == 1 item_ids = [i.id for i in loyalty_sections[0].items] - assert "loyalty-overview" in item_ids + assert "loyalty-program" in item_ids def test_get_all_menu_items_merchant(self): """get_all_menu_items returns items for MERCHANT frontend type.""" @@ -75,7 +75,7 @@ class TestMenuDiscoveryService: item_ids = {i.id for i in items} assert "dashboard" in item_ids assert "subscriptions" in item_ids - assert "loyalty-overview" in item_ids + assert "loyalty-program" in item_ids def test_get_all_menu_item_ids_merchant(self): """get_all_menu_item_ids returns IDs for MERCHANT frontend type.""" @@ -85,7 +85,7 @@ class TestMenuDiscoveryService: assert "invoices" in item_ids assert "stores" in item_ids assert "profile" in item_ids - assert "loyalty-overview" in item_ids + assert "loyalty-program" in item_ids def test_get_mandatory_item_ids_merchant(self): """Mandatory items for MERCHANT include dashboard and subscriptions.""" diff --git a/docs/deployment/hetzner-server-setup.md b/docs/deployment/hetzner-server-setup.md index d38e0fe7..4d3c504f 100644 --- a/docs/deployment/hetzner-server-setup.md +++ b/docs/deployment/hetzner-server-setup.md @@ -2280,6 +2280,10 @@ nano .env Add: ```bash +# Loyalty Module +LOYALTY_DEFAULT_LOGO_URL=https://rewardflow.lu/static/modules/loyalty/shared/img/default-logo-200.png +LOYALTY_GOOGLE_WALLET_ORIGINS=["https://rewardflow.lu"] + # Google Wallet (Loyalty Module) LOYALTY_GOOGLE_ISSUER_ID=3388000000023089598 LOYALTY_GOOGLE_SERVICE_ACCOUNT_JSON=/app/google-wallet-sa.json diff --git a/middleware/store_context.py b/middleware/store_context.py index ad08b13e..234a99ce 100644 --- a/middleware/store_context.py +++ b/middleware/store_context.py @@ -59,8 +59,17 @@ class StoreContextManager: # Check if this is a custom domain (not platform.com and not localhost) platform_domain = getattr(settings, "platform_domain", "platform.com") + # Skip custom domain detection if host is already a platform domain + # (e.g. rewardflow.lu is the loyalty platform, not a store) + platform = getattr(request.state, "platform", None) + is_platform_domain = ( + platform and getattr(platform, "domain", None) + and host == platform.domain + ) + is_custom_domain = ( host + and not is_platform_domain and not host.endswith(f".{platform_domain}") and host != platform_domain and host