From c6173ed2e66c6a6d256eb551882ab558c8148471 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Sat, 30 Sep 2017 16:53:44 +0530 Subject: [PATCH 1/3] lead text added --- hosting/templates/hosting/create_virtual_machine.html | 1 + 1 file changed, 1 insertion(+) diff --git a/hosting/templates/hosting/create_virtual_machine.html b/hosting/templates/hosting/create_virtual_machine.html index 4ba5274e..a614dd78 100644 --- a/hosting/templates/hosting/create_virtual_machine.html +++ b/hosting/templates/hosting/create_virtual_machine.html @@ -7,6 +7,7 @@

{% trans "Create VM" %}

+

{% trans "Affordable VM hosting based in Switzerland" %}

{% if messages %}
{% for message in messages %} From 315ce92a78e1e63f473eedacc4d5ec389f91f0b2 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Tue, 3 Oct 2017 21:24:35 +0530 Subject: [PATCH 2/3] post request attributes changed --- hosting/views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index 1cd29532..f6a64ad3 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -747,13 +747,12 @@ class OrdersHostingDetailView(LoginRequiredMixin, template = request.session.get('template') specs = request.session.get('specs') stripe_customer_id = request.session.get('customer') - customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() billing_address_data = request.session.get('billing_address_data') vm_template_id = template.get('id', 1) - + stripe_api_cus_id = self.request.session.get('customer') # Make stripe charge to a customer stripe_utils = StripeUtils() - card_details = stripe_utils.get_card_details(customer.stripe_id, + card_details = stripe_utils.get_card_details(stripe_api_cus_id, request.session.get( 'token')) if not card_details.get('response_object'): @@ -780,7 +779,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, name=plan_name, stripe_plan_id=stripe_plan_id) subscription_result = stripe_utils.subscribe_customer_to_plan( - customer.stripe_id, + stripe_api_cus_id, [{"plan": stripe_plan.get( 'response_object').stripe_plan_id}]) stripe_subscription_obj = subscription_result.get('response_object') From c410e2cbc5fe889e606f5d88eb1389c65025ef21 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Tue, 3 Oct 2017 21:35:08 +0530 Subject: [PATCH 3/3] stripe_customer_id retrieved from request.user relation --- hosting/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index f6a64ad3..f0afb0c8 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -746,7 +746,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, def post(self, request): template = request.session.get('template') specs = request.session.get('specs') - stripe_customer_id = request.session.get('customer') + # We assume that if the user is here, his/her StripeCustomer + # object already exists + stripe_customer_id = request.user.stripecustomer.id billing_address_data = request.session.get('billing_address_data') vm_template_id = template.get('id', 1) stripe_api_cus_id = self.request.session.get('customer')