From 026396470572dd34d37ec8f1c07f1161ac54db5f Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Tue, 3 Oct 2017 21:04:25 +0530 Subject: [PATCH] stripe_id used instead of id --- hosting/views.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index 6d4f15ca..1cd29532 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -638,7 +638,7 @@ class PaymentVMView(LoginRequiredMixin, FormView): request.session['billing_address_data'] = billing_address_data request.session['token'] = token - request.session['customer'] = customer.id + request.session['customer'] = customer.stripe_id return HttpResponseRedirect("{url}?{query_params}".format( url=reverse('hosting:order-confirmation'), query_params='page=payment')) @@ -663,16 +663,12 @@ class OrdersHostingDetailView(LoginRequiredMixin, context = super(DetailView, self).get_context_data(**kwargs) obj = self.get_object() owner = self.request.user - stripe_customer_id = self.request.session.get('customer') - customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() + stripe_api_cus_id = self.request.session.get('customer') stripe_utils = StripeUtils() - if customer: - card_details = stripe_utils.get_card_details( - customer.stripe_id, - self.request.session.get('token') - ) - else: - card_details = {} + card_details = stripe_utils.get_card_details( + stripe_api_cus_id, + self.request.session.get('token') + ) if self.request.GET.get('page') == 'payment': context['page_header_text'] = _('Confirm Order')