Private
Public Access
1
0

downgrade notifications

This commit is contained in:
Sander Roosendaal
2018-12-20 17:40:32 +01:00
parent 954bd46bce
commit ab9579a048
10 changed files with 423 additions and 12 deletions

View File

@@ -107,7 +107,7 @@ def make_payment(rower,data):
else:
return 0,''
def update_subscription(rower,data):
def update_subscription(rower,data,method='up'):
planid = data['plan']
plan = PaidPlan.objects.get(id=planid)
nonce_from_the_client = data['payment_method_nonce']
@@ -148,11 +148,13 @@ def update_subscription(rower,data):
l = rower.user.last_name,
)
if method == 'up':
transactions = result.subscription.transactions
transactions = result.subscription.transactions
if transactions:
amount = transactions[0].amount
if transactions:
amount = transactions[0].amount
else:
amount = 0
else:
amount = 0
@@ -164,7 +166,8 @@ def update_subscription(rower,data):
plan.paymenttype == 'recurring',
plan.price,
amount,
result.subscription.billing_period_end_date.strftime('%Y-%m-%d'))
result.subscription.billing_period_end_date.strftime('%Y-%m-%d'),
method)
return True
else: