deb-sig / double-entry-generator

Rule-based double-entry bookkeeping importer (from Alipay/WeChat/Huobi etc. to Beancount/Ledger).
https://github.com/deb-sig/double-entry-generator
Apache License 2.0
537 stars 79 forks source link

[feat] Add provider support for TD #105

Closed ramsayleung closed 1 year ago

ramsayleung commented 1 year ago

Description

double-entry-generator 增加对海外银行 TD 的账单支持

About TD

Toronto-Dominion Bank, 简称 TD, 是加拿大第二大的银行, 在加拿大本土和美国都有相关的业务, 更多信息详见 wikipedia

Transaction Statement

TD的账单相当简洁 (简陋), 只有5个字段:

Date Transaction Description Withdrawals Deposits Balance
05/01/2023 DOLLARAMA # 845 _M 1.96 13.04
05/01/2023 T T SUPERMARKET _M 12.10 15.00
05/01/2023 PTS TO: 02816700587 10.00 27.10
05/01/2023 SFCA MSP 0.01 37.10
05/01/2023 ICBC AGENT #942 35.00 37.11
  1. 只有支付日期,没有支付具体时间
  2. 没有交易对手(Peer) 和 商品(Item)字段, 都合并在 Transaction Description, 因此将 Transaction Description 当作 Item 字段, Peer 字段为 TD
  3. 如果 Withdrawals/Deposits 字段不为空,即属于 Withdrawals/Deposits 该类型的交易.

改动点

  1. 增加 example/td: 增加 td 相关示例
  2. 增加 provider/td: provider增加对 td
  3. 增加 analyser/td: analyser 增加对 td的 支持.
  4. ISSUE/PR template: 这个混杂了 #104 的内容, 需要等这个PR先合并.

Motivation and Context

101

Dependencies

None

Type of change

Please delete options that are not relevant.

How has this been tested?

生成 beancount 账单

bin/double-entry-generator translate \
  --provider td \
  --config ./example/td/config.yaml \
  --output ./example/td/example-td-output.beancount \
  ./example/td/example-td-records.csv

语法正确, 生成结果符合账单描述

生成 ledger 账单

bin/double-entry-generator translate \
  --target ledger \
  --provider td \
  --config ./example/td/config.yaml \
  --output ./example/td/example-td-output.ledger \
  ./example/td/example-td-records.csv

语法正确, 生成结果符合账单描述

Is this change properly documented?

Please make sure you've properly documented the changes you're making.

Don't forget to add an entry to the CHANGELOG if necessary (new features, breaking changes, relevant internal improvements).

Yes, we need to update the README.

TODO:

  1. 后面再提额外的PR增加end-to-end 测试与更新 README 文档, 避免单个PR 内容过多(现在已经很多了).\
  2. 待 #104 合并之后再将这个PR 从Draft 修改成 PR.
Triple-Z commented 1 year ago

Thanks for your contribution!

gaocegege commented 1 year ago

Thanks for your contribution! :tada: :+1: