Tighten dummy payment validation
This commit is contained in:
@@ -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."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user