eerste set wijzigingen
This commit is contained in:
@@ -418,35 +418,72 @@ def create_subscription(rower, data):
|
||||
|
||||
return False, 0 # pragma: no cover
|
||||
|
||||
|
||||
def cancel_subscription(rower, id):
|
||||
themessages = []
|
||||
errormessages = []
|
||||
|
||||
# 1. Fetch subscription first so we can read paid_through_date
|
||||
try:
|
||||
_ = gateway.subscription.cancel(id)
|
||||
themessages.append("Subscription canceled")
|
||||
except: # pragma: no cover
|
||||
subscription = gateway.subscription.find(id)
|
||||
paid_through = subscription.paid_through_date # may be None
|
||||
except Exception:
|
||||
errormessages.append(
|
||||
"We could not find the subscription record in our customer database."
|
||||
" We have notified the site owner, who will contact you.")
|
||||
" We have notified the site owner, who will contact you."
|
||||
)
|
||||
|
||||
name = '{f} {l}'.format(f=rower.user.first_name,
|
||||
l=rower.user.last_name)
|
||||
name = f"{rower.user.first_name} {rower.user.last_name}"
|
||||
|
||||
_ = myqueue(queuehigh,
|
||||
handle_send_email_failed_cancel,
|
||||
name, rower.user.email, rower.user.username, id)
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
handle_send_email_failed_cancel,
|
||||
name,
|
||||
rower.user.email,
|
||||
rower.user.username,
|
||||
id,
|
||||
)
|
||||
|
||||
return False, themessages, errormessages
|
||||
|
||||
# 2. Attempt cancellation
|
||||
try:
|
||||
_ = gateway.subscription.cancel(id)
|
||||
themessages.append("Subscription canceled")
|
||||
except Exception: # pragma: no cover
|
||||
errormessages.append(
|
||||
"We could not find the subscription record in our customer database."
|
||||
" We have notified the site owner, who will contact you."
|
||||
)
|
||||
|
||||
name = f"{rower.user.first_name} {rower.user.last_name}"
|
||||
|
||||
_ = myqueue(
|
||||
queuehigh,
|
||||
handle_send_email_failed_cancel,
|
||||
name,
|
||||
rower.user.email,
|
||||
rower.user.username,
|
||||
id,
|
||||
)
|
||||
|
||||
return False, themessages, errormessages
|
||||
|
||||
# 3. Update rower object (using paid_through_date)
|
||||
basicplans = PaidPlan.objects.filter(price=0, paymentprocessor='braintree')
|
||||
rower.paidplan = basicplans[0]
|
||||
|
||||
# teamplanexpires stays "now" (as you had it)
|
||||
rower.teamplanexpires = timezone.now()
|
||||
rower.planexpires = timezone.now()
|
||||
|
||||
# planexpires becomes the user's real, fully paid end date
|
||||
# fallback = now() if Braintree somehow returns None
|
||||
rower.planexpires = paid_through or timezone.now()
|
||||
|
||||
rower.clubsize = 0
|
||||
rower.rowerplan = 'basic'
|
||||
rower.subscription_id = None
|
||||
rower.save()
|
||||
|
||||
themessages.append("Your plan was reset to basic")
|
||||
|
||||
return True, themessages, errormessages
|
||||
|
||||
@@ -44,14 +44,7 @@
|
||||
{% if user.is_anonymous %}
|
||||
<li class="grid_2">
|
||||
</li>
|
||||
<li style="text-align: center;">
|
||||
<a class="button midden" href="/rowers/register">
|
||||
<h2 class="midden rounder whiteborder">
|
||||
<div>SIGN UP FREE</div>
|
||||
</h1>
|
||||
</a>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<li class="grid_2">
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
</li>
|
||||
|
||||
@@ -209,13 +209,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
{% if not user.is_authenticated %}
|
||||
<div class="register">
|
||||
<h1>SIGN UP</h1>
|
||||
<p><a href="/rowers/register/">I am a rower</a></p>
|
||||
<p><a href="/rowers/coachregister/">I am a rowing coach</a></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="bgimg-1">
|
||||
<div class="caption">
|
||||
@@ -353,9 +346,6 @@ using my NK empower oarlock for about a month now, and I‘m really
|
||||
<li>
|
||||
<a href="/rowers/email/">Contact</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/rowers/paidplans/">Paid Plans</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/rowers/legal/">Legal</a>
|
||||
</li>
|
||||
|
||||
@@ -832,7 +832,6 @@ urlpatterns = [
|
||||
name='payment_completed_view'),
|
||||
re_path(r'^downgradecompleted/$', views.downgrade_completed_view,
|
||||
name='downgrade_completed_view'),
|
||||
re_path(r'^paidplans/$', views.paidplans_view, name='paidplans_view'),
|
||||
re_path(r'^me/cancelsubscriptions/$',
|
||||
views.plan_stop_view, name='plan_stop_view'),
|
||||
re_path(r'^me/cancelsubscription/(?P<id>[\w\ ]+.*)/$',
|
||||
@@ -847,10 +846,6 @@ urlpatterns = [
|
||||
re_path(r'^starttrial/$', views.start_trial_view, name='start_trial_view'),
|
||||
re_path(r'^legal', TemplateView.as_view(
|
||||
template_name='legal.html'), name='legal'),
|
||||
re_path(r'^register/$', views.rower_register_view,
|
||||
name='rower_register_view'),
|
||||
re_path(r'^coachregister/$', views.coach_register_view,
|
||||
name='coach_register_view'),
|
||||
path('activate/<uidb64>/<token>/', views.useractivate, name='useractivate'),
|
||||
re_path(r'^register/thankyou/$', TemplateView.as_view(
|
||||
template_name='registerthankyou.html'), name='registerthankyou'),
|
||||
|
||||
@@ -165,11 +165,6 @@
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="/rowers/register/" title="Sign Up">
|
||||
<i class="fas fa-user-plus "></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'login' %}" title="Sign In">
|
||||
<i class="fas fa-sign-in-alt "></i>
|
||||
@@ -230,7 +225,7 @@
|
||||
{% if user.rower.planexpires|date_dif|ddays < 4 %}
|
||||
<li class="grid_4">
|
||||
<p class="successmessage">
|
||||
You have {{ user.rower.planexpires|date_dif|ddays }} days left of your one year subscription. Please renew on or before {{ user.rower.planexpires }} or your plan will be reset to Basic. Click <a href="/rowers/paidplans/">here</a> to renew your membership.</p>
|
||||
You have {{ user.rower.planexpires|date_dif|ddays }} days left of your one year subscription. Please renew on or before {{ user.rower.planexpires }} or your plan will be reset to Basic.</p>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -239,14 +234,14 @@
|
||||
{% if user.rower.plantrialexpires and user.rower.plantrialexpires|is_future_date and user.rower.rowerplan != 'plan' %}
|
||||
<li class="grid_4">
|
||||
<p class="successmessage">
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Self-Coach trial - Would you like to <a href="/rowers/paidplans/">upgrade now?</a>
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Self-Coach trial </a>
|
||||
</p>
|
||||
</li>
|
||||
{% else %}
|
||||
{% if user.rower.rowerplan == 'basic' %}
|
||||
<li class="grid_4">
|
||||
<p class="successmessage">
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Pro trial - Would you like to <a href="/rowers/paidplans/">upgrade now?</a>
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Pro trial </a>
|
||||
</p>
|
||||
</li>
|
||||
{% endif %}
|
||||
@@ -255,7 +250,7 @@
|
||||
{% if user.rower.coachtrialexpires and user.rower.coachtrialexpires|is_future_date and user.rower.rowerplan != 'coach' %}
|
||||
<li class="grid_4">
|
||||
<p class="successmessage">
|
||||
{{ user.rower.coachtrialexpires|date_dif|ddays }} days left of your Coach trial - Would you like to <a href="/rowers/paidplans/">upgrade now?</a>
|
||||
{{ user.rower.coachtrialexpires|date_dif|ddays }} days left of your Coach trial </a>
|
||||
</p>
|
||||
</li>
|
||||
{% endif %}
|
||||
@@ -336,13 +331,7 @@
|
||||
</div>
|
||||
<div id="id_blogs">
|
||||
</div>
|
||||
{% if user.is_authenticated and user.rower.rowerplan == 'basic' %}
|
||||
<div class="site-announcement-box">
|
||||
<div class="site-announcement-white">
|
||||
<a href="/rowers/paidplans/">Support us and get more features!</a>
|
||||
</div>
|
||||
</div>
|
||||
{% elif user.is_authenticated and user.rower.rowerplan == 'pro' %}
|
||||
{% if user.is_authenticated and user.rower.rowerplan == 'pro' %}
|
||||
<div class="site-announcement-box">
|
||||
<div class="site-announcement-white">
|
||||
<i class="fa-solid fa-user-astronaut "></i> Thank you for supporting Rowsandall.com!
|
||||
@@ -409,14 +398,6 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h2>Support Us</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/rowers/paidplans/">Support Us</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h2>Legal</h2>
|
||||
<ul>
|
||||
|
||||
@@ -170,11 +170,6 @@
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="/rowers/register/" title="Sign Up">
|
||||
<i class="fas fa-user-plus "></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'login' %}" title="Sign In">
|
||||
<i class="fas fa-sign-in-alt "></i>
|
||||
@@ -236,14 +231,14 @@
|
||||
{% if user.rower.plantrialexpires and user.rower.rowerplan != 'plan' %}
|
||||
<li class="grid_5">
|
||||
<p class="successmessage">
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Self-Coach trial - Would you like to <a href="/rowers/paidplans/">upgrade now?</a>
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Self-Coach trial </a>
|
||||
</p>
|
||||
</li>
|
||||
{% else %}
|
||||
{% if user.rower.rowerplan == 'basic' %}
|
||||
<li class="grid_5">
|
||||
<p class="successmessage">
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Pro trial - Would you like to <a href="/rowers/paidplans/">upgrade now?</a>
|
||||
{{ user.rower.protrialexpires|date_dif|ddays }} days left of your Pro trial </a>
|
||||
</p>
|
||||
</li>
|
||||
{% endif %}
|
||||
@@ -329,14 +324,6 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h1>Paid Plans</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/rowers/paidplans/">Paid Plans</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<h1>Legal</h1>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user