parsers: support comma-grouped amounts in BMO parser

This commit is contained in:
Keenan Tims 2025-04-25 12:40:17 -07:00
parent 1bbd3302e4
commit 6565bdd94d

View File

@ -124,7 +124,7 @@ class MBNAParser(TransactionParser):
class BMOParser(TransactionParser):
EXTRACT_RE = re.compile(
r"We want to let you know that a (withdrawal|deposit) of\s+\$(\d+\.\d{2})\s+has been made (?:to|from) your account ending\s+in\s+(\d{3})", # noqa: E501
r"We want to let you know that a (withdrawal|deposit) of\s+\$([0-9,]+\.\d{2})\s+has been made (?:to|from) your account ending\s+in\s+(\d{3})", # noqa: E501
flags=re.MULTILINE,
)
@ -146,7 +146,7 @@ class BMOParser(TransactionParser):
if matches is None:
raise TransactionParsingFailed("No matches for extraction RE")
amount = Decimal(matches[2])
amount = Decimal(matches[2].replace(",", ""))
if matches[1] == "withdrawal":
amount = amount * -1
date_raw = msg["Date"]