Skip to content

Commit

Permalink
✨ 工商银行信用卡 #180
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkioTomas committed May 27, 2024
1 parent 9ee8743 commit c41dac9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@ const TITLES_BOC = ['动账交易提醒'];
// 正则表达式和处理函数的映射关系
const regexMapBOC = new Map([
[
/账号类型:尾号(\d+)的信用卡\n交易时间:(.*?)\n交易类型:(.*?)-(.*?)\n交易金额:出账 ([\d,]+.\d{2}) (.*?)元\n账户余额:登录工行手机银行查看详细信息/,
//账号类型:尾号0849的信用卡\n交易时间:2024年5月27日00:30\n交易类型:退款财付通-京东商城平台商户\n交易金额:入账 1,281.56 人民币元\n账户余额:登录工行手机银行查看详细信息
/账号类型:尾号(\d+)的信用卡\n交易时间:(.*?)\n交易类型:(.*?)-(.*?)\n交易金额:(出账|入账) ([\d,]+.\d{2}) (.*?)元\n账户余额:登录工行手机银行查看详细信息/,
match => {
const [, number, time, shopName, shopItem, money, currency] = match;
const [, number, time, shopName, shopItem, type, money, currency] = match;

let billType = BillType.Expend;
let channel = ``;
if (type.includes('入账')) {
billType = BillType.Income;
channel = `收入`;
} else if (type.includes('出账')) {
billType = BillType.Expend;
channel = `支出`;
}

return {
money: toFloat(money),
type: BillType.Expend,
type: billType,
time: formatDate(time, 'Y年M月D日h:i'), //2024年5月26日20:12
shopItem: shopItem,
shopName: shopName,
accountNameFrom: `中国工商银行信用卡(${number})`,
Currency: Currency[currency],
channel: `微信[中国工商银行信用卡-支出]`,
channel: `微信[中国工商银行信用卡-${channel}]`,
};
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ test('工商银行信用卡支出', () =>
channel: '微信[中国工商银行信用卡-支出]',
},
]));
test('工商银行信用卡退款', () =>
testAnkio('工商银行信用卡退款', [
{
type: 1,
money: 1281.56,
fee: 0,
shopName: '退款财付通',
shopItem: '京东商城平台商户',
accountNameFrom: '中国工商银行信用卡(0849)',
accountNameTo: '',
currency: 'CNY',
time: formatDate('2024年5月27日00:30', 'Y年M月D日h:i'),
channel: '微信[中国工商银行信用卡-收入]',
},
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mMap": {
"tableName": "AppMessage",
"description": "账号类型:尾号0849的信用卡\n交易时间:2024年5月27日00:30\n交易类型:退款财付通-京东商城平台商户\n交易金额:入账 1,281.56 人民币元\n账户余额:登录工行手机银行查看详细信息",
"source": "中国工商银行客户服务",
"arg": "msgId",
"type": 5,
"appId": "",
"msgId": 10111358,
"title": "动账交易提醒"
}
}

0 comments on commit c41dac9

Please sign in to comment.