Skip to content

Commit

Permalink
✨ (api): 宁波银行消费账单解析测试 #265
Browse files Browse the repository at this point in the history
添加了宁波银行消费账单的测试用例,并更新了规则以识别消费交易类型。

This commit adds a test case for Ningbo Bank's consumption bills and updates the rules to identify consumption transactions.
  • Loading branch information
AnkioTomas committed Sep 19, 2024
1 parent c551901 commit 9d12baf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ const TITLES_BOC = ['交易提醒'];
const regexMapBOC = [
[
//交易类型:尾号2582-工资-人民币\n交易时间:09月15日 17:00\n交易对象:大夏公司\n交易金额:1696.49\n可用余额:428.97
//交易类型:尾号2582-网络支付消费-人民币\n交易时间:09月16日 10:29\n交易对象:拼多多平台商户\n交易金额:58.75\n可用余额:370.22
/交易类型:尾号(\d{4})-(.*?)-人民币\n交易时间:(.*?)\n交易对象:(.*?)\n交易金额:([\d,]+.\d{2})\n可用余额:([\d,]+.\d{2})$/,
match => {
let [,number,shopItem,time,shopName,money,] = match

let billType = BillType.Income;
if (shopItem.indexOf("消费") !==-1 || shopItem.indexOf("支付")!==-1){
billType = BillType.Expend;
}

return {
"money": toFloat(money),
"type": BillType.Income,
"type": billType,
"time": formatDate(time,"M月D日 h:i"),
"shopItem": shopItem,
"shopName":shopName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ test('宁波银行收入', () =>
"channel": '微信[宁波银行-收入]',
},
]));
test('宁波银行消费', () =>
testAnkio('宁波银行消费', [
{
"type": "Expend",
"money": 58.75,
"fee": 0,
"shopName": '拼多多平台商户',
"shopItem": '网络支付消费',
"accountNameFrom": '宁波银行(2582)',
"accountNameTo": '',
"currency": 'CNY',
"time": formatDate('09月16日 10:29', 'M月D日 h:i'),
"channel": '微信[宁波银行-收入]',
},
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mMap":{"tableName":"AppMessage","description":"交易类型:尾号2582-网络支付消费-人民币\n交易时间:09月16日 10:29\n交易对象:拼多多平台商户\n交易金额:58.75\n可用余额:370.22","source":"宁波银行","arg":"msgId","type":5,"appId":"","msgId":553603,"title":"交易提醒"}}

0 comments on commit 9d12baf

Please sign in to comment.