From fe6ade38ebf23236d327fe38eecd9531922cd445 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 26 Dec 2019 11:54:54 +0530 Subject: [PATCH] Update vat_number validated field based on tax_id + save --- webhook/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webhook/views.py b/webhook/views.py index 85aaf218..7e9175e6 100644 --- a/webhook/views.py +++ b/webhook/views.py @@ -71,13 +71,15 @@ def handle_webhook(request): logger.debug("Tax_id %s is %s" % (tax_id_obj.id, tax_id_obj.verification.status)) if tax_id_obj.verification.status == "verified": - b_addresses = BillingAddress.objects.filter(vat_number=tax_id_obj.value) + b_addresses = BillingAddress.objects.filter(stripe_tax_id=tax_id_obj.id) for b_address in b_addresses: b_address.vat_number_validated_on = datetime.datetime.now() + b_address.save() - ub_addresses = UserBillingAddress.objects.filter(vat_number=tax_id_obj.value) + ub_addresses = UserBillingAddress.objects.filter(stripe_tax_id=tax_id_obj.id) for ub_address in ub_addresses: ub_address.vat_number_validated_on = datetime.datetime.now() + ub_address.save() else: logger.debug("Tax_id %s is %s" % (tax_id_obj.id, tax_id_obj.verification.status))