- | Your current plan |
+ Your current plan |
{% if rower.rowerplan == 'basic' %}
BASIC
@@ -137,21 +144,21 @@
|
{% if rower.rowerplan == 'pro' %}
- PRO
+ PRO ({{ rower.paymenttype }})
{% else %}
{% endif %}
|
{% if rower.rowerplan == 'plan' %}
- SELF-COACH
+ SELF-COACH ({{ rower.paymenttype }})
{% else %}
{% endif %}
|
{% if rower.rowerplan == 'coach' %}
- COACH
+ COACH ({{ rower.paymenttype }})
{% else %}
{% endif %}
From 117836a1025daebd9d2f4c3c9e2a0ef467eb914c Mon Sep 17 00:00:00 2001
From: Sander Roosendaal
Date: Mon, 31 Dec 2018 16:45:46 +0100
Subject: [PATCH 8/9] errors fixed
---
rowers/braintreestuff.py | 22 ++++++++++++-------
rowers/tasks.py | 1 +
.../templates/subscription_create_email.html | 2 +-
.../subscription_create_notification.html | 2 +-
.../subscription_downgrade_email.html | 2 +-
.../subscription_downgrade_notification.html | 2 +-
.../templates/subscription_update_email.html | 2 +-
.../subscription_update_notification.html | 2 +-
rowers/templates/subscriptions_cancel.html | 10 ++++++++-
9 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/rowers/braintreestuff.py b/rowers/braintreestuff.py
index 2b36a91f..a7372f93 100644
--- a/rowers/braintreestuff.py
+++ b/rowers/braintreestuff.py
@@ -115,6 +115,7 @@ def update_subscription(rower,data,method='up'):
amount = data['amount']
amount = '{amount:.2f}'.format(amount=amount)
+
gatewaydata = {
"price": amount,
"plan_id": plan.external_id,
@@ -124,16 +125,19 @@ def update_subscription(rower,data,method='up'):
},
}
+
if plan.paymenttype == 'single':
gatewaydata['number_of_billing_cycles'] = 1
else:
gatewaydata['never_expires'] = True
-
- result = gateway.subscription.update(
- rower.subscription_id,
- gatewaydata
- )
+ try:
+ result = gateway.subscription.update(
+ rower.subscription_id,
+ gatewaydata
+ )
+ except:
+ return False
if result.is_success:
rower.paidplan = plan
@@ -164,7 +168,7 @@ def update_subscription(rower,data,method='up'):
handle_send_email_subscription_update,
name, rower.user.email,
plan.name,
- plan.paymenttype == 'recurring',
+ plan.paymenttype,
plan.price,
amount,
result.subscription.billing_period_end_date.strftime('%Y-%m-%d'),
@@ -225,7 +229,7 @@ def create_subscription(rower,data):
)
- recurring = plan.paymenttype == 'recurring',
+ recurring = plan.paymenttype
job = myqueue(
queuehigh,
@@ -268,6 +272,7 @@ def cancel_subscription(rower,id):
rower.planexpires = timezone.now()
rower.clubsize = 0
rower.rowerplan = 'basic'
+ rower.subscription_id = None
rower.save()
themessages.append("Your plan was reset to basic")
@@ -309,7 +314,8 @@ def find_subscriptions(rower):
'plan_id': subscription.plan_id,
'price': subscription.price,
'id': subscription.id,
- 'plan': plan.name
+ 'plan': plan.name,
+ 'never_expires': subscription.never_expires
}
result.append(thedict)
diff --git a/rowers/tasks.py b/rowers/tasks.py
index 784ad55a..ece7a6a6 100644
--- a/rowers/tasks.py
+++ b/rowers/tasks.py
@@ -852,6 +852,7 @@ def handle_send_email_subscription_create(
from_email = 'Rowsandall '
+
d = {
'name': username,
'siteurl': siteurl,
diff --git a/rowers/templates/subscription_create_email.html b/rowers/templates/subscription_create_email.html
index c312a6b1..63c70e90 100644
--- a/rowers/templates/subscription_create_email.html
+++ b/rowers/templates/subscription_create_email.html
@@ -8,7 +8,7 @@
subscription to the Rowsandall paid plan "{{ planname }}".
-{% if recurring %}
+{% if recurring=='recurring' %}
Your next charge is due on {{ end_of_billing_period }}. We will charge your {{ paymentmethod }}
on that date.
diff --git a/rowers/templates/subscription_create_notification.html b/rowers/templates/subscription_create_notification.html
index 89c0ebf1..bcf19cc7 100644
--- a/rowers/templates/subscription_create_notification.html
+++ b/rowers/templates/subscription_create_notification.html
@@ -7,7 +7,7 @@
New plan: "{{ planname }}".
-{% if recurring %}
+{% if recurring=='recurring'%}
The subscription cost is €{{ price }} per year.
The next charge is due on {{ end_of_billing_period }}.
diff --git a/rowers/templates/subscription_downgrade_email.html b/rowers/templates/subscription_downgrade_email.html
index 789b48ae..579ab8ce 100644
--- a/rowers/templates/subscription_downgrade_email.html
+++ b/rowers/templates/subscription_downgrade_email.html
@@ -7,7 +7,7 @@
Thank you. You have successfully changed your plan to "{{ planname }}".
-{% if recurring %}
+{% if recurring=='recurring' %}
The subscription cost is €{{ price }} per year.
Your next charge is due on {{ end_of_billing_period }}. We will charge you automatically
diff --git a/rowers/templates/subscription_downgrade_notification.html b/rowers/templates/subscription_downgrade_notification.html
index 6fb0589d..a0a95257 100644
--- a/rowers/templates/subscription_downgrade_notification.html
+++ b/rowers/templates/subscription_downgrade_notification.html
@@ -7,7 +7,7 @@
New plan: "{{ planname }}".
-{% if recurring %}
+{% if recurring=='recurring' %}
The subscription cost is €{{ price }} per year.
The next charge is due on {{ end_of_billing_period }}.
diff --git a/rowers/templates/subscription_update_email.html b/rowers/templates/subscription_update_email.html
index c50e1b08..d805d0d5 100644
--- a/rowers/templates/subscription_update_email.html
+++ b/rowers/templates/subscription_update_email.html
@@ -9,7 +9,7 @@
You are now on the Rowsandall paid plan "{{ planname }}".
-{% if recurring %}
+{% if recurring=='recurring' %}
The subscription cost is €{{ price }} per year.
Your next charge is due on {{ end_of_billing_period }}. We will charge you automatically
diff --git a/rowers/templates/subscription_update_notification.html b/rowers/templates/subscription_update_notification.html
index ce72fe97..26f1f392 100644
--- a/rowers/templates/subscription_update_notification.html
+++ b/rowers/templates/subscription_update_notification.html
@@ -7,7 +7,7 @@
New plan: "{{ planname }}".
-{% if recurring %}
+{% if recurring=='recurring' %}
The subscription cost is €{{ price }} per year.
The next charge is due on {{ end_of_billing_period }}.
diff --git a/rowers/templates/subscriptions_cancel.html b/rowers/templates/subscriptions_cancel.html
index aa360f37..2419c07b 100644
--- a/rowers/templates/subscriptions_cancel.html
+++ b/rowers/templates/subscriptions_cancel.html
@@ -12,7 +12,8 @@
- | Subscription | Next Billing Date | Price | |
+ Subscription | Paid Until | Price |
+ Subscription type | |
@@ -27,6 +28,13 @@
{{ subscription|lookup:"price" }} €
|
+
+ {% if subscription|lookup:"never_expires" %}
+ Recurring
+ {% else %}
+ Not recurring
+ {% endif %}
+ |
Stop this plan
|
From 639ab23beba3bb740efdbfb66a281e66f17dbaa0 Mon Sep 17 00:00:00 2001
From: Sander Roosendaal
Date: Mon, 31 Dec 2018 17:21:50 +0100
Subject: [PATCH 9/9] implemented mike's improvement suggestions
---
rowers/braintreestuff.py | 14 +++++++-------
rowers/templates/billing.html | 8 +++++++-
rowers/templates/downgrade_completed.html | 2 +-
rowers/templates/downgradeconfirm.html | 6 +++++-
rowers/templates/paidplans.html | 22 ++++++++++++----------
rowers/templates/payment_completed.html | 3 ++-
rowers/templates/subscriptions_cancel.html | 6 ++++--
rowers/templates/upgrade.html | 6 ++++++
rowers/views.py | 18 +++++++++++++-----
9 files changed, 57 insertions(+), 28 deletions(-)
diff --git a/rowers/braintreestuff.py b/rowers/braintreestuff.py
index a7372f93..c3da9330 100644
--- a/rowers/braintreestuff.py
+++ b/rowers/braintreestuff.py
@@ -174,7 +174,7 @@ def update_subscription(rower,data,method='up'):
result.subscription.billing_period_end_date.strftime('%Y-%m-%d'),
method)
- return True
+ return True,amount
else:
errors = result.errors.for_object("subscription")
codes = [str(e.code) for e in errors]
@@ -187,9 +187,9 @@ def update_subscription(rower,data,method='up'):
if create_new:
return create_subscription(rower,data)
- return False
+ return False,0
- return False
+ return False,0
def create_subscription(rower,data):
@@ -207,7 +207,7 @@ def create_subscription(rower,data):
if result.is_success:
payment_method_token = result.payment_method.token
else:
- return False
+ return False,0
result = gateway.subscription.create({
"payment_method_token": payment_method_token,
@@ -241,12 +241,12 @@ def create_subscription(rower,data):
plan.price,
result.subscription.billing_period_end_date.strftime('%Y-%m-%d')
)
- return True
+ return True,plan.price
else:
- return False
+ return False,0
- return False
+ return False,0
def cancel_subscription(rower,id):
themessages = []
diff --git a/rowers/templates/billing.html b/rowers/templates/billing.html
index bf4a358f..1d16238a 100644
--- a/rowers/templates/billing.html
+++ b/rowers/templates/billing.html
@@ -16,7 +16,13 @@
Choose your Plan
-
+
+ Unless specified otherwise, the payments on the
+ recurring payment plans are annual. The prices are specified
+ as a price per year.
+
+
+
{{ planselectform.as_table }}
diff --git a/rowers/templates/downgrade_completed.html b/rowers/templates/downgrade_completed.html
index 1fdde09b..4ede1451 100644
--- a/rowers/templates/downgrade_completed.html
+++ b/rowers/templates/downgrade_completed.html
@@ -7,7 +7,7 @@
Thank you for changing to {{ user.rower.paidplan.name }}. You're all settled.
- membership.
+ You will receive an email confirming the transaction.
diff --git a/rowers/templates/downgradeconfirm.html b/rowers/templates/downgradeconfirm.html
index f6dea839..9bb0aee0 100644
--- a/rowers/templates/downgradeconfirm.html
+++ b/rowers/templates/downgradeconfirm.html
@@ -78,7 +78,11 @@
- Your downgrade will be effective immediately. You will not be charged.
+ Your downgrade will be effective immediately.
+ We need your payment method to process the downgrade.
+ If the selected
+ new plan has a lower price than your current plan, your payment method
+ will not be charged.
diff --git a/rowers/templates/paidplans.html b/rowers/templates/paidplans.html
index bef6da0c..4550c0d7 100644
--- a/rowers/templates/paidplans.html
+++ b/rowers/templates/paidplans.html
@@ -39,13 +39,6 @@
✔ |
✔ |
-
- | Automatic Synchronization with other fitness sites |
- |
- ✔ |
- ✔ |
- ✔ |
-
| Heart rate and power zones |
✔ |
@@ -60,6 +53,13 @@
✔ |
✔ |
+
+ | Automatic Synchronization with other fitness sites |
+ |
+ ✔ |
+ ✔ |
+ ✔ |
+
| Advanced Analysis (Critical Power, Stats, Box Chart, Trend Flex) |
|
@@ -272,9 +272,6 @@
Coach and Self-Coach Membership
- The Coach plan functionality listed is available to the coach only. Individual athletes
- can purchase upgrades to "Pro" and "Self-Coach" plans.
-
Rowsandall.com's Training Planning functionality
is part of the paid "Self-Coach" and "Coach" plans.
@@ -286,6 +283,11 @@
athletes.
+ The Coach plan functionality listed is available to the coach only.
+ Individual athletes
+ can purchase upgrades to "Pro" and "Self-Coach" plans.
+
+
If you would like to find a coach who helps you plan your training
through rowsandall.com, contact me throught the contact form.
diff --git a/rowers/templates/payment_completed.html b/rowers/templates/payment_completed.html
index b29fbaea..45c02d84 100644
--- a/rowers/templates/payment_completed.html
+++ b/rowers/templates/payment_completed.html
@@ -7,7 +7,8 @@
Thank you for registering to {{ user.rower.paidplan.name }}. You have paid for 12 months
- membership.
+ membership. You were charged {{ amount }} € You will receive an email
+ confirming the payment
diff --git a/rowers/templates/subscriptions_cancel.html b/rowers/templates/subscriptions_cancel.html
index 2419c07b..b93b2522 100644
--- a/rowers/templates/subscriptions_cancel.html
+++ b/rowers/templates/subscriptions_cancel.html
@@ -45,7 +45,9 @@
By clicking on the link to stop the plan, you will downgrade to the Basic plan.
- Future payments will be stopped.
+ Future payments will be stopped. Warning: You will not receive a refund.
+ If you wanted to downgrade (and receive a credit for the price
+ difference), click here: Downgrade.
{% else %}
@@ -53,7 +55,7 @@
from the site.
- If you have paid through PayPal, log in to your PayPal account and cancel the recurring payment
+ If you have paid through PayPal, log in to your PayPal account and cancel any recurring payment
there. We will manually downgrade your subscription.
diff --git a/rowers/templates/upgrade.html b/rowers/templates/upgrade.html
index 42b04f13..9f21c889 100644
--- a/rowers/templates/upgrade.html
+++ b/rowers/templates/upgrade.html
@@ -17,6 +17,12 @@
Choose your Plan
+
+ Unless specified otherwise, the payments on the
+ recurring payment plans are annual. The prices are specified
+ as a price per year.
+
+
{{ planselectform.as_table }}
diff --git a/rowers/views.py b/rowers/views.py
index 1521014e..4cd13953 100644
--- a/rowers/views.py
+++ b/rowers/views.py
@@ -1376,10 +1376,12 @@ def checkouts_view(request):
form = BillingForm(request.POST)
if form.is_valid():
data = form.cleaned_data
- success = braintreestuff.create_subscription(r,data)
+ success,amount = braintreestuff.create_subscription(r,data)
if success:
messages.info(request,"Your payment has succeeded and your plan has been updated")
- url = reverse(payment_completed_view)
+ url = "{baseurl}?amount={amount:.2f}".format(
+ baseurl = reverse(payment_completed_view),
+ amount = amount)
return HttpResponseRedirect(url)
else:
messages.error(request,"There was a problem with your payment")
@@ -1410,10 +1412,12 @@ def upgrade_checkouts_view(request):
form = BillingForm(request.POST)
if form.is_valid():
data = form.cleaned_data
- success = braintreestuff.update_subscription(r,data)
+ success,amount = braintreestuff.update_subscription(r,data)
if success:
messages.info(request,"Your payment has succeeded and your plan has been updated")
- url = reverse(payment_completed_view)
+ url = "{baseurl}?amount={amount:.2f}".format(
+ baseurl = reverse(payment_completed_view),
+ amount = amount)
return HttpResponseRedirect(url)
else:
messages.error(request,"There was a problem with your payment")
@@ -1468,13 +1472,17 @@ def payment_completed_view(request):
if not PAYMENT_PROCESSING_ON:
url = reverse('promembership')
return HttpResponseRedirect(url)
+
+ amount = request.GET.get('amount',0)
+
r = getrequestrower(request)
return render(request,
"payment_completed.html",
{
- 'rower':r
+ 'rower':r,
+ 'amount':amount,
})
@login_required()
|