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

Support Same-Day ACH transactions in checking #140

Merged
merged 1 commit into from
Jun 27, 2024
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: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ ignored-argument-names=_.*
max-locals=30

# Maximum number of return / yield for function / method body
max-returns=6
max-returns=100

# Maximum number of branch for function / method body
max-branches=12
Expand Down
6 changes: 6 additions & 0 deletions beancount_chase/checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def _extract_transaction_from_row(self, row, metadata):
_OUTBOUND_TRANSFER_PATTERN = re.compile(
r'Online Transfer \d+ to (.+?)\s*transaction #', re.IGNORECASE)

_SAME_DAY_ACH_PAYMENT_PATTERN = re.compile(
r'^Same-Day ACH Payment \d+ to ([A-Za-z]+) \(_#+\d+\)$', re.IGNORECASE)

_INBOUND_TRANSFER_PATTERN = re.compile(
r'Online Transfer \d+ from (.+?)\s*transaction #', re.IGNORECASE)

Expand All @@ -143,6 +146,9 @@ def _parse_description(description):
if match:
return match.group(1), match.group(2)
match = _OUTBOUND_TRANSFER_PATTERN.search(description)
if match:
return match.group(1), description
match = _SAME_DAY_ACH_PAYMENT_PATTERN.search(description)
if match:
return match.group(1), description
match = _INBOUND_TRANSFER_PATTERN.search(description)
Expand Down
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_same_day_ach_transaction(tmp_path):
chase_file = tmp_path / 'Chase1234_Activity_20211019.CSV'
chase_file.write_text(
_unindent("""
Details,Posting Date,Description,Amount,Type,Balance,Check or Slip #
DEBIT,05/24/2024,"Same-Day ACH Payment 12232800456 to JoeExample (_######9587)",-87.50,ACH_PAYMENT,6788.52,,
"""))

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

assert _unindent("""
2024-05-24 * "JoeExample" "Same-Day ACH Payment 12232800456 to JoeExample (_######9587)"
Assets:Checking:Chase -87.50 USD
""".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(
Expand Down