Skip to content

Commit

Permalink
change last4 and brand to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
jdungan committed Apr 15, 2017
1 parent 69776d1 commit 28fa041
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/serializers.py
Expand Up @@ -9,7 +9,7 @@ class Meta:
model = User
fields = (
'id', 'username', 'stripe_card', 'stripe_customer',
'stripe_bank_account', 'last4', 'brand')
'stripe_bank_account', 'card_last4', 'card_brand')
read_only_fields = ('id', 'username')


Expand Down
2 changes: 1 addition & 1 deletion api/tests/serializer_tests.py
Expand Up @@ -19,7 +19,7 @@ def test_attrs(self):
self.assertEqual(
self.serializer.Meta.fields, (
'id', 'username', 'stripe_card', 'stripe_customer',
'stripe_bank_account', 'last4', 'brand')
'stripe_bank_account', 'card_last4', 'card_brand')
)
self.assertEqual(
self.serializer.Meta.read_only_fields, ('id', 'username'))
Expand Down
2 changes: 1 addition & 1 deletion codesy/base/admin.py
Expand Up @@ -22,7 +22,7 @@ class CodesyUserAdmin(UserAdmin):
),
('CC information',
{'fields':
('brand', 'last4')
('card_brand', 'card_last4')
}
),

Expand Down
25 changes: 25 additions & 0 deletions codesy/base/migrations/0023_auto_20170415_2154.py
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-04-15 21:54
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('base', '0022_auto_20170410_0301'),
]

operations = [
migrations.RenameField(
model_name='user',
old_name='brand',
new_name='card_brand',
),
migrations.RenameField(
model_name='user',
old_name='last4',
new_name='card_last4',
),
]
4 changes: 2 additions & 2 deletions codesy/base/models.py
Expand Up @@ -17,8 +17,8 @@ class User(AbstractUser):
stripe_bank_account = models.CharField(max_length=100, blank=True)
tos_acceptance_date = models.DateTimeField(null=True, blank=True)
tos_acceptance_ip = models.CharField(max_length=20, blank=True)
last4 = models.CharField(max_length=4, blank=True)
brand = models.CharField(max_length=100, blank=True)
card_last4 = models.CharField(max_length=4, blank=True)
card_brand = models.CharField(max_length=100, blank=True)
USERNAME_FIELD = 'username'

def get_gravatar_url(self):
Expand Down
2 changes: 1 addition & 1 deletion payments/templates/credit_card_page.html
Expand Up @@ -4,7 +4,7 @@
<div class="row">
<div class="column medium-4 medium-offset-4 text-left">
{% if request.user.stripe_customer %}
We saved your <b> {{request.user.brand}}</b> card ending in <b> {{ request.user.last4}} </b> with Stripe.
We saved your <b> {{request.user.card_brand}}</b> card ending in <b> {{ request.user.card_last4}} </b> with Stripe.

<div class="reveal" id="credit_card_form" data-reveal>
{% include "credit_card_form.html" %}
Expand Down
4 changes: 2 additions & 2 deletions static/js/stripe-app.js
Expand Up @@ -17,8 +17,8 @@ $(window).load(function () {
function prepare_data ({type, id, card, bank_account }){
switch (type) {
case 'card':
( {last4, brand} = card)
return {stripe_card: id, last4, brand}
;( {last4: card_last4, brand: card_brand} = card)
return {stripe_card: id, card_last4, card_brand}
break;
case 'bank_account':
return {stripe_bank_account: id}
Expand Down

0 comments on commit 28fa041

Please sign in to comment.