Skip to content

Commit

Permalink
Add VAT ID field for Gold User
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Oct 17, 2018
1 parent 8916742 commit debfb98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion readthedocs/gold/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ def validate_stripe(self):
subscription = self.get_subscription()
self.instance.stripe_id = subscription.customer
self.instance.subscribed = True
self.instance.business_vat_id = self.cleaned_data['business_vat_id']

def get_customer_kwargs(self):
return {
'description': self.customer.get_full_name() or self.customer.username,
'email': self.customer.email,
'id': self.instance.stripe_id or None
'id': self.instance.stripe_id or None,
'business_vat_id': self.cleaned_data['business_vat_id'] or None,
}

def get_subscription(self):
Expand Down
1 change: 1 addition & 0 deletions readthedocs/gold/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class GoldUser(models.Model):
last_4_card_digits = models.CharField(max_length=4)
stripe_id = models.CharField(max_length=255)
subscribed = models.BooleanField(default=False)
business_vat_id = models.CharField(max_length=128, required=False)

def __str__(self):
return 'Gold Level %s for %s' % (self.level, self.user)
Expand Down
5 changes: 5 additions & 0 deletions readthedocs/payments/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class StripeModelForm(forms.ModelForm):
:cvar cc_cvv: Credit card security code field, used only by Stripe.js
"""

business_vat_id = forms.CharField(
label=_('VAT ID number'),
required=False,
)

# Stripe token input from Stripe.js
stripe_token = forms.CharField(
required=False,
Expand Down

0 comments on commit debfb98

Please sign in to comment.