Skip to content

feat(config): add per-provider card_last4 filter - #3

Open
felinae98 wants to merge 1 commit into
Xm798:masterfrom
felinae98:feat/provider-card-filter
Open

felinae98 wants to merge 1 commit into
Xm798:masterfrom
felinae98:feat/provider-card-filter

Conversation

@felinae98

Copy link
Copy Markdown

背景

按卡管理的银行每张卡单独导出流水,但同一 provider 下可能配置了多张卡。对账时其他卡的账本条目会被算进 Extra,卡间转账只要一侧流水有记录,另一侧的腿也会被豁免,导致结果不准确。

改动

新增 providers.<id>.card_filter.include / .exclude,在解析之后、范围推断 / hooks / 匹配之前按 card_last4 丢弃账单行:

  • include 是白名单(没有卡号的行也会被丢弃)
  • exclude 是黑名单(没有卡号的行保留)
  • 两者同时配置时 exclude 优先
  • 被过滤的行不产生 Missing / pending,不参与匹配与 Extra 判定
  • context.parsed 仍保留未过滤的解析结果
providers:
  abc_credit:
    accounts:
      "1111": Liabilities:CreditCard:ABC
    card_filter:
      include: ["1111"]

测试

  • 新增 API 测试 104 行、配置测试 28 行
  • uv run pytest tests/:811 passed
  • uv run ruff check . 通过

Allow providers.<id>.card_filter.include/exclude to drop statement rows by
card_last4 before date-range inference, hooks and matching. Filtered rows
produce no pending entries, do not constrain matching and do not reach
Extra; include is a whitelist (rows without card_last4 are dropped), exclude
a blacklist (they are kept), and exclude wins when both are set.
context.parsed keeps the unfiltered parse.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant