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/adyen/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/adyen/util.py')
-rw-r--r-- | postgresqleu/adyen/util.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/postgresqleu/adyen/util.py b/postgresqleu/adyen/util.py index da9403c6..89d956a0 100644 --- a/postgresqleu/adyen/util.py +++ b/postgresqleu/adyen/util.py @@ -12,6 +12,7 @@ from postgresqleu.mailqueue.util import send_simple_mail from postgresqleu.invoices.util import InvoiceManager from postgresqleu.invoices.models import Invoice, InvoicePaymentMethod from postgresqleu.accounting.util import create_accounting_entry +from postgresqleu.util.currency import format_currency from .models import TransactionStatus, Report, AdyenLog, Notification, Refund @@ -56,9 +57,8 @@ def process_authorization(notification): send_simple_mail(settings.INVOICE_SENDER_EMAIL, pm.config('notification_receiver'), 'Manual Adyen payment authorized', - "An Adyen payment of %s%s was authorized on the Adyen platform for %s.\nThis payment was not from the automated system, it was manually authorized, probably from a POS terminal.\nReference: %s\nAdyen reference: %s\nMerchant account: %s\n" % ( - settings.CURRENCY_ABBREV, - notification.amount, + "An Adyen payment of %s was authorized on the Adyen platform for %s.\nThis payment was not from the automated system, it was manually authorized, probably from a POS terminal.\nReference: %s\nAdyen reference: %s\nMerchant account: %s\n" % ( + format_currency(notification.amount), method.internaldescription, notification.merchantReference, notification.pspReference, @@ -159,8 +159,8 @@ def process_authorization(notification): send_simple_mail(settings.INVOICE_SENDER_EMAIL, pm.config('notification_receiver'), 'Adyen payment authorized', - "An Adyen payment of %s%s with reference %s was authorized on the Adyen platform for %s.\nInvoice: %s\nRecipient name: %s\nRecipient user: %s\nPayment method: %s\nAdyen reference: %s\n" % ( - settings.CURRENCY_ABBREV, notification.amount, + "An Adyen payment of %s with reference %s was authorized on the Adyen platform for %s.\nInvoice: %s\nRecipient name: %s\nRecipient user: %s\nPayment method: %s\nAdyen reference: %s\n" % ( + format_currency(notification.amount), notification.merchantReference, method.internaldescription, invoice.title, @@ -269,7 +269,7 @@ def process_refund(notification): send_simple_mail(settings.INVOICE_SENDER_EMAIL, pm.config('notification_receiver'), 'Adyen refund received', - "A refund of %s%s for transaction %s was processed on %s\n\nNOTE! You must complete the accounting system entry manually as it was not API generated!!" % (settings.CURRENCY_ABBREV, notification.amount, method.internaldescription, notification.originalReference)) + "A refund of %s for transaction %s was processed on %s\n\nNOTE! You must complete the accounting system entry manually as it was not API generated!!" % (format_currency(notification.amount), method.internaldescription, notification.originalReference)) create_accounting_entry(accrows, True, urls) |