Skip to content

Commit

Permalink
✨ 农业银行 #179
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkioTomas committed May 27, 2024
1 parent c41dac9 commit e448804
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ const TITLES_BOC = ['交易成功通知'];
// 正则表达式和处理函数的映射关系
const regexMapBOC = new Map([
[
/交易时间:(.*?)\n交易类型:卡号尾号((\d+)),网上支付\n交易金额:([\d,]+.\d{2})元\n可用余额:.*?元\n交易地址:(.*?)-(.*?)$/,
//交易时间:2024-05-27 00:30:49\n交易类型:卡号尾号(5981),退货\n交易金额:1281.56元\n可用余额:67591.21元\n交易地址:财付通退款
/交易时间:(.*?)\n交易类型:卡号尾号((\d+)),(.*?)\n交易金额:([\d,]+.\d{2})元\n可用余额:.*?元\n交易地址:(.*?)$/,
match => {
const [, time, number, money, shopName, shopItem] = match;
const [, time, number, type, money, shopName] = 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:s'), //2024-05-12 17:51
shopItem: shopItem,
shopItem: type,
shopName: shopName,
accountNameFrom: `${SOURCE_NAME_BOC}(${number})`,
Currency: Currency['人民币'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,27 @@ test('农业银行信用卡支出', () =>
type: 0,
money: 1281.56,
fee: 0,
shopName: '财付通,微信支付',
shopItem: '京东商城平台商户',
shopName: '财付通,微信支付-京东商城平台商户',
shopItem: '网上支付',
accountNameFrom: '农业银行信用卡(5981)',
accountNameTo: '',
currency: 'CNY',
time: formatDate('2024-05-26 20:09:20', 'Y-M-D h:i:s'),
channel: '微信[农业银行信用卡-支出]',
},
]));
test('农业银行信用卡退款', () =>
testAnkio('农业银行信用卡退款', [
{
type: 1,
money: 1281.56,
fee: 0,
shopName: '财付通退款',
shopItem: '退货',
accountNameFrom: '农业银行信用卡(5981)',
accountNameTo: '',
currency: 'CNY',
time: formatDate('2024-05-27 00:30:49', 'Y-M-D h:i:s'),
channel: '微信[农业银行信用卡-收入]',
},
]));
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mMap": {
"tableName": "AppMessage",
"description": "交易时间:2024-05-27 00:30:49\n交易类型:卡号尾号(5981),退货\n交易金额:1281.56元\n可用余额:67591.21元\n交易地址:财付通退款",
"source": "农业银行信用卡",
"arg": "msgId",
"type": 5,
"appId": "",
"msgId": 10111361,
"title": "交易成功通知"
}
}

0 comments on commit e448804

Please sign in to comment.