From 82991d07397c2e1ff1cbf4fe8866715db69b2e8e Mon Sep 17 00:00:00 2001 From: ankio Date: Wed, 18 Dec 2024 09:51:21 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20(=E6=94=AF=E4=BB=98=E5=AE=9D?= =?UTF-8?q?=E8=BD=AC=E8=B4=A6=E5=88=B0=E9=93=B6=E8=A1=8C=E5=8D=A1):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98=E5=AE=9D=E8=BD=AC=E8=B4=A6?= =?UTF-8?q?=E5=88=B0=E9=93=B6=E8=A1=8C=E5=8D=A1=E5=8A=9F=E8=83=BD=E5=8F=8A?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=B5=8B=E8=AF=95=20=20#455?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增支付宝转账到银行卡的处理逻辑,包括自动转账功能和相关测试用例。更新了 `AliTools` 工具类以支持新的转账场景。 --- .../main.js" | 29 +++++++++++++++++++ .../main.test.js" | 23 +++++++++++++++ ...0\351\223\266\350\241\214\345\215\241.txt" | 10 +++++++ src/utils/AliTools.js | 2 ++ 4 files changed, 64 insertions(+) create mode 100644 "src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.js" create mode 100644 "src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.test.js" create mode 100644 "src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/tests/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241.txt" diff --git "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.js" "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.js" new file mode 100644 index 0000000..36ed495 --- /dev/null +++ "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.js" @@ -0,0 +1,29 @@ +import { AliTools, BillType, RuleObject, toFloat } from 'common/index.js'; + +function autoTransfer(pl,t){ + let obj = new RuleObject(BillType.Transfer); + + obj.channel = `支付宝[转账到银行卡]`; + + let content = JSON.parse(pl.content); + obj.money = toFloat(content.money); + obj.shopName = "转账到银行卡"; + obj.shopItem = pl.title; + obj.time = t; + obj.accountNameFrom = '支付宝余额'; + AliTools.handleContentItems(content.content, obj); + + return obj; + +} + + +export function get(data) { + let json = JSON.parse(data)[0]; + let pl = JSON.parse(json.pl); + let t = json.mct; + if (pl.title.indexOf('转出到账成功') !== -1) { + return autoTransfer(pl, t); + } + return null; +} diff --git "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.test.js" "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.test.js" new file mode 100644 index 0000000..dd39731 --- /dev/null +++ "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/main.test.js" @@ -0,0 +1,23 @@ +const { get } = require('./main'); +const { testAnkio, testAnkioInit } = require('../../../../tests/TestUtils'); + + +testAnkioInit(get, __dirname, 'com.eg.android.AlipayGphone'); + + + +test('支付宝转账到银行卡', () => + testAnkio('支付宝转账到银行卡', [ + { + "type": "Transfer", + "money": 500, + "fee": 0, + "shopName": '转账到银行卡', + "shopItem": '转出到账成功', + "accountNameFrom": '支付宝余额', + "accountNameTo": '中信银行(5792)', + "currency": 'CNY', + "time": 1729359863000, + "channel": '支付宝[转账到银行卡]', + }, + ])); diff --git "a/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/tests/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241.txt" "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/tests/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241.txt" new file mode 100644 index 0000000..522ed6e --- /dev/null +++ "b/src/rule/com.eg.android.AlipayGphone/app/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241/tests/\346\224\257\344\273\230\345\256\235\350\275\254\350\264\246\345\210\260\351\223\266\350\241\214\345\215\241.txt" @@ -0,0 +1,10 @@ +[ +{ +"mk": 241060014423200001, +"st": 1, +"isSc": 0, +"appId": "", +"mct": 1729359863000, +"pl": "{\"templateType\":\"BN\",\"commandType\":\"UPDATE\",\"withPushNfc\":\"Y\",\"expireLink\":\"\",\"msgType\":\"TODO\",\"icon\":\"https://gw.alipayobjects.com/mdn/rms_f96971/afts/img/A*leNcS41oUu0AAAAAAAAAAABkARQnAQ\",\"link\":\"alipays://platformapi/startapp?appId=20000003&actionType=toBillDetails&tradeNO=20241020019130201010290096463581&bizType=YEB?tagid=MB_SEND_PH\",\"businessId\":\"PAY_HELPER_CARD_2088822946736298\",\"msgId\":\"0c7739c58a0c4b2c6a24f51234bfbb7600629\",\"templateCode\":\"00059_00094_zfzs001\",\"templateId\":\"WALLET-BILL@BLPaymentHelper\",\"title\":\"转出到账成功\",\"content\":\"{\\\"status\\\":\\\"转出到账成功\\\",\\\"date\\\":\\\"10月20日\\\",\\\"amountTip\\\":\\\"\\\",\\\"money\\\":\\\"500.00\\\",\\\"unit\\\":\\\"元\\\",\\\"infoTip\\\":\\\"\\\",\\\"failTip\\\":\\\"\\\",\\\"goto\\\":\\\"alipays://platformapi/startapp?appId=20000003&actionType=toBillDetails&tradeNO=20241020019130201010290096463581&bizType=YEB\\\",\\\"content\\\":[{\\\"title\\\":\\\"转入账户:\\\",\\\"content\\\":\\\"中信银行(5792)\\\"}],\\\"ad\\\":[],\\\"actions\\\":[{\\\"name\\\":\\\"\\\",\\\"url\\\":\\\"\\\"},{\\\"name\\\":\\\"查看详情\\\",\\\"url\\\":\\\"alipays://platformapi/startapp?appId=20000003&actionType=toBillDetails&tradeNO=20241020019130201010290096463581&bizType=YEB\\\"}]}\",\"linkName\":\"\",\"bizName\":\"支付助手\",\"msgCategory\":\"bill\",\"scm\":\"27.gotone.card.0c7739c58a0c4b2c6a24f51234bfbb7600629.MB_SEND_PH.null.payment_assist.10090.10099.2019062521000502094325.9991746\",\"assistInfo\":\"{\\\"showInFriendTab\\\":false,\\\"icon\\\":\\\"https://gw.alipayobjects.com/mdn/rms_f96971/afts/img/A*ZapXT6AjvG0AAAAAAAAAAABkARQnAQ\\\",\\\"reminderType\\\":\\\"point\\\",\\\"hiddenMsgHeader\\\":false,\\\"title\\\":\\\"支付助手\\\",\\\"reminderTypeModifyEnable\\\":false,\\\"assistId\\\":\\\"payment_assist\\\",\\\"desc\\\":\\\"支付宝资金变动通知\\\"}\",\"ih\":\"{\\\"extInfo\\\":{},\\\"iid\\\":\\\"105\\\",\\\"ioty\\\":\\\"aor\\\",\\\"itemBasicInfo\\\":{\\\"dn\\\":\\\"服务提醒\\\",\\\"ic\\\":\\\"https://gw.alipayobjects.com/zos/bmw-prod/b96c31e0-64ba-4cbb-9a64-73ff17d701fd.webp\\\",\\\"lk\\\":\\\"alipays://platformapi/startapp?appId=20000235&source=friendTab\\\"},\\\"itemUserRelation\\\":{\\\"ilf\\\":\\\"N\\\",\\\"uc\\\":{\\\"top\\\":\\\"0\\\"},\\\"version\\\":0},\\\"ity\\\":\\\"105\\\",\\\"moty\\\":\\\"u\\\",\\\"msgInfo\\\":{\\\"bm\\\":\\\"转出到账成功¥500.00 \\\",\\\"cmid\\\":\\\"0c7739c58a0c4b2c6a24f51234bfbb7600629\\\",\\\"lmt\\\":1729359863036,\\\"msrid\\\":\\\"00059_00094_zfzs001\\\",\\\"ncs\\\":\\\"N\\\",\\\"rps\\\":\\\"num\\\",\\\"sam\\\":\\\"Y\\\",\\\"ssrid\\\":\\\"PAY_HELPER_CARD_2088822946736298\\\",\\\"urn\\\":1}}\",\"bizMonitor\":\"{\\\"serviceCode\\\":\\\"MB_SEND_PH\\\",\\\"bizName\\\":\\\"\\\",\\\"createTime\\\":1729359863118,\\\"businessId\\\":\\\"PAY_HELPER_CARD_2088822946736298\\\",\\\"messageId\\\":\\\"0c7739c58a0c4b2c6a24f51234bfbb7600629\\\",\\\"messageTitle\\\":\\\"转出到账成功\\\",\\\"pid\\\":\\\"2088822946736298\\\",\\\"templateId\\\":\\\"WALLET-BILL@BLPaymentHelper\\\",\\\"status\\\":\\\"\\\"}\",\"languageType\":\"zh-Hans\",\"subscribeConfig\":\"0\",\"gmtCreate\":1729359863036,\"gmtValid\":2040399863024,\"operate\":\"SEND\",\"templateName\":\"支付助手\",\"homePageTitle\":\"转出到账成功¥500.00 \",\"status\":\"\",\"extraInfo\":\"{\\\"topSubContent\\\":\\\"转出到账成功\\\",\\\"preValue\\\":\\\"¥\\\",\\\"languageType\\\":\\\"zh-Hans\\\",\\\"isPaymentMsg\\\":true,\\\"assistName2\\\":\\\"\\\",\\\"assistName3\\\":\\\"\\\",\\\"assistName1\\\":\\\"转入账户\\\",\\\"templateId\\\":\\\"WALLET-FWC@remindNumber\\\",\\\"content\\\":\\\"500.00\\\",\\\"linkName\\\":\\\"\\\",\\\"assistMsg3\\\":\\\"\\\",\\\"sceneExt2\\\":{\\\"sceneUrl\\\":\\\"alipays://platformapi/startapp?appId=20000003&actionType=toBillDetails&tradeNO=20241020019130201010290096463581&bizType=YEB\\\",\\\"sceneType\\\":\\\"nativeApp\\\",\\\"sceneName\\\":\\\"中信银行\\\",\\\"sceneIcon\\\":\\\"https://mdn.alipayobjects.com/fin_instasset/uri/img/as/instasset/CITIC/BANK_LOGO/PURE?zoom=[pixelWidth]w_[pixelHeight]h.png\\\"},\\\"assistMsg2\\\":\\\"\\\",\\\"assistMsg1\\\":\\\"中信银行(5792)\\\",\\\"assistName4\\\":\\\"\\\",\\\"assistMsg5\\\":\\\"\\\",\\\"assistMsg4\\\":\\\"\\\",\\\"assistName5\\\":\\\"\\\",\\\"buttonLink\\\":\\\"\\\",\\\"cardAdInfo\\\":{\\\"p116\\\":{\\\"bizMonitor\\\":{\\\"marketingUniqueId\\\":\\\"MUd7b640fe57bc4e4f886095b6fec476d9\\\",\\\"marketingRuleId\\\":\\\"MR3149d4f6dba24f3abe06cd558c5bed0b\\\",\\\"style\\\":\\\"actionLine2\\\",\\\"marketingItemId\\\":\\\"MI5ff0025309f9429193144b30b0cfc50f\\\"},\\\"expireTime\\\":1760895863103,\\\"marketingUniqueId\\\":\\\"MUd7b640fe57bc4e4f886095b6fec476d9\\\",\\\"minClientVersion\\\":\\\"10.1.98\\\",\\\"recommendTemplateId\\\":\\\"actionLine2\\\",\\\"viewInfo\\\":{\\\"btnName\\\":\\\"支付奖励\\\",\\\"actionType\\\":\\\"link\\\",\\\"tagIcon\\\":\\\"https://mdn.alipayobjects.com/huamei_ekkls7/afts/img/A*h6FWQ6x3NT8AAAAAAAAAAAAADiGFAQ/original\\\",\\\"tagColor\\\":\\\"#FF6011\\\",\\\"actionUrl\\\":\\\"alipays://platformapi/startapp?appId=2021001168603174&page=/pages/marketing-index/index&chInfo=xiaoxidh\\\",\\\"tag\\\":\\\"领取你的摇红包福利\\\"}}}}\"}" +} +] diff --git a/src/utils/AliTools.js b/src/utils/AliTools.js index 162ff43..3e114d1 100644 --- a/src/utils/AliTools.js +++ b/src/utils/AliTools.js @@ -22,6 +22,7 @@ export const AliTools = { case '付款方式:': case '退款方式:': case 'Payment method:': + if (item.content === '账户余额' || item.content === 'Balance') { result.accountNameFrom = '支付宝余额'; break; @@ -34,6 +35,7 @@ export const AliTools = { result.shopItem = item.content; break; case '还款到:': + case '转入账户:': result.accountNameTo = item.content; break; }