From bbb88f9a2f3dcfaa769100d91ce5259fa0d4ef23 Mon Sep 17 00:00:00 2001 From: Mandel Olaiya Date: Thu, 9 Apr 2026 01:06:49 +0200 Subject: [PATCH] Tighten dummy payment validation --- mandelstudio/launch_validation.py | 8 +++++++- .../commands/validate_idea_marketplace_launch.py | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mandelstudio/launch_validation.py b/mandelstudio/launch_validation.py index 2a87435..83e2353 100644 --- a/mandelstudio/launch_validation.py +++ b/mandelstudio/launch_validation.py @@ -13,6 +13,12 @@ def _is_demo_data(value: str) -> bool: return "demodata" in normalized +def _is_dummy_payment_app(app_label: str) -> bool: + normalized = str(app_label).lower().replace(":", ".") + parts = [part for part in normalized.split(".") if part] + return "payment_dummy" in parts or normalized == "payment_dummy" + + def validate_payment_provider_config() -> None: installed_apps = list(settings.INSTALLED_APPS) payment_apps = [app for app in installed_apps if "payment" in app.lower()] @@ -28,7 +34,7 @@ def validate_payment_provider_config() -> None: raise CommandError( "Demo data plugin detected in INSTALLED_APPS. Remove all demodata plugins before launch." ) - if any("dummy" in app.lower() for app in payment_apps): + if any(_is_dummy_payment_app(app) for app in payment_apps): raise CommandError( "Dummy payment app detected in INSTALLED_APPS. Use a real provider plugin before production launch." ) diff --git a/mandelstudio/management/commands/validate_idea_marketplace_launch.py b/mandelstudio/management/commands/validate_idea_marketplace_launch.py index 494be1d..7902f9a 100644 --- a/mandelstudio/management/commands/validate_idea_marketplace_launch.py +++ b/mandelstudio/management/commands/validate_idea_marketplace_launch.py @@ -16,7 +16,10 @@ from mandelstudio.idea_marketplace import ( IDEA_PRODUCTS, SHORT_DESCRIPTION_ATTRIBUTE_CODE, ) -from mandelstudio.launch_validation import validate_payment_provider_config +from mandelstudio.launch_validation import ( + _is_dummy_payment_app, + validate_payment_provider_config, +) class Command(BaseCommand): @@ -34,6 +37,12 @@ class Command(BaseCommand): validate_payment_provider_config() + installed_apps = list(settings.INSTALLED_APPS) + if any(_is_dummy_payment_app(app) for app in installed_apps): + raise CommandError( + "Dummy payment app detected in INSTALLED_APPS. Use a real provider plugin before production launch." + ) + config_path = Path(__file__).resolve().parents[2] / "ocyan.json" if config_path.exists(): with config_path.open("r", encoding="utf-8") as handle: