From 7dfd9722658917ab0804f30c5226f43e6ee9d043 Mon Sep 17 00:00:00 2001 From: rizwanisready Date: Thu, 28 Mar 2024 16:55:11 +0530 Subject: [PATCH] stripe card --- manage_subscriptions/views.py | 21 ++++++++++ static/src/assets/css/payment/style.css | 14 ++++++- templates/stripe_html/index.html | 56 +++++++++++++------------ 3 files changed, 63 insertions(+), 28 deletions(-) diff --git a/manage_subscriptions/views.py b/manage_subscriptions/views.py index 92f424d..98415f9 100644 --- a/manage_subscriptions/views.py +++ b/manage_subscriptions/views.py @@ -377,6 +377,27 @@ class SubscriptionPageView(TemplateView): return super().get(request, *args, **kwargs) + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context = super().get_context_data(**kwargs) + request = self.request + if request.user.is_authenticated: + print("request.user: ", request.user) + if request.user.principal_type.name == "event_user": + subscription_id = 1 + elif request.user.principal_type.name == "event_manager": + subscription_id = 2 + else: + subscription_id = None + + if subscription_id is not None: + subscription = Subscription.objects.get(id=subscription_id) + context['subscription_amount'] = subscription.amount + else: + # Handle error or default case + context['error'] = "Invalid principal type or subscription not found." + return context + @csrf_exempt def stripe_config(request): diff --git a/static/src/assets/css/payment/style.css b/static/src/assets/css/payment/style.css index e8cf119..73c52e4 100644 --- a/static/src/assets/css/payment/style.css +++ b/static/src/assets/css/payment/style.css @@ -597,6 +597,16 @@ margin-top: 90px; } + .gold-text { + color: rgb(209 170 88); + } + .feat-card { + border: 1px solid #d1aa588c; + padding: 18px; + width: 300px; + border-radius: 6px; + background-color: #00000080; + } /* mediascreen */ @media (max-width: 1199px) { @@ -711,9 +721,9 @@ flex-direction: column-reverse; } - .baner-section .store-app { + /* .baner-section .store-app { justify-content: center; - } + } */ .baner-btn { text-align: center; diff --git a/templates/stripe_html/index.html b/templates/stripe_html/index.html index db88bd4..51a44b0 100644 --- a/templates/stripe_html/index.html +++ b/templates/stripe_html/index.html @@ -1,4 +1,5 @@ {% load static %} + @@ -12,6 +13,9 @@ Good times + + + @@ -70,38 +74,37 @@ - - - - - - -
-
- -
-
- @@ -430,6 +433,7 @@ // new // Event handler document.querySelector("#submitBtn").addEventListener("click", () => { + this.setAttribute('disabled', true); // Get Checkout Session ID fetch("https://goodtimes.betadelivery.com/subscriptions/create-checkout-session/") .then((result) => { return result.json(); })