@alipay/ams-checkout 0.0.1730107332-dev.3 → 0.0.1730107332-dev.31
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 +2 -3
- package/esm/component/channel.js +65 -30
- package/esm/component/component.inline.style.js +1 -1
- package/esm/component/component.popup.style.d.ts +1 -3
- package/esm/component/component.popup.style.js +1 -3
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/bus/ability/callback.d.ts +9 -0
- package/esm/core/bus/ability/callback.js +55 -0
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/bus/interface.d.ts +36 -0
- package/esm/core/bus/interface.js +40 -0
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/ckp/index.d.ts +27 -0
- package/esm/core/component/ckp/index.js +166 -0
- package/esm/core/component/index.d.ts +51 -0
- package/esm/core/component/index.js +531 -0
- package/esm/core/drop-in/index.d.ts +22 -0
- package/esm/core/drop-in/index.js +104 -0
- package/esm/core/instance/index.d.ts +89 -0
- package/esm/core/instance/index.js +499 -0
- package/esm/foundation/core/index.d.ts +2 -2
- package/esm/foundation/core/index.js +9 -5
- package/esm/foundation/index.d.ts +8 -5
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +5 -4
- package/esm/foundation/product-processor/easysafepay/deps.js +3 -2
- package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -3
- package/esm/foundation/product-processor/easysafepay/index.js +115 -231
- package/esm/foundation/service/api-bus/index.d.ts +2 -2
- package/esm/foundation/service/container/index.d.ts +2 -2
- package/esm/foundation/service/container/index.js +0 -1
- package/esm/foundation/service/event-center.d.ts +4 -4
- package/esm/foundation/service/event-center.js +10 -10
- package/esm/foundation/service/global-data/index.d.ts +2 -2
- package/esm/foundation/service/index.d.ts +2 -2
- package/esm/foundation/service/log/index.d.ts +2 -2
- package/esm/foundation/service/requester/deps.d.ts +1 -1
- package/esm/foundation/service/requester/requester.d.ts +2 -2
- package/esm/foundation/service/security/index.d.ts +2 -2
- package/esm/foundation/service/security/index.js +1 -0
- package/esm/foundation/utils/redirect_utils.d.ts +5 -0
- package/esm/foundation/utils/redirect_utils.js +178 -24
- package/esm/foundation/utils/web_app_url_utils.js +1 -1
- package/esm/index.d.ts +27 -2
- package/esm/index.js +133 -7
- package/esm/plugin/applepay/component.d.ts +50 -0
- package/esm/plugin/applepay/component.js +339 -0
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/plugin/applepay/interface.d.ts +161 -0
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/plugin/applepay/service.d.ts +54 -0
- package/esm/plugin/applepay/service.js +289 -0
- package/esm/plugin/component/cashierApp.d.ts +34 -0
- package/esm/plugin/component/cashierApp.js +237 -0
- package/esm/plugin/component/channel.d.ts +21 -0
- package/esm/plugin/component/channel.js +89 -0
- package/esm/plugin/component/component.inline.style.d.ts +10 -0
- package/esm/plugin/component/component.inline.style.js +119 -0
- package/esm/plugin/component/component.popup.style.d.ts +16 -0
- package/esm/plugin/component/component.popup.style.js +174 -0
- package/esm/plugin/component/index.d.ts +126 -0
- package/esm/plugin/component/index.js +1839 -0
- package/esm/plugin/component/popupWindow.style.d.ts +11 -0
- package/esm/plugin/component/popupWindow.style.js +121 -0
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/drop-in/index.d.ts +71 -0
- package/esm/plugin/drop-in/index.js +324 -0
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +390 -0
- package/esm/plugin/type.d.ts +34 -0
- package/esm/plugin/type.js +1 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/types/index.d.ts +10 -11
- package/esm/types/index.js +2 -1
- package/esm/util/createIframeNode.d.ts +6 -0
- package/esm/util/createIframeNode.js +48 -0
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/getBackScheme.js +134 -0
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +4 -3
- package/esm/util/intl-callapp/es/index.js +0 -1
- package/esm/util/security.d.ts +33 -0
- package/esm/util/security.js +182 -0
- package/package.json +2 -2
- package/esm/foundation/types/index.d.ts +0 -4
- package/esm/foundation/types/index.js +0 -4
@@ -1,17 +1,18 @@
|
|
1
1
|
export type { SDKMetaData } from "../..";
|
2
|
+
export { v4 as uuid } from 'uuid';
|
3
|
+
export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload, } from '../..';
|
2
4
|
export * as ChannelCustomize from '../../../component/channel';
|
3
5
|
export type { IChannelBehavior } from '../../../component/channel';
|
4
6
|
export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../../types';
|
5
|
-
export {
|
6
|
-
export { v4 as uuid } from 'uuid';
|
7
|
-
export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IOptionsParams, } from '../../../types';
|
7
|
+
export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
|
8
8
|
export { isPC } from '../../../util';
|
9
|
+
export { getBackScheme } from '../../utils/redirect_utils';
|
9
10
|
export { isLocalMock } from '../../../util/mock';
|
10
|
-
export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload } from '../..';
|
11
11
|
export { ServiceProvider } from '../../service';
|
12
12
|
export type { ContainerService } from '../../service/container';
|
13
13
|
export type { EventCenter } from '../../service/event-center';
|
14
14
|
export { LogService } from '../../service/log';
|
15
15
|
export type { RequesterService } from '../../service/requester/requester';
|
16
16
|
export type { SecurityService } from '../../service/security';
|
17
|
+
export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
|
17
18
|
export * as WebAppUrlUtil from '../../utils/web_app_url_utils';
|
@@ -1,11 +1,12 @@
|
|
1
|
+
export { v4 as uuid } from 'uuid';
|
1
2
|
import * as _ChannelCustomize from "../../../component/channel";
|
2
3
|
export { _ChannelCustomize as ChannelCustomize };
|
3
4
|
export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from "../../../types";
|
4
|
-
export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
|
5
|
-
export { v4 as uuid } from 'uuid';
|
6
5
|
export { isPC } from "../../../util";
|
6
|
+
export { getBackScheme } from "../../utils/redirect_utils";
|
7
7
|
export { isLocalMock } from "../../../util/mock";
|
8
8
|
export { ServiceProvider } from "../../service";
|
9
9
|
export { LogService } from "../../service/log";
|
10
|
+
export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
|
10
11
|
import * as _WebAppUrlUtil from "../../utils/web_app_url_utils";
|
11
12
|
export { _WebAppUrlUtil as WebAppUrlUtil };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BizFlowStartBehavior,
|
1
|
+
import { BizFlowStartBehavior, IoptionsParams, PaymentContext, ProductProcessor, SDKMetaData } from './deps';
|
2
2
|
export declare class EasySafePayProcessor implements ProductProcessor {
|
3
3
|
private paymentContext?;
|
4
4
|
private initConfig;
|
@@ -9,7 +9,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
|
|
9
9
|
private allowSubmitPayCallAhead;
|
10
10
|
private channelBehavior?;
|
11
11
|
private SECURITY_SDK_INIT_TIMEOUT;
|
12
|
-
init(config:
|
12
|
+
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
13
13
|
startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
|
14
14
|
private preloadWebApp;
|
15
15
|
private buildWebAppPreloadUrl;
|
@@ -20,7 +20,6 @@ export declare class EasySafePayProcessor implements ProductProcessor {
|
|
20
20
|
* start waiting web launch, then send renderComponent event
|
21
21
|
* */
|
22
22
|
private sendRequestAndWaitWebLaunch;
|
23
|
-
private processPaymentQuery;
|
24
23
|
private processSubmitPay;
|
25
24
|
private acquireApdidToken;
|
26
25
|
private initSecuritySDK;
|
@@ -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 } 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,23 +213,24 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
225
213
|
});
|
226
214
|
|
227
215
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
228
|
-
Promise.all([
|
216
|
+
Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
229
217
|
var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6;
|
230
|
-
var
|
231
|
-
|
232
|
-
|
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: requestResult.queryRes,
|
238
|
-
submitResult: requestResult.submitRes,
|
239
226
|
sessionResult: (_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj,
|
227
|
+
submitResult: submitRes,
|
240
228
|
paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSession,
|
241
229
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
242
230
|
renderDisplayType: _this2.paymentContext.displayInfo.type,
|
243
231
|
appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
|
244
232
|
notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
|
233
|
+
isAppWebview: _this2.paymentContext.startBizFlowOptions.isAppWebview,
|
245
234
|
merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
|
246
235
|
allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
|
247
236
|
envInfo: {
|
@@ -264,160 +253,40 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
264
253
|
});
|
265
254
|
}
|
266
255
|
}, {
|
267
|
-
key: "
|
256
|
+
key: "processSubmitPay",
|
268
257
|
value: function () {
|
269
|
-
var
|
270
|
-
var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$
|
271
|
-
var
|
258
|
+
var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
259
|
+
var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$2;
|
260
|
+
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
261
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
273
262
|
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
263
|
case 0:
|
395
264
|
submitParams = {
|
396
|
-
paymentSessionData: ((_this$
|
397
|
-
paymentSessionConfig: (_this$
|
265
|
+
paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
|
266
|
+
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
267
|
};
|
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;
|
268
|
+
_ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
|
269
|
+
_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
270
|
if (productSceneVersion === '2.0' && !autoDebitWithToken) {
|
411
271
|
///EasyPay 2.0 首次传signAgreement字段
|
412
272
|
submitParams['signAgreement'] = enableSignAgreement;
|
273
|
+
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;
|
274
|
+
isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
|
275
|
+
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
276
|
+
backScheme = getBackScheme(undefined, this.logger);
|
277
|
+
if (backScheme && backScheme !== 'https') {
|
278
|
+
submitParams['h5FromApp'] = encodeURIComponent(backScheme);
|
279
|
+
}
|
280
|
+
}
|
413
281
|
}
|
414
|
-
|
415
|
-
|
416
|
-
if (
|
417
|
-
|
282
|
+
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
283
|
+
console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
284
|
+
if (this.allowSubmitPayCallAhead) {
|
285
|
+
_context2.next = 9;
|
418
286
|
break;
|
419
287
|
}
|
420
|
-
|
288
|
+
console.log('[web-sdk] DO NOT call submitPay');
|
289
|
+
return _context2.abrupt("return", {
|
421
290
|
message: 'sdk no need to make submitPay request',
|
422
291
|
success: true
|
423
292
|
});
|
@@ -430,40 +299,42 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
430
299
|
requestBizId: requestBizId
|
431
300
|
});
|
432
301
|
// 由渠道定制点来构建额外参数
|
433
|
-
extParams = ((_this$
|
302
|
+
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
303
|
instanceId: this.instanceId,
|
435
304
|
locale: this.initConfig.locale,
|
436
|
-
paymentMethodType: (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext
|
305
|
+
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
306
|
paymentSessionData: this.paymentContext.paymentSession,
|
438
307
|
env: this.initConfig.environment,
|
439
308
|
sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
|
440
309
|
})) || {};
|
310
|
+
extParams.complianceSDK = true;
|
441
311
|
submitParams.extParams = extParams;
|
442
312
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
313
|
+
_context2.prev = 15;
|
314
|
+
console.log('[web-sdk] DO call submitPay');
|
315
|
+
_context2.t0 = requester;
|
316
|
+
_context2.t1 = submitParams;
|
317
|
+
_context2.t2 = this.initConfig.environment;
|
318
|
+
_context2.next = 22;
|
448
319
|
return this.acquireApdidToken();
|
449
|
-
case
|
450
|
-
|
451
|
-
|
452
|
-
deviceId:
|
320
|
+
case 22:
|
321
|
+
_context2.t3 = _context2.sent;
|
322
|
+
_context2.t4 = {
|
323
|
+
deviceId: _context2.t3
|
453
324
|
};
|
454
|
-
|
455
|
-
|
456
|
-
env:
|
325
|
+
_context2.t5 = this.hostSign;
|
326
|
+
_context2.t6 = {
|
327
|
+
env: _context2.t2,
|
457
328
|
timeout: 15000,
|
458
|
-
envInfo:
|
459
|
-
hostSign:
|
329
|
+
envInfo: _context2.t4,
|
330
|
+
hostSign: _context2.t5,
|
460
331
|
needEnvInfo: true,
|
461
332
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
462
333
|
};
|
463
|
-
|
464
|
-
return
|
465
|
-
case
|
466
|
-
res =
|
334
|
+
_context2.next = 28;
|
335
|
+
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
|
336
|
+
case 28:
|
337
|
+
res = _context2.sent;
|
467
338
|
this.logger.logInfo({
|
468
339
|
title: 'sdk_event_submitPayEnd'
|
469
340
|
}, {
|
@@ -471,50 +342,50 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
471
342
|
requestBizId: requestBizId,
|
472
343
|
traceId: res.traceId
|
473
344
|
});
|
474
|
-
return
|
475
|
-
case
|
476
|
-
|
477
|
-
|
345
|
+
return _context2.abrupt("return", res);
|
346
|
+
case 33:
|
347
|
+
_context2.prev = 33;
|
348
|
+
_context2.t7 = _context2["catch"](15);
|
478
349
|
this.logger.logError({
|
479
350
|
title: 'sdk_event_submitPay_failed'
|
480
351
|
}, {
|
481
352
|
paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
|
482
|
-
errorReason:
|
353
|
+
errorReason: _context2.t7,
|
483
354
|
requestBizId: requestBizId,
|
484
|
-
traceId:
|
355
|
+
traceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
|
485
356
|
});
|
486
|
-
throw
|
487
|
-
case
|
357
|
+
throw _context2.t7;
|
358
|
+
case 37:
|
488
359
|
case "end":
|
489
|
-
return
|
360
|
+
return _context2.stop();
|
490
361
|
}
|
491
|
-
},
|
362
|
+
}, _callee2, this, [[15, 33]]);
|
492
363
|
}));
|
493
364
|
function processSubmitPay() {
|
494
365
|
return _processSubmitPay.apply(this, arguments);
|
495
366
|
}
|
496
367
|
return processSubmitPay;
|
497
|
-
}()
|
368
|
+
}()
|
498
369
|
}, {
|
499
370
|
key: "acquireApdidToken",
|
500
371
|
value: function () {
|
501
|
-
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
502
|
-
var _this$paymentContext$
|
372
|
+
var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
373
|
+
var _this$paymentContext$3;
|
503
374
|
var securityService, productScene, deviceId;
|
504
|
-
return _regeneratorRuntime().wrap(function
|
505
|
-
while (1) switch (
|
375
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
376
|
+
while (1) switch (_context3.prev = _context3.next) {
|
506
377
|
case 0:
|
507
378
|
securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
508
|
-
productScene = (_this$paymentContext$
|
379
|
+
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
380
|
deviceId = securityService.getDeviceId({
|
510
381
|
productScene: productScene
|
511
382
|
});
|
512
|
-
return
|
383
|
+
return _context3.abrupt("return", deviceId);
|
513
384
|
case 4:
|
514
385
|
case "end":
|
515
|
-
return
|
386
|
+
return _context3.stop();
|
516
387
|
}
|
517
|
-
},
|
388
|
+
}, _callee3, this);
|
518
389
|
}));
|
519
390
|
function acquireApdidToken() {
|
520
391
|
return _acquireApdidToken.apply(this, arguments);
|
@@ -524,58 +395,71 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
524
395
|
}, {
|
525
396
|
key: "initSecuritySDK",
|
526
397
|
value: function () {
|
527
|
-
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
528
|
-
var _this$paymentContext$
|
529
|
-
return _regeneratorRuntime().wrap(function
|
530
|
-
while (1) switch (
|
398
|
+
var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
399
|
+
var _this$paymentContext$4, _this$paymentContext$5, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay;
|
400
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
401
|
+
while (1) switch (_context4.prev = _context4.next) {
|
531
402
|
case 0:
|
532
|
-
|
403
|
+
_context4.prev = 0;
|
533
404
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
534
|
-
nonCompliant = (_this$paymentContext$
|
405
|
+
nonCompliant = (_this$paymentContext$4 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$4 === void 0 ? void 0 : _this$paymentContext$4.nonCompliant;
|
406
|
+
nonInitSecuritySDK = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.nonInitSecuritySDK;
|
535
407
|
isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
|
408
|
+
if (!nonInitSecuritySDK) {
|
409
|
+
_context4.next = 8;
|
410
|
+
break;
|
411
|
+
}
|
412
|
+
// 钱包不依赖风控
|
413
|
+
console.log('[web-sdk][security-sdk] DO NOT init security sdk when nonInitSecuritySDK is true');
|
414
|
+
return _context4.abrupt("return");
|
415
|
+
case 8:
|
536
416
|
if (!(productSceneVersion === '1.0')) {
|
537
|
-
|
417
|
+
_context4.next = 13;
|
538
418
|
break;
|
539
419
|
}
|
540
|
-
console.log('[web-sdk][security-sdk] skip init security sdk for easypay 1.0');
|
541
420
|
// 1.0 不初始化 SecuritySDK
|
542
|
-
|
543
|
-
|
421
|
+
console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
|
422
|
+
return _context4.abrupt("return");
|
423
|
+
case 13:
|
544
424
|
if (!(productSceneVersion === '2.0')) {
|
545
|
-
|
425
|
+
_context4.next = 27;
|
546
426
|
break;
|
547
427
|
}
|
548
428
|
if (!(nonCompliant === true)) {
|
549
|
-
|
429
|
+
_context4.next = 20;
|
550
430
|
break;
|
551
431
|
}
|
552
432
|
// 未切流「隐私合规」
|
553
|
-
console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and nonCompliant is true');
|
554
|
-
|
433
|
+
console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and nonCompliant is true');
|
434
|
+
_context4.next = 18;
|
555
435
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
556
|
-
case
|
557
|
-
|
436
|
+
case 18:
|
437
|
+
_context4.next = 27;
|
558
438
|
break;
|
559
|
-
case
|
560
|
-
if (isFirstTimeToPay) {
|
561
|
-
|
439
|
+
case 20:
|
440
|
+
if (!isFirstTimeToPay) {
|
441
|
+
_context4.next = 24;
|
562
442
|
break;
|
563
443
|
}
|
444
|
+
console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0 and when first time to pay');
|
445
|
+
_context4.next = 27;
|
446
|
+
break;
|
447
|
+
case 24:
|
564
448
|
// 切流「隐私合规」且非首次支付
|
565
|
-
console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and when not first time to pay');
|
566
|
-
|
449
|
+
console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
|
450
|
+
_context4.next = 27;
|
567
451
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
568
|
-
case
|
569
|
-
|
452
|
+
case 27:
|
453
|
+
_context4.next = 31;
|
570
454
|
break;
|
571
|
-
case
|
572
|
-
|
573
|
-
|
574
|
-
case
|
455
|
+
case 29:
|
456
|
+
_context4.prev = 29;
|
457
|
+
_context4.t0 = _context4["catch"](0);
|
458
|
+
case 31:
|
575
459
|
case "end":
|
576
|
-
return
|
460
|
+
return _context4.stop();
|
577
461
|
}
|
578
|
-
},
|
462
|
+
}, _callee4, this, [[0, 29]]);
|
579
463
|
}));
|
580
464
|
function initSecuritySDK() {
|
581
465
|
return _initSecuritySDK.apply(this, arguments);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Service } from '../../index';
|
2
|
-
import {
|
2
|
+
import { IoptionsParams } from '../../../types';
|
3
3
|
import { LogService } from '../log';
|
4
4
|
import { BusMessage, BusSubscriber, OnBusCallback } from './busManager';
|
5
5
|
/**
|
@@ -10,7 +10,7 @@ export declare class ApiBusManagerService implements Service {
|
|
10
10
|
protected logger: LogService;
|
11
11
|
protected instanceId: string;
|
12
12
|
private busManager;
|
13
|
-
init(initOptions:
|
13
|
+
init(initOptions: IoptionsParams, instanceId: string): void;
|
14
14
|
subscribe(subscriber: BusSubscriber): void;
|
15
15
|
unsubscribe(subscriber: BusSubscriber): void;
|
16
16
|
isSubscribed(actionName: string): boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DisplayInfo, SDKMetaData, Service } from '../../index';
|
2
|
-
import {
|
2
|
+
import { IoptionsParams } from '../../../types';
|
3
3
|
export declare class ContainerService implements Service {
|
4
4
|
private instanceId;
|
5
5
|
private sdkMetaData;
|
@@ -11,7 +11,7 @@ export declare class ContainerService implements Service {
|
|
11
11
|
private webApp;
|
12
12
|
private customizedLoadingListener;
|
13
13
|
destroy(): void;
|
14
|
-
init(initOptions:
|
14
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
15
15
|
update(): void;
|
16
16
|
load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
|
17
17
|
cleanContainer(displayInfo: DisplayInfo): void;
|
@@ -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;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { EventPayload, EventPayloadContext,
|
1
|
+
import { EventPayload, EventPayloadContext, IoptionsParams } from '../../types';
|
2
2
|
import { SDKMetaData, Service } from '../index';
|
3
3
|
/**
|
4
4
|
* @author 江跃 <jiangbin.gjb@antgroup.com>
|
@@ -12,7 +12,7 @@ export declare class EventCenter implements Service {
|
|
12
12
|
/**
|
13
13
|
* Initializes the event center
|
14
14
|
*/
|
15
|
-
init(initOptions:
|
15
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
16
16
|
/**
|
17
17
|
* Cleans up event listeners when the event center is destroyed.
|
18
18
|
*/
|
@@ -54,7 +54,7 @@ export declare class EventCenter implements Service {
|
|
54
54
|
* @param name - The name of the event to emit.
|
55
55
|
* @param data - The event data to pass to the event listeners.
|
56
56
|
*/
|
57
|
-
emit(name: string, data: any,
|
57
|
+
emit(name: string, data: any, EventPayload?: EventPayload): void;
|
58
58
|
/**
|
59
59
|
* Registers a callback for an event and immediately dispatches the event to the app.
|
60
60
|
* @param payloadContext - The context containing event information and callback ID.
|
@@ -69,6 +69,6 @@ export declare class EventCenter implements Service {
|
|
69
69
|
isExist(name: string): boolean;
|
70
70
|
}
|
71
71
|
interface IListener {
|
72
|
-
(data: any,
|
72
|
+
(data: any, EventPayload?: EventPayload): void;
|
73
73
|
}
|
74
74
|
export {};
|