@alipay/ams-checkout 0.0.1747907034-dev.0 → 0.0.1747907034-dev.2
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 +3 -1
- package/esm/component/channel.js +26 -62
- package/esm/config/index.d.ts +1 -1
- package/esm/config/index.js +1 -1
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/easysafepay.js +19 -0
- package/esm/constant/index.d.ts +4 -0
- package/esm/constant/index.js +4 -0
- package/esm/core/component/ckp/index.d.ts +2 -0
- package/esm/core/component/ckp/index.js +39 -5
- package/esm/foundation/core/index.d.ts +3 -0
- package/esm/foundation/core/index.js +81 -29
- package/esm/foundation/index.d.ts +6 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -0
- package/esm/foundation/product-processor/easysafepay/index.js +224 -121
- package/esm/foundation/service/container/index.d.ts +1 -0
- package/esm/foundation/service/container/index.js +20 -2
- package/esm/foundation/utils/preload_helper.d.ts +2 -2
- package/esm/foundation/utils/preload_helper.js +8 -4
- package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
- package/esm/foundation/utils/web_app_url_utils.js +215 -8
- package/esm/index.js +1 -1
- package/esm/plugin/component/cashierApp.js +4 -4
- package/esm/plugin/component/channel.d.ts +3 -1
- package/esm/plugin/component/channel.js +10 -12
- package/esm/plugin/component/index.js +45 -42
- package/esm/types/index.d.ts +17 -0
- package/esm/types/index.js +6 -0
- package/esm/util/redirect.d.ts +6 -0
- package/esm/util/redirect.js +54 -0
- package/package.json +3 -2
@@ -18,6 +18,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
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
20
|
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil, EVENT, eventCodeEnum } from "./deps";
|
21
|
+
import { isEmpty } from "../../../util";
|
22
|
+
import { getDoubleFaUrlFromSession } from "../../utils/web_app_url_utils";
|
21
23
|
export var EasySafePayProcessor = /*#__PURE__*/function () {
|
22
24
|
function EasySafePayProcessor() {
|
23
25
|
_classCallCheck(this, EasySafePayProcessor);
|
@@ -29,10 +31,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
29
31
|
_defineProperty(this, "instanceId", void 0);
|
30
32
|
// 服务端接口区域信息,请求时决定API域名
|
31
33
|
_defineProperty(this, "hostSign", void 0);
|
34
|
+
_defineProperty(this, "allowQueryCall", void 0);
|
32
35
|
// 是否允许submitPay提前调用,在ESP非首次的性能优化场景使用
|
33
36
|
_defineProperty(this, "allowSubmitPayCallAhead", void 0);
|
34
37
|
_defineProperty(this, "channelBehavior", void 0);
|
35
|
-
_defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT",
|
38
|
+
_defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT", 1500);
|
36
39
|
_defineProperty(this, "SDK_REQUEST_TIMEOUT", 15000);
|
37
40
|
_defineProperty(this, "LOAD_APP_RESOURCES_TIMEOUT", 15000);
|
38
41
|
}
|
@@ -46,13 +49,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
46
49
|
this.eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
47
50
|
|
48
51
|
// preload web app
|
49
|
-
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment);
|
52
|
+
PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment, true);
|
50
53
|
}
|
51
54
|
}, {
|
52
55
|
key: "startBizFlow",
|
53
56
|
value: function () {
|
54
57
|
var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentContext) {
|
55
|
-
var _paymentContext$payme2, _this$channelBehavior;
|
58
|
+
var _paymentContext$payme2, _paymentContext$start, _this$channelBehavior;
|
56
59
|
var _paymentContext$payme, productSceneVersion, paymentMethodCategoryType, autoDebitWithToken, requireFastSdk, authUrlInfo, isFirstTimeToPay, webAppUrl, resultPayload;
|
57
60
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
58
61
|
while (1) switch (_context.prev = _context.next) {
|
@@ -60,9 +63,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
60
63
|
// 放在最前面的逻辑
|
61
64
|
// 在PC场景下,几乎所有渠道都是没有拉端的逻辑的,所以需要改成1.0, 这个是历史原因
|
62
65
|
if (isPC()) {
|
63
|
-
// 非TOSS渠道,在PC场景需要改成1.0
|
66
|
+
// 非TOSS渠道,在PC场景需要改成1.0/needAccountConfirmPage=false
|
64
67
|
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)) {
|
65
68
|
paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion = '1.0';
|
69
|
+
paymentContext.paymentSessionObj.needAccountConfirmPage = false;
|
66
70
|
}
|
67
71
|
}
|
68
72
|
this.paymentContext = paymentContext;
|
@@ -72,17 +76,18 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
72
76
|
autoDebitWithToken = paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
73
77
|
requireFastSdk = paymentContext.paymentSessionObj.action.requireFastSdk;
|
74
78
|
authUrlInfo = ((_paymentContext$payme2 = paymentContext.paymentSessionObj) === null || _paymentContext$payme2 === void 0 ? void 0 : _paymentContext$payme2.authUrlInfo) || {};
|
75
|
-
this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
|
79
|
+
this.channelBehavior = ChannelCustomize.getChannelBehavior(((_paymentContext$start = paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _paymentContext$start === void 0 ? void 0 : _paymentContext$start.notRedirectAfterComplete) === true, paymentContext.paymentSessionObj);
|
80
|
+
|
76
81
|
// 首次支付
|
77
|
-
isFirstTimeToPay = !autoDebitWithToken; // 处理
|
78
|
-
if (!(
|
82
|
+
isFirstTimeToPay = !autoDebitWithToken; // 处理ESP极速外跳支付场景
|
83
|
+
if (!(isFirstTimeToPay && requireFastSdk)) {
|
79
84
|
_context.next = 12;
|
80
85
|
break;
|
81
86
|
}
|
82
87
|
return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
|
83
88
|
case 12:
|
84
89
|
// 下面的场景是需要渲染UI的渠道, 打开WebUrl
|
85
|
-
webAppUrl = this.buildWebAppUrl();
|
90
|
+
webAppUrl = this.buildWebAppUrl();
|
86
91
|
resultPayload = {
|
87
92
|
url: webAppUrl,
|
88
93
|
allowClickPopupOutsideClose: (_this$channelBehavior = this.channelBehavior) === null || _this$channelBehavior === void 0 ? void 0 : _this$channelBehavior.allowClickOutsideClose
|
@@ -113,15 +118,19 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
113
118
|
}, {
|
114
119
|
key: "buildWebAppUrl",
|
115
120
|
value: function buildWebAppUrl() {
|
116
|
-
var _paymentContext$payme3, _paymentContext$payme4, _this$initConfig$anal;
|
121
|
+
var _paymentContext$payme3, _paymentContext$payme4, _paymentContext$payme5, _this$initConfig$anal;
|
117
122
|
var paymentContext = this.paymentContext;
|
118
123
|
var paymentMethodCategoryType = (_paymentContext$payme3 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme3 === void 0 ? void 0 : _paymentContext$payme3.paymentMethodCategoryType;
|
119
|
-
var
|
124
|
+
var productScene = (_paymentContext$payme4 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme4 === void 0 ? void 0 : _paymentContext$payme4.productScene;
|
125
|
+
var productSceneVersion = (_paymentContext$payme5 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme5 === void 0 ? void 0 : _paymentContext$payme5.productSceneVersion;
|
120
126
|
var hostSign = this.hostSign;
|
121
|
-
var
|
127
|
+
var mid = paymentContext.paymentSessionObj.clientId;
|
128
|
+
var extendInfo = paymentContext.paymentSessionObj.extendInfo;
|
129
|
+
var webAppUrl = WebAppUrlUtil.getWebAppV2Url({
|
122
130
|
environment: this.initConfig.environment,
|
123
131
|
paymentMethodCategoryType: paymentMethodCategoryType,
|
124
132
|
sdkMetaData: paymentContext.sdkMetaData,
|
133
|
+
productScene: productScene,
|
125
134
|
productSceneVersion: productSceneVersion,
|
126
135
|
isPreload: false,
|
127
136
|
query: {
|
@@ -130,7 +139,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
130
139
|
instanceId: this.instanceId,
|
131
140
|
locale: this.initConfig.locale,
|
132
141
|
hostSign: hostSign
|
133
|
-
}
|
142
|
+
},
|
143
|
+
mid: mid,
|
144
|
+
extendInfo: extendInfo
|
134
145
|
});
|
135
146
|
return webAppUrl;
|
136
147
|
}
|
@@ -177,42 +188,48 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
177
188
|
});
|
178
189
|
|
179
190
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
180
|
-
Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
181
|
-
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
|
182
|
-
var _ref2 = _slicedToArray(_ref,
|
191
|
+
Promise.all([this.initSecuritySDK(), this.processQuery(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
192
|
+
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext3, _this$paymentContext$4;
|
193
|
+
var _ref2 = _slicedToArray(_ref, 4),
|
183
194
|
_initSecurityRes = _ref2[0],
|
184
|
-
|
185
|
-
|
195
|
+
queryRes = _ref2[1],
|
196
|
+
submitRes = _ref2[2],
|
197
|
+
_webLaunchRes = _ref2[3];
|
186
198
|
var logMetaData = _this.logger.getLogConfig().mdata;
|
199
|
+
var data = {
|
200
|
+
sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
|
201
|
+
submitResult: submitRes,
|
202
|
+
paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
|
203
|
+
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
204
|
+
renderDisplayType: _this.paymentContext.displayInfo.type,
|
205
|
+
appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
|
206
|
+
notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
|
207
|
+
isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
|
208
|
+
merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
|
209
|
+
allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
|
210
|
+
doubleFaUrl: getDoubleFaUrlFromSession((_this$paymentContext3 = _this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionObj, _this.initConfig.environment),
|
211
|
+
envInfo: {
|
212
|
+
screenHeight: screen.height,
|
213
|
+
screenWidth: screen.width
|
214
|
+
},
|
215
|
+
logMetaData: _objectSpread(_objectSpread({
|
216
|
+
trackId: logMetaData.requestSeq,
|
217
|
+
platform: logMetaData.platform,
|
218
|
+
firstLogTime: logMetaData.firstLogTime
|
219
|
+
}, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
|
220
|
+
renderDisplayType: logMetaData.renderDisplayType,
|
221
|
+
sdkVersion: logMetaData.sdkVersion,
|
222
|
+
merchantId: logMetaData.merchantId,
|
223
|
+
instanceId: logMetaData.instanceId,
|
224
|
+
paymentMethodType: logMetaData.paymentMethodType
|
225
|
+
})
|
226
|
+
};
|
227
|
+
if (queryRes) {
|
228
|
+
data.queryResult = queryRes;
|
229
|
+
}
|
187
230
|
_this.eventCenter.dispatchToApp({
|
188
231
|
event: 'renderComponent',
|
189
|
-
data:
|
190
|
-
sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
|
191
|
-
submitResult: submitRes,
|
192
|
-
paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
|
193
|
-
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
194
|
-
renderDisplayType: _this.paymentContext.displayInfo.type,
|
195
|
-
appearance: (_this$paymentContext$ = _this.paymentContext.displayInfo) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.appearance,
|
196
|
-
notRedirectAfterComplete: ((_this$paymentContext$2 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.notRedirectAfterComplete) === true,
|
197
|
-
isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
|
198
|
-
merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
|
199
|
-
allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
|
200
|
-
envInfo: {
|
201
|
-
screenHeight: screen.height,
|
202
|
-
screenWidth: screen.width
|
203
|
-
},
|
204
|
-
logMetaData: _objectSpread(_objectSpread({
|
205
|
-
trackId: logMetaData.requestSeq,
|
206
|
-
platform: logMetaData.platform,
|
207
|
-
firstLogTime: logMetaData.firstLogTime
|
208
|
-
}, ((_this$paymentContext$4 = _this.paymentContext.paymentSessionObj) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.paymentSessionConfig) || {}), {}, {
|
209
|
-
renderDisplayType: logMetaData.renderDisplayType,
|
210
|
-
sdkVersion: logMetaData.sdkVersion,
|
211
|
-
merchantId: logMetaData.merchantId,
|
212
|
-
instanceId: logMetaData.instanceId,
|
213
|
-
paymentMethodType: logMetaData.paymentMethodType
|
214
|
-
})
|
215
|
-
}
|
232
|
+
data: data
|
216
233
|
});
|
217
234
|
}).catch(function (error) {
|
218
235
|
_this.eventCenter.emit(EVENT.destroy.name, {});
|
@@ -225,24 +242,108 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
225
242
|
});
|
226
243
|
}
|
227
244
|
}, {
|
228
|
-
key: "
|
245
|
+
key: "processQuery",
|
229
246
|
value: function () {
|
230
|
-
var
|
231
|
-
var _this$
|
232
|
-
var
|
247
|
+
var _processQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
248
|
+
var _this$paymentContext4, _this$paymentContext5, _this$paymentContext6, _this$paymentContext$5, _this$paymentContext7, _this$paymentContext8;
|
249
|
+
var queryParams, extendInfo, needAccountConfirmPage, isFirstTimeToPay, needQueryRender, extendInfoData, requestBizId, requester, _this$paymentContext$6, res;
|
233
250
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
234
251
|
while (1) switch (_context2.prev = _context2.next) {
|
252
|
+
case 0:
|
253
|
+
queryParams = {
|
254
|
+
paymentSessionData: ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionId) || '',
|
255
|
+
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
|
256
|
+
};
|
257
|
+
extendInfo = (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionObj.extendInfo;
|
258
|
+
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;
|
259
|
+
isFirstTimeToPay = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.autoDebitWithToken);
|
260
|
+
needQueryRender = true;
|
261
|
+
try {
|
262
|
+
extendInfoData = JSON.parse(extendInfo);
|
263
|
+
needQueryRender = isEmpty(extendInfoData.needQueryRender) || extendInfoData.needQueryRender === true;
|
264
|
+
} catch (error) {
|
265
|
+
console.log(error);
|
266
|
+
}
|
267
|
+
this.allowQueryCall = needQueryRender && isFirstTimeToPay && needAccountConfirmPage;
|
268
|
+
if (this.allowQueryCall) {
|
269
|
+
_context2.next = 9;
|
270
|
+
break;
|
271
|
+
}
|
272
|
+
return _context2.abrupt("return", null);
|
273
|
+
case 9:
|
274
|
+
requestBizId = uuid();
|
275
|
+
this.logger.logInfo({
|
276
|
+
title: 'sdk_event_sdkQuery'
|
277
|
+
}, {
|
278
|
+
config: JSON.stringify(queryParams.paymentSessionConfig),
|
279
|
+
requestId: requestBizId
|
280
|
+
});
|
281
|
+
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
282
|
+
_context2.prev = 12;
|
283
|
+
_context2.next = 15;
|
284
|
+
return requester.request(_objectSpread(_objectSpread({}, queryParams), {}, {
|
285
|
+
actionType: 'init',
|
286
|
+
integrationType: 'SDK',
|
287
|
+
sdkVersion: (_this$paymentContext$6 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$6 !== void 0 ? _this$paymentContext$6 : '1.0.0'
|
288
|
+
}), {
|
289
|
+
env: this.initConfig.environment,
|
290
|
+
timeout: this.SDK_REQUEST_TIMEOUT,
|
291
|
+
hostSign: this.hostSign,
|
292
|
+
needEnvInfo: true,
|
293
|
+
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
294
|
+
});
|
295
|
+
case 15:
|
296
|
+
res = _context2.sent;
|
297
|
+
this.logger.logInfo({
|
298
|
+
title: 'sdk_event_sdkQueryEnd'
|
299
|
+
}, {
|
300
|
+
config: JSON.stringify(queryParams.paymentSessionConfig),
|
301
|
+
requestId: requestBizId,
|
302
|
+
rpcTraceId: res.traceId
|
303
|
+
});
|
304
|
+
return _context2.abrupt("return", res);
|
305
|
+
case 20:
|
306
|
+
_context2.prev = 20;
|
307
|
+
_context2.t0 = _context2["catch"](12);
|
308
|
+
this.logger.logError({
|
309
|
+
title: 'sdk_event_sdkQuery_failed'
|
310
|
+
}, {
|
311
|
+
config: JSON.stringify(queryParams.paymentSessionConfig),
|
312
|
+
errorMessage: JSON.stringify(_context2.t0),
|
313
|
+
requestId: requestBizId,
|
314
|
+
rpcTraceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
|
315
|
+
});
|
316
|
+
return _context2.abrupt("return", null);
|
317
|
+
case 24:
|
318
|
+
case "end":
|
319
|
+
return _context2.stop();
|
320
|
+
}
|
321
|
+
}, _callee2, this, [[12, 20]]);
|
322
|
+
}));
|
323
|
+
function processQuery() {
|
324
|
+
return _processQuery.apply(this, arguments);
|
325
|
+
}
|
326
|
+
return processQuery;
|
327
|
+
}()
|
328
|
+
}, {
|
329
|
+
key: "processSubmitPay",
|
330
|
+
value: function () {
|
331
|
+
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
332
|
+
var _this$paymentContext9, _this$paymentContext10, _this$paymentContext11, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$8, _this$paymentContext12;
|
333
|
+
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;
|
334
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
335
|
+
while (1) switch (_context3.prev = _context3.next) {
|
235
336
|
case 0:
|
236
337
|
submitParams = {
|
237
|
-
paymentSessionData: ((_this$
|
238
|
-
paymentSessionConfig: (_this$
|
338
|
+
paymentSessionData: ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionId) || '',
|
339
|
+
paymentSessionConfig: (_this$paymentContext10 = this.paymentContext) === null || _this$paymentContext10 === void 0 || (_this$paymentContext10 = _this$paymentContext10.paymentSessionObj) === null || _this$paymentContext10 === void 0 ? void 0 : _this$paymentContext10.paymentSessionConfig
|
239
340
|
};
|
240
341
|
_ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
|
241
|
-
_ref4 = ((_this$
|
342
|
+
_ref4 = ((_this$paymentContext11 = this.paymentContext) === null || _this$paymentContext11 === void 0 ? void 0 : _this$paymentContext11.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;
|
242
343
|
if (productSceneVersion === '2.0' && !autoDebitWithToken) {
|
243
344
|
///EasyPay 2.0 首次传signAgreement字段
|
244
345
|
submitParams['signAgreement'] = enableSignAgreement;
|
245
|
-
paymentMethodType = (_this$paymentContext$
|
346
|
+
paymentMethodType = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentMethodInfoView) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.paymentMethodType;
|
246
347
|
isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
|
247
348
|
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
248
349
|
backScheme = getBackScheme(undefined, this.logger);
|
@@ -254,10 +355,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
254
355
|
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
255
356
|
//console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
256
357
|
if (this.allowSubmitPayCallAhead) {
|
257
|
-
|
358
|
+
_context3.next = 7;
|
258
359
|
break;
|
259
360
|
}
|
260
|
-
return
|
361
|
+
return _context3.abrupt("return", {
|
261
362
|
message: 'sdk no need to make submitPay request',
|
262
363
|
success: true
|
263
364
|
});
|
@@ -273,39 +374,46 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
273
374
|
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, {
|
274
375
|
instanceId: this.instanceId,
|
275
376
|
locale: this.initConfig.locale,
|
276
|
-
paymentMethodType: (_this$paymentContext$
|
377
|
+
paymentMethodType: (_this$paymentContext$8 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$8 === void 0 || (_this$paymentContext$8 = _this$paymentContext$8.paymentMethodInfoView) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.paymentMethodType,
|
277
378
|
paymentSessionData: this.paymentContext.paymentSessionId,
|
379
|
+
paymentSessionObj: this.paymentContext.paymentSessionObj,
|
278
380
|
env: this.initConfig.environment,
|
279
|
-
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
|
280
|
-
|
281
|
-
|
381
|
+
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion,
|
382
|
+
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
|
383
|
+
})) || {}; // 二次支付不再需要该参数
|
384
|
+
if (!autoDebitWithToken) {
|
385
|
+
extParams.complianceSDK = true;
|
386
|
+
}
|
282
387
|
submitParams.extParams = extParams;
|
283
388
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
389
|
+
_context3.prev = 13;
|
390
|
+
_context3.t0 = requester;
|
391
|
+
_context3.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
|
392
|
+
integrationType: 'SDK',
|
393
|
+
sdkVersion: (_this$paymentContext$9 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$9 !== void 0 ? _this$paymentContext$9 : '1.0.0'
|
394
|
+
});
|
395
|
+
_context3.t2 = this.initConfig.environment;
|
396
|
+
_context3.t3 = this.SDK_REQUEST_TIMEOUT;
|
397
|
+
_context3.next = 20;
|
290
398
|
return this.acquireApdidToken();
|
291
399
|
case 20:
|
292
|
-
|
293
|
-
|
294
|
-
deviceId:
|
400
|
+
_context3.t4 = _context3.sent;
|
401
|
+
_context3.t5 = {
|
402
|
+
deviceId: _context3.t4
|
295
403
|
};
|
296
|
-
|
297
|
-
|
298
|
-
env:
|
299
|
-
timeout:
|
300
|
-
envInfo:
|
301
|
-
hostSign:
|
404
|
+
_context3.t6 = this.hostSign;
|
405
|
+
_context3.t7 = {
|
406
|
+
env: _context3.t2,
|
407
|
+
timeout: _context3.t3,
|
408
|
+
envInfo: _context3.t5,
|
409
|
+
hostSign: _context3.t6,
|
302
410
|
needEnvInfo: true,
|
303
411
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
304
412
|
};
|
305
|
-
|
306
|
-
return
|
413
|
+
_context3.next = 26;
|
414
|
+
return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t7);
|
307
415
|
case 26:
|
308
|
-
res =
|
416
|
+
res = _context3.sent;
|
309
417
|
this.logger.logInfo({
|
310
418
|
title: 'sdk_event_submitPayEnd'
|
311
419
|
}, {
|
@@ -313,24 +421,24 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
313
421
|
requestId: requestBizId,
|
314
422
|
rpcTraceId: res.traceId
|
315
423
|
});
|
316
|
-
return
|
424
|
+
return _context3.abrupt("return", res);
|
317
425
|
case 31:
|
318
|
-
|
319
|
-
|
426
|
+
_context3.prev = 31;
|
427
|
+
_context3.t8 = _context3["catch"](13);
|
320
428
|
this.logger.logError({
|
321
429
|
title: 'sdk_event_submitPay_failed'
|
322
430
|
}, {
|
323
431
|
config: JSON.stringify(submitParams.paymentSessionConfig),
|
324
|
-
errorMessage: JSON.stringify(
|
432
|
+
errorMessage: JSON.stringify(_context3.t8),
|
325
433
|
requestId: requestBizId,
|
326
|
-
rpcTraceId:
|
434
|
+
rpcTraceId: _context3.t8 === null || _context3.t8 === void 0 ? void 0 : _context3.t8.traceId
|
327
435
|
});
|
328
|
-
return
|
436
|
+
return _context3.abrupt("return", null);
|
329
437
|
case 35:
|
330
438
|
case "end":
|
331
|
-
return
|
439
|
+
return _context3.stop();
|
332
440
|
}
|
333
|
-
},
|
441
|
+
}, _callee3, this, [[13, 31]]);
|
334
442
|
}));
|
335
443
|
function processSubmitPay() {
|
336
444
|
return _processSubmitPay.apply(this, arguments);
|
@@ -340,23 +448,23 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
340
448
|
}, {
|
341
449
|
key: "acquireApdidToken",
|
342
450
|
value: function () {
|
343
|
-
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
344
|
-
var _this$paymentContext$
|
451
|
+
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
452
|
+
var _this$paymentContext$10;
|
345
453
|
var securityService, productScene, deviceId;
|
346
|
-
return _regeneratorRuntime().wrap(function
|
347
|
-
while (1) switch (
|
454
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
455
|
+
while (1) switch (_context4.prev = _context4.next) {
|
348
456
|
case 0:
|
349
457
|
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
350
|
-
productScene = (_this$paymentContext$
|
458
|
+
productScene = (_this$paymentContext$10 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$10 === void 0 || (_this$paymentContext$10 = _this$paymentContext$10.paymentSessionConfig) === null || _this$paymentContext$10 === void 0 ? void 0 : _this$paymentContext$10.productScene;
|
351
459
|
deviceId = securityService.getDeviceId({
|
352
460
|
productScene: productScene
|
353
461
|
});
|
354
|
-
return
|
462
|
+
return _context4.abrupt("return", deviceId);
|
355
463
|
case 4:
|
356
464
|
case "end":
|
357
|
-
return
|
465
|
+
return _context4.stop();
|
358
466
|
}
|
359
|
-
},
|
467
|
+
}, _callee4, this);
|
360
468
|
}));
|
361
469
|
function acquireApdidToken() {
|
362
470
|
return _acquireApdidToken.apply(this, arguments);
|
@@ -366,15 +474,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
366
474
|
}, {
|
367
475
|
key: "initSecuritySDK",
|
368
476
|
value: function () {
|
369
|
-
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
370
|
-
var _this$paymentContext$
|
371
|
-
return _regeneratorRuntime().wrap(function
|
372
|
-
while (1) switch (
|
477
|
+
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
478
|
+
var _this$paymentContext$11, _this$paymentContext$12, _this$paymentContext$13, _this$paymentContext$14, _this$paymentContext$15, _this$paymentContext$16, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
|
479
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
480
|
+
while (1) switch (_context5.prev = _context5.next) {
|
373
481
|
case 0:
|
374
|
-
|
482
|
+
_context5.prev = 0;
|
375
483
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
376
|
-
|
377
|
-
|
484
|
+
nonInitSecuritySDK = (_this$paymentContext$11 = (_this$paymentContext$12 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$12 === void 0 ? void 0 : _this$paymentContext$12.nonInitSecuritySDK) !== null && _this$paymentContext$11 !== void 0 ? _this$paymentContext$11 : false;
|
485
|
+
signButtonDisplay = (_this$paymentContext$13 = (_this$paymentContext$14 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$14 === void 0 ? void 0 : _this$paymentContext$14.signButtonDisplay) !== null && _this$paymentContext$13 !== void 0 ? _this$paymentContext$13 : false;
|
486
|
+
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;
|
378
487
|
isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
379
488
|
shouldInitSecuritySDK = false;
|
380
489
|
if (nonInitSecuritySDK) {
|
@@ -387,44 +496,38 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
387
496
|
// console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
|
388
497
|
shouldInitSecuritySDK = false;
|
389
498
|
} else if (productSceneVersion === '2.0') {
|
390
|
-
if (
|
391
|
-
//
|
392
|
-
|
393
|
-
shouldInitSecuritySDK = true;
|
499
|
+
if (isFirstTimeToPay) {
|
500
|
+
// console.log((signButtonDisplay && userSignAgreement) ? '[web-sdk][security-sdk] DO init security sdk for easypay 2.0, first time to pay and user agreeement signing from merchant' : '[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0, first time to pay and user agreeement has not been signed from merchant');
|
501
|
+
shouldInitSecuritySDK = signButtonDisplay && userSignAgreement;
|
394
502
|
} else {
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
} else {
|
399
|
-
// 切流「隐私合规」且非首次支付
|
400
|
-
// console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
|
401
|
-
shouldInitSecuritySDK = true;
|
402
|
-
}
|
503
|
+
// 切流「隐私合规」且非首次支付
|
504
|
+
// console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
|
505
|
+
shouldInitSecuritySDK = true;
|
403
506
|
}
|
404
507
|
}
|
405
508
|
}
|
406
509
|
if (!shouldInitSecuritySDK) {
|
407
|
-
|
510
|
+
_context5.next = 11;
|
408
511
|
break;
|
409
512
|
}
|
410
|
-
|
513
|
+
_context5.next = 11;
|
411
514
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
412
|
-
case
|
515
|
+
case 11:
|
413
516
|
this.logger.logInfo({
|
414
517
|
title: 'a3753.b101271.c388193.d514078'
|
415
518
|
}, {
|
416
519
|
riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
|
417
520
|
});
|
418
|
-
|
521
|
+
_context5.next = 16;
|
419
522
|
break;
|
420
|
-
case
|
421
|
-
|
422
|
-
|
423
|
-
case
|
523
|
+
case 14:
|
524
|
+
_context5.prev = 14;
|
525
|
+
_context5.t0 = _context5["catch"](0);
|
526
|
+
case 16:
|
424
527
|
case "end":
|
425
|
-
return
|
528
|
+
return _context5.stop();
|
426
529
|
}
|
427
|
-
},
|
530
|
+
}, _callee5, this, [[0, 14]]);
|
428
531
|
}));
|
429
532
|
function initSecuritySDK() {
|
430
533
|
return _initSecuritySDK.apply(this, arguments);
|
@@ -11,7 +11,7 @@ import { isEmpty } from "../../../util";
|
|
11
11
|
import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
|
12
12
|
import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
|
13
13
|
import { insertStyleSheet } from "../../../component/popupWindow.style";
|
14
|
-
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
|
14
|
+
import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT, closeImg, closeImgLight } from "../../../constant";
|
15
15
|
import { DisplayTypeEnum, ProductSceneEnum } from "../../../types";
|
16
16
|
import { ServiceProvider } from "../index";
|
17
17
|
import { PopupManager } from "./popup";
|
@@ -194,7 +194,8 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
194
194
|
this.eventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
195
195
|
_this.handleSizeChanged(_objectSpread({}, data));
|
196
196
|
});
|
197
|
-
this.eventCenter.listen(EVENT.showCloseButton.name, function () {
|
197
|
+
this.eventCenter.listen(EVENT.showCloseButton.name, function (data) {
|
198
|
+
_this.handleCloseButtonTheme(data.theme);
|
198
199
|
_this.changeCloseBtnVisibility(true);
|
199
200
|
});
|
200
201
|
this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
|
@@ -323,6 +324,23 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
323
324
|
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
|
324
325
|
}
|
325
326
|
}
|
327
|
+
}, {
|
328
|
+
key: "handleCloseButtonTheme",
|
329
|
+
value: function handleCloseButtonTheme(theme) {
|
330
|
+
if (!theme) return;
|
331
|
+
var closeBlock = document.getElementById(COMPONENT_CLOSE_BLOCK_ID);
|
332
|
+
var closeButtonImg = closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.querySelector('img');
|
333
|
+
var maskCloseBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
|
334
|
+
if (theme === 'light') {
|
335
|
+
closeButtonImg === null || closeButtonImg === void 0 || closeButtonImg.setAttribute('src', closeImgLight);
|
336
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-light"));
|
337
|
+
maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
|
338
|
+
} else {
|
339
|
+
closeButtonImg === null || closeButtonImg === void 0 || closeButtonImg.setAttribute('src', closeImg);
|
340
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_BLOCK_ID, "-light"));
|
341
|
+
maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
|
342
|
+
}
|
343
|
+
}
|
326
344
|
}, {
|
327
345
|
key: "getWebApp",
|
328
346
|
value: function getWebApp() {
|
@@ -4,10 +4,10 @@ export default class PreloadHelper {
|
|
4
4
|
static isWebAppPreloaded: boolean;
|
5
5
|
static isSecuritySDKPreloaded: boolean;
|
6
6
|
private static securitySdkMap;
|
7
|
-
static preloadWebApp(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment?: string): void;
|
7
|
+
static preloadWebApp(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment?: string, useV2?: boolean): void;
|
8
8
|
static preloadSecuritySDK(product: ProductSceneEnum, securityRegion?: string): void;
|
9
9
|
static getSecuritySdk(scene: any): Security;
|
10
|
-
static buildWebAppPreloadUrl(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment: string): {
|
10
|
+
static buildWebAppPreloadUrl(productScene: ProductSceneEnum, paymentMethodCategoryType: PaymentMethodCategoryTypeEnum, environment: string, useV2?: boolean): {
|
11
11
|
preloadUrl: string;
|
12
12
|
containerId: string;
|
13
13
|
};
|