Tighten dummy payment validation

This commit is contained in:
2026-04-09 01:06:49 +02:00
parent 4648b7b0b3
commit bbb88f9a2f
2 changed files with 17 additions and 2 deletions

View File

@@ -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."
)

View File

@@ -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: