From 24edf05e7ac8d8c51e5d3313b4bd0bab92be842a Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 17 Dec 2019 23:57:15 +0530 Subject: [PATCH] Save vat_number after payment is submitted --- datacenterlight/views.py | 3 +++ hosting/views.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 76abd9b3..51466d93 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -491,6 +491,9 @@ class PaymentOrderView(FormView): customer = StripeCustomer.get_or_create( email=this_user.get('email'), token=token ) + request.user.vat_number = address_form.cleaned_data.get( + "vat_number") + request.user.save() else: user_email = address_form.cleaned_data.get('email') user_name = address_form.cleaned_data.get('name') diff --git a/hosting/views.py b/hosting/views.py index 8acd0d28..0c7077e5 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -779,6 +779,8 @@ class PaymentVMView(LoginRequiredMixin, FormView): reverse('hosting:payment') + '#payment_error') request.session['token'] = token request.session['billing_address_data'] = billing_address_data + owner.vat_number = billing_address_data.get("vat_number") + owner.save() self.request.session['order_confirm_url'] = "{url}?{query_params}".format( url=reverse('hosting:order-confirmation'), query_params='page=payment')