From fcdabd8dc30371fe45a8ceb46d41e298dd9a25cc Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 26 Dec 2019 19:55:28 +0530 Subject: [PATCH] Set vat validation status in more places --- datacenterlight/utils.py | 3 +++ utils/models.py | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index 1fb546b4..a082df7f 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -266,6 +266,7 @@ def create_tax_id(stripe_customer_id, billing_address_id, type, billing_address_set.add(ho.billing_address) for b_address in billing_address_set: b_address.stripe_tax_id = tax_id_obj.id + b_address.vat_validation_status = tax_id_obj.verification.status b_address.save() logger.debug("Updated billing_address %s" % str(b_address)) @@ -273,10 +274,12 @@ def create_tax_id(stripe_customer_id, billing_address_id, type, vat_number=billing_address.vat_number) for ub_address in ub_addresses: ub_address.stripe_tax_id = tax_id_obj.id + ub_address.vat_validation_status = tax_id_obj.verification.status ub_address.save() logger.debug("Updated user_billing_address %s" % str(ub_address)) except StripeCustomer.DoesNotExist as dne: logger.debug("StripeCustomer %s does not exist" % stripe_customer_id) billing_address.stripe_tax_id = tax_id_obj.id + billing_address.vat_validation_status = tax_id_obj.verification.status billing_address.save() return tax_id_obj diff --git a/utils/models.py b/utils/models.py index f179fffa..9e643707 100644 --- a/utils/models.py +++ b/utils/models.py @@ -26,10 +26,11 @@ class BaseBillingAddress(models.Model): class BillingAddress(BaseBillingAddress): def __str__(self): if self.vat_number: - return "%s, %s, %s, %s, %s, %s %s %s" % ( + return "%s, %s, %s, %s, %s, %s %s %s %s" % ( self.cardholder_name, self.street_address, self.city, self.postal_code, self.country, self.vat_number, - self.stripe_tax_id, self.vat_number_validated_on + self.stripe_tax_id, self.vat_number_validated_on, + self.vat_validation_status ) else: return "%s, %s, %s, %s, %s" % ( @@ -44,10 +45,11 @@ class UserBillingAddress(BaseBillingAddress): def __str__(self): if self.vat_number: - return "%s, %s, %s, %s, %s, %s %s %s" % ( + return "%s, %s, %s, %s, %s, %s %s %s %s" % ( self.cardholder_name, self.street_address, self.city, self.postal_code, self.country, self.vat_number, - self.stripe_tax_id, self.vat_number_validated_on + self.stripe_tax_id, self.vat_number_validated_on, + self.vat_validation_status ) else: return "%s, %s, %s, %s, %s" % (