Add set_as_default parameter for associate_customer_card method
This commit is contained in:
parent
38168e8f8f
commit
73169e825d
1 changed files with 6 additions and 2 deletions
|
@ -79,9 +79,13 @@ class StripeUtils(object):
|
|||
customer.save()
|
||||
|
||||
@handleStripeError
|
||||
def associate_customer_card(self, stripe_customer_id, token):
|
||||
def associate_customer_card(self, stripe_customer_id, token,
|
||||
set_as_default=False):
|
||||
customer = stripe.Customer.retrieve(stripe_customer_id)
|
||||
customer.sources.create(source=token)
|
||||
card = customer.sources.create(source=token)
|
||||
if set_as_default:
|
||||
customer.default_source = card.id
|
||||
customer.save()
|
||||
|
||||
@handleStripeError
|
||||
def dissociate_customer_card(self, stripe_customer_id, card_id):
|
||||
|
|
Loading…
Reference in a new issue