Skip to content

Commit

Permalink
🐛 (api): 修复微信支付退款规则 #202
Browse files Browse the repository at this point in the history
修复微信支付退款规则中的正则表达式,使其能够匹配新的退款消息格式。

该修复解决了之前由于消息格式变化导致的误判问题,确保了退款消息能够被正确识别和处理。
  • Loading branch information
AnkioTomas committed Sep 17, 2024
1 parent 9086b06 commit 9336730
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/rule/com.tencent.mm/app/微信支付/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,16 @@ const regexMap =[
},
],
[
/退款金额¥(\d+\.\d{2})\n商品详情商户单号.*?\n商户名称(.*?)\n退款方式退回(.*?)\n到账时间(.*?)$/,
// 退款金额¥166.60\n商品详情美团订单-24052911100400001306304144901069\n商户名称美团\n退款方式退回支付卡(建设银行8254)\n退款原因[2406010080800792069]退交易\n到账时间2024-06-01 20:35:34",
/退款金额¥(\d+\.\d{2})\n商品详情(.*?)\n商户名称(.*?)\n退款方式退回(.*?)\n(退款原因.*?\n)?到账时间(.*?)$/,
match => {
const [, money, shopName, accountNameFrom, time] = match;
const [, money,shopItem, shopName, accountNameFrom,, time] = match;
return {
"money": toFloat(money),
"type": BillType.Income,
"accountNameFrom": accountNameFrom,
"shopName": shopName, //2024-05-25 11:21:52
"shopItem": 'empty',
"shopItem": shopItem,
"time": formatDate(time, 'Y-M-D h:i:s'),
"channel": '微信[微信支付-退款]',
};
Expand Down
14 changes: 13 additions & 1 deletion src/rule/com.tencent.mm/app/微信支付/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,25 @@ test('微信支付退款', () =>
"money": 10.93,
"fee": 0,
"shopName": '拼多多平台商户',
"shopItem": '',
"shopItem": '商户单号XP1124052116500189874886000731',
"accountNameFrom": '零钱',
"accountNameTo": '',
"currency": 'CNY',
"time": formatDate('2024-05-25 11:21:52', 'Y-M-D h:i:s'),
"channel": '微信[微信支付-退款]',
},
{
"type": "Income",
"money": 166.6,
"fee": 0,
"shopName": '美团',
"shopItem": '美团订单-24052911100400001306304144901069',
"accountNameFrom": '支付卡(建设银行8254)',
"accountNameTo": '',
"currency": 'CNY',
"time": formatDate('2024-06-01 20:35:34', 'Y-M-D h:i:s'),
"channel": '微信[微信支付-退款]',
},
]));
test('微信支付亲属卡扣款', () =>
testAnkio('微信支付亲属卡扣款', [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"mMap": {
"description": "退款金额¥166.60\n商品详情美团订单-24052911100400001306304144901069\n商户名称美团\n退款方式退回支付卡(建设银行8254)\n退款原因[2406010080800792069]退交易\n到账时间2024-06-01 20:35:34",
"source": "微信支付",
"type": 5,
"appId": "",
"msgId": 99064,
"title": "退款到账通知",
"display_name": "",
"cachedPayTools": "工商银行储蓄卡(4508)",
"cachedPayMoney": "¥19.90",
"cachedPayShop": "付款给迷失(**会)"
}
}
12 changes: 6 additions & 6 deletions src/rule/tests.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"mMap": {
"description": "收款金额¥1500.00\n收款店铺jyf\n顾客信息新顾客消费\n备注收款成功,已存入经营账户",
"description": "退款金额¥166.60\n商品详情美团订单-24052911100400001306304144901069\n商户名称美团\n退款方式退回支付卡(建设银行8254)\n退款原因[2406010080800792069]退交易\n到账时间2024-06-01 20:35:34",
"source": "微信支付",
"type": 5,
"appId": "",
"msgId": 99064,
"title": "微信支付收款1500.00元(新顾客消费)",
"display_name": "经营收款",
"cachedPayTools": "零钱",
"cachedPayMoney": "¥570.00",
"cachedPayShop": "向李丽丝(**丝)转账"
"title": "退款到账通知",
"display_name": "",
"cachedPayTools": "工商银行储蓄卡(4508)",
"cachedPayMoney": "¥19.90",
"cachedPayShop": "付款给迷失(**会)"
}
}

0 comments on commit 9336730

Please sign in to comment.