Skip to content

Commit debfb98

Browse files
committed
Add VAT ID field for Gold User
1 parent 8916742 commit debfb98

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

readthedocs/gold/forms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ def validate_stripe(self):
4747
subscription = self.get_subscription()
4848
self.instance.stripe_id = subscription.customer
4949
self.instance.subscribed = True
50+
self.instance.business_vat_id = self.cleaned_data['business_vat_id']
5051

5152
def get_customer_kwargs(self):
5253
return {
5354
'description': self.customer.get_full_name() or self.customer.username,
5455
'email': self.customer.email,
55-
'id': self.instance.stripe_id or None
56+
'id': self.instance.stripe_id or None,
57+
'business_vat_id': self.cleaned_data['business_vat_id'] or None,
5658
}
5759

5860
def get_subscription(self):

readthedocs/gold/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class GoldUser(models.Model):
4242
last_4_card_digits = models.CharField(max_length=4)
4343
stripe_id = models.CharField(max_length=255)
4444
subscribed = models.BooleanField(default=False)
45+
business_vat_id = models.CharField(max_length=128, required=False)
4546

4647
def __str__(self):
4748
return 'Gold Level %s for %s' % (self.level, self.user)

readthedocs/payments/forms.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class StripeModelForm(forms.ModelForm):
7171
:cvar cc_cvv: Credit card security code field, used only by Stripe.js
7272
"""
7373

74+
business_vat_id = forms.CharField(
75+
label=_('VAT ID number'),
76+
required=False,
77+
)
78+
7479
# Stripe token input from Stripe.js
7580
stripe_token = forms.CharField(
7681
required=False,

0 commit comments

Comments
 (0)