implemented mike's improvement suggestions
This commit is contained in:
@@ -174,7 +174,7 @@ def update_subscription(rower,data,method='up'):
|
|||||||
result.subscription.billing_period_end_date.strftime('%Y-%m-%d'),
|
result.subscription.billing_period_end_date.strftime('%Y-%m-%d'),
|
||||||
method)
|
method)
|
||||||
|
|
||||||
return True
|
return True,amount
|
||||||
else:
|
else:
|
||||||
errors = result.errors.for_object("subscription")
|
errors = result.errors.for_object("subscription")
|
||||||
codes = [str(e.code) for e in errors]
|
codes = [str(e.code) for e in errors]
|
||||||
@@ -187,9 +187,9 @@ def update_subscription(rower,data,method='up'):
|
|||||||
if create_new:
|
if create_new:
|
||||||
return create_subscription(rower,data)
|
return create_subscription(rower,data)
|
||||||
|
|
||||||
return False
|
return False,0
|
||||||
|
|
||||||
return False
|
return False,0
|
||||||
|
|
||||||
|
|
||||||
def create_subscription(rower,data):
|
def create_subscription(rower,data):
|
||||||
@@ -207,7 +207,7 @@ def create_subscription(rower,data):
|
|||||||
if result.is_success:
|
if result.is_success:
|
||||||
payment_method_token = result.payment_method.token
|
payment_method_token = result.payment_method.token
|
||||||
else:
|
else:
|
||||||
return False
|
return False,0
|
||||||
|
|
||||||
result = gateway.subscription.create({
|
result = gateway.subscription.create({
|
||||||
"payment_method_token": payment_method_token,
|
"payment_method_token": payment_method_token,
|
||||||
@@ -241,12 +241,12 @@ def create_subscription(rower,data):
|
|||||||
plan.price,
|
plan.price,
|
||||||
result.subscription.billing_period_end_date.strftime('%Y-%m-%d')
|
result.subscription.billing_period_end_date.strftime('%Y-%m-%d')
|
||||||
)
|
)
|
||||||
return True
|
return True,plan.price
|
||||||
else:
|
else:
|
||||||
return False
|
return False,0
|
||||||
|
|
||||||
|
|
||||||
return False
|
return False,0
|
||||||
|
|
||||||
def cancel_subscription(rower,id):
|
def cancel_subscription(rower,id):
|
||||||
themessages = []
|
themessages = []
|
||||||
|
|||||||
@@ -16,7 +16,13 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<h2>Choose your Plan</h2>
|
<h2>Choose your Plan</h2>
|
||||||
<table width="100%">
|
|
||||||
|
<p>Unless specified otherwise, the payments on the
|
||||||
|
recurring payment plans are annual. The prices are specified
|
||||||
|
as a price per year.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table width="100%">
|
||||||
{{ planselectform.as_table }}
|
{{ planselectform.as_table }}
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Thank you for changing to {{ user.rower.paidplan.name }}. You're all settled.
|
Thank you for changing to {{ user.rower.paidplan.name }}. You're all settled.
|
||||||
membership.
|
You will receive an email confirming the transaction.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -78,7 +78,11 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<p>
|
<p>
|
||||||
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.
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -39,13 +39,6 @@
|
|||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Automatic Synchronization with other fitness sites</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>✔</td>
|
|
||||||
<td>✔</td>
|
|
||||||
<td>✔</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Heart rate and power zones</td>
|
<td>Heart rate and power zones</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
@@ -60,6 +53,13 @@
|
|||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Automatic Synchronization with other fitness sites</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>✔</td>
|
||||||
|
<td>✔</td>
|
||||||
|
<td>✔</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Advanced Analysis (Critical Power, Stats, Box Chart, Trend Flex)</td>
|
<td>Advanced Analysis (Critical Power, Stats, Box Chart, Trend Flex)</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
@@ -272,9 +272,6 @@
|
|||||||
|
|
||||||
<h2>Coach and Self-Coach Membership</h2>
|
<h2>Coach and Self-Coach Membership</h2>
|
||||||
|
|
||||||
<p>The Coach plan functionality listed is available to the coach only. Individual athletes
|
|
||||||
can purchase upgrades to "Pro" and "Self-Coach" plans.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>Rowsandall.com's Training Planning functionality
|
<p>Rowsandall.com's Training Planning functionality
|
||||||
is part of the paid "Self-Coach" and "Coach" plans.</p>
|
is part of the paid "Self-Coach" and "Coach" plans.</p>
|
||||||
@@ -286,6 +283,11 @@
|
|||||||
athletes.
|
athletes.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>The Coach plan functionality listed is available to the coach only.
|
||||||
|
Individual athletes
|
||||||
|
can purchase upgrades to "Pro" and "Self-Coach" plans.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>If you would like to find a coach who helps you plan your training
|
<p>If you would like to find a coach who helps you plan your training
|
||||||
through rowsandall.com, contact me throught the contact form.</p>
|
through rowsandall.com, contact me throught the contact form.</p>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Thank you for registering to {{ user.rower.paidplan.name }}. You have paid for 12 months
|
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
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -45,7 +45,9 @@
|
|||||||
<p>
|
<p>
|
||||||
<p>
|
<p>
|
||||||
By clicking on the link to stop the plan, you will downgrade to the Basic plan.
|
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: <a href="/rowers/downgrade">Downgrade</a>.
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>
|
<p>
|
||||||
@@ -53,7 +55,7 @@
|
|||||||
from the site.
|
from the site.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
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.
|
there. We will manually downgrade your subscription.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -17,6 +17,12 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="grid_3">
|
<li class="grid_3">
|
||||||
<h2>Choose your Plan</h2>
|
<h2>Choose your Plan</h2>
|
||||||
|
|
||||||
|
<p>Unless specified otherwise, the payments on the
|
||||||
|
recurring payment plans are annual. The prices are specified
|
||||||
|
as a price per year.
|
||||||
|
</p>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
{{ planselectform.as_table }}
|
{{ planselectform.as_table }}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1376,10 +1376,12 @@ def checkouts_view(request):
|
|||||||
form = BillingForm(request.POST)
|
form = BillingForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
data = form.cleaned_data
|
data = form.cleaned_data
|
||||||
success = braintreestuff.create_subscription(r,data)
|
success,amount = braintreestuff.create_subscription(r,data)
|
||||||
if success:
|
if success:
|
||||||
messages.info(request,"Your payment has succeeded and your plan has been updated")
|
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)
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
messages.error(request,"There was a problem with your payment")
|
messages.error(request,"There was a problem with your payment")
|
||||||
@@ -1410,10 +1412,12 @@ def upgrade_checkouts_view(request):
|
|||||||
form = BillingForm(request.POST)
|
form = BillingForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
data = form.cleaned_data
|
data = form.cleaned_data
|
||||||
success = braintreestuff.update_subscription(r,data)
|
success,amount = braintreestuff.update_subscription(r,data)
|
||||||
if success:
|
if success:
|
||||||
messages.info(request,"Your payment has succeeded and your plan has been updated")
|
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)
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
messages.error(request,"There was a problem with your payment")
|
messages.error(request,"There was a problem with your payment")
|
||||||
@@ -1468,13 +1472,17 @@ def payment_completed_view(request):
|
|||||||
if not PAYMENT_PROCESSING_ON:
|
if not PAYMENT_PROCESSING_ON:
|
||||||
url = reverse('promembership')
|
url = reverse('promembership')
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
amount = request.GET.get('amount',0)
|
||||||
|
|
||||||
|
|
||||||
r = getrequestrower(request)
|
r = getrequestrower(request)
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
"payment_completed.html",
|
"payment_completed.html",
|
||||||
{
|
{
|
||||||
'rower':r
|
'rower':r,
|
||||||
|
'amount':amount,
|
||||||
})
|
})
|
||||||
|
|
||||||
@login_required()
|
@login_required()
|
||||||
|
|||||||
Reference in New Issue
Block a user