Remove redundant code in check_customer
This commit is contained in:
parent
692f82cba4
commit
85d19c004b
1 changed files with 4 additions and 11 deletions
|
@ -126,16 +126,9 @@ class StripeUtils(object):
|
|||
}
|
||||
return card_details
|
||||
|
||||
def check_customer(self, id, user, token):
|
||||
customers = self.stripe.Customer.list()
|
||||
if not customers.get('data'):
|
||||
customer = self.create_customer(token, user.email, user.name)
|
||||
user.stripecustomer.stripe_id = customer.get(
|
||||
'response_object').get('id')
|
||||
user.stripecustomer.save()
|
||||
else:
|
||||
def check_customer(self, stripe_cus_api_id, user, token):
|
||||
try:
|
||||
customer = stripe.Customer.retrieve(id)
|
||||
customer = stripe.Customer.retrieve(stripe_cus_api_id)
|
||||
except stripe.InvalidRequestError:
|
||||
customer = self.create_customer(token, user.email, user.name)
|
||||
user.stripecustomer.stripe_id = customer.get(
|
||||
|
|
Loading…
Reference in a new issue