Skip to content

Commit

Permalink
dev: add an edge case for jd provider
Browse files Browse the repository at this point in the history
  • Loading branch information
CNLHC committed Apr 17, 2024
1 parent 9dcd290 commit 5290119
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
12 changes: 12 additions & 0 deletions example/jd/example-jd-output.beancount
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,15 @@ option "operating_currency" "CNY"
Assets:EPay:JD 0.01 CNY
Income:PnL:JD -0.01 CNY

2023-12-08 * "京东云余额充值预付款网银账户" "PLUS京典年卡(先享后付)"
category: "其他"
merchantId: "700000000000000"
method: "京东白条"
orderId: "700000000000008"
payTime: "2023-12-08 00:14:40 +0800 CST"
source: "京东云余额充值预付款网银账户"
status: "交易成功"
type: "支出"
Expenses:FIXME 99.00 CNY
Liabilities:Baitiao -99.00 CNY

12 changes: 12 additions & 0 deletions example/jd/example-jd-output.ledger
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,15 @@
Assets:EPay:JD 0.01 CNY
Income:PnL:JD - 0.01 CNY

2023/12/08 * 京东云余额充值预付款网银账户 - PLUS京典年卡(先享后付)
; category: "其他"
; merchantId: "700000000000000"
; method: "京东白条"
; orderId: "700000000000008"
; payTime: "2023-12-08 00:14:40 +0800 CST"
; source: "京东云余额充值预付款网银账户"
; status: "交易成功"
; type: "支出"
Expenses:FIXME 99.00 CNY
Liabilities:Baitiao - 99.00 CNY

3 changes: 3 additions & 0 deletions example/jd/example-jd-records.csv
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

电子回单客户
交易时间,交易分类,商户名称,交易说明,收/支,金额,收/付款方式,交易状态,交易订单号,商家订单号,备注
2023-12-08 00:15:08 ,其他,京东云余额充值预付款网银账户,解冻-PLUS京典年卡(先享后付),不计收支,0.00,京东白条,交易成功,700000000000000_1 ,700000000000000_1 ,
2023-12-08 00:14:40 ,其他,京东云余额充值预付款网银账户,PLUS京典年卡(先享后付),支出,99.00,京东白条,交易成功,700000000000008 ,700000000000000 ,
2022-12-04 23:29:31 ,其他,null,冻结-PLUS京典年卡(先享后付),不计收支,99.00,京东白条,交易成功,700000000000007 ,700000000000007 ,
2021-12-29 06:37:20 ,小金库,京东小金库,京东小金库收益,收入,0.01,小金库零用钱,交易成功,20000000000000000022 ,20000000000000000002 ,
2021-12-28 12:14:38 ,小金库,京东小金库,京东小金库收益,收入,0.01,小金库零用钱,交易成功,20000000000000000002 ,29999999999999999992 ,
2021-12-23 12:04:37 ,食品酒饮,京东平台商户,Members Mark 泰国进口 椰子水 1L*6支 椰子汁饮料,支出,91.42,京东白条,交易成功,234906303557 ,110000000000000000000044 ,
Expand Down
5 changes: 3 additions & 2 deletions pkg/analyser/jd/jd.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ func (a JD) GetAccountsAndTags(o *ir.Order, cfg *config.Config, target, provider
}
}

if strings.HasPrefix(o.Item, "退款-") && ir.TypeRecv != o.Type {
return ignore, resPlus, resMinus, extraAccounts, tags
if o.TypeOriginal == "不计收支" && (strings.HasPrefix(o.Item, "冻结-") ||
strings.HasPrefix(o.Item, "解冻-")) {
ignore = true
}
return ignore, resMinus, resPlus, extraAccounts, tags
}

0 comments on commit 5290119

Please sign in to comment.