Private
Public Access
1
0

more test fiddling

This commit is contained in:
Sander Roosendaal
2019-01-15 22:35:09 +01:00
parent e29035bbca
commit 5fc82a2bb8
7 changed files with 2700 additions and 688 deletions

View File

@@ -209,6 +209,10 @@ def update_subscription(rower,data,method='up'):
def create_subscription(rower,data):
nonce_from_the_client = data['payment_method_nonce']
amount = data['amount']
planid = data['plan']
plan = PaidPlan.objects.get(id=planid)
# create or find payment method
result = gateway.payment_method.create({
@@ -235,6 +239,7 @@ def create_subscription(rower,data):
rower.paymenttype = plan.paymenttype
rower.rowerplan = plan.shortname
rower.subscription_id = result.subscription.id
rower.save()
name = '{f} {l}'.format(
f = rower.user.first_name,
@@ -308,7 +313,7 @@ def find_subscriptions(rower):
try:
paypal_accounts = result.paypal_accounts
for account in accuonts:
for account in paypal_accounts:
for subscription in account.subscriptions:
if subscription.status == 'Active':
active_subscriptions.append(subscription)
@@ -409,3 +414,13 @@ def get_transactions(start_date,end_date):
return df
def mocktest(rower):
nonce_from_the_client = 'aap'
result = gateway.payment_method.create({
"customer_id": rower.customer_id,
"payment_method_nonce": nonce_from_the_client
})
return result.subscription.id