Skip to content

Commit

Permalink
✨ (rule): 新增招商银行信用卡自动还款失败处理逻辑 #627
Browse files Browse the repository at this point in the history
新增了招商银行信用卡自动还款失败的通知处理逻辑,包括测试用例和规则匹配。更新了 `main.js` 中的标题列表,并添加了新的正则表达式规则以解析还款失败信息。同时,新增了 `招商银行信用卡自动还款失败.txt` 测试文件以验证功能。
  • Loading branch information
AnkioTomas committed Dec 27, 2024
1 parent c470a5e commit ac1bfcf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BillType, formatDate, parseWechat, RuleObject, transferCurrency } from 'common/index.js';

const SOURCE_NAME = '招商银行信用卡';
const TITLE = ['交易成功提醒', '自动还款到账提醒','还款提醒'];
const TITLE = ['交易成功提醒', '自动还款到账提醒', '还款提醒', '自动还款失败通知'];

// 定义正则表达式,用于匹配交易时间、交易类型、交易金额、交易商户和可用额度
const rules = [
Expand Down Expand Up @@ -80,6 +80,25 @@ const rules = [
)
},
],
[
// 还款账户:个人消费卡账户\n应扣金额:人民币61597.12元\n还款金额:人民币13905.14元\n失败原因:关联活期账户余额不足,未足额扣款\n还款方式:预约还款失败,剩余欠款请自行还款至信用卡
/还款账户:个人消费卡账户\n应扣金额:(.*?)(\d+\.\d{2})元\n还款金额:(.*?)(\d+\.\d{2})元\n失败原因:(.*?)\n还款方式:(.*?)$/,
(match, t) => {
const [, currency1, money1, currency2, money2, reason, method] = match;
return new RuleObject(
BillType.Transfer,
parseFloat(money2),
'',
reason,
'',
SOURCE_NAME,
0.0,
transferCurrency(currency2),
t,
`微信[${SOURCE_NAME}-自动还款失败]`
)
},
],
];


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,19 @@ test('招商银行信用卡退货', () =>
"channel": '微信[招商银行信用卡-退货]',
},
]));

test('招商银行信用卡自动还款失败', () =>
testAnkio('招商银行信用卡自动还款失败', [
{
'type': 'Transfer',
'money': 13905.14,
'shopName': '',
'shopItem': '关联活期账户余额不足,未足额扣款',
'accountNameTo': '招商银行信用卡',
'accountNameFrom': '',
'fee': 0,
'currency': 'CNY',
'time': 1734931086159,
'channel': '微信[招商银行信用卡-自动还款失败]'
}
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mMap":{"tableName":"AppMessage","description":"还款账户:个人消费卡账户\n应扣金额:人民币61597.12元\n还款金额:人民币13905.14元\n失败原因:关联活期账户余额不足,未足额扣款\n还款方式:预约还款失败,剩余欠款请自行还款至信用卡","source":"招商银行信用卡","t":1734931086159,"arg":"msgId","type":5,"appId":"","msgId":148596,"title":"自动还款失败通知"}}

0 comments on commit ac1bfcf

Please sign in to comment.