updated models to add paid plan complexity
This commit is contained in:
30
rowers/payments.py
Normal file
30
rowers/payments.py
Normal file
@@ -0,0 +1,30 @@
|
||||
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 setrowerplans():
|
||||
rowers = Rower.objects.all()
|
||||
|
||||
for r in rowers:
|
||||
if r.rowerplan != 'basic':
|
||||
paidplans = PaidPlan.objects.filter(
|
||||
shortname = r.rowerplan,
|
||||
paymenttype = r.paymenttype,
|
||||
clubsize = r.clubsize)
|
||||
|
||||
if paidplans:
|
||||
r.paidplan = paidplans[0]
|
||||
r.paymenttype = 'paypal'
|
||||
r.save()
|
||||
else:
|
||||
print 'Could not set plan for ',r
|
||||
|
||||
|
||||
Reference in New Issue
Block a user