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/stripepayment | |
| 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/stripepayment')
| -rw-r--r-- | postgresqleu/stripepayment/util.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/postgresqleu/stripepayment/util.py b/postgresqleu/stripepayment/util.py index 62f8b580..cb612497 100644 --- a/postgresqleu/stripepayment/util.py +++ b/postgresqleu/stripepayment/util.py @@ -4,6 +4,7 @@ from django.db import transaction 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 .models import StripeLog from .api import StripeApi, StripeException @@ -38,15 +39,14 @@ def process_stripe_checkout(co): invoice_logger, method) - StripeLog(message="Completed payment for Stripe id {0} ({1}{2}, invoice {3})".format(co.id, settings.CURRENCY_ABBREV, co.amount, invoice.id), paymentmethod=method).save() + StripeLog(message="Completed payment for Stripe id {0} ({1}, invoice {2})".format(co.id, format_currency(co.amount), invoice.id), paymentmethod=method).save() send_simple_mail(settings.INVOICE_SENDER_EMAIL, pm.config('notification_receiver'), "Stripe payment completed", - "A Stripe payment for {0} of {1}{2} for invoice {3} was completed.\n\nInvoice: {4}\nRecipient name: {5}\nRecipient email: {6}\n".format( + "A Stripe payment for {0} of {1} for invoice {2} was completed.\n\nInvoice: {3}\nRecipient name: {4}\nRecipient email: {5}\n".format( method.internaldescription, - settings.CURRENCY_ABBREV, - co.amount, + format_currency(co.amount), invoice.id, invoice.title, invoice.recipient_name, |
