Change currency in emails.

This commit is contained in:
Lynne 2018-09-19 20:14:39 +02:00
parent ee022f032d
commit 7be17efc8b
3 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
An attempt was just made to charge your card for your monthly donation to An attempt was just made to charge your card for your monthly donation to
{{your_name}} for ${{amount}}. Unfortunately, your card was declined. {{your_name}} for {{amount}}. Unfortunately, your card was declined.
The donation has been disabled. If you would like to, you may create a new The donation has been disabled. If you would like to, you may create a new
recurring donation here: recurring donation here:

View File

@ -3,10 +3,10 @@ Thank you for donating!
Receipt: Receipt:
{{#monthly}} {{#monthly}}
Monthly donation ${{amount}} Monthly donation {{amount}}
{{/monthly}} {{/monthly}}
{{^monthly}} {{^monthly}}
One-time donation ${{amount}} One-time donation {{amount}}
{{/monthly}} {{/monthly}}
You can view and manage your donations online here: You can view and manage your donations online here:

View File

@ -10,6 +10,7 @@ from flask import url_for
from fosspay.database import db from fosspay.database import db
from fosspay.objects import User from fosspay.objects import User
from fosspay.config import _cfg, _cfgi from fosspay.config import _cfg, _cfgi
from fosspay.currency import currency
def send_thank_you(user, amount, monthly): def send_thank_you(user, amount, monthly):
if _cfg("smtp-host") == "": if _cfg("smtp-host") == "":
@ -24,7 +25,7 @@ def send_thank_you(user, amount, monthly):
"user": user, "user": user,
"root": _cfg("protocol") + "://" + _cfg("domain"), "root": _cfg("protocol") + "://" + _cfg("domain"),
"your_name": _cfg("your-name"), "your_name": _cfg("your-name"),
"amount": "{:.2f}".format(amount / 100), "amount": currency.amount("{:.2f}".format(amount / 100)),
"monthly": monthly, "monthly": monthly,
"your_email": _cfg("your-email") "your_email": _cfg("your-email")
}))) })))
@ -70,7 +71,7 @@ def send_declined(user, amount):
"user": user, "user": user,
"root": _cfg("protocol") + "://" + _cfg("domain"), "root": _cfg("protocol") + "://" + _cfg("domain"),
"your_name": _cfg("your-name"), "your_name": _cfg("your-name"),
"amount": "{:.2f}".format(amount / 100) "amount": currency.amount("{:.2f}".format(amount / 100))
}))) })))
message['Subject'] = "Your monthly donation was declined." message['Subject'] = "Your monthly donation was declined."
message['From'] = _cfg("smtp-from") message['From'] = _cfg("smtp-from")