diff --git a/src/pretix/plugins/banktransfer/refund_export.py b/src/pretix/plugins/banktransfer/refund_export.py index d96f3885b..2ea2f5af7 100644 --- a/src/pretix/plugins/banktransfer/refund_export.py +++ b/src/pretix/plugins/banktransfer/refund_export.py @@ -30,6 +30,7 @@ from django.templatetags.l10n import localize from django.utils.translation import gettext_lazy as _ from localflavor.generic.validators import BICValidator +from pretix.base.i18n import language from pretix.plugins.banktransfer.models import RefundExport @@ -85,12 +86,14 @@ def build_sepa_xml(refund_export: RefundExport, account_holder, iban, bic): sepa = SepaTransfer(config, clean=True) for row in refund_export.rows_data: + with language(row.get("locale", (refund_export.event or refund_export.organizer).settings.locale)): + ref = f"{row['id']} {_('Refund')} {row.get('comment') or ''}".strip()[:140] payment = { "name": row['payer'], "IBAN": row["iban"], "amount": int(Decimal(row['amount']) * 100), # in euro-cents "execution_date": datetime.date.today(), - "description": f"{row['id']} {refund_export.entity_slug} {_('Refund')} {row.get('comment') or ''}".strip()[:140], + "description": ref, } if row.get('bic'): try: diff --git a/src/pretix/plugins/banktransfer/views.py b/src/pretix/plugins/banktransfer/views.py index ed3492cf8..3875c934b 100644 --- a/src/pretix/plugins/banktransfer/views.py +++ b/src/pretix/plugins/banktransfer/views.py @@ -674,6 +674,7 @@ def _unite_transaction_rows(transaction_rows): united_transactions_rows.append({ "iban": iban, "bic": bic, + "locale": rows[0].get('locale', 'en'), "id": ", ".join(sorted(set(r['id'] for r in rows))), "payer": ", ".join(sorted(set(r['payer'] for r in rows))), "amount": sum(r['amount'] for r in rows), @@ -726,6 +727,7 @@ class RefundExportListView(ListView): "amount": refund.amount, "id": refund.full_id, "comment": refund.comment, + "locale": refund.order.locale, **{key: data.get(key) for key in ("payer", "iban", "bic")} }) refund.done(user=self.request.user) diff --git a/src/tests/plugins/banktransfer/test_refund_export.py b/src/tests/plugins/banktransfer/test_refund_export.py index b054afff7..360310cdc 100644 --- a/src/tests/plugins/banktransfer/test_refund_export.py +++ b/src/tests/plugins/banktransfer/test_refund_export.py @@ -185,6 +185,7 @@ def test_unite_transaction_rows(): 'iban': 'DE12345678901234567890', 'bic': 'HARKE9000', 'id': "ROLLA-R-1", + 'locale': "en", 'comment': None, 'amount': Decimal("42.23"), }, @@ -193,6 +194,7 @@ def test_unite_transaction_rows(): 'iban': 'DE111111111111111111111', 'bic': 'ikswez2020', 'id': "PARTY-R-1", + 'locale': "en", 'comment': None, 'amount': Decimal("6.50"), } @@ -206,6 +208,7 @@ def test_unite_transaction_rows(): 'iban': 'DE12345678901234567890', 'bic': 'HARKE9000', 'id': "ROLLA-R-1", + 'locale': "en", 'comment': None, 'amount': Decimal("7.77"), }, @@ -214,6 +217,7 @@ def test_unite_transaction_rows(): 'iban': 'DE111111111111111111111', 'bic': 'ikswez2020', 'id': "PARTY-R-2", + 'locale': "en", 'comment': None, 'amount': Decimal("13.50"), } @@ -225,6 +229,7 @@ def test_unite_transaction_rows(): 'iban': 'DE12345678901234567890', 'bic': 'HARKE9000', 'id': "ROLLA-R-1", + 'locale': "en", 'comment': None, 'amount': Decimal("50.00"), }, @@ -233,6 +238,7 @@ def test_unite_transaction_rows(): 'iban': 'DE111111111111111111111', 'bic': 'ikswez2020', 'id': 'PARTY-R-1, PARTY-R-2', + 'locale': "en", 'comment': None, 'amount': Decimal('20.00'), }], key=_row_key_func)