Skip to content

Commit

Permalink
✨ (rule): 添加网商银行余利宝收益处理规则及测试用例 #487
Browse files Browse the repository at this point in the history
新增对网商银行余利宝收益通知的处理规则,扩展了匹配标题数组,并添加了相应的正则表达式和处理函数。同时,新增了测试文件和测试用例以验证新规则的正确性。
  • Loading branch information
AnkioTomas committed Dec 18, 2024
1 parent 5dd4aea commit 605eda3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/rule/com.tencent.mm/app/微信公众号网商银行/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BillType, Currency, formatDate, parseWechat, RuleObject, toFloat } from

// 定义源名称和需要匹配的标题数组
const SOURCE = '网商银行';
const TITLE = ['交易提醒'];
const TITLE = ['交易提醒','账户动账通知'];

// 正则表达式和处理函数的映射关系
const rules = [
Expand All @@ -24,6 +24,24 @@ const rules = [
`微信[${SOURCE}-消费]`)
}
],
[
// 交易时间:11-11\n交易用途:理财收益提醒\n交易金额:+1022元\n交易类型:余利宝昨日收益到账
/交易时间:(.*?)\n交易用途:(.*?)\n交易金额:\+(.*?)元\n交易类型:余利宝昨日收益到账/,
(match,t) => {
const [, time, shopItem, money] = match;
return new RuleObject(
BillType.Income,
toFloat(money),
'余利宝昨日收益到账',
shopItem,
SOURCE,
'',
0.0,
Currency['人民币'],
t,
`微信[${SOURCE}-收益]`)
}
],
];


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,20 @@ test('网商银行消费', () =>
},

]));

test('网商银行余利宝收益', () =>
testAnkio('网商银行余利宝收益', [
{
"type": "Income",
"money": 1022,
"fee": 0,
"shopName": '余利宝昨日收益到账',
"shopItem": '理财收益提醒',
"accountNameFrom": '网商银行',
"accountNameTo": '',
"currency": 'CNY',
"time": 1731378714282,
"channel": '微信[网商银行-收益]',
},

]));
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mMap": {
"tableName": "AppMessage",
"description": "交易时间:11-11\n交易用途:理财收益提醒\n交易金额:+1022元\n交易类型:余利宝昨日收益到账",
"source": "网商银行",
"t": 1731378714282,
"arg": "msgId",
"type": 5,
"appId": "",
"msgId": 139299,
"title": "账户动账通知"
}
}

0 comments on commit 605eda3

Please sign in to comment.