from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from rowers.models import Rower,PaidPlan # run once - copies plans to paypal def planstopaypal(): plans = PaidPlan.objects.all() for plan in plans: plan.pk = None plan.paymentprocessor = 'paypal' plan.external_id = None plan.save() #def initiaterowerplans(): # rowers = Rower.objects.filter(paymenttype = 'recurring',paidplan = None) # for r in rowers: # r.paymentprocessor = 'paypal' # r.save() #def setrowerplans(): # rowers = Rower.objects.all() # for r in rowers: # paidplans = PaidPlan.objects.filter( # shortname = r.rowerplan, # paymenttype = r.paymenttype, # clubsize = r.clubsize, # paymentprocessor=r.paymentprocessor) # if paidplans: # r.paidplan = paidplans[0] # r.save() # else: # try: # print 'Could not set plan for ',r.user.username # except: # pass def is_existing_customer(rower): if rower.country is not None and rower.customer_id is not None and rower.country != '': if rower.subscription_id is None or rower.subscription_id == '': return False else: return True return False