Private
Public Access
1
0
Files
rowsandall/rowers/payments.py
Sander Roosendaal 3286630931 adding braintree info
2018-12-21 15:04:35 +01:00

44 lines
1.2 KiB
Python

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:
print 'Could not set plan for ',r
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