Skip to content

Commit

Permalink
✨ (微信公众号美团钱包): 添加数字人民币支付解析规则及测试用例 #493
Browse files Browse the repository at this point in the history
新增对数字人民币支付的解析规则,支持提取支付单号、支付时间、支付金额和支付方式。同时添加了相应的测试用例以验证解析逻辑的正确性。
  • Loading branch information
AnkioTomas committed Dec 18, 2024
1 parent 91def44 commit d319fe9
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/rule/com.tencent.mm/app/微信公众号美团钱包/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ const TITLE = ['支付成功提醒'];

const rules = [
[
//支付单号:24111311100301670001712501694723\n支付时间:2024年11月13日 11:52\n支付金额:18.28元\n支付方式:数字人民币
//支付单号:2412032204388043010906918154 \n支付时间:2024-12-03 22:04:38 \n支付金额:¥79.87 \n支付方式:美团月付
/支付单号:(.*?)\n支付时间:(.*?)\n支付金额:(.*?)元\n支付方式:(.+)$/,
match => {
const [, order, time, money, accountNameFrom] = match;
let t = 0;
let _time = time.trim()
t = formatDate(_time,'Y年M月D日 h:i')
return new RuleObject(
BillType.Expend,
toFloat(money),
'美团',
order,
accountNameFrom,
'',
0.0,
Currency['人民币'],
t,
`微信[${SOURCE_NAME}-消费]`
)
},
],
[
//支付单号:24111311100301670001712501694723\n支付时间:2024年11月13日 11:52\n支付金额:18.28元\n支付方式:数字人民币
//支付单号:2412032204388043010906918154 \n支付时间:2024-12-03 22:04:38 \n支付金额:¥79.87 \n支付方式:美团月付
/支付单号:(.*?) \n支付时间:(.*?) \n支付金额:¥(.*?) \n支付方式:(.+)$/,
match => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@ test('美团钱包消费', () =>
"time": formatDate('2024-12-03 22:04:38', 'Y-M-D h:i:s'),
"channel": '微信[美团钱包-消费]',
},
{
"type": "Expend",
"money": 18.28,
"fee": 0,
"shopName": '美团',
"shopItem": '24111311100301670001712501694723',
"accountNameFrom": '数字人民币',
"accountNameTo": '',
"currency": 'CNY',
"time": formatDate('2024年11月13日 11:52', 'Y年M月D日 h:i'),
"channel": '微信[美团钱包-消费]',
},
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mMap": {
"tableName": "AppMessage",
"description": "支付单号:24111311100301670001712501694723\n支付时间:2024年11月13日 11:52\n支付金额:18.28元\n支付方式:数字人民币",
"source": "美团钱包",
"t": 1731470031661,
"arg": "msgId",
"type": 5,
"appId": "",
"msgId": 100124,
"title": "支付成功提醒"
}
}

0 comments on commit d319fe9

Please sign in to comment.