parsers: credit card transactions are negative amounts

This commit is contained in:
Keenan Tims 2025-04-25 21:38:51 -07:00
parent 595c763932
commit 0009d98791

View File

@ -71,7 +71,7 @@ class RogersBankParser(TransactionParser):
matches = self.EXTRACT_RE.search(content) matches = self.EXTRACT_RE.search(content)
if matches is None: if matches is None:
raise TransactionParsingFailed("No matches for extraction RE") raise TransactionParsingFailed("No matches for extraction RE")
amount = Decimal(matches[1].replace(",", "")) amount = Decimal(matches[1].replace(",", "")) * -1
date_raw = matches[2] date_raw = matches[2]
payee = matches[3] payee = matches[3]
date = datetime.strptime(date_raw, "%b %d, %Y").date() date = datetime.strptime(date_raw, "%b %d, %Y").date()
@ -109,7 +109,7 @@ class MBNAParser(TransactionParser):
matches = self.EXTRACT_RE.search(content) matches = self.EXTRACT_RE.search(content)
if matches is None: if matches is None:
raise TransactionParsingFailed("No matches for extraction RE") raise TransactionParsingFailed("No matches for extraction RE")
amount = Decimal(matches[1].replace(",", "")) amount = Decimal(matches[1].replace(",", "")) * -1
payee = matches[2] payee = matches[2]
date_raw = matches[5] date_raw = matches[5]
return Transaction( return Transaction(