Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-11-09 19:14:00 +01:00
parent 96a4b2ba10
commit 919e7f331b
4 changed files with 48 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ from rowers.tasks import (
handle_send_email_subscription_update,
handle_send_email_subscription_create,
handle_send_email_failed_cancel,
handle_send_email_transaction_notification,
)
import pandas as pd
@@ -219,6 +220,8 @@ def make_payment(rower,data):
try:
job = myqueue(queuehigh,handle_send_email_transaction,
name, rower.user.email, amount)
job = myqueue(queuehigh,handle_send_email_transation_notification,
name.rower.user.email, amount, additional_text)
except: # pragma: no cover
pass

View File

@@ -1341,6 +1341,33 @@ def handle_send_email_transaction(
return 1
@app.task
def handle_send_email_transaction_notification(
username, useremail, amount, additional_text, **kwargs):
if 'debug' in kwargs: # pragma: no cover
debug = kwargs['debug']
else:
debug = True
subject = "Rowsandall Payment Confirmation"
from_email = 'Rowsandall <admin@rowsandall.com>'
d = {
'name': username,
'siteurl': siteurl,
'amount': amount,
'reason':additional_text,
}
res = send_template_email(from_email,['support@rowsandall.com'],
subject,
'instantplansold.html',
d, **kwargs)
return 1
@app.task
def handle_send_email_failed_cancel(
name, email, username, id, **kwargs):

View File

@@ -0,0 +1,17 @@
{% extends "emailbase.html" %}
{% block body %}
<p>User <strong>{{ name }}</strong> made a payment.</p>
<p>
{{ additional_text }}
</p>
<p>
Price: &euro;{{ price }}.
</p>
<p>
Best Regards, the Rowsandall Team
</p>
{% endblock %}

View File

@@ -136,7 +136,7 @@ def buy_trainingplan_view(request,id=0):
try:
targetid = cd['target']
target = TrainingTarget.objects.get(id=int(targetid))
except KeyError:
except (KeyError,ValueError):
try:
targetid = request.POST['target']