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:
|
||||||
card_detail = UserCardDetail.objects.get(
|
if ('fingerprint' in card_details and 'exp_month' in card_details
|
||||||
stripe_customer=stripe_customer,
|
and 'exp_year' in card_details):
|
||||||
fingerprint=card_details['fingerprint'],
|
card_detail = UserCardDetail.objects.get(
|
||||||
exp_month=card_details['exp_month'],
|
stripe_customer=stripe_customer,
|
||||||
exp_year=card_details['exp_year']
|
fingerprint=card_details['fingerprint'],
|
||||||
)
|
exp_month=card_details['exp_month'],
|
||||||
|
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