Do a get on UserCardDetail only when fingerprint, exp_month and exp_year are known
This commit is contained in:
parent
1c5ff1f9dd
commit
d98a683b2a
1 changed files with 10 additions and 6 deletions
|
@ -272,12 +272,16 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
|
||||||
:return: UserCardDetail object
|
:return: UserCardDetail object
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
if ('fingerprint' in card_details and 'exp_month' in card_details
|
||||||
|
and 'exp_year' in card_details):
|
||||||
card_detail = UserCardDetail.objects.get(
|
card_detail = UserCardDetail.objects.get(
|
||||||
stripe_customer=stripe_customer,
|
stripe_customer=stripe_customer,
|
||||||
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']
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
raise UserCardDetail.DoesNotExist()
|
||||||
except UserCardDetail.DoesNotExist:
|
except UserCardDetail.DoesNotExist:
|
||||||
preferred = False
|
preferred = False
|
||||||
if 'preferred' in card_details:
|
if 'preferred' in card_details:
|
||||||
|
|
Loading…
Reference in a new issue