legacy
Gogs 8 years ago
parent 2e747924f2
commit 4ca95366b9

@ -85,7 +85,6 @@ class User:
# At this point we have a new user and a plan identifier # At this point we have a new user and a plan identifier
# We formt the plan as it is given to us as a string ... later will be subscribed. # We formt the plan as it is given to us as a string ... later will be subscribed.
# #
plans = [{"id":plans}]
self.user = {"_id":id,"emails":[uid],"source":self.stripeToken} self.user = {"_id":id,"emails":[uid],"source":self.stripeToken}
else: else:
@ -101,8 +100,9 @@ class User:
# If this user's isn't already subscribed we should subscribe her # If this user's isn't already subscribed we should subscribe her
# We perform a set operation to determine if she is alread susbscribed # We perform a set operation to determine if she is alread susbscribed
# #
lsub = self.subscriptions()
plans = [{"id":plans}]
lsub = self.subscriptions()
if len(lsub.data) > 0 : if len(lsub.data) > 0 :
lplans = [str(item['plan']['id']) for item in lsub.data if item.ended_at in [None,""]] lplans = [str(item['plan']['id']) for item in lsub.data if item.ended_at in [None,""]]
x_plans = [item['id'] for item in plans] x_plans = [item['id'] for item in plans]
@ -110,7 +110,7 @@ class User:
if lplans and not set(x_plans) - set(lplans) : if lplans and not set(x_plans) - set(lplans) :
has_plans = False has_plans = False
x = list(set(x_plans) - set(lplans)) x = list(set(x_plans) - set(lplans))
plans = [ item for item in plans if item.id in x] plans = [ item for item in plans if item['id'] in x]
else: else:
# #
# In case the user doesn't have any plans with us # In case the user doesn't have any plans with us
@ -209,10 +209,8 @@ class User:
for plan in plans: for plan in plans:
sid = plan['subscription'] sid = plan['subscription']
if plan['amount'] > 0 : if plan['amount'] > 0 :
print [' *** ',plan['amount']]
_invoice= stripe.Invoice.create(customer=id,subscription=sid) _invoice= stripe.Invoice.create(customer=id,subscription=sid)
r = _invoice.pay() r = _invoice.pay()
print r
""" """
This function is designed to determine if the user exists or not This function is designed to determine if the user exists or not

Loading…
Cancel
Save