Private
Public Access
1
0

further pepping

This commit is contained in:
Sander Roosendaal
2022-02-15 16:53:38 +01:00
parent fb98877b5f
commit 2fb011e876
4 changed files with 81 additions and 61 deletions

View File

@@ -28,7 +28,9 @@ def paidplans_view(request):
if not request.user.is_anonymous:
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
else:
r = None
@@ -46,7 +48,9 @@ def billing_view(request):
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
if payments.is_existing_customer(r): # pragma: no cover
url = reverse(upgrade_view)
@@ -66,7 +70,7 @@ def billing_view(request):
if planselectform.is_valid():
plan = planselectform.cleaned_data['plan']
try:
customer_id = braintreestuff.create_customer(r)
_ = braintreestuff.create_customer(r)
except ProcessorCustomerError: # pragma: no cover
messages.error(
request, "Something went wrong registering you as a customer.")
@@ -223,7 +227,7 @@ def purchase_checkouts_view(request):
amount, success = braintreestuff.make_payment(r, data)
diff = plan.price - int(amount)
eurocredits = credits.withdraw(diff, r)
_ = credits.withdraw(diff, r)
if success:
messages.info(
@@ -258,13 +262,13 @@ def purchase_checkouts_view(request):
create_sessions_from_json(plansteps, r, startdate, r.user)
job = myqueue(queuehigh, handle_send_email_instantplan_notification,
r.user.username,
r.user.email,
plan.price,
plan.name,
startdate,
enddate)
_ = myqueue(queuehigh, handle_send_email_instantplan_notification,
r.user.username,
r.user.email,
plan.price,
plan.name,
startdate,
enddate)
url = reverse('plannedsessions_view')
timeperiod = startdate.strftime(
@@ -280,9 +284,7 @@ def purchase_checkouts_view(request):
return HttpResponseRedirect(url)
elif 'tac' not in request.POST: # pragma: no cover
try:
planid = int(request.POST['plan'])
enddate = request.POST['enddate']
rower = r.id
# incomplete
except IndexError:
messages.error(request, "There was an error in the payment form")
@@ -355,7 +357,9 @@ def upgrade_view(request):
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
if r.subscription_id is None or r.subscription_id == '': # pragma: no cover
url = reverse(billing_view)
@@ -402,7 +406,9 @@ def downgrade_view(request):
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
if r.subscription_id is None or r.subscription_id == '': # pragma: no cover
url = reverse(billing_view)
@@ -462,7 +468,9 @@ def plan_stop_view(request):
subscriptions = []
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
if r.paidplan is not None and r.paidplan.paymentprocessor == 'braintree':
try:
@@ -516,7 +524,9 @@ def upgrade_confirm_view(request, planid=0):
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
client_token = braintreestuff.get_client_token(r)
@@ -571,7 +581,9 @@ def payment_confirm_view(request, planid=0):
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only available through" \
" BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
client_token = braintreestuff.get_client_token(r)
@@ -593,7 +605,10 @@ def checkouts_view(request):
r = request.user.rower
if r.paymentprocessor != 'braintree' and r.paymenttype == 'recurring': # pragma: no cover
messages.error(request, 'Automated payment processing is currently only available through BrainTree (by PayPal). You are currently on a recurring payment plan with PayPal. Contact the site administrator at support@rowsandall.com before you proceed')
messages.error(request, 'Automated payment processing is currently only" \
" available through BrainTree (by PayPal). " \
"You are currently on a recurring payment plan with PayPal." \
" Contact the site administrator at support@rowsandall.com before you proceed')
if request.method != 'POST': # pragma: no cover
url = reverse(paidplans_view)
@@ -785,7 +800,7 @@ def useractivate(request, uidb64, token): # pragma: no cover
template = 'coachregisteremail.html'
send_template_email(from_address, [fullemail],
subject, 'registeremail.html', d)
subject, template, d)
subject2 = "New User"
message2 = "New user registered.\n"
@@ -820,7 +835,6 @@ def rower_register_view(request):
nextpage = '/rowers/list-workouts/'
if request.method == 'POST':
#form = RegistrationFormUniqueEmail(request.POST)
form = RegistrationFormSex(request.POST)
if form.is_valid():
first_name = form.cleaned_data['first_name']
@@ -870,12 +884,6 @@ def rower_register_view(request):
# Create and send email
current_site = get_current_site(request)
mail_subject = 'Activate your account.'
d = {
'user': theuser,
'domain': current_site.domain,
'uid': urlsafe_base64_encode(force_bytes(theuser.id)),
'token': account_activation_token.make_token(theuser),
}
to_email = form.cleaned_data.get('email')
message = render_to_string('acc_activate_email.html', {
'user': theuser,
@@ -917,7 +925,6 @@ def freecoach_register_view(request): # pragma: no cover
nextpage = '/rowers/me/teams/'
if request.method == 'POST':
#form = RegistrationFormUniqueEmail(request.POST)
form = RegistrationFormSex(request.POST)
if form.is_valid():
first_name = form.cleaned_data['first_name']
@@ -951,12 +958,6 @@ def freecoach_register_view(request): # pragma: no cover
# Create and send email
current_site = get_current_site(request)
mail_subject = 'Activate your account.'
d = {
'user': theuser,
'domain': current_site.domain,
'uid': urlsafe_base64_encode(force_bytes(theuser.id)).decode(),
'token': account_activation_token.make_token(theuser),
}
to_email = form.cleaned_data.get('email')
message = render_to_string('acc_activate_email.html', {
'user': theuser,