@alipay/ams-checkout 0.0.1730107332-dev.1 → 0.0.1730107332-dev.11
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 -2
- package/esm/component/channel.js +57 -29
- package/esm/foundation/core/index.js +68 -39
- package/esm/foundation/index.d.ts +3 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +5 -4
- package/esm/foundation/product-processor/easysafepay/deps.js +4 -3
- package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -1
- package/esm/foundation/product-processor/easysafepay/index.js +131 -235
- package/esm/foundation/service/container/index.js +0 -1
- package/esm/foundation/service/security/index.js +1 -0
- package/esm/foundation/utils/redirect_utils.js +24 -8
- package/esm/index.js +2 -1
- package/esm/types/index.d.ts +3 -23
- package/esm/types/index.js +0 -3
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/getBackScheme.js +134 -0
- package/esm/util/index.d.ts +2 -11
- package/esm/util/index.js +17 -84
- package/esm/util/intl-callapp/es/index.js +1 -0
- package/package.json +1 -1
@@ -16,7 +16,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
16
16
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
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
|
-
import {
|
19
|
+
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, ProductInfoCacheUtil, ProductSceneEnum, ServiceProvider, uuid, WebAppUrlUtil, isEmpty } from "./deps";
|
20
20
|
export var EasySafePayProcessor = /*#__PURE__*/function () {
|
21
21
|
function EasySafePayProcessor() {
|
22
22
|
_classCallCheck(this, EasySafePayProcessor);
|
@@ -74,9 +74,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
74
74
|
}
|
75
75
|
return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
|
76
76
|
case 12:
|
77
|
-
_context.next = 14;
|
78
|
-
return this.initSecuritySDK();
|
79
|
-
case 14:
|
80
77
|
// 下面的场景是需要渲染UI的渠道, 打开WebUrl
|
81
78
|
webAppUrl = this.buildWebAppUrl(); // const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
|
82
79
|
resultPayload = {
|
@@ -88,14 +85,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
88
85
|
hostSign: this.hostSign,
|
89
86
|
productSceneVersion: productSceneVersion
|
90
87
|
});
|
91
|
-
// 返回结果之前,发送
|
88
|
+
// 返回结果之前,发送 sessionData,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
|
92
89
|
this.sendRequestAndWaitWebLaunch();
|
93
90
|
// 返回结果,RENDER,让外层去处理iframe加载等逻辑
|
94
91
|
return _context.abrupt("return", {
|
95
92
|
behaviorType: 'RENDER',
|
96
93
|
payload: resultPayload
|
97
94
|
});
|
98
|
-
case
|
95
|
+
case 17:
|
99
96
|
case "end":
|
100
97
|
return _context.stop();
|
101
98
|
}
|
@@ -209,15 +206,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
209
206
|
value: function sendRequestAndWaitWebLaunch() {
|
210
207
|
var _this2 = this;
|
211
208
|
var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
212
|
-
var requestPromise = Promise.all([this.processPaymentQuery(), this.processSubmitPay()]).then(function (_ref) {
|
213
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
214
|
-
queryRes = _ref2[0],
|
215
|
-
submitRes = _ref2[1];
|
216
|
-
return {
|
217
|
-
queryRes: queryRes,
|
218
|
-
submitRes: submitRes
|
219
|
-
};
|
220
|
-
});
|
221
209
|
var webLaunchPromise = new Promise(function (resolve) {
|
222
210
|
eventCenter.listen('onLaunch', function (res) {
|
223
211
|
resolve(res);
|
@@ -225,24 +213,31 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
225
213
|
});
|
226
214
|
|
227
215
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
228
|
-
Promise.all([
|
229
|
-
var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6;
|
230
|
-
var
|
231
|
-
|
232
|
-
|
216
|
+
Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
217
|
+
var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6, _this2$paymentContext7, _this2$paymentContext8, _this2$paymentContext9;
|
218
|
+
var _ref2 = _slicedToArray(_ref, 3),
|
219
|
+
_initSecurityRes = _ref2[0],
|
220
|
+
submitRes = _ref2[1],
|
221
|
+
_webLaunchRes = _ref2[2];
|
233
222
|
var logMetaData = _this2.logger.getLogConfig().mdata;
|
234
223
|
eventCenter.dispatchToApp({
|
235
224
|
event: 'renderComponent',
|
236
225
|
data: {
|
237
|
-
queryResult:
|
238
|
-
|
239
|
-
|
240
|
-
|
226
|
+
queryResult: isEmpty((_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj) ? {
|
227
|
+
success: false
|
228
|
+
} : _objectSpread({
|
229
|
+
success: true,
|
230
|
+
orderAmount: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 || (_this2$paymentContext2 = _this2$paymentContext2.paymentSessionObj) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentView
|
231
|
+
}, (_this2$paymentContext3 = _this2.paymentContext) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.paymentSessionObj),
|
232
|
+
sessionResult: (_this2$paymentContext4 = _this2.paymentContext) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.paymentSessionObj,
|
233
|
+
submitResult: submitRes,
|
234
|
+
paymentSessionData: (_this2$paymentContext5 = _this2.paymentContext) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.paymentSession,
|
241
235
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
242
236
|
renderDisplayType: _this2.paymentContext.displayInfo.type,
|
243
|
-
appearance: (_this2$
|
244
|
-
notRedirectAfterComplete: ((_this2$
|
245
|
-
|
237
|
+
appearance: (_this2$paymentContext6 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext6 === void 0 ? void 0 : _this2$paymentContext6.appearance,
|
238
|
+
notRedirectAfterComplete: ((_this2$paymentContext7 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext7 === void 0 ? void 0 : _this2$paymentContext7.notRedirectAfterComplete) === true,
|
239
|
+
isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
|
240
|
+
merchantAppointParam: (_this2$paymentContext8 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext8 === void 0 ? void 0 : _this2$paymentContext8.merchantAppointParam,
|
246
241
|
allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
|
247
242
|
envInfo: {
|
248
243
|
screenHeight: screen.height,
|
@@ -252,7 +247,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
252
247
|
trackId: logMetaData.requestSeq,
|
253
248
|
platform: logMetaData.platform,
|
254
249
|
firstLogTime: logMetaData.firstLogTime
|
255
|
-
}, ((_this2$
|
250
|
+
}, ((_this2$paymentContext9 = _this2.paymentContext.paymentSessionObj) === null || _this2$paymentContext9 === void 0 ? void 0 : _this2$paymentContext9.paymentSessionConfig) || {}), {}, {
|
256
251
|
renderDisplayType: logMetaData.renderDisplayType,
|
257
252
|
sdkVersion: logMetaData.sdkVersion,
|
258
253
|
merchantId: logMetaData.merchantId,
|
@@ -264,160 +259,40 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
264
259
|
});
|
265
260
|
}
|
266
261
|
}, {
|
267
|
-
key: "
|
262
|
+
key: "processSubmitPay",
|
268
263
|
value: function () {
|
269
|
-
var
|
270
|
-
var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$
|
271
|
-
var
|
264
|
+
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
265
|
+
var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$2;
|
266
|
+
var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, res;
|
272
267
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
273
268
|
while (1) switch (_context2.prev = _context2.next) {
|
274
|
-
case 0:
|
275
|
-
envInfo = {
|
276
|
-
locale: this.initConfig.locale
|
277
|
-
}; //
|
278
|
-
requestData = {
|
279
|
-
paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
|
280
|
-
paymentSessionConfig: (_this$paymentContext2 = this.paymentContext) === null || _this$paymentContext2 === void 0 || (_this$paymentContext2 = _this$paymentContext2.paymentSessionObj) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionConfig,
|
281
|
-
notRedirectAfterComplete: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.startBizFlowOptions.submitPayRequestExtra.notRedirectAfterComplete) === true
|
282
|
-
// merchantAppointParam: this._merchantAppointParam,
|
283
|
-
};
|
284
|
-
extendInfo = ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.extendInfo) || '';
|
285
|
-
actionData = (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.action;
|
286
|
-
enableEasypayApiOptimize = false;
|
287
|
-
try {
|
288
|
-
extendInfoData = JSON.parse(extendInfo);
|
289
|
-
enableEasypayApiOptimize = extendInfoData.enableEasypayApiOptimize || false;
|
290
|
-
} catch (error) {
|
291
|
-
console.log(error);
|
292
|
-
}
|
293
|
-
if (!isLocalMock()) {
|
294
|
-
_context2.next = 8;
|
295
|
-
break;
|
296
|
-
}
|
297
|
-
return _context2.abrupt("return", {
|
298
|
-
message: 'sdk no need to make query request',
|
299
|
-
success: true
|
300
|
-
});
|
301
|
-
case 8:
|
302
|
-
if (!((_this$channelBehavior2 = this.channelBehavior) !== null && _this$channelBehavior2 !== void 0 && _this$channelBehavior2.usePaymentSessionAsQueryResult)) {
|
303
|
-
_context2.next = 10;
|
304
|
-
break;
|
305
|
-
}
|
306
|
-
return _context2.abrupt("return", {
|
307
|
-
autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
|
308
|
-
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
309
|
-
success: true
|
310
|
-
});
|
311
|
-
case 10:
|
312
|
-
if (!(actionData.skipSdkQuery && enableEasypayApiOptimize)) {
|
313
|
-
_context2.next = 12;
|
314
|
-
break;
|
315
|
-
}
|
316
|
-
return _context2.abrupt("return", {
|
317
|
-
message: 'sdk no need to make query request',
|
318
|
-
success: true
|
319
|
-
});
|
320
|
-
case 12:
|
321
|
-
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion; // ESP 2.0 无需Query
|
322
|
-
if (!(productSceneVersion === '2.0')) {
|
323
|
-
_context2.next = 15;
|
324
|
-
break;
|
325
|
-
}
|
326
|
-
return _context2.abrupt("return", {
|
327
|
-
message: 'sdk no need to make query request',
|
328
|
-
success: true
|
329
|
-
});
|
330
|
-
case 15:
|
331
|
-
_context2.next = 17;
|
332
|
-
return this.acquireApdidToken();
|
333
|
-
case 17:
|
334
|
-
envInfo.deviceId = _context2.sent;
|
335
|
-
requestBizId = uuid(); // 打日志
|
336
|
-
this.logger.logInfo({
|
337
|
-
title: 'sdk_event_sdkQuery'
|
338
|
-
}, {
|
339
|
-
paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
|
340
|
-
requestBizId: requestBizId
|
341
|
-
});
|
342
|
-
|
343
|
-
// 真正发请求
|
344
|
-
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
345
|
-
_context2.prev = 21;
|
346
|
-
_context2.next = 24;
|
347
|
-
return requester.request(requestData, {
|
348
|
-
env: this.initConfig.environment,
|
349
|
-
envInfo: envInfo,
|
350
|
-
hostSign: this.hostSign,
|
351
|
-
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
352
|
-
});
|
353
|
-
case 24:
|
354
|
-
res = _context2.sent;
|
355
|
-
this.logger.logInfo({
|
356
|
-
title: 'sdk_event_sdkQueryEnd'
|
357
|
-
}, {
|
358
|
-
paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
|
359
|
-
requestBizId: requestBizId,
|
360
|
-
traceId: res.traceId
|
361
|
-
});
|
362
|
-
return _context2.abrupt("return", res);
|
363
|
-
case 29:
|
364
|
-
_context2.prev = 29;
|
365
|
-
_context2.t0 = _context2["catch"](21);
|
366
|
-
this.logger.logError({
|
367
|
-
title: 'sdk_event_sdkQuery_failed'
|
368
|
-
}, {
|
369
|
-
paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
|
370
|
-
errorReason: _context2.t0,
|
371
|
-
requestBizId: requestBizId,
|
372
|
-
traceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
|
373
|
-
});
|
374
|
-
throw _context2.t0;
|
375
|
-
case 33:
|
376
|
-
case "end":
|
377
|
-
return _context2.stop();
|
378
|
-
}
|
379
|
-
}, _callee2, this, [[21, 29]]);
|
380
|
-
}));
|
381
|
-
function processPaymentQuery() {
|
382
|
-
return _processPaymentQuery.apply(this, arguments);
|
383
|
-
}
|
384
|
-
return processPaymentQuery;
|
385
|
-
}()
|
386
|
-
}, {
|
387
|
-
key: "processSubmitPay",
|
388
|
-
value: function () {
|
389
|
-
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
390
|
-
var _this$paymentContext6, _this$paymentContext7, _this$paymentContext9, _this$channelBehavior3, _this$channelBehavior4, _this$paymentContext$;
|
391
|
-
var submitParams, shouldSkipSubmitPayInSDK, _this$paymentContext8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref6, _ref6$action, _ref6$action2, _ref6$action2$enableS, enableSignAgreement, _ref6$action2$autoDeb, autoDebitWithToken, requestBizId, extParams, requester, res;
|
392
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
393
|
-
while (1) switch (_context3.prev = _context3.next) {
|
394
269
|
case 0:
|
395
270
|
submitParams = {
|
396
|
-
paymentSessionData: ((_this$
|
397
|
-
paymentSessionConfig: (_this$
|
271
|
+
paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
|
272
|
+
paymentSessionConfig: (_this$paymentContext2 = this.paymentContext) === null || _this$paymentContext2 === void 0 || (_this$paymentContext2 = _this$paymentContext2.paymentSessionObj) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionConfig
|
398
273
|
};
|
399
|
-
|
400
|
-
|
401
|
-
// 新逻辑走 channelBehavior判断
|
402
|
-
shouldSkipSubmitPayInSDK = !this.channelBehavior.submitPayInSdk;
|
403
|
-
} else {
|
404
|
-
// TODO: 拉会找栎昂、甘颜一起对下
|
405
|
-
// 老逻辑,只要服务端标记不跳过sdkquery,就需要跳过submitpay
|
406
|
-
shouldSkipSubmitPayInSDK = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.skipSdkQuery);
|
407
|
-
}
|
408
|
-
_ref5 = submitParams.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer;
|
409
|
-
_ref6 = ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionObj) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$enableS = _ref6$action2.enableSignAgreement, enableSignAgreement = _ref6$action2$enableS === void 0 ? false : _ref6$action2$enableS, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
|
274
|
+
_ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
|
275
|
+
_ref4 = ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.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;
|
410
276
|
if (productSceneVersion === '2.0' && !autoDebitWithToken) {
|
411
277
|
///EasyPay 2.0 首次传signAgreement字段
|
412
278
|
submitParams['signAgreement'] = enableSignAgreement;
|
279
|
+
paymentMethodType = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType;
|
280
|
+
isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
|
281
|
+
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
282
|
+
backScheme = getBackScheme(undefined, this.logger);
|
283
|
+
if (backScheme && backScheme !== 'https') {
|
284
|
+
submitParams['h5FromApp'] = encodeURIComponent(backScheme);
|
285
|
+
}
|
286
|
+
}
|
413
287
|
}
|
414
|
-
|
415
|
-
|
416
|
-
if (
|
417
|
-
|
288
|
+
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
289
|
+
console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
290
|
+
if (this.allowSubmitPayCallAhead) {
|
291
|
+
_context2.next = 9;
|
418
292
|
break;
|
419
293
|
}
|
420
|
-
|
294
|
+
console.log('[web-sdk] DO NOT call submitPay');
|
295
|
+
return _context2.abrupt("return", {
|
421
296
|
message: 'sdk no need to make submitPay request',
|
422
297
|
success: true
|
423
298
|
});
|
@@ -430,40 +305,42 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
430
305
|
requestBizId: requestBizId
|
431
306
|
});
|
432
307
|
// 由渠道定制点来构建额外参数
|
433
|
-
extParams = ((_this$
|
308
|
+
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, {
|
434
309
|
instanceId: this.instanceId,
|
435
310
|
locale: this.initConfig.locale,
|
436
|
-
paymentMethodType: (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext
|
311
|
+
paymentMethodType: (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentMethodInfoView) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.paymentMethodType,
|
437
312
|
paymentSessionData: this.paymentContext.paymentSession,
|
438
313
|
env: this.initConfig.environment,
|
439
314
|
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
|
440
315
|
})) || {};
|
316
|
+
extParams.complianceSDK = true;
|
441
317
|
submitParams.extParams = extParams;
|
442
318
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
319
|
+
_context2.prev = 15;
|
320
|
+
console.log('[web-sdk] DO call submitPay');
|
321
|
+
_context2.t0 = requester;
|
322
|
+
_context2.t1 = submitParams;
|
323
|
+
_context2.t2 = this.initConfig.environment;
|
324
|
+
_context2.next = 22;
|
448
325
|
return this.acquireApdidToken();
|
449
|
-
case
|
450
|
-
|
451
|
-
|
452
|
-
deviceId:
|
326
|
+
case 22:
|
327
|
+
_context2.t3 = _context2.sent;
|
328
|
+
_context2.t4 = {
|
329
|
+
deviceId: _context2.t3
|
453
330
|
};
|
454
|
-
|
455
|
-
|
456
|
-
env:
|
331
|
+
_context2.t5 = this.hostSign;
|
332
|
+
_context2.t6 = {
|
333
|
+
env: _context2.t2,
|
457
334
|
timeout: 15000,
|
458
|
-
envInfo:
|
459
|
-
hostSign:
|
335
|
+
envInfo: _context2.t4,
|
336
|
+
hostSign: _context2.t5,
|
460
337
|
needEnvInfo: true,
|
461
338
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
462
339
|
};
|
463
|
-
|
464
|
-
return
|
465
|
-
case
|
466
|
-
res =
|
340
|
+
_context2.next = 28;
|
341
|
+
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
|
342
|
+
case 28:
|
343
|
+
res = _context2.sent;
|
467
344
|
this.logger.logInfo({
|
468
345
|
title: 'sdk_event_submitPayEnd'
|
469
346
|
}, {
|
@@ -471,50 +348,50 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
471
348
|
requestBizId: requestBizId,
|
472
349
|
traceId: res.traceId
|
473
350
|
});
|
474
|
-
return
|
475
|
-
case
|
476
|
-
|
477
|
-
|
351
|
+
return _context2.abrupt("return", res);
|
352
|
+
case 33:
|
353
|
+
_context2.prev = 33;
|
354
|
+
_context2.t7 = _context2["catch"](15);
|
478
355
|
this.logger.logError({
|
479
356
|
title: 'sdk_event_submitPay_failed'
|
480
357
|
}, {
|
481
358
|
paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
|
482
|
-
errorReason:
|
359
|
+
errorReason: _context2.t7,
|
483
360
|
requestBizId: requestBizId,
|
484
|
-
traceId:
|
361
|
+
traceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
|
485
362
|
});
|
486
|
-
throw
|
487
|
-
case
|
363
|
+
throw _context2.t7;
|
364
|
+
case 37:
|
488
365
|
case "end":
|
489
|
-
return
|
366
|
+
return _context2.stop();
|
490
367
|
}
|
491
|
-
},
|
368
|
+
}, _callee2, this, [[15, 33]]);
|
492
369
|
}));
|
493
370
|
function processSubmitPay() {
|
494
371
|
return _processSubmitPay.apply(this, arguments);
|
495
372
|
}
|
496
373
|
return processSubmitPay;
|
497
|
-
}()
|
374
|
+
}()
|
498
375
|
}, {
|
499
376
|
key: "acquireApdidToken",
|
500
377
|
value: function () {
|
501
|
-
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
502
|
-
var _this$paymentContext$
|
378
|
+
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
379
|
+
var _this$paymentContext$3;
|
503
380
|
var securityService, productScene, deviceId;
|
504
|
-
return _regeneratorRuntime().wrap(function
|
505
|
-
while (1) switch (
|
381
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
382
|
+
while (1) switch (_context3.prev = _context3.next) {
|
506
383
|
case 0:
|
507
384
|
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
508
|
-
productScene = (_this$paymentContext$
|
385
|
+
productScene = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentSessionConfig) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.productScene;
|
509
386
|
deviceId = securityService.getDeviceId({
|
510
387
|
productScene: productScene
|
511
388
|
});
|
512
|
-
return
|
389
|
+
return _context3.abrupt("return", deviceId);
|
513
390
|
case 4:
|
514
391
|
case "end":
|
515
|
-
return
|
392
|
+
return _context3.stop();
|
516
393
|
}
|
517
|
-
},
|
394
|
+
}, _callee3, this);
|
518
395
|
}));
|
519
396
|
function acquireApdidToken() {
|
520
397
|
return _acquireApdidToken.apply(this, arguments);
|
@@ -524,52 +401,71 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
524
401
|
}, {
|
525
402
|
key: "initSecuritySDK",
|
526
403
|
value: function () {
|
527
|
-
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
528
|
-
var _this$paymentContext$
|
529
|
-
return _regeneratorRuntime().wrap(function
|
530
|
-
while (1) switch (
|
404
|
+
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
405
|
+
var _this$paymentContext$4, _this$paymentContext$5, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay;
|
406
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
407
|
+
while (1) switch (_context4.prev = _context4.next) {
|
531
408
|
case 0:
|
532
|
-
|
409
|
+
_context4.prev = 0;
|
533
410
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
534
|
-
nonCompliant = (_this$paymentContext$
|
411
|
+
nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
|
412
|
+
nonInitSecuritySDK = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.nonCompliant;
|
535
413
|
isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
536
|
-
if (!
|
537
|
-
|
414
|
+
if (!nonInitSecuritySDK) {
|
415
|
+
_context4.next = 8;
|
538
416
|
break;
|
539
417
|
}
|
540
|
-
|
418
|
+
// 钱包不依赖风控
|
419
|
+
console.log('[web-sdk][security-sdk] DO NOT init security sdk when nonInitSecuritySDK is true');
|
420
|
+
return _context4.abrupt("return");
|
541
421
|
case 8:
|
422
|
+
if (!(productSceneVersion === '1.0')) {
|
423
|
+
_context4.next = 13;
|
424
|
+
break;
|
425
|
+
}
|
426
|
+
// 1.0 不初始化 SecuritySDK
|
427
|
+
console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
|
428
|
+
return _context4.abrupt("return");
|
429
|
+
case 13:
|
542
430
|
if (!(productSceneVersion === '2.0')) {
|
543
|
-
|
431
|
+
_context4.next = 27;
|
544
432
|
break;
|
545
433
|
}
|
546
434
|
if (!(nonCompliant === true)) {
|
547
|
-
|
435
|
+
_context4.next = 20;
|
548
436
|
break;
|
549
437
|
}
|
550
|
-
|
438
|
+
// 未切流「隐私合规」
|
439
|
+
console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and nonCompliant is true');
|
440
|
+
_context4.next = 18;
|
551
441
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
552
|
-
case
|
553
|
-
|
442
|
+
case 18:
|
443
|
+
_context4.next = 27;
|
554
444
|
break;
|
555
|
-
case
|
556
|
-
if (isFirstTimeToPay) {
|
557
|
-
|
445
|
+
case 20:
|
446
|
+
if (!isFirstTimeToPay) {
|
447
|
+
_context4.next = 24;
|
558
448
|
break;
|
559
449
|
}
|
560
|
-
|
450
|
+
console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0 and when first time to pay');
|
451
|
+
_context4.next = 27;
|
452
|
+
break;
|
453
|
+
case 24:
|
454
|
+
// 切流「隐私合规」且非首次支付
|
455
|
+
console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
|
456
|
+
_context4.next = 27;
|
561
457
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
562
|
-
case
|
563
|
-
|
458
|
+
case 27:
|
459
|
+
_context4.next = 31;
|
564
460
|
break;
|
565
|
-
case
|
566
|
-
|
567
|
-
|
568
|
-
case
|
461
|
+
case 29:
|
462
|
+
_context4.prev = 29;
|
463
|
+
_context4.t0 = _context4["catch"](0);
|
464
|
+
case 31:
|
569
465
|
case "end":
|
570
|
-
return
|
466
|
+
return _context4.stop();
|
571
467
|
}
|
572
|
-
},
|
468
|
+
}, _callee4, this, [[0, 29]]);
|
573
469
|
}));
|
574
470
|
function initSecuritySDK() {
|
575
471
|
return _initSecuritySDK.apply(this, arguments);
|
@@ -54,7 +54,6 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
54
54
|
}, {
|
55
55
|
key: "load",
|
56
56
|
value: function load(displayInfo, url, closeBtnFunc) {
|
57
|
-
console.log('load');
|
58
57
|
var webApp = createIframe('antom-sdk-web-app' + (displayInfo.appendAliasContainerId ? "-".concat(displayInfo.selector) : ''));
|
59
58
|
this.webApp = webApp;
|
60
59
|
this.displayInfo = displayInfo;
|
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
7
7
|
import { eventCodeEnum, RedirectType, TargetEnum } from "../../types";
|
8
8
|
import { ServiceProvider } from "../service";
|
9
9
|
import { isPC } from "../../util";
|
10
|
-
import CallApp from "../../util/intl-callapp/es";
|
10
|
+
import CallApp from "../../util/intl-callapp/es/index";
|
11
11
|
import { EVENT } from "../../constant";
|
12
12
|
|
13
13
|
/**
|
@@ -20,15 +20,31 @@ export var redirect = function redirect(payload, instanceId) {
|
|
20
20
|
logService.logInfo({
|
21
21
|
title: 'sdk_event_call_url_start'
|
22
22
|
}, _objectSpread({}, payload)).send();
|
23
|
+
if (payload.isCallApp && payload.schemeUrl) {
|
24
|
+
var detectSuccessDelay = payload.callAppDetectSuccessDelay;
|
25
|
+
var _callAppLib = new CallApp({
|
26
|
+
successCb: function successCb() {
|
27
|
+
successCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
28
|
+
},
|
29
|
+
resultJudgmentTime: detectSuccessDelay
|
30
|
+
});
|
31
|
+
_callAppLib.open({
|
32
|
+
scheme: payload.schemeUrl,
|
33
|
+
fallback: function fallback() {
|
34
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
35
|
+
}
|
36
|
+
});
|
37
|
+
return;
|
38
|
+
}
|
23
39
|
// 支持 target: _blank,新开tab页打开
|
24
40
|
if (payload.browserLinkTarget === TargetEnum.BLANK) {
|
25
|
-
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '',
|
41
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
26
42
|
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
27
43
|
window.open(payload.url);
|
28
44
|
return;
|
29
45
|
}
|
30
46
|
if (payload.browserLinkTarget === TargetEnum.REPLACE && !(payload !== null && payload !== void 0 && payload.applinkUrl) && !(payload !== null && payload !== void 0 && payload.schemeUrl)) {
|
31
|
-
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '',
|
47
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
32
48
|
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
33
49
|
window.location.replace(payload.url);
|
34
50
|
return;
|
@@ -55,14 +71,14 @@ export var redirect = function redirect(payload, instanceId) {
|
|
55
71
|
fallback: function fallback() {
|
56
72
|
// Applink evoke failed, try to use scheme url
|
57
73
|
if (payload.applinkUrl) {
|
58
|
-
failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl,
|
74
|
+
failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, serviceProvider);
|
59
75
|
}
|
60
76
|
callAppLib.open({
|
61
77
|
scheme: payload.schemeUrl,
|
62
78
|
fallback: function fallback() {
|
63
|
-
//
|
79
|
+
// SchemeUrl evoke failed
|
64
80
|
if (payload.schemeUrl) {
|
65
|
-
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl,
|
81
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
66
82
|
}
|
67
83
|
window.location.href = payload.url;
|
68
84
|
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
@@ -84,10 +100,10 @@ var successCallback = function successCallback(payload, type, url, serviceProvid
|
|
84
100
|
url: url
|
85
101
|
}).send();
|
86
102
|
};
|
87
|
-
var failCallback = function failCallback(payload, type, url,
|
103
|
+
var failCallback = function failCallback(payload, type, url, serviceProvider) {
|
88
104
|
serviceProvider.getService('EventCenter').emit(EVENT.eventCallback.name, {
|
89
105
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
90
|
-
message: "Failed to open app,applinkUrl: ".concat(
|
106
|
+
message: "Failed to open app,applinkUrl: ".concat(payload === null || payload === void 0 ? void 0 : payload.applinkUrl, " schemeUrl: ").concat(payload === null || payload === void 0 ? void 0 : payload.schemeUrl, " normalUrl: ").concat(payload === null || payload === void 0 ? void 0 : payload.url)
|
91
107
|
});
|
92
108
|
serviceProvider.getService('Log').logInfo({
|
93
109
|
title: 'sdk_error_call_url_failed'
|
package/esm/index.js
CHANGED