diff --git a/utils/migrations/0008_auto_20191226_1402.py b/utils/migrations/0008_auto_20191226_1402.py new file mode 100644 index 00000000..2c409c0f --- /dev/null +++ b/utils/migrations/0008_auto_20191226_1402.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2019-12-26 14:02 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('utils', '0007_auto_20191226_0610'), + ] + + operations = [ + migrations.AddField( + model_name='billingaddress', + name='vat_validation_status', + field=models.CharField(blank=True, default='', max_length=25), + ), + migrations.AddField( + model_name='userbillingaddress', + name='vat_validation_status', + field=models.CharField(blank=True, default='', max_length=25), + ), + ] diff --git a/utils/models.py b/utils/models.py index e2cabaad..f179fffa 100644 --- a/utils/models.py +++ b/utils/models.py @@ -16,6 +16,8 @@ class BaseBillingAddress(models.Model): vat_number = models.CharField(max_length=100, default="", blank=True) stripe_tax_id = models.CharField(max_length=100, default="", blank=True) vat_number_validated_on = models.DateTimeField(blank=True, null=True) + vat_validation_status = models.CharField(max_length=25, default="", + blank=True) class Meta: abstract = True diff --git a/webhook/views.py b/webhook/views.py index 7e9175e6..482985ba 100644 --- a/webhook/views.py +++ b/webhook/views.py @@ -73,11 +73,13 @@ def handle_webhook(request): if tax_id_obj.verification.status == "verified": b_addresses = BillingAddress.objects.filter(stripe_tax_id=tax_id_obj.id) for b_address in b_addresses: + b_address.vat_validation_status = tax_id_obj.verification.status b_address.vat_number_validated_on = datetime.datetime.now() b_address.save() ub_addresses = UserBillingAddress.objects.filter(stripe_tax_id=tax_id_obj.id) for ub_address in ub_addresses: + ub_address.vat_validation_status = tax_id_obj.verification.status ub_address.vat_number_validated_on = datetime.datetime.now() ub_address.save() else: