Skip to content

Commit

Permalink
✨ (短信招商银行): 新增银联卡转入规则及测试用例
Browse files Browse the repository at this point in the history
新增招商银行短信解析规则,支持解析银联卡转入的短信格式,并添加相应的测试用例以确保功能正确性。
  • Loading branch information
AnkioTomas committed Dec 27, 2024
1 parent e4a79bf commit 8907a97
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/rule/com.android.phone/app/短信招商银行/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ const rules = [
obj.accountNameTo = `招商银行信用卡(${toNumber})`;
return obj;
}
] , //您账户1999于11月12日15:04银联入账人民币0.09元,余额238.06元(微信零钱提现/微信零钱提现)
],
[
//您账户1999于11月12日15:04银联入账人民币0.09元,余额238.06元(微信零钱提现/微信零钱提现)
/您账户(\d{4})于(\d+月\d+日\d+:\d+)(.*?)人民币([\d,]+.\d{2})元,余额(.*?)元((.*?))/,
match => {
let [, fromNumber, date, shopItem, money, total,shopName] = match;
let [, fromNumber, date, shopItem, money, total, shopName] = match;

let obj = new RuleObject();

Expand All @@ -60,6 +60,25 @@ const rules = [
obj.accountNameFrom = `招商银行(${fromNumber})`;
return obj;
}
],
[
//【招商银行】您账户“银行卡尾号4位数字”于12月27日发生的银联卡转入已到账,人民币“金额”,转出方尾号“转出方尾号4位数字”
/您账户(\d{4})于(\d+月\d+日)发生的银联卡转入已到账,人民币([\d,]+.\d{2}),转出方尾号(\d{4})$/,
match => {
let [, number, date, money, fromNumber] = match;

let obj = new RuleObject();

obj.money = toFloat(money);
obj.channel = `招商银行[转入]`;
obj.currency = 'CNY';
obj.shopItem = '银联卡转入';
obj.time = formatDate(date, 'M月D日');

obj.type = BillType.Income;
obj.accountNameFrom = `招商银行(${number})`;
return obj;
}
]
];

Expand Down
13 changes: 13 additions & 0 deletions src/rule/com.android.phone/app/短信招商银行/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,17 @@ test('招商银行收入', () =>
"time": formatDate("11月12日15:04", "M月D日h:i"),
"channel": '招商银行[入账]',
},
{
'type': 'Income',
'money': 0.01,
'fee': 0,
'shopName': '',
'shopItem': '银联卡转入',
'accountNameFrom': '招商银行(1234)',
'accountNameTo': '',
'currency': 'CNY',
'time': formatDate('12月27日', 'M月D日'),
'channel': '招商银行[转入]'
}
]));

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sender":"10693495555","body":"【招商银行】您账户1234于12月27日发生的银联卡转入已到账,人民币0.01,转出方尾号1234","t":1735289617829}

0 comments on commit 8907a97

Please sign in to comment.