Update vat_number validated field based on tax_id + save
This commit is contained in:
parent
242dbb2479
commit
fe6ade38eb
1 changed files with 4 additions and 2 deletions
|
@ -71,13 +71,15 @@ def handle_webhook(request):
|
||||||
logger.debug("Tax_id %s is %s" % (tax_id_obj.id,
|
logger.debug("Tax_id %s is %s" % (tax_id_obj.id,
|
||||||
tax_id_obj.verification.status))
|
tax_id_obj.verification.status))
|
||||||
if tax_id_obj.verification.status == "verified":
|
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:
|
for b_address in b_addresses:
|
||||||
b_address.vat_number_validated_on = datetime.datetime.now()
|
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:
|
for ub_address in ub_addresses:
|
||||||
ub_address.vat_number_validated_on = datetime.datetime.now()
|
ub_address.vat_number_validated_on = datetime.datetime.now()
|
||||||
|
ub_address.save()
|
||||||
else:
|
else:
|
||||||
logger.debug("Tax_id %s is %s" % (tax_id_obj.id,
|
logger.debug("Tax_id %s is %s" % (tax_id_obj.id,
|
||||||
tax_id_obj.verification.status))
|
tax_id_obj.verification.status))
|
||||||
|
|
Loading…
Reference in a new issue