@alipay/ams-checkout 0.0.1755253657-dev.2 → 0.0.1755258862-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/channel.d.ts +1 -3
- package/esm/component/channel.js +62 -26
- package/esm/component/component.inline.style.js +2 -2
- package/esm/component/popupWindow.style.d.ts +1 -4
- package/esm/component/popupWindow.style.js +2 -37
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/constant/index.d.ts +2 -41
- package/esm/constant/index.js +5 -43
- package/esm/core/component/ckp/index.d.ts +0 -2
- package/esm/core/component/ckp/index.js +5 -41
- package/esm/core/component/element/index.d.ts +46 -7
- package/esm/core/component/element/index.js +923 -31
- package/esm/core/component/element/mock.d.ts +0 -4
- package/esm/core/component/element/mock.js +1 -365
- package/esm/core/component/element/type.d.ts +34 -74
- package/esm/core/component/element/type.js +12 -20
- package/esm/core/component/index.d.ts +1 -5
- package/esm/core/component/index.js +2 -1
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/core/instance/index.js +1 -1
- package/esm/foundation/core/index.d.ts +1 -9
- package/esm/foundation/core/index.js +49 -153
- package/esm/foundation/index.d.ts +0 -20
- package/esm/foundation/index.js +2 -13
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -3
- package/esm/foundation/product-processor/easysafepay/deps.js +1 -3
- package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -5
- package/esm/foundation/product-processor/easysafepay/index.js +137 -313
- package/esm/foundation/service/container/index.d.ts +3 -14
- package/esm/foundation/service/container/index.js +25 -178
- package/esm/foundation/service/container/popup.d.ts +7 -10
- package/esm/foundation/service/container/popup.js +1 -3
- package/esm/foundation/service/event-center.js +0 -1
- package/esm/foundation/service/log/keys.js +1 -3
- package/esm/foundation/service/log/types.d.ts +0 -1
- package/esm/foundation/service/requester/requester.js +6 -7
- package/esm/foundation/utils/preload_helper.d.ts +2 -2
- package/esm/foundation/utils/preload_helper.js +4 -8
- package/esm/foundation/utils/redirect_utils.js +18 -34
- package/esm/foundation/utils/web_app_url_utils.d.ts +1 -71
- package/esm/foundation/utils/web_app_url_utils.js +8 -219
- package/esm/index.d.ts +4 -7
- package/esm/index.js +48 -98
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +5 -5
- package/esm/plugin/component/channel.d.ts +1 -3
- package/esm/plugin/component/channel.js +12 -10
- package/esm/plugin/component/index.js +44 -47
- package/esm/plugin/type.d.ts +1 -1
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +3 -37
- package/esm/types/index.js +2 -10
- package/esm/util/index.d.ts +1 -8
- package/esm/util/index.js +3 -31
- package/esm/util/spm-map.d.ts +4 -18
- package/esm/util/spm-map.js +6 -20
- package/package.json +4 -27
- package/esm/constant/easysafepay.d.ts +0 -16
- package/esm/constant/easysafepay.js +0 -19
- package/esm/core/component/element/elementContainerService/containerService.d.ts +0 -33
- package/esm/core/component/element/elementContainerService/containerService.js +0 -123
- package/esm/core/component/element/elementContainerService/index.d.ts +0 -20
- package/esm/core/component/element/elementContainerService/index.js +0 -63
- package/esm/core/component/element/elementController/index.d.ts +0 -27
- package/esm/core/component/element/elementController/index.js +0 -493
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/addressProcessor.js +0 -160
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/authProcessor.js +0 -125
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +0 -41
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +0 -96
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +0 -380
- package/esm/core/component/element/util.d.ts +0 -69
- package/esm/core/component/element/util.js +0 -477
- package/esm/core/component/oldElement/index.d.ts +0 -59
- package/esm/core/component/oldElement/index.js +0 -956
- package/esm/core/component/oldElement/mock.d.ts +0 -6
- package/esm/core/component/oldElement/mock.js +0 -567
- package/esm/core/component/oldElement/type.d.ts +0 -354
- package/esm/core/component/oldElement/type.js +0 -81
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +0 -14
- package/esm/foundation/product-processor/autoDebit/deps.js +0 -12
- package/esm/foundation/product-processor/autoDebit/index.d.ts +0 -48
- package/esm/foundation/product-processor/autoDebit/index.js +0 -466
- package/esm/foundation/product-processor/element/index.d.ts +0 -7
- package/esm/foundation/product-processor/element/index.js +0 -24
- package/esm/util/redirect.d.ts +0 -6
- package/esm/util/redirect.js +0 -54
- /package/esm/core/component/{oldElement → element}/components/address.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/components/address.js +0 -0
- /package/esm/core/component/{oldElement → element}/components/auth.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/components/auth.js +0 -0
- /package/esm/core/component/{oldElement → element}/components/payment.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/components/payment.js +0 -0
- /package/esm/core/component/{oldElement → element}/utils.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/utils.js +0 -0
@@ -17,9 +17,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
18
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
19
19
|
import PreloadHelper from "../../../foundation/utils/preload_helper";
|
20
|
-
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil
|
21
|
-
import { isEmpty } from "../../../util";
|
22
|
-
import { getDoubleFaUrlFromSession } from "../../utils/web_app_url_utils";
|
20
|
+
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
|
23
21
|
export var EasySafePayProcessor = /*#__PURE__*/function () {
|
24
22
|
function EasySafePayProcessor() {
|
25
23
|
_classCallCheck(this, EasySafePayProcessor);
|
@@ -27,17 +25,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
27
25
|
_defineProperty(this, "initConfig", void 0);
|
28
26
|
_defineProperty(this, "logger", void 0);
|
29
27
|
_defineProperty(this, "securityService", void 0);
|
30
|
-
_defineProperty(this, "eventCenter", void 0);
|
31
28
|
_defineProperty(this, "instanceId", void 0);
|
32
29
|
// 服务端接口区域信息,请求时决定API域名
|
33
30
|
_defineProperty(this, "hostSign", void 0);
|
34
|
-
_defineProperty(this, "allowQueryCall", void 0);
|
35
31
|
// 是否允许submitPay提前调用,在ESP非首次的性能优化场景使用
|
36
32
|
_defineProperty(this, "allowSubmitPayCallAhead", void 0);
|
37
33
|
_defineProperty(this, "channelBehavior", void 0);
|
38
|
-
_defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT",
|
39
|
-
_defineProperty(this, "SDK_REQUEST_TIMEOUT", 15000);
|
40
|
-
_defineProperty(this, "LOAD_APP_RESOURCES_TIMEOUT", 15000);
|
34
|
+
_defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT", 18000);
|
41
35
|
}
|
42
36
|
_createClass(EasySafePayProcessor, [{
|
43
37
|
key: "init",
|
@@ -46,16 +40,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
46
40
|
this.instanceId = instanceId;
|
47
41
|
this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
|
48
42
|
this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
49
|
-
this.eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
50
43
|
|
51
44
|
// preload web app
|
52
|
-
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment
|
45
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment);
|
53
46
|
}
|
54
47
|
}, {
|
55
48
|
key: "startBizFlow",
|
56
49
|
value: function () {
|
57
50
|
var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentContext) {
|
58
|
-
var _paymentContext$payme2,
|
51
|
+
var _paymentContext$payme2, _this$channelBehavior;
|
59
52
|
var _paymentContext$payme, productSceneVersion, paymentMethodCategoryType, autoDebitWithToken, requireFastSdk, authUrlInfo, isFirstTimeToPay, webAppUrl, resultPayload;
|
60
53
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
61
54
|
while (1) switch (_context.prev = _context.next) {
|
@@ -63,10 +56,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
63
56
|
// 放在最前面的逻辑
|
64
57
|
// 在PC场景下,几乎所有渠道都是没有拉端的逻辑的,所以需要改成1.0, 这个是历史原因
|
65
58
|
if (isPC()) {
|
66
|
-
// 非TOSS渠道,在PC场景需要改成1.0
|
59
|
+
// 非TOSS渠道,在PC场景需要改成1.0
|
67
60
|
if ('BANKTRANSFER_QUICKPAY' !== ((_paymentContext$payme = paymentContext.paymentSessionObj) === null || _paymentContext$payme === void 0 || (_paymentContext$payme = _paymentContext$payme.paymentMethodInfoView) === null || _paymentContext$payme === void 0 ? void 0 : _paymentContext$payme.paymentMethodType)) {
|
68
61
|
paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion = '1.0';
|
69
|
-
paymentContext.paymentSessionObj.needAccountConfirmPage = false;
|
70
62
|
}
|
71
63
|
}
|
72
64
|
this.paymentContext = paymentContext;
|
@@ -76,18 +68,17 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
76
68
|
autoDebitWithToken = paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
77
69
|
requireFastSdk = paymentContext.paymentSessionObj.action.requireFastSdk;
|
78
70
|
authUrlInfo = ((_paymentContext$payme2 = paymentContext.paymentSessionObj) === null || _paymentContext$payme2 === void 0 ? void 0 : _paymentContext$payme2.authUrlInfo) || {};
|
79
|
-
this.channelBehavior = ChannelCustomize.getChannelBehavior(
|
80
|
-
|
71
|
+
this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
|
81
72
|
// 首次支付
|
82
|
-
isFirstTimeToPay = !autoDebitWithToken; // 处理
|
83
|
-
if (!(isFirstTimeToPay && requireFastSdk)) {
|
73
|
+
isFirstTimeToPay = !autoDebitWithToken; // 处理ESP1.0极速外跳支付场景
|
74
|
+
if (!(productSceneVersion === '1.0' && isFirstTimeToPay && requireFastSdk)) {
|
84
75
|
_context.next = 12;
|
85
76
|
break;
|
86
77
|
}
|
87
78
|
return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
|
88
79
|
case 12:
|
89
80
|
// 下面的场景是需要渲染UI的渠道, 打开WebUrl
|
90
|
-
webAppUrl = this.buildWebAppUrl();
|
81
|
+
webAppUrl = this.buildWebAppUrl(); // const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
|
91
82
|
resultPayload = {
|
92
83
|
url: webAppUrl,
|
93
84
|
allowClickPopupOutsideClose: (_this$channelBehavior = this.channelBehavior) === null || _this$channelBehavior === void 0 ? void 0 : _this$channelBehavior.allowClickOutsideClose
|
@@ -98,13 +89,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
98
89
|
productSceneVersion: productSceneVersion
|
99
90
|
});
|
100
91
|
// 返回结果之前,发送 sessionData,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
|
92
|
+
console.log('[DEBUG] sendRequestAndWaitWebLaunch start');
|
101
93
|
this.sendRequestAndWaitWebLaunch();
|
94
|
+
console.log('[DEBUG] sendRequestAndWaitWebLaunch completed');
|
102
95
|
// 返回结果,RENDER,让外层去处理iframe加载等逻辑
|
103
96
|
return _context.abrupt("return", {
|
104
97
|
behaviorType: 'RENDER',
|
105
98
|
payload: resultPayload
|
106
99
|
});
|
107
|
-
case
|
100
|
+
case 19:
|
108
101
|
case "end":
|
109
102
|
return _context.stop();
|
110
103
|
}
|
@@ -118,19 +111,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
118
111
|
}, {
|
119
112
|
key: "buildWebAppUrl",
|
120
113
|
value: function buildWebAppUrl() {
|
121
|
-
var _paymentContext$payme3, _paymentContext$payme4,
|
114
|
+
var _paymentContext$payme3, _paymentContext$payme4, _this$initConfig$anal;
|
122
115
|
var paymentContext = this.paymentContext;
|
123
116
|
var paymentMethodCategoryType = (_paymentContext$payme3 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme3 === void 0 ? void 0 : _paymentContext$payme3.paymentMethodCategoryType;
|
124
|
-
var
|
125
|
-
var productSceneVersion = (_paymentContext$payme5 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme5 === void 0 ? void 0 : _paymentContext$payme5.productSceneVersion;
|
117
|
+
var productSceneVersion = (_paymentContext$payme4 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme4 === void 0 ? void 0 : _paymentContext$payme4.productSceneVersion;
|
126
118
|
var hostSign = this.hostSign;
|
127
|
-
var
|
128
|
-
var extendInfo = paymentContext.paymentSessionObj.extendInfo;
|
129
|
-
var webAppUrl = WebAppUrlUtil.getWebAppV2Url({
|
119
|
+
var webAppUrl = WebAppUrlUtil.getWebAppUrl({
|
130
120
|
environment: this.initConfig.environment,
|
131
121
|
paymentMethodCategoryType: paymentMethodCategoryType,
|
132
122
|
sdkMetaData: paymentContext.sdkMetaData,
|
133
|
-
productScene: productScene,
|
134
123
|
productSceneVersion: productSceneVersion,
|
135
124
|
isPreload: false,
|
136
125
|
query: {
|
@@ -139,9 +128,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
139
128
|
instanceId: this.instanceId,
|
140
129
|
locale: this.initConfig.locale,
|
141
130
|
hostSign: hostSign
|
142
|
-
}
|
143
|
-
mid: mid,
|
144
|
-
extendInfo: extendInfo
|
131
|
+
}
|
145
132
|
});
|
146
133
|
return webAppUrl;
|
147
134
|
}
|
@@ -177,216 +164,75 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
177
164
|
key: "sendRequestAndWaitWebLaunch",
|
178
165
|
value: function sendRequestAndWaitWebLaunch() {
|
179
166
|
var _this = this;
|
180
|
-
|
181
|
-
var webLaunchPromise = new Promise(function (resolve
|
182
|
-
|
183
|
-
var t = setTimeout(function () {
|
184
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch webLaunchPromise timeout');
|
185
|
-
reject(new Error('Load resource timeout'));
|
186
|
-
}, _this.LOAD_APP_RESOURCES_TIMEOUT);
|
187
|
-
_this.eventCenter.listen('onLaunch', function (res) {
|
188
|
-
clearTimeout(t);
|
167
|
+
var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
168
|
+
var webLaunchPromise = new Promise(function (resolve) {
|
169
|
+
eventCenter.listen('onLaunch', function (res) {
|
189
170
|
resolve(res);
|
190
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch webLaunchPromise onLaunch');
|
191
|
-
_this.logger.logInfo({
|
192
|
-
title: 'sdk_event_webAppOnLaunch'
|
193
|
-
});
|
194
171
|
});
|
195
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch completed');
|
196
172
|
});
|
197
|
-
|
173
|
+
|
198
174
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
199
|
-
Promise.all([this.initSecuritySDK(), this.
|
200
|
-
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$
|
201
|
-
var _ref2 = _slicedToArray(_ref,
|
175
|
+
Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
176
|
+
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
|
177
|
+
var _ref2 = _slicedToArray(_ref, 3),
|
202
178
|
_initSecurityRes = _ref2[0],
|
203
|
-
|
204
|
-
|
205
|
-
_webLaunchRes = _ref2[3];
|
206
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch success', _initSecurityRes, queryRes, submitRes, _webLaunchRes);
|
179
|
+
submitRes = _ref2[1],
|
180
|
+
_webLaunchRes = _ref2[2];
|
207
181
|
var logMetaData = _this.logger.getLogConfig().mdata;
|
208
|
-
|
209
|
-
sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
|
210
|
-
submitResult: submitRes,
|
211
|
-
paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
|
212
|
-
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
213
|
-
renderDisplayType: _this.paymentContext.displayInfo.type,
|
214
|
-
appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
|
215
|
-
notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
|
216
|
-
isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
|
217
|
-
merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
|
218
|
-
allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
|
219
|
-
doubleFaUrl: getDoubleFaUrlFromSession((_this$paymentContext3 = _this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionObj, _this.initConfig.environment),
|
220
|
-
envInfo: {
|
221
|
-
screenHeight: screen.height,
|
222
|
-
screenWidth: screen.width
|
223
|
-
},
|
224
|
-
logMetaData: _objectSpread(_objectSpread({
|
225
|
-
trackId: logMetaData.requestSeq,
|
226
|
-
platform: logMetaData.platform,
|
227
|
-
firstLogTime: logMetaData.firstLogTime
|
228
|
-
}, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
|
229
|
-
renderDisplayType: logMetaData.renderDisplayType,
|
230
|
-
sdkVersion: logMetaData.sdkVersion,
|
231
|
-
merchantId: logMetaData.merchantId,
|
232
|
-
instanceId: logMetaData.instanceId,
|
233
|
-
paymentMethodType: logMetaData.paymentMethodType
|
234
|
-
})
|
235
|
-
};
|
236
|
-
if (queryRes) {
|
237
|
-
data.queryResult = queryRes;
|
238
|
-
}
|
239
|
-
console.log('[DEBUG] sendRequestAndWaitWebLaunch enter.dispatchToApp start', data);
|
240
|
-
_this.eventCenter.dispatchToApp({
|
182
|
+
eventCenter.dispatchToApp({
|
241
183
|
event: 'renderComponent',
|
242
|
-
data:
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
184
|
+
data: {
|
185
|
+
sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
|
186
|
+
submitResult: submitRes,
|
187
|
+
paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
|
188
|
+
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
189
|
+
renderDisplayType: _this.paymentContext.displayInfo.type,
|
190
|
+
appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
|
191
|
+
notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
|
192
|
+
isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
|
193
|
+
merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
|
194
|
+
allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
|
195
|
+
envInfo: {
|
196
|
+
screenHeight: screen.height,
|
197
|
+
screenWidth: screen.width
|
198
|
+
},
|
199
|
+
logMetaData: _objectSpread(_objectSpread({
|
200
|
+
trackId: logMetaData.requestSeq,
|
201
|
+
platform: logMetaData.platform,
|
202
|
+
firstLogTime: logMetaData.firstLogTime
|
203
|
+
}, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
|
204
|
+
renderDisplayType: logMetaData.renderDisplayType,
|
205
|
+
sdkVersion: logMetaData.sdkVersion,
|
206
|
+
merchantId: logMetaData.merchantId,
|
207
|
+
instanceId: logMetaData.instanceId,
|
208
|
+
paymentMethodType: logMetaData.paymentMethodType
|
209
|
+
})
|
256
210
|
}
|
257
211
|
});
|
212
|
+
}, function (error) {
|
213
|
+
console.log('[DEBUG] - sendRequestAndWaitWebLaunch - ERROR', error);
|
258
214
|
});
|
259
215
|
}
|
260
216
|
}, {
|
261
|
-
key: "
|
217
|
+
key: "processSubmitPay",
|
262
218
|
value: function () {
|
263
|
-
var
|
264
|
-
var _this$
|
265
|
-
var
|
219
|
+
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
220
|
+
var _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$6;
|
221
|
+
var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$5, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
|
266
222
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
267
223
|
while (1) switch (_context2.prev = _context2.next) {
|
268
224
|
case 0:
|
269
|
-
console.log('[DEBUG]
|
270
|
-
queryParams = {
|
271
|
-
paymentSessionData: ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionId) || '',
|
272
|
-
paymentSessionConfig: (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionConfig
|
273
|
-
};
|
274
|
-
extendInfo = (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionObj.extendInfo;
|
275
|
-
needAccountConfirmPage = (_this$paymentContext$5 = (_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionObj.needAccountConfirmPage) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : true;
|
276
|
-
isFirstTimeToPay = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.autoDebitWithToken);
|
277
|
-
needQueryRender = true;
|
278
|
-
try {
|
279
|
-
console.log('[DEBUG] processQuery JSON.parse(extendInfo) start', extendInfo);
|
280
|
-
extendInfoData = JSON.parse(extendInfo);
|
281
|
-
needQueryRender = isEmpty(extendInfoData.needQueryRender) || extendInfoData.needQueryRender === true;
|
282
|
-
console.log('[DEBUG] processQuery JSON.parse(extendInfo) completed', needQueryRender);
|
283
|
-
} catch (error) {
|
284
|
-
console.log('[DEBUG] processQuery JSON.parse(extendInfo) ERROR', error);
|
285
|
-
console.log(error);
|
286
|
-
}
|
287
|
-
this.allowQueryCall = needQueryRender && isFirstTimeToPay && needAccountConfirmPage;
|
288
|
-
console.log('[DEBUG] processQuery allowQueryCall', this.allowQueryCall);
|
289
|
-
if (this.allowQueryCall) {
|
290
|
-
_context2.next = 12;
|
291
|
-
break;
|
292
|
-
}
|
293
|
-
console.log('[DEBUG] processQuery allowQueryCall NO', this.allowQueryCall);
|
294
|
-
return _context2.abrupt("return", null);
|
295
|
-
case 12:
|
296
|
-
requestBizId = uuid();
|
297
|
-
this.logger.logInfo({
|
298
|
-
title: 'sdk_event_sdkQuery'
|
299
|
-
}, {
|
300
|
-
config: JSON.stringify(queryParams.paymentSessionConfig),
|
301
|
-
requestId: requestBizId
|
302
|
-
});
|
303
|
-
console.log('[DEBUG] processQuery ServiceProvider.getInstance start');
|
304
|
-
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
305
|
-
console.log('[DEBUG] processQuery ServiceProvider.getInstance completed', requester);
|
306
|
-
_context2.prev = 17;
|
307
|
-
console.log('[DEBUG] processQuery requester.request<CashierSdkActionQuerySessionResult start');
|
308
|
-
_context2.t0 = requester;
|
309
|
-
_context2.t1 = _objectSpread(_objectSpread({}, queryParams), {}, {
|
310
|
-
actionType: 'init',
|
311
|
-
integrationType: 'SDK',
|
312
|
-
sdkVersion: (_this$paymentContext$6 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$6 !== void 0 ? _this$paymentContext$6 : '1.0.0'
|
313
|
-
});
|
314
|
-
_context2.t2 = this.initConfig.environment;
|
315
|
-
_context2.t3 = this.SDK_REQUEST_TIMEOUT;
|
316
|
-
_context2.next = 25;
|
317
|
-
return this.acquireApdidToken();
|
318
|
-
case 25:
|
319
|
-
_context2.t4 = _context2.sent;
|
320
|
-
_context2.t5 = {
|
321
|
-
deviceId: _context2.t4
|
322
|
-
};
|
323
|
-
_context2.t6 = this.hostSign;
|
324
|
-
_context2.t7 = {
|
325
|
-
env: _context2.t2,
|
326
|
-
timeout: _context2.t3,
|
327
|
-
envInfo: _context2.t5,
|
328
|
-
hostSign: _context2.t6,
|
329
|
-
needEnvInfo: true,
|
330
|
-
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
331
|
-
};
|
332
|
-
_context2.next = 31;
|
333
|
-
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t7);
|
334
|
-
case 31:
|
335
|
-
res = _context2.sent;
|
336
|
-
console.log('[DEBUG] processQuery requester.request<CashierSdkActionQuerySessionResult completed', res);
|
337
|
-
this.logger.logInfo({
|
338
|
-
title: 'sdk_event_sdkQueryEnd'
|
339
|
-
}, {
|
340
|
-
config: JSON.stringify(queryParams.paymentSessionConfig),
|
341
|
-
requestId: requestBizId,
|
342
|
-
rpcTraceId: res.traceId
|
343
|
-
});
|
344
|
-
console.log('[DEBUG] processQuery completed', res);
|
345
|
-
return _context2.abrupt("return", res);
|
346
|
-
case 38:
|
347
|
-
_context2.prev = 38;
|
348
|
-
_context2.t8 = _context2["catch"](17);
|
349
|
-
console.log('[DEBUG] processQuery ERROR', _context2.t8);
|
350
|
-
this.logger.logError({
|
351
|
-
title: 'sdk_event_sdkQuery_failed'
|
352
|
-
}, {
|
353
|
-
config: JSON.stringify(queryParams.paymentSessionConfig),
|
354
|
-
errorMessage: JSON.stringify(_context2.t8),
|
355
|
-
requestId: requestBizId,
|
356
|
-
rpcTraceId: _context2.t8 === null || _context2.t8 === void 0 ? void 0 : _context2.t8.traceId
|
357
|
-
});
|
358
|
-
return _context2.abrupt("return", null);
|
359
|
-
case 43:
|
360
|
-
case "end":
|
361
|
-
return _context2.stop();
|
362
|
-
}
|
363
|
-
}, _callee2, this, [[17, 38]]);
|
364
|
-
}));
|
365
|
-
function processQuery() {
|
366
|
-
return _processQuery.apply(this, arguments);
|
367
|
-
}
|
368
|
-
return processQuery;
|
369
|
-
}()
|
370
|
-
}, {
|
371
|
-
key: "processSubmitPay",
|
372
|
-
value: function () {
|
373
|
-
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
374
|
-
var _this$paymentContext9, _this$paymentContext10, _this$paymentContext11, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$8, _this$paymentContext12;
|
375
|
-
var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$7, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$9, res;
|
376
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
377
|
-
while (1) switch (_context3.prev = _context3.next) {
|
378
|
-
case 0:
|
379
|
-
console.log('DEBUG] processSubmitPay start');
|
225
|
+
console.log('[DEBUG] processSubmitPay start');
|
380
226
|
submitParams = {
|
381
|
-
paymentSessionData: ((_this$
|
382
|
-
paymentSessionConfig: (_this$
|
227
|
+
paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
|
228
|
+
paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
|
383
229
|
};
|
384
230
|
_ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
|
385
|
-
_ref4 = ((_this$
|
231
|
+
_ref4 = ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
|
386
232
|
if (productSceneVersion === '2.0' && !autoDebitWithToken) {
|
387
233
|
///EasyPay 2.0 首次传signAgreement字段
|
388
234
|
submitParams['signAgreement'] = enableSignAgreement;
|
389
|
-
paymentMethodType = (_this$paymentContext$
|
235
|
+
paymentMethodType = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$5 === void 0 || (_this$paymentContext$5 = _this$paymentContext$5.paymentMethodInfoView) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.paymentMethodType;
|
390
236
|
isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
|
391
237
|
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
392
238
|
backScheme = getBackScheme(undefined, this.logger);
|
@@ -397,22 +243,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
397
243
|
}
|
398
244
|
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
399
245
|
//console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
400
|
-
|
401
|
-
console.log('DEBUG] processSubmitPay allowSubmitPayCallAhead start', this.allowSubmitPayCallAhead);
|
402
246
|
if (this.allowSubmitPayCallAhead) {
|
403
|
-
|
247
|
+
_context2.next = 8;
|
404
248
|
break;
|
405
249
|
}
|
406
|
-
|
407
|
-
console.log('DEBUG] processSubmitPay allowSubmitPayCallAhead ', {
|
408
|
-
message: 'sdk no need to make submitPay request',
|
409
|
-
success: true
|
410
|
-
});
|
411
|
-
return _context3.abrupt("return", {
|
250
|
+
return _context2.abrupt("return", {
|
412
251
|
message: 'sdk no need to make submitPay request',
|
413
252
|
success: true
|
414
253
|
});
|
415
|
-
case
|
254
|
+
case 8:
|
416
255
|
requestBizId = uuid(); // 下面真实发请求
|
417
256
|
this.logger.logInfo({
|
418
257
|
title: 'sdk_event_submitPay'
|
@@ -420,58 +259,42 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
420
259
|
config: JSON.stringify(submitParams.paymentSessionConfig),
|
421
260
|
requestId: requestBizId
|
422
261
|
});
|
423
|
-
console.log('DEBUG] processSubmitPay channelBehavior?.buildSubmitPayExtParams start');
|
424
262
|
// 由渠道定制点来构建额外参数
|
425
263
|
extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
|
426
264
|
instanceId: this.instanceId,
|
427
265
|
locale: this.initConfig.locale,
|
428
|
-
paymentMethodType: (_this$paymentContext$
|
266
|
+
paymentMethodType: (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentMethodInfoView) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.paymentMethodType,
|
429
267
|
paymentSessionData: this.paymentContext.paymentSessionId,
|
430
|
-
paymentSessionObj: this.paymentContext.paymentSessionObj,
|
431
268
|
env: this.initConfig.environment,
|
432
|
-
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
|
433
|
-
notRedirectAfterComplete: ((_this$paymentContext12 = this.paymentContext) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.startBizFlowOptions) === null || _this$paymentContext12 === void 0 || (_this$paymentContext12 = _this$paymentContext12.submitPayRequestExtra) === null || _this$paymentContext12 === void 0 ? void 0 : _this$paymentContext12.notRedirectAfterComplete) === true
|
269
|
+
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
|
434
270
|
})) || {};
|
435
|
-
|
436
|
-
|
437
|
-
// 二次支付不再需要该参数
|
438
|
-
if (!autoDebitWithToken) {
|
439
|
-
extParams.complianceSDK = true;
|
440
|
-
}
|
271
|
+
extParams.complianceSDK = true;
|
441
272
|
submitParams.extParams = extParams;
|
442
|
-
console.log('DEBUG] processSubmitPay ServiceProvider.getInstance start');
|
443
273
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
integrationType: 'SDK',
|
450
|
-
sdkVersion: (_this$paymentContext$9 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$9 !== void 0 ? _this$paymentContext$9 : '1.0.0'
|
451
|
-
});
|
452
|
-
_context3.t2 = this.initConfig.environment;
|
453
|
-
_context3.t3 = this.SDK_REQUEST_TIMEOUT;
|
454
|
-
_context3.next = 28;
|
274
|
+
_context2.prev = 14;
|
275
|
+
_context2.t0 = requester;
|
276
|
+
_context2.t1 = submitParams;
|
277
|
+
_context2.t2 = this.initConfig.environment;
|
278
|
+
_context2.next = 20;
|
455
279
|
return this.acquireApdidToken();
|
456
|
-
case
|
457
|
-
|
458
|
-
|
459
|
-
deviceId:
|
280
|
+
case 20:
|
281
|
+
_context2.t3 = _context2.sent;
|
282
|
+
_context2.t4 = {
|
283
|
+
deviceId: _context2.t3
|
460
284
|
};
|
461
|
-
|
462
|
-
|
463
|
-
env:
|
464
|
-
timeout:
|
465
|
-
envInfo:
|
466
|
-
hostSign:
|
285
|
+
_context2.t5 = this.hostSign;
|
286
|
+
_context2.t6 = {
|
287
|
+
env: _context2.t2,
|
288
|
+
timeout: 15000,
|
289
|
+
envInfo: _context2.t4,
|
290
|
+
hostSign: _context2.t5,
|
467
291
|
needEnvInfo: true,
|
468
292
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
469
293
|
};
|
470
|
-
|
471
|
-
return
|
472
|
-
case
|
473
|
-
res =
|
474
|
-
console.log('DEBUG] processSubmitPay requester.request<CashierSubmitPayResult completed', res);
|
294
|
+
_context2.next = 26;
|
295
|
+
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
|
296
|
+
case 26:
|
297
|
+
res = _context2.sent;
|
475
298
|
this.logger.logInfo({
|
476
299
|
title: 'sdk_event_submitPayEnd'
|
477
300
|
}, {
|
@@ -479,26 +302,26 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
479
302
|
requestId: requestBizId,
|
480
303
|
rpcTraceId: res.traceId
|
481
304
|
});
|
482
|
-
console.log('DEBUG] processSubmitPay completed', res);
|
483
|
-
return
|
484
|
-
case
|
485
|
-
|
486
|
-
|
487
|
-
console.log('DEBUG] processSubmitPay ERROR', _context3.t8);
|
305
|
+
console.log('[DEBUG] processSubmitPay completed', res);
|
306
|
+
return _context2.abrupt("return", res);
|
307
|
+
case 32:
|
308
|
+
_context2.prev = 32;
|
309
|
+
_context2.t7 = _context2["catch"](14);
|
488
310
|
this.logger.logError({
|
489
311
|
title: 'sdk_event_submitPay_failed'
|
490
312
|
}, {
|
491
313
|
config: JSON.stringify(submitParams.paymentSessionConfig),
|
492
|
-
errorMessage:
|
314
|
+
errorMessage: _context2.t7,
|
493
315
|
requestId: requestBizId,
|
494
|
-
rpcTraceId:
|
316
|
+
rpcTraceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
|
495
317
|
});
|
496
|
-
|
497
|
-
|
318
|
+
console.log('[DEBUG] processSubmitPay ERROR', _context2.t7);
|
319
|
+
throw _context2.t7;
|
320
|
+
case 37:
|
498
321
|
case "end":
|
499
|
-
return
|
322
|
+
return _context2.stop();
|
500
323
|
}
|
501
|
-
},
|
324
|
+
}, _callee2, this, [[14, 32]]);
|
502
325
|
}));
|
503
326
|
function processSubmitPay() {
|
504
327
|
return _processSubmitPay.apply(this, arguments);
|
@@ -508,23 +331,23 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
508
331
|
}, {
|
509
332
|
key: "acquireApdidToken",
|
510
333
|
value: function () {
|
511
|
-
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
512
|
-
var _this$paymentContext$
|
334
|
+
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
335
|
+
var _this$paymentContext$7;
|
513
336
|
var securityService, productScene, deviceId;
|
514
|
-
return _regeneratorRuntime().wrap(function
|
515
|
-
while (1) switch (
|
337
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
338
|
+
while (1) switch (_context3.prev = _context3.next) {
|
516
339
|
case 0:
|
517
340
|
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
518
|
-
productScene = (_this$paymentContext$
|
341
|
+
productScene = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentSessionConfig) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.productScene;
|
519
342
|
deviceId = securityService.getDeviceId({
|
520
343
|
productScene: productScene
|
521
344
|
});
|
522
|
-
return
|
345
|
+
return _context3.abrupt("return", deviceId);
|
523
346
|
case 4:
|
524
347
|
case "end":
|
525
|
-
return
|
348
|
+
return _context3.stop();
|
526
349
|
}
|
527
|
-
},
|
350
|
+
}, _callee3, this);
|
528
351
|
}));
|
529
352
|
function acquireApdidToken() {
|
530
353
|
return _acquireApdidToken.apply(this, arguments);
|
@@ -534,20 +357,18 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
534
357
|
}, {
|
535
358
|
key: "initSecuritySDK",
|
536
359
|
value: function () {
|
537
|
-
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
538
|
-
var _this$paymentContext$
|
539
|
-
return _regeneratorRuntime().wrap(function
|
540
|
-
while (1) switch (
|
360
|
+
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
361
|
+
var _this$paymentContext$8, _this$paymentContext$9, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
|
362
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
363
|
+
while (1) switch (_context4.prev = _context4.next) {
|
541
364
|
case 0:
|
542
365
|
console.log('[DEBUG] initSecuritySDK start');
|
543
|
-
|
366
|
+
_context4.prev = 1;
|
544
367
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
545
|
-
|
546
|
-
|
547
|
-
userSignAgreement = (_this$paymentContext$15 = (_this$paymentContext$16 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$16 === void 0 ? void 0 : _this$paymentContext$16.userSignAgreement) !== null && _this$paymentContext$15 !== void 0 ? _this$paymentContext$15 : false;
|
368
|
+
nonCompliant = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.nonCompliant;
|
369
|
+
nonInitSecuritySDK = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.nonInitSecuritySDK;
|
548
370
|
isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
549
371
|
shouldInitSecuritySDK = false;
|
550
|
-
console.log("[DEBUG] initSecuritySDK -- productSceneVersion:".concat(productSceneVersion, " | nonInitSecuritySDK:").concat(nonInitSecuritySDK, " | signButtonDisplay:").concat(signButtonDisplay, " | userSignAgreement:").concat(userSignAgreement, " | isFirstTimeToPay:").concat(isFirstTimeToPay));
|
551
372
|
if (nonInitSecuritySDK) {
|
552
373
|
// 钱包不依赖风控
|
553
374
|
// console.log('[web-sdk][security-sdk] DO NOT init security sdk when nonInitSecuritySDK is true');
|
@@ -558,44 +379,47 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
558
379
|
// console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
|
559
380
|
shouldInitSecuritySDK = false;
|
560
381
|
} else if (productSceneVersion === '2.0') {
|
561
|
-
if (
|
562
|
-
//
|
563
|
-
|
564
|
-
} else {
|
565
|
-
// 切流「隐私合规」且非首次支付
|
566
|
-
// console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
|
382
|
+
if (nonCompliant === true) {
|
383
|
+
// 未切流「隐私合规」
|
384
|
+
// console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and nonCompliant is true');
|
567
385
|
shouldInitSecuritySDK = true;
|
386
|
+
} else {
|
387
|
+
if (isFirstTimeToPay) {
|
388
|
+
// console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0 and when first time to pay');
|
389
|
+
shouldInitSecuritySDK = false;
|
390
|
+
} else {
|
391
|
+
// 切流「隐私合规」且非首次支付
|
392
|
+
// console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
|
393
|
+
shouldInitSecuritySDK = true;
|
394
|
+
}
|
568
395
|
}
|
569
396
|
}
|
570
397
|
}
|
571
398
|
if (!shouldInitSecuritySDK) {
|
572
|
-
|
399
|
+
_context4.next = 11;
|
573
400
|
break;
|
574
401
|
}
|
575
|
-
|
576
|
-
_context5.next = 14;
|
402
|
+
_context4.next = 11;
|
577
403
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
578
|
-
case
|
579
|
-
console.log("[DEBUG] securityService.initSecurity completed ");
|
580
|
-
case 15:
|
404
|
+
case 11:
|
581
405
|
console.log('[DEBUG] initSecuritySDK completed');
|
582
406
|
this.logger.logInfo({
|
583
407
|
title: 'a3753.b101271.c388193.d514078'
|
584
408
|
}, {
|
585
409
|
riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
|
586
410
|
});
|
587
|
-
|
411
|
+
_context4.next = 18;
|
588
412
|
break;
|
589
|
-
case
|
590
|
-
|
591
|
-
|
413
|
+
case 15:
|
414
|
+
_context4.prev = 15;
|
415
|
+
_context4.t0 = _context4["catch"](1);
|
592
416
|
console.log('[DEBUG] initSecuritySDK ERROR');
|
593
417
|
// do nothing when init security failed
|
594
|
-
case
|
418
|
+
case 18:
|
595
419
|
case "end":
|
596
|
-
return
|
420
|
+
return _context4.stop();
|
597
421
|
}
|
598
|
-
},
|
422
|
+
}, _callee4, this, [[1, 15]]);
|
599
423
|
}));
|
600
424
|
function initSecuritySDK() {
|
601
425
|
return _initSecuritySDK.apply(this, arguments);
|