errors fixed
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -852,6 +852,7 @@ def handle_send_email_subscription_create(
|
||||
|
||||
from_email = 'Rowsandall <admin@rowsandall.com>'
|
||||
|
||||
|
||||
d = {
|
||||
'name': username,
|
||||
'siteurl': siteurl,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
subscription to the Rowsandall paid plan "{{ planname }}".
|
||||
</p>
|
||||
|
||||
{% if recurring %}
|
||||
{% if recurring=='recurring' %}
|
||||
<p>
|
||||
Your next charge is due on {{ end_of_billing_period }}. We will charge your {{ paymentmethod }}
|
||||
on that date.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
New plan: "{{ planname }}".
|
||||
</p>
|
||||
|
||||
{% if recurring %}
|
||||
{% if recurring=='recurring'%}
|
||||
<p>
|
||||
The subscription cost is €{{ price }} per year.
|
||||
The next charge is due on {{ end_of_billing_period }}.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Thank you. You have successfully changed your plan to "{{ planname }}".
|
||||
</p>
|
||||
|
||||
{% if recurring %}
|
||||
{% if recurring=='recurring' %}
|
||||
<p>
|
||||
The subscription cost is €{{ price }} per year.
|
||||
Your next charge is due on {{ end_of_billing_period }}. We will charge you automatically
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
New plan: "{{ planname }}".
|
||||
</p>
|
||||
|
||||
{% if recurring %}
|
||||
{% if recurring=='recurring' %}
|
||||
<p>
|
||||
The subscription cost is €{{ price }} per year.
|
||||
The next charge is due on {{ end_of_billing_period }}.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
You are now on the Rowsandall paid plan "{{ planname }}".
|
||||
</p>
|
||||
|
||||
{% if recurring %}
|
||||
{% if recurring=='recurring' %}
|
||||
<p>
|
||||
The subscription cost is €{{ price }} per year.
|
||||
Your next charge is due on {{ end_of_billing_period }}. We will charge you automatically
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
New plan: "{{ planname }}".
|
||||
</p>
|
||||
|
||||
{% if recurring %}
|
||||
{% if recurring=='recurring' %}
|
||||
<p>
|
||||
The subscription cost is €{{ price }} per year.
|
||||
The next charge is due on {{ end_of_billing_period }}.
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
<table class="plantable shortpadded" width="80%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Subscription</th><th>Next Billing Date</th><th>Price</th><th> </th>
|
||||
<th>Subscription</th><th>Paid Until</th><th>Price</th>
|
||||
<th>Subscription type</th><th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -27,6 +28,13 @@
|
||||
<td>
|
||||
{{ subscription|lookup:"price" }} €
|
||||
</td>
|
||||
<td>
|
||||
{% if subscription|lookup:"never_expires" %}
|
||||
Recurring
|
||||
{% else %}
|
||||
Not recurring
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="/rowers/me/cancelsubscription/{{ subscription|lookup:'id' }}">Stop this plan</a>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user