From 7be17efc8bc542f625ad2fe0a5918baa3edb6fd7 Mon Sep 17 00:00:00 2001 From: Lynne <> Date: Wed, 19 Sep 2018 20:14:39 +0200 Subject: [PATCH] Change currency in emails. --- emails/declined | 2 +- emails/thank-you | 4 ++-- fosspay/email.py | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/emails/declined b/emails/declined index 7cf6fdc..777baec 100644 --- a/emails/declined +++ b/emails/declined @@ -1,5 +1,5 @@ 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 recurring donation here: diff --git a/emails/thank-you b/emails/thank-you index 6d45485..7e1e8a9 100644 --- a/emails/thank-you +++ b/emails/thank-you @@ -3,10 +3,10 @@ Thank you for donating! Receipt: {{#monthly}} -Monthly donation ${{amount}} +Monthly donation {{amount}} {{/monthly}} {{^monthly}} -One-time donation ${{amount}} +One-time donation {{amount}} {{/monthly}} You can view and manage your donations online here: diff --git a/fosspay/email.py b/fosspay/email.py index 78601b0..96b21b2 100644 --- a/fosspay/email.py +++ b/fosspay/email.py @@ -10,6 +10,7 @@ from flask import url_for from fosspay.database import db from fosspay.objects import User from fosspay.config import _cfg, _cfgi +from fosspay.currency import currency def send_thank_you(user, amount, monthly): if _cfg("smtp-host") == "": @@ -24,7 +25,7 @@ def send_thank_you(user, amount, monthly): "user": user, "root": _cfg("protocol") + "://" + _cfg("domain"), "your_name": _cfg("your-name"), - "amount": "{:.2f}".format(amount / 100), + "amount": currency.amount("{:.2f}".format(amount / 100)), "monthly": monthly, "your_email": _cfg("your-email") }))) @@ -70,7 +71,7 @@ def send_declined(user, amount): "user": user, "root": _cfg("protocol") + "://" + _cfg("domain"), "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['From'] = _cfg("smtp-from")