Skip to content

Commit

Permalink
✨ (微信公众号平安银行): 添加平安银行消费交易提醒测试用例及正则表达式优化 #460
Browse files Browse the repository at this point in the history
新增平安银行消费交易提醒的测试用例,并优化正则表达式以处理交易类型中的括号问题。
  • Loading branch information
AnkioTomas committed Dec 18, 2024
1 parent edf59d0 commit a956588
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const TITLE = ['交易提醒'];
const rules = [
[
//账号:尾号6274的账户\n交易时间:2024年05月23日09:14\n交易类型:财付通快捷支付(微信红包-微信红包)\n交易币种:人民币\n交易金额:0.01
/账号:尾号(\d+)的账户\n交易时间:(.*?)\n交易类型:(.*?)\((.*?)\)\n交易币种:(.*?)\n交易金额:([\d,]+.\d{2})$/,
// 账号:尾号8888的账户\n交易时间:2024年10月23日14:07\n交易类型:支付宝快捷支付(中国电信股份有限公司-商...\n交易币种:人民币\n交易金额:28.73
/账号:尾号(\d+)的账户\n交易时间:(.*?)\n交易类型:(.*?)\((.*?)\n交易币种:(.*?)\n交易金额:([\d,]+.\d{2})$/,
match => {
const [, number, time, type, shopItem, currency, money] = match;
let billType = BillType.Income;
Expand All @@ -21,7 +22,7 @@ const rules = [
billType,
toFloat(money),
type,
shopItem,
shopItem.replace(/\)$/, ""),
`${SOURCE}(${number})`,
'',
0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ test('平安银行消费', () =>
"time": formatDate('6月14日 16:33', 'M月D日 h:i'),
"channel": '微信[平安银行-消费]',
},
{
"type": "Expend",
"money":28.73,
"fee": 0,
"shopName": '支付宝快捷支付',
"shopItem": '中国电信股份有限公司-商...',
"accountNameFrom": '平安银行(8888)',
"accountNameTo": '',
"currency": 'CNY',
"time": formatDate('2024年10月23日14:07', 'Y年M月D日h:i'),
"channel": '微信[平安银行-消费]',
},
]));

test('平安银行收入', () =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mMap": {
"tableName": "AppMessage",
"description": "账号:尾号8888的账户\n交易时间:2024年10月23日14:07\n交易类型:支付宝快捷支付(中国电信股份有限公司-商...\n交易币种:人民币\n交易金额:28.73",
"source": "平安银行",
"t": 1729663988778,
"arg": "msgId",
"type": 5,
"appId": "",
"msgId": 10128203,
"title": "交易提醒"
}
}

0 comments on commit a956588

Please sign in to comment.