Add vat_validation_status
This commit is contained in:
parent
7eed04ec73
commit
69996f536b
3 changed files with 29 additions and 0 deletions
25
utils/migrations/0008_auto_20191226_1402.py
Normal file
25
utils/migrations/0008_auto_20191226_1402.py
Normal file
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue