diff options
author | Dave Page | 2023-07-25 09:54:44 +0000 |
---|---|---|
committer | Dave Page | 2023-07-25 09:54:44 +0000 |
commit | c594130d3577239e8c33b9270b8c4f9b43ec2f5c (patch) | |
tree | 4344b29582840e1845cd1b747f6312bc7fb762da /postgresqleu/trustlypayment/util.py | |
parent | 8ea4ba64f7bb1ec32fa90ca59dfac092f3bdd508 (diff) |
BREAKING CHANGE: Allow the currency format to be configurable.
This change allows the currency format to be configured in the
instance. This allows us to use alternate symbols (e.g. £), and
to format amounts using the format required in different
jurisdictions.
The currency format is set to Euro by default.
Note that this change requires an update to any Jinja templates
that use the currency_format tag. This must be changed to
format_currency.
Diffstat (limited to 'postgresqleu/trustlypayment/util.py')
-rw-r--r-- | postgresqleu/trustlypayment/util.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/postgresqleu/trustlypayment/util.py b/postgresqleu/trustlypayment/util.py index a473075e..3cef63e8 100644 --- a/postgresqleu/trustlypayment/util.py +++ b/postgresqleu/trustlypayment/util.py @@ -8,6 +8,7 @@ from decimal import Decimal from postgresqleu.mailqueue.util import send_simple_mail from postgresqleu.invoices.util import InvoiceManager from postgresqleu.invoices.models import Invoice +from postgresqleu.util.currency import format_currency from .api import TrustlyWrapper, TrustlyException from .models import TrustlyTransaction, TrustlyLog @@ -196,15 +197,14 @@ class Trustly(TrustlyWrapper): invoice_logger, method) - TrustlyLog(message="Completed payment for Trustly id {0} (order {1}), {2}{3}, invoice {4}".format(trans.id, trans.orderid, settings.CURRENCY_ABBREV, trans.amount, invoice.id), paymentmethod=method).save() + TrustlyLog(message="Completed payment for Trustly id {0} (order {1}), {2}, invoice {3}".format(trans.id, trans.orderid, format_currency(trans.amount), invoice.id), paymentmethod=method).save() send_simple_mail(settings.INVOICE_SENDER_EMAIL, pm.config('notification_receiver'), "Trustly payment completed", - "A Trustly payment for {0} of {1}{2} for invoice {3} was completed on the Trustly platform.\n\nInvoice: {4}\nRecipient name: {5}\nRecipient email: {6}\n".format( + "A Trustly payment for {0} of {1} for invoice {2} was completed on the Trustly platform.\n\nInvoice: {3}\nRecipient name: {4}\nRecipient email: {5}\n".format( method.internaldescription, - settings.CURRENCY_ABBREV, - trans.amount, + format_currency(trans.amount), invoice.id, invoice.title, invoice.recipient_name, |