parsers: Support commas in MBNA numbers
This commit is contained in:
parent
f43ea80f3b
commit
a0d9486075
@ -87,7 +87,7 @@ class RogersBankParser(TransactionParser):
|
|||||||
|
|
||||||
class MBNAParser(TransactionParser):
|
class MBNAParser(TransactionParser):
|
||||||
EXTRACT_RE = re.compile(
|
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):
|
def __init__(self, account_id: UUID):
|
||||||
@ -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])
|
amount = Decimal(matches[1].replace(",", ""))
|
||||||
payee = matches[2]
|
payee = matches[2]
|
||||||
date_raw = matches[5]
|
date_raw = matches[5]
|
||||||
return Transaction(
|
return Transaction(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user