Set preferred field as in card_details

This commit is contained in:
PCoder 2017-10-28 15:26:15 +02:00
parent 8759e2a4b5
commit d14a643171

View file

@ -254,6 +254,9 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
exp_year=card_details['exp_year'] exp_year=card_details['exp_year']
) )
except UserCardDetail.DoesNotExist: except UserCardDetail.DoesNotExist:
preferred = False
if 'preferred' in card_details:
preferred = card_details['preferred']
card_detail = UserCardDetail.create( card_detail = UserCardDetail.create(
stripe_customer=stripe_customer, stripe_customer=stripe_customer,
last4=card_details['last4'], last4=card_details['last4'],
@ -261,7 +264,8 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
fingerprint=card_details['fingerprint'], fingerprint=card_details['fingerprint'],
exp_month=card_details['exp_month'], exp_month=card_details['exp_month'],
exp_year=card_details['exp_year'], exp_year=card_details['exp_year'],
card_id=card_details['card_id'] card_id=card_details['card_id'],
preferred=preferred
) )
return card_detail return card_detail