From c92613b4153c38319e2ab84f4d7cd13e19841928 Mon Sep 17 00:00:00 2001 From: James Addison Date: Mon, 18 Dec 2023 12:19:48 +0000 Subject: [PATCH] payments: during bank transaction reference matching, trim structured creditor reference prefix + check digits when they appear following a word boundary (this includes '*') --- models/payment.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/payment.py b/models/payment.py index 0f4195415..f3cd81245 100644 --- a/models/payment.py +++ b/models/payment.py @@ -462,6 +462,9 @@ def match_payment(self) -> Optional[BankPayment]: ref = self.payee.upper() + # Trim any ISO11649 creditor reference prefix and check digits from the payee + ref = re.sub(r"\bRF[0-9][0-9]", "", ref) + found = re.findall("[%s]{4}[- ]?[%s]{4}" % (safechars, safechars), ref) for f in found: bankref = f.replace("-", "").replace(" ", "")