Skip to content

Commit

Permalink
✨ (rule): 添加微信支付扫码支付测试用例和正则表达式优化 #602
Browse files Browse the repository at this point in the history
新增面对面红包支付测试用例,并优化正则表达式以支持多种支付描述格式。
  • Loading branch information
AnkioTomas committed Dec 18, 2024
1 parent 3b84283 commit bf59617
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rule/com.tencent.mm/app/微信支付扫码支付/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ const TITLE_WECHAT = [
// 正则表达式和处理函数的映射关系
const rules =[
[
/付款金额¥(\d+\.\d{2})\n付款方式(.*?)\n收单机构.*/,
//支付金额¥29.00\n支付方式零钱\n收单机构财付通支付科技有限公司
/(付款|支付)金额¥(\d+\.\d{2})\n(付款|支付)方式(.*?)\n收单机构.*/,
(match,t,item) => {
let [, money, accountNameFrom] = match;
let [,, money, ,accountNameFrom] = match;
return new RuleObject(
BillType.Expend,
toFloat(money),
Expand Down
12 changes: 12 additions & 0 deletions src/rule/com.tencent.mm/app/微信支付扫码支付/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,16 @@ test('微信支付扫码付款', () =>
"time": 1731045490128,
"channel": '微信[微信支付-付款]',
},
{
"type": "Expend",
"money": 29,
"fee": 0,
"shopName": '十六楼工作室',
"shopItem": '面对面红包',
"accountNameFrom": '零钱',
"accountNameTo": '',
"currency": 'CNY',
"time": 1734092827912,
"channel": '微信[微信支付-付款]',
},
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"mMap": {
"description": "支付金额¥29.00\n支付方式零钱\n收单机构财付通支付科技有限公司",
"source": "微信支付",
"type": 5,
"appId": "",
"msgId": 99064,
"title": "微信支付凭证",
"display_name": "十六楼工作室",
"hookerUser": "静谧阳光",
"cachedPayTools": "零钱",
"cachedPayMoney": "¥29.00",
"cachedPayShop": "面对面红包",
"t": 1734092827912
}
}

0 comments on commit bf59617

Please sign in to comment.