diff --git a/padelclub_backend/settings.py b/padelclub_backend/settings.py index 5d8b334..a2bc9d5 100644 --- a/padelclub_backend/settings.py +++ b/padelclub_backend/settings.py @@ -156,37 +156,5 @@ AUTHENTICATION_BACKENDS = [ CSRF_COOKIE_SECURE = True # if using HTTPS SESSION_COOKIE_SECURE = True # Si vous utilisez HTTPS -STRIPE_MODE = os.environ.get('STRIPE_MODE', 'test') # Default to test mode - -# Depending on the mode, use appropriate keys -if STRIPE_MODE == 'test': - STRIPE_PUBLISHABLE_KEY = os.environ.get( - 'STRIPE_TEST_PUBLISHABLE_KEY', - 'pk_test_51R4LrTPEZkECCx484C2KbmRpcO2ZkZb0NoNi8QJB4X3E5JFu3bvLk4JZQmz9grKbk6O40z3xI8DawHrGyUY0fOT600VEKC9ran' - ) - STRIPE_SECRET_KEY = os.environ.get( - 'STRIPE_TEST_SECRET_KEY', - 'sk_test_51R4LrTPEZkECCx48PkSbEYarhts7J7XNYpS1mJgows5z5dcv38l0G2tImvhXCjzvMgUH9ML0vLMOEPeyUBtYVf5H00Qvz8t3rE' - ) - STRIPE_WEBHOOK_SECRET = os.environ.get( - 'STRIPE_TEST_WEBHOOK_SECRET', - 'whsec_cbaa9c0c7b24041136e063a7d60fb674ec0646b2c4b821512c41a27634d7b1ba' - ) -else: - STRIPE_PUBLISHABLE_KEY = os.environ.get('STRIPE_LIVE_PUBLISHABLE_KEY', '') - STRIPE_SECRET_KEY = os.environ.get('STRIPE_LIVE_SECRET_KEY', '') - STRIPE_WEBHOOK_SECRET = os.environ.get('STRIPE_LIVE_WEBHOOK_SECRET', '') - -STRIPE_CURRENCY = 'eur' -# Add managers who should receive internal emails -SHOP_MANAGERS = [ - ('Razmig Sarkissian', 'razmig@padelclub.app'), - # ('Shop Admin', 'shop-admin@padelclub.app'), - # ('Laurent Morvillier', 'laurent@padelclub.app'), - # ('Xavier Rousset', 'xavier@padelclub.app'), -] -SITE_URL = 'https://padelclub.app' -SHOP_SUPPORT_EMAIL = 'shop-support@padelclub.app' - from .settings_local import * from .settings_app import * diff --git a/padelclub_backend/settings_app.py b/padelclub_backend/settings_app.py index be8a614..0af1365 100644 --- a/padelclub_backend/settings_app.py +++ b/padelclub_backend/settings_app.py @@ -41,3 +41,14 @@ CACHES = { } QR_CODE_CACHE_ALIAS = 'qr-code' + +STRIPE_CURRENCY = 'eur' +# Add managers who should receive internal emails +SHOP_MANAGERS = [ + ('Razmig Sarkissian', 'razmig@padelclub.app'), + # ('Shop Admin', 'shop-admin@padelclub.app'), + # ('Laurent Morvillier', 'laurent@padelclub.app'), + # ('Xavier Rousset', 'xavier@padelclub.app'), +] +SHOP_SITE_ROOT_URL = 'https://padelclub.app' +SHOP_SUPPORT_EMAIL = 'shop-support@padelclub.app' diff --git a/padelclub_backend/settings_local.py.dist b/padelclub_backend/settings_local.py.dist index 4ac11b0..c28e747 100644 --- a/padelclub_backend/settings_local.py.dist +++ b/padelclub_backend/settings_local.py.dist @@ -19,3 +19,8 @@ DATABASES = { 'NAME': BASE_DIR / 'db.sqlite3', } } + +STRIPE_MODE = 'test' +STRIPE_PUBLISHABLE_KEY = '' +STRIPE_SECRET_KEY = '' +STRIPE_WEBHOOK_SECRET = '' diff --git a/requirements.txt b/requirements.txt index aa6fcb7..602d512 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ xlrd==2.0.1 openpyxl==3.1.5 django-filter==24.3 cryptography==41.0.7 +stripe==11.6.0 diff --git a/shop/signals.py b/shop/signals.py index 4dd1091..4679112 100644 --- a/shop/signals.py +++ b/shop/signals.py @@ -43,7 +43,7 @@ def _send_order_email(instance, **kwargs): total_price = instance.total_price # Generate admin URL - admin_url = f"{settings.SITE_URL}{reverse('admin:shop_order_change', args=[order_id])}" + admin_url = f"{settings.SHOP_SITE_ROOT_URL}{reverse('admin:shop_order_change', args=[order_id])}" # Get customer info customer_email = None @@ -130,7 +130,7 @@ Ceci est un message automatique. Merci de ne pas répondre. # Only send customer email for PAID status and if we have customer email if status == OrderStatus.PAID and customer_email and instance.payment_status == "PAID": # Generate customer-facing URLs - shop_url = f"{settings.SITE_URL}/shop" + shop_url = f"{settings.SHOP_SITE_ROOT_URL}/shop" contact_email = f"{settings.SHOP_SUPPORT_EMAIL}" # Create a customer receipt email diff --git a/tournaments/custom_views.py b/tournaments/custom_views.py index 76c926a..43a6840 100644 --- a/tournaments/custom_views.py +++ b/tournaments/custom_views.py @@ -6,7 +6,6 @@ from .forms import EmailOrUsernameAuthenticationForm class CustomLoginView(auth_views.LoginView): template_name = 'registration/login.html' authentication_form = EmailOrUsernameAuthenticationForm - print("CustomLoginView") def get_success_url(self): next_url = self.request.POST.get('next')