diff --git a/readthedocs/gold/forms.py b/readthedocs/gold/forms.py index 0e03009d605..8339e5d92f2 100644 --- a/readthedocs/gold/forms.py +++ b/readthedocs/gold/forms.py @@ -23,14 +23,14 @@ class GoldSubscriptionForm(StripeResourceMixin, StripeModelForm): class Meta(object): model = GoldUser - fields = ['last_4_digits', 'level'] + fields = ['last_4_card_digits', 'level'] - last_4_digits = forms.CharField( + last_4_card_digits = forms.CharField( required=True, min_length=4, max_length=4, widget=forms.HiddenInput(attrs={ - 'data-bind': 'valueInit: card_digits, value: card_digits' + 'data-bind': 'valueInit: last_4_card_digits, value: last_4_card_digits', }) ) @@ -73,10 +73,6 @@ def get_subscription(self): ) return subscription - def clear_card_data(self): - super(GoldSubscriptionForm, self).clear_card_data() - self.data['last_4_digits'] = None - class GoldProjectForm(forms.Form): project = forms.CharField( diff --git a/readthedocs/gold/migrations/0002_rename_last_4_digits.py b/readthedocs/gold/migrations/0002_rename_last_4_digits.py new file mode 100644 index 00000000000..2ed345fd3ce --- /dev/null +++ b/readthedocs/gold/migrations/0002_rename_last_4_digits.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-07-16 15:45 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('gold', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='golduser', + old_name='last_4_digits', + new_name='last_4_card_digits', + ), + ] diff --git a/readthedocs/gold/models.py b/readthedocs/gold/models.py index 27500e5fff7..c07aee2a92c 100644 --- a/readthedocs/gold/models.py +++ b/readthedocs/gold/models.py @@ -39,7 +39,7 @@ class GoldUser(models.Model): projects = models.ManyToManyField(Project, verbose_name=_('Projects'), related_name='gold_owners') - last_4_digits = models.CharField(max_length=4) + last_4_card_digits = models.CharField(max_length=4) stripe_id = models.CharField(max_length=255) subscribed = models.BooleanField(default=False) diff --git a/readthedocs/gold/static-src/gold/js/gold.js b/readthedocs/gold/static-src/gold/js/gold.js index 07b42608ee1..95e29018571 100644 --- a/readthedocs/gold/static-src/gold/js/gold.js +++ b/readthedocs/gold/static-src/gold/js/gold.js @@ -10,7 +10,7 @@ function GoldView(config) { self.constructor.call(self, config); - self.last_4_digits = ko.observable(null); + self.last_4_card_digits = ko.observable(null); } GoldView.prototype = new payment.PaymentView(); @@ -22,10 +22,4 @@ GoldView.init = function (config, obj) { return view; }; -GoldView.prototype.submit_form = function (card_digits, token) { - this.form.find('#id_last_4_digits').val(card_digits); - this.form.find('#id_stripe_token').val(token); - this.form.submit(); -}; - module.exports.GoldView = GoldView; diff --git a/readthedocs/gold/templates/gold/subscription_detail.html b/readthedocs/gold/templates/gold/subscription_detail.html index 2c675c95dd8..fe791753bfb 100644 --- a/readthedocs/gold/templates/gold/subscription_detail.html +++ b/readthedocs/gold/templates/gold/subscription_detail.html @@ -43,7 +43,7 @@
- ****-{{ golduser.last_4_digits }} + ****-{{ golduser.last_4_card_digits }}