parsers: Support commas in MBNA numbers

This commit is contained in:
Keenan Tims 2025-04-25 12:46:33 -07:00
parent f43ea80f3b
commit a0d9486075

View File

@ -87,7 +87,7 @@ class RogersBankParser(TransactionParser):
class MBNAParser(TransactionParser):
EXTRACT_RE = re.compile(
r"A purchase of \$(\d+\.\d{2}) from ([^<]+) was made at (\d{1,2}:\d{2} (AM|PM)) UTC on (\d{4}-\d{2}-\d{2})" # noqa: E501
r"A purchase of \$([0-9,]+\.\d{2}) from ([^<]+) was made at (\d{1,2}:\d{2} (AM|PM)) UTC on (\d{4}-\d{2}-\d{2})" # noqa: E501
)
def __init__(self, account_id: UUID):
@ -109,7 +109,7 @@ class MBNAParser(TransactionParser):
matches = self.EXTRACT_RE.search(content)
if matches is None:
raise TransactionParsingFailed("No matches for extraction RE")
amount = Decimal(matches[1])
amount = Decimal(matches[1].replace(",", ""))
payee = matches[2]
date_raw = matches[5]
return Transaction(