Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle monthly service fee lines #91

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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