Private
Public Access
1
0

got a little further - still failing

This commit is contained in:
Sander Roosendaal
2019-01-15 19:09:12 +01:00
parent 60c7219134
commit 80c04ee9bb
4 changed files with 137 additions and 122 deletions

View File

@@ -43,6 +43,7 @@ else:
)
)
from rowers.models import Rower,PaidPlan
from rowers.utils import ProcessorCustomerError
@@ -208,6 +209,9 @@ def update_subscription(rower,data,method='up'):
def create_subscription(rower,data):
planid = data['plan']
plan = PaidPlan.objects.get(id=planid)
print plan
print data
raise ValueError
nonce_from_the_client = data['payment_method_nonce']
amount = data['amount']
@@ -217,22 +221,18 @@ def create_subscription(rower,data):
"payment_method_nonce": nonce_from_the_client
})
print 'aap'
if result.is_success:
payment_method_token = result.payment_method.token
else:
return False,0
print 'noot'
result = gateway.subscription.create({
"payment_method_token": payment_method_token,
"plan_id": plan.external_id
})
if result.is_success:
print 'mies'
rower.paidplan = plan
rower.planexpires = result.subscription.billing_period_end_date
rower.teamplanexpires = result.subscription.billing_period_end_date