From 165a47b593e9baf3d6ca1e7458d664ca7bf7029c Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 9 Dec 2025 08:50:04 +0100 Subject: [PATCH] Bank transfer: Auto-ignore all 0-valued transactions (fixes #5168) (#5620) * Bank transfer: Auto-ignore all 0-valued transactions (fixes #5168) * Fix failing test --- src/pretix/plugins/banktransfer/tasks.py | 5 +++++ src/tests/plugins/banktransfer/test_import.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pretix/plugins/banktransfer/tasks.py b/src/pretix/plugins/banktransfer/tasks.py index f8999fbcdb..464fa6b16b 100644 --- a/src/pretix/plugins/banktransfer/tasks.py +++ b/src/pretix/plugins/banktransfer/tasks.py @@ -419,6 +419,11 @@ def process_banktransfers(self, job: int, data: list) -> None: ) for trans in transactions: + if trans.amount == Decimal("0.00"): + # Ignore all zero-valued transactions + trans.state = BankTransaction.STATE_DISCARDED + trans.save() + continue # Whitespace in references is unreliable since linebreaks and spaces can occur almost anywhere, e.g. # DEMOCON-123\n45 should be matched to DEMOCON-12345. However, sometimes whitespace is important, # e.g. when there are two references. "DEMOCON-12345 DEMOCON-45678" would otherwise be parsed as diff --git a/src/tests/plugins/banktransfer/test_import.py b/src/tests/plugins/banktransfer/test_import.py index 56646b587e..d1bdf60a5d 100644 --- a/src/tests/plugins/banktransfer/test_import.py +++ b/src/tests/plugins/banktransfer/test_import.py @@ -504,7 +504,7 @@ def test_valid_plus_invalid_match(env, orga_job): 'payer': 'Karla Kundin', 'reference': 'Bestellungen DUMMY-1Z3AS DUMMY-99999', 'date': '2016-01-26', - 'amount': '.00' + 'amount': '2.00' }]) with scopes_disabled(): job = BankImportJob.objects.last()