Skip to content

Commit

Permalink
✨ (支付宝转账到银行卡): 添加支付宝转账到银行卡功能及相关测试 #455
Browse files Browse the repository at this point in the history
新增支付宝转账到银行卡的处理逻辑,包括自动转账功能和相关测试用例。更新了 `AliTools` 工具类以支持新的转账场景。
  • Loading branch information
AnkioTomas committed Dec 18, 2024
1 parent 41e6388 commit 82991d0
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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": '支付宝[转账到银行卡]',
},
]));
Original file line number Diff line number Diff line change
@@ -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\\\":\\\"领取你的摇红包福利\\\"}}}}\"}"
}
]
2 changes: 2 additions & 0 deletions src/utils/AliTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const AliTools = {
case '付款方式:':
case '退款方式:':
case 'Payment method:':

if (item.content === '账户余额' || item.content === 'Balance') {
result.accountNameFrom = '支付宝余额';
break;
Expand All @@ -34,6 +35,7 @@ export const AliTools = {
result.shopItem = item.content;
break;
case '还款到:':
case '转入账户:':
result.accountNameTo = item.content;
break;
}
Expand Down

0 comments on commit 82991d0

Please sign in to comment.