Save default card only if Stripe's default_source is not None
This commit is contained in:
parent
73169e825d
commit
8759e2a4b5
1 changed files with 2 additions and 1 deletions
|
@ -285,7 +285,8 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
|
||||||
cus_response = stripe_utils.get_customer(stripe_api_cus_id)
|
cus_response = stripe_utils.get_customer(stripe_api_cus_id)
|
||||||
cu = cus_response['response_object']
|
cu = cus_response['response_object']
|
||||||
default_source = cu.default_source
|
default_source = cu.default_source
|
||||||
self._save_default_card(stripe_api_cus_id, default_source)
|
if default_source is not None:
|
||||||
|
self._save_default_card(stripe_api_cus_id, default_source)
|
||||||
|
|
||||||
def _save_default_card(self, stripe_api_cus_id, card_id):
|
def _save_default_card(self, stripe_api_cus_id, card_id):
|
||||||
stripe_cust = StripeCustomer.objects.get(stripe_id=stripe_api_cus_id)
|
stripe_cust = StripeCustomer.objects.get(stripe_id=stripe_api_cus_id)
|
||||||
|
|
Loading…
Reference in a new issue