From 9bf7220aae4bbde4f3b690e721f5b8329e29c9ab Mon Sep 17 00:00:00 2001 From: Kara Engelhardt Date: Fri, 10 Apr 2026 11:38:05 +0200 Subject: [PATCH] Do not show payment text of canceled and failed payments on invoice (Z#23231070) --- src/pretix/base/services/invoices.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/services/invoices.py b/src/pretix/base/services/invoices.py index deadc4d2ff..5e4e9666b0 100644 --- a/src/pretix/base/services/invoices.py +++ b/src/pretix/base/services/invoices.py @@ -58,6 +58,7 @@ from pretix.base.invoicing.transmission import ( from pretix.base.models import ( ExchangeRate, Invoice, InvoiceAddress, InvoiceLine, Order, OrderFee, ) +from pretix.base.models.orders import OrderPayment from pretix.base.models.tax import EU_CURRENCIES from pretix.base.services.tasks import ( TransactionAwareProfiledEventTask, TransactionAwareTask, @@ -102,7 +103,7 @@ def build_invoice(invoice: Invoice) -> Invoice: introductory = invoice.event.settings.get('invoice_introductory_text', as_type=LazyI18nString) additional = invoice.event.settings.get('invoice_additional_text', as_type=LazyI18nString) footer = invoice.event.settings.get('invoice_footer_text', as_type=LazyI18nString) - if lp and lp.payment_provider: + if lp and lp.payment_provider and lp.state not in (OrderPayment.PAYMENT_STATE_FAILED, OrderPayment.PAYMENT_STATE_CANCELED): if 'payment' in inspect.signature(lp.payment_provider.render_invoice_text).parameters: payment = str(lp.payment_provider.render_invoice_text(invoice.order, lp)) else: