Skip to content

Commit

Permalink
Gracefully handle monthly service fee lines (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch authored Sep 6, 2023
1 parent 32e2d60 commit 8a77aff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions beancount_chase/checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,6 @@ def _parse_description(description):
match = _INBOUND_TRANSFER_PATTERN.search(description)
if match:
return match.group(1), description
if description == 'MONTHLY SERVICE FEE':
return description, description
return None, None
18 changes: 18 additions & 0 deletions beancount_chase/checking_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ def test_extracts_outbound_transfer(tmp_path):
""".rstrip()) == _stringify_directives(directives).strip()


def test_extracts_monthly_account_fee(tmp_path):
chase_file = tmp_path / 'Chase1234_Activity_20230919.CSV'
chase_file.write_text(
_unindent("""
Details,Posting Date,Description,Amount,Type,Balance,Check or Slip #
DEBIT,08/31/2023,"MONTHLY SERVICE FEE",-15.00,FEE_TRANSACTION,2118.39,,
"""))

with chase_file.open() as f:
directives = CheckingImporter(account='Assets:Checking:Chase',
lastfour='1234').extract(f)

assert _unindent("""
2023-08-31 * "Monthly Service Fee" "Monthly Service Fee"
Assets:Checking:Chase -15.00 USD
""".rstrip()) == _stringify_directives(directives).strip()


def test_extracts_credit(tmp_path):
chase_file = tmp_path / 'Chase1234_Activity_20211019.CSV'
chase_file.write_text(
Expand Down

0 comments on commit 8a77aff

Please sign in to comment.