@alipay/ams-checkout 0.0.1744283958-dev.6 → 0.0.1745390310-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/component.inline.style.js +1 -1
- package/esm/component/popupWindow.style.js +1 -4
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +0 -9
- package/esm/constant/index.js +0 -9
- package/esm/core/component/ckp/index.d.ts +26 -6
- package/esm/core/component/ckp/index.js +357 -25
- package/esm/core/component/ckp/interface.d.ts +540 -0
- package/esm/core/component/ckp/interface.js +233 -0
- package/esm/core/component/element/index.d.ts +46 -8
- package/esm/core/component/element/index.js +922 -28
- package/esm/core/component/element/mock.d.ts +0 -2
- package/esm/core/component/element/mock.js +0 -360
- package/esm/core/component/element/type.d.ts +1 -42
- package/esm/core/component/index.d.ts +1 -5
- package/esm/core/component/index.js +2 -1
- package/esm/foundation/core/index.d.ts +1 -6
- package/esm/foundation/core/index.js +34 -68
- package/esm/foundation/index.d.ts +0 -8
- package/esm/foundation/index.js +2 -11
- package/esm/foundation/service/container/index.d.ts +3 -6
- package/esm/foundation/service/container/index.js +14 -41
- package/esm/foundation/service/container/popup.d.ts +1 -1
- package/esm/foundation/service/event-center.js +0 -1
- package/esm/index.js +0 -1
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/index.js +1 -1
- package/esm/types/index.d.ts +1 -1
- package/esm/types/index.js +1 -1
- package/package.json +1 -1
- package/esm/core/component/element/elementContainerService/containerService.d.ts +0 -33
- package/esm/core/component/element/elementContainerService/containerService.js +0 -122
- package/esm/core/component/element/elementContainerService/index.d.ts +0 -20
- package/esm/core/component/element/elementContainerService/index.js +0 -63
- package/esm/core/component/element/elementController/index.d.ts +0 -25
- package/esm/core/component/element/elementController/index.js +0 -448
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/addressProcessor.js +0 -145
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/authProcessor.js +0 -125
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +0 -38
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +0 -85
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +0 -356
- package/esm/core/component/element/util.d.ts +0 -60
- package/esm/core/component/element/util.js +0 -451
- package/esm/core/component/oldElement/index.d.ts +0 -59
- package/esm/core/component/oldElement/index.js +0 -956
- package/esm/core/component/oldElement/mock.d.ts +0 -6
- package/esm/core/component/oldElement/mock.js +0 -567
- package/esm/core/component/oldElement/type.d.ts +0 -351
- package/esm/core/component/oldElement/type.js +0 -81
- package/esm/foundation/product-processor/element/index.d.ts +0 -7
- package/esm/foundation/product-processor/element/index.js +0 -24
- /package/esm/core/component/{oldElement → element}/components/address.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/components/address.js +0 -0
- /package/esm/core/component/{oldElement → element}/components/auth.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/components/auth.js +0 -0
- /package/esm/core/component/{oldElement → element}/components/payment.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/components/payment.js +0 -0
- /package/esm/core/component/{oldElement → element}/utils.d.ts +0 -0
- /package/esm/core/component/{oldElement → element}/utils.js +0 -0
@@ -1,125 +0,0 @@
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
6
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
9
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
10
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
11
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
|
-
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); }
|
13
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
14
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
15
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
16
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
17
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
18
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
19
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
20
|
-
import { parseSessionData } from "../../index";
|
21
|
-
import PackageJson from "../../../../../package.json";
|
22
|
-
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
23
|
-
import BaseElementProcessor from "./baseElementProcessor";
|
24
|
-
var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
25
|
-
_inherits(AuthProcessor, _BaseElementProcessor);
|
26
|
-
var _super = _createSuper(AuthProcessor);
|
27
|
-
function AuthProcessor() {
|
28
|
-
_classCallCheck(this, AuthProcessor);
|
29
|
-
return _super.apply(this, arguments);
|
30
|
-
}
|
31
|
-
_createClass(AuthProcessor, [{
|
32
|
-
key: "onReady",
|
33
|
-
value: function onReady(extraParam) {
|
34
|
-
this.eventCenter.dispatchToApp({
|
35
|
-
event: 'renderComponent',
|
36
|
-
data: {
|
37
|
-
params: extraParam,
|
38
|
-
target: 'AUTH_ELEMENT'
|
39
|
-
}
|
40
|
-
});
|
41
|
-
}
|
42
|
-
}, {
|
43
|
-
key: "parameterInitAndCheck",
|
44
|
-
value: function parameterInitAndCheck() {
|
45
|
-
// 实现 parameterInitAndCheck 方法
|
46
|
-
}
|
47
|
-
}, {
|
48
|
-
key: "beforeMount",
|
49
|
-
value: function beforeMount() {
|
50
|
-
// 实现 beforeMount 方法
|
51
|
-
}
|
52
|
-
}, {
|
53
|
-
key: "preload",
|
54
|
-
value: function preload() {
|
55
|
-
// 实现 preload 方法
|
56
|
-
}
|
57
|
-
}, {
|
58
|
-
key: "generateIframeSrc",
|
59
|
-
value: function generateIframeSrc(_ref) {
|
60
|
-
var link = _ref.link,
|
61
|
-
instanceId = _ref.instanceId;
|
62
|
-
// 实现 generateIframeSrc 方法
|
63
|
-
this.instanceId = instanceId;
|
64
|
-
var _ref2 = this.elementContainer.getPaymentContext() || {},
|
65
|
-
paymentSession = _ref2.paymentSession,
|
66
|
-
paymentSessionObj = _ref2.paymentSessionObj,
|
67
|
-
sdkMetaData = _ref2.sdkMetaData;
|
68
|
-
var _this$options = this.options,
|
69
|
-
environment = _this$options.env.environment,
|
70
|
-
analytics = _this$options.analytics,
|
71
|
-
locale = _this$options.locale;
|
72
|
-
var version = PackageJson.version;
|
73
|
-
var pageUrl = "/auth-element/".concat(version, "/pages/element_auth/index.html");
|
74
|
-
return _generateIframeSrc({
|
75
|
-
paymentSession: paymentSession,
|
76
|
-
paymentSessionObj: paymentSessionObj,
|
77
|
-
environment: environment,
|
78
|
-
analytics: analytics,
|
79
|
-
locale: locale,
|
80
|
-
link: link,
|
81
|
-
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
82
|
-
pageUrl: pageUrl,
|
83
|
-
instanceId: instanceId
|
84
|
-
});
|
85
|
-
}
|
86
|
-
}, {
|
87
|
-
key: "obtainData",
|
88
|
-
value: function obtainData() {
|
89
|
-
// 实现 obtainData 方法
|
90
|
-
this.obtainDataRes = {};
|
91
|
-
return {};
|
92
|
-
}
|
93
|
-
}, {
|
94
|
-
key: "getValue",
|
95
|
-
value: function getValue() {
|
96
|
-
// 实现 getValue 方法
|
97
|
-
return {};
|
98
|
-
}
|
99
|
-
}, {
|
100
|
-
key: "update",
|
101
|
-
value: function update(_ref3) {
|
102
|
-
var data = _ref3.data,
|
103
|
-
paymentSessionData = _ref3.paymentSessionData;
|
104
|
-
var _parseSessionData = parseSessionData(paymentSessionData),
|
105
|
-
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
106
|
-
parseData = _parseSessionData2[0],
|
107
|
-
sessionData = _parseSessionData2[1];
|
108
|
-
// 实现 update 方法的具体逻辑
|
109
|
-
this.eventCenter.dispatchToApp({
|
110
|
-
event: 'updatePayment',
|
111
|
-
data: {
|
112
|
-
params: {
|
113
|
-
paymentSessionData: paymentSessionData,
|
114
|
-
sessionResult: parseData,
|
115
|
-
sessionData: sessionData,
|
116
|
-
originActionQueryResult: data.originActionQueryResult,
|
117
|
-
originOneAccountQueryResult: data.originOneAccountQueryResult
|
118
|
-
}
|
119
|
-
}
|
120
|
-
});
|
121
|
-
}
|
122
|
-
}]);
|
123
|
-
return AuthProcessor;
|
124
|
-
}(BaseElementProcessor);
|
125
|
-
export default AuthProcessor;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { AntomSDKCore } from "../../../../foundation/core";
|
2
|
-
import { Ianalytics, Ienv } from '../../../../types';
|
3
|
-
import { EventCenter } from './../../../../foundation/service/event-center';
|
4
|
-
interface ElementProcessorOptions {
|
5
|
-
env: Ienv;
|
6
|
-
locale: string;
|
7
|
-
networkMode: string;
|
8
|
-
mode: string;
|
9
|
-
analytics?: Ianalytics;
|
10
|
-
product: string;
|
11
|
-
}
|
12
|
-
declare abstract class BaseElementProcessor {
|
13
|
-
elementContainer: AntomSDKCore;
|
14
|
-
instanceId: string;
|
15
|
-
options: ElementProcessorOptions;
|
16
|
-
obtainDataRes: any;
|
17
|
-
eventCenter: EventCenter;
|
18
|
-
eventListener: {};
|
19
|
-
abstract beforeMount(): void;
|
20
|
-
abstract preload(): void;
|
21
|
-
abstract generateIframeSrc({ instanceId, link }: {
|
22
|
-
instanceId: any;
|
23
|
-
link: any;
|
24
|
-
}): string;
|
25
|
-
abstract obtainData(): any;
|
26
|
-
abstract getValue(): any;
|
27
|
-
abstract onReady(extraParam: {
|
28
|
-
[key: string]: any;
|
29
|
-
}): void;
|
30
|
-
constructor(options: any);
|
31
|
-
private _setOptions;
|
32
|
-
abstract update(data: any): void;
|
33
|
-
registerElementContainer(elementContainer: AntomSDKCore): void;
|
34
|
-
registerEventCenter(eventCenter: EventCenter): void;
|
35
|
-
registerEventListener(event: any, callback: any): void;
|
36
|
-
getObtainDataRes(): any;
|
37
|
-
}
|
38
|
-
export default BaseElementProcessor;
|
@@ -1,85 +0,0 @@
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
-
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; }
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
|
-
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); }
|
8
|
-
import { ERRORMESSAGE } from "../../../../constant";
|
9
|
-
import { EnvironmentEnum, modeEnum, networkModeEnum, osTypeEnum, terminalTypeEnum } from "../../../../types";
|
10
|
-
import { device, queryParse } from "../../../../util/index";
|
11
|
-
var BaseElementProcessor = /*#__PURE__*/function () {
|
12
|
-
function BaseElementProcessor(options) {
|
13
|
-
_classCallCheck(this, BaseElementProcessor);
|
14
|
-
_defineProperty(this, "elementContainer", void 0);
|
15
|
-
_defineProperty(this, "instanceId", void 0);
|
16
|
-
_defineProperty(this, "options", void 0);
|
17
|
-
_defineProperty(this, "obtainDataRes", void 0);
|
18
|
-
_defineProperty(this, "eventCenter", void 0);
|
19
|
-
_defineProperty(this, "eventListener", {});
|
20
|
-
this._setOptions(options);
|
21
|
-
}
|
22
|
-
_createClass(BaseElementProcessor, [{
|
23
|
-
key: "_setOptions",
|
24
|
-
value: function _setOptions(options) {
|
25
|
-
var _this = this;
|
26
|
-
var _setEnv = function _setEnv() {
|
27
|
-
var _queryParse = queryParse(),
|
28
|
-
_moreEnv = _queryParse._moreEnv;
|
29
|
-
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in EnvironmentEnum) && _moreEnv !== 'true') {
|
30
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
|
31
|
-
options.environment = 'prod';
|
32
|
-
}
|
33
|
-
_this.options.env = {
|
34
|
-
terminalType: device.isMobile ? terminalTypeEnum.WAP : terminalTypeEnum.WEB,
|
35
|
-
environment: (options === null || options === void 0 ? void 0 : options.environment) || 'prod'
|
36
|
-
};
|
37
|
-
if (_this.options.env.terminalType === terminalTypeEnum.WAP) {
|
38
|
-
// eslint-disable-next-line no-nested-ternary
|
39
|
-
_this.options.env.osType = device.iOS ? osTypeEnum.IOS : device.Android ? osTypeEnum.ANDROID : osTypeEnum.ELSE;
|
40
|
-
}
|
41
|
-
};
|
42
|
-
var _setMode = function _setMode() {
|
43
|
-
_this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || modeEnum.component;
|
44
|
-
if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in modeEnum)) {
|
45
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.message);
|
46
|
-
_this.options.mode = modeEnum.component;
|
47
|
-
}
|
48
|
-
_this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkModeEnum.session;
|
49
|
-
if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkModeEnum)) {
|
50
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
51
|
-
_this.options.networkMode = networkModeEnum.proxy;
|
52
|
-
}
|
53
|
-
};
|
54
|
-
this.options = {};
|
55
|
-
_setMode();
|
56
|
-
_setEnv();
|
57
|
-
this.options.locale = (options === null || options === void 0 ? void 0 : options.locale) || '';
|
58
|
-
this.options.product = options === null || options === void 0 ? void 0 : options.product;
|
59
|
-
}
|
60
|
-
}, {
|
61
|
-
key: "registerElementContainer",
|
62
|
-
value:
|
63
|
-
// 添加 update 方法的抽象声明
|
64
|
-
function registerElementContainer(elementContainer) {
|
65
|
-
this.elementContainer = elementContainer;
|
66
|
-
}
|
67
|
-
}, {
|
68
|
-
key: "registerEventCenter",
|
69
|
-
value: function registerEventCenter(eventCenter) {
|
70
|
-
this.eventCenter = eventCenter;
|
71
|
-
}
|
72
|
-
}, {
|
73
|
-
key: "registerEventListener",
|
74
|
-
value: function registerEventListener(event, callback) {
|
75
|
-
this.eventCenter[event] = callback;
|
76
|
-
}
|
77
|
-
}, {
|
78
|
-
key: "getObtainDataRes",
|
79
|
-
value: function getObtainDataRes() {
|
80
|
-
return this.obtainDataRes;
|
81
|
-
}
|
82
|
-
}]);
|
83
|
-
return BaseElementProcessor;
|
84
|
-
}();
|
85
|
-
export default BaseElementProcessor;
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import BaseElementProcessor from './baseElementProcessor';
|
2
|
-
declare class PaymentProcessor extends BaseElementProcessor {
|
3
|
-
private ApplePayService;
|
4
|
-
onReady(extraParam: any): void;
|
5
|
-
private addEventListener;
|
6
|
-
private initApplePaySdk;
|
7
|
-
beforeMount(): void;
|
8
|
-
preload(): void;
|
9
|
-
generateIframeSrc({ link, instanceId }: {
|
10
|
-
link: any;
|
11
|
-
instanceId: any;
|
12
|
-
}): string;
|
13
|
-
obtainData(): Promise<any>;
|
14
|
-
getValue(): any;
|
15
|
-
update({ data, paymentSessionData }: {
|
16
|
-
data: any;
|
17
|
-
paymentSessionData: any;
|
18
|
-
}): void;
|
19
|
-
}
|
20
|
-
export default PaymentProcessor;
|
@@ -1,356 +0,0 @@
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
6
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
9
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
10
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
11
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
12
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
15
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
16
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
17
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
18
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
19
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
20
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
21
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
22
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
23
|
-
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; }
|
24
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
25
|
-
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); }
|
26
|
-
import { parseSessionData } from "../../index";
|
27
|
-
import PackageJson from "../../../../../package.json";
|
28
|
-
import { EVENT } from "../../../../constant";
|
29
|
-
import { ServiceProvider } from "../../../../foundation/service";
|
30
|
-
import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
|
31
|
-
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
32
|
-
import { oneAccount, sdkAction } from "../mock";
|
33
|
-
import { LogConfig, Logger } from "../../../../util/logger";
|
34
|
-
var logger = new Logger(LogConfig, true);
|
35
|
-
import BaseElementProcessor from "./baseElementProcessor";
|
36
|
-
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
37
|
-
_inherits(PaymentProcessor, _BaseElementProcessor);
|
38
|
-
var _super = _createSuper(PaymentProcessor);
|
39
|
-
function PaymentProcessor() {
|
40
|
-
var _this;
|
41
|
-
_classCallCheck(this, PaymentProcessor);
|
42
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
43
|
-
args[_key] = arguments[_key];
|
44
|
-
}
|
45
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
46
|
-
// parameterInitAndCheck(): void {}
|
47
|
-
// apple pay
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "ApplePayService", void 0);
|
49
|
-
return _this;
|
50
|
-
}
|
51
|
-
_createClass(PaymentProcessor, [{
|
52
|
-
key: "onReady",
|
53
|
-
value: function onReady(extraParam) {
|
54
|
-
var paymentContext = this.elementContainer.getPaymentContext();
|
55
|
-
this.eventCenter.dispatchToApp({
|
56
|
-
event: 'renderComponent',
|
57
|
-
data: {
|
58
|
-
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
59
|
-
paymentSessionData: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionId,
|
60
|
-
queryResult: extraParam === null || extraParam === void 0 ? void 0 : extraParam.originActionQueryResult,
|
61
|
-
envInfo: {
|
62
|
-
screenHeight: screen.height,
|
63
|
-
screenWidth: screen.width
|
64
|
-
},
|
65
|
-
appearance: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.displayInfo.appearance,
|
66
|
-
sessionResult: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionObj,
|
67
|
-
notRedirectAfterComplete: (extraParam === null || extraParam === void 0 ? void 0 : extraParam.notRedirectAfterComplete) === true,
|
68
|
-
merchantAppointParam: extraParam === null || extraParam === void 0 ? void 0 : extraParam.merchantAppointParam
|
69
|
-
}
|
70
|
-
});
|
71
|
-
}
|
72
|
-
}, {
|
73
|
-
key: "addEventListener",
|
74
|
-
value: function addEventListener() {
|
75
|
-
var _this2 = this;
|
76
|
-
this.eventCenter.listen(EVENT.onPollingEnd.name, function (data) {
|
77
|
-
_this2.eventCenter.dispatchToApp({
|
78
|
-
event: 'onPollingEnd',
|
79
|
-
data: data
|
80
|
-
});
|
81
|
-
});
|
82
|
-
this.eventCenter.listen(EVENT.closePaymentPolling.name, function (data) {
|
83
|
-
_this2.eventCenter.dispatchToApp({
|
84
|
-
event: EVENT.closePaymentPolling.name,
|
85
|
-
data: data
|
86
|
-
});
|
87
|
-
});
|
88
|
-
this.eventCenter.listen(EVENT.getGooglePayToken.name, function (data, result) {
|
89
|
-
handleGooglePay(result).then(function (res) {
|
90
|
-
_this2.eventCenter.dispatchToApp({
|
91
|
-
event: 'getGooglePayToken',
|
92
|
-
data: _objectSpread({}, res)
|
93
|
-
});
|
94
|
-
}).catch(function (err) {
|
95
|
-
_this2.eventCenter.dispatchToApp({
|
96
|
-
event: 'getGooglePayToken',
|
97
|
-
data: {
|
98
|
-
err: err
|
99
|
-
}
|
100
|
-
});
|
101
|
-
});
|
102
|
-
});
|
103
|
-
this.eventCenter.listen(EVENT.getApplePayToken.name, function (data) {
|
104
|
-
var _this2$elementContain = _this2.elementContainer.getPaymentContext(),
|
105
|
-
paymentSessionId = _this2$elementContain.paymentSessionId,
|
106
|
-
paymentSessionObj = _this2$elementContain.paymentSessionObj;
|
107
|
-
var applePayService = new ApplePaySdk({
|
108
|
-
paymentSessionData: paymentSessionId,
|
109
|
-
parseData: paymentSessionObj,
|
110
|
-
logger: logger
|
111
|
-
});
|
112
|
-
applePayService.startPay().then(function (res) {
|
113
|
-
_this2.eventCenter.dispatchToApp({
|
114
|
-
event: 'getApplePayToken',
|
115
|
-
data: {
|
116
|
-
success: true,
|
117
|
-
result: res
|
118
|
-
}
|
119
|
-
});
|
120
|
-
}).catch(function (err) {
|
121
|
-
_this2.eventCenter.dispatchToApp({
|
122
|
-
event: 'getApplePayToken',
|
123
|
-
data: {
|
124
|
-
success: false,
|
125
|
-
result: err
|
126
|
-
}
|
127
|
-
});
|
128
|
-
});
|
129
|
-
});
|
130
|
-
}
|
131
|
-
}, {
|
132
|
-
key: "initApplePaySdk",
|
133
|
-
value: function () {
|
134
|
-
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
135
|
-
var _this$elementContaine2;
|
136
|
-
var _this$elementContaine, paymentSessionObj, paymentSessionId;
|
137
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
138
|
-
while (1) switch (_context.prev = _context.next) {
|
139
|
-
case 0:
|
140
|
-
_this$elementContaine = (_this$elementContaine2 = this.elementContainer) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.getPaymentContext(), paymentSessionObj = _this$elementContaine.paymentSessionObj, paymentSessionId = _this$elementContaine.paymentSessionId;
|
141
|
-
if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
|
142
|
-
_context.next = 13;
|
143
|
-
break;
|
144
|
-
}
|
145
|
-
this.ApplePayService = new ApplePaySdk({
|
146
|
-
paymentSessionData: paymentSessionId,
|
147
|
-
parseData: paymentSessionObj,
|
148
|
-
logger: logger
|
149
|
-
});
|
150
|
-
_context.prev = 3;
|
151
|
-
logger.logInfo({
|
152
|
-
title: 'a3753.b107385.c398110'
|
153
|
-
});
|
154
|
-
_context.next = 7;
|
155
|
-
return this.ApplePayService.initApplePaySession();
|
156
|
-
case 7:
|
157
|
-
logger.logInfo({
|
158
|
-
title: 'a3753.b107385.c398112'
|
159
|
-
});
|
160
|
-
_context.next = 13;
|
161
|
-
break;
|
162
|
-
case 10:
|
163
|
-
_context.prev = 10;
|
164
|
-
_context.t0 = _context["catch"](3);
|
165
|
-
logger.logError({
|
166
|
-
title: 'a3753.b107385.c398111'
|
167
|
-
});
|
168
|
-
case 13:
|
169
|
-
case "end":
|
170
|
-
return _context.stop();
|
171
|
-
}
|
172
|
-
}, _callee, this, [[3, 10]]);
|
173
|
-
}));
|
174
|
-
function initApplePaySdk() {
|
175
|
-
return _initApplePaySdk.apply(this, arguments);
|
176
|
-
}
|
177
|
-
return initApplePaySdk;
|
178
|
-
}()
|
179
|
-
}, {
|
180
|
-
key: "beforeMount",
|
181
|
-
value: function beforeMount() {
|
182
|
-
// 实现 beforeMount 方法
|
183
|
-
this.initApplePaySdk();
|
184
|
-
this.addEventListener();
|
185
|
-
}
|
186
|
-
}, {
|
187
|
-
key: "preload",
|
188
|
-
value: function preload() {
|
189
|
-
// 实现 preload 方法
|
190
|
-
}
|
191
|
-
}, {
|
192
|
-
key: "generateIframeSrc",
|
193
|
-
value: function generateIframeSrc(_ref) {
|
194
|
-
var link = _ref.link,
|
195
|
-
instanceId = _ref.instanceId;
|
196
|
-
this.instanceId = instanceId;
|
197
|
-
var _ref2 = this.elementContainer.getPaymentContext() || {},
|
198
|
-
paymentSession = _ref2.paymentSession,
|
199
|
-
paymentSessionObj = _ref2.paymentSessionObj,
|
200
|
-
sdkMetaData = _ref2.sdkMetaData;
|
201
|
-
var _this$options = this.options,
|
202
|
-
environment = _this$options.env.environment,
|
203
|
-
analytics = _this$options.analytics,
|
204
|
-
locale = _this$options.locale;
|
205
|
-
var _ref3 = paymentSessionObj || {},
|
206
|
-
extendInfo = _ref3.extendInfo;
|
207
|
-
var version = PackageJson.version;
|
208
|
-
var pageUrl = "/elements/".concat(version, "/pages/element_payment/index.html");
|
209
|
-
try {
|
210
|
-
var _JSON$parse;
|
211
|
-
var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
|
212
|
-
if (expressCheckout) {
|
213
|
-
pageUrl = "/elements/".concat(version, "/pages/express_checkout/index.html");
|
214
|
-
}
|
215
|
-
} catch (error) {}
|
216
|
-
return _generateIframeSrc({
|
217
|
-
paymentSession: paymentSession,
|
218
|
-
paymentSessionObj: paymentSessionObj,
|
219
|
-
environment: environment,
|
220
|
-
analytics: analytics,
|
221
|
-
locale: locale,
|
222
|
-
link: link,
|
223
|
-
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
224
|
-
pageUrl: pageUrl,
|
225
|
-
instanceId: instanceId
|
226
|
-
});
|
227
|
-
}
|
228
|
-
}, {
|
229
|
-
key: "obtainData",
|
230
|
-
value: function () {
|
231
|
-
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
232
|
-
var _paymentSessionObj$co;
|
233
|
-
var requestService, _this$elementContaine3, paymentSession, paymentSessionObj, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
234
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
235
|
-
while (1) switch (_context2.prev = _context2.next) {
|
236
|
-
case 0:
|
237
|
-
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
238
|
-
_this$elementContaine3 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine3.paymentSession, paymentSessionObj = _this$elementContaine3.paymentSessionObj;
|
239
|
-
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
240
|
-
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
241
|
-
hostSign = paymentSession.split('&&')[1] || '';
|
242
|
-
isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
|
243
|
-
LOCAL_MOCK = window.location.href.indexOf('LOCAL_MOCK=1') !== -1;
|
244
|
-
generateActionQueryPromise = function generateActionQueryPromise() {
|
245
|
-
return new Promise(function (resolve, reject) {
|
246
|
-
if (LOCAL_MOCK) {
|
247
|
-
setTimeout(function () {
|
248
|
-
resolve(oneAccount);
|
249
|
-
resolve(sdkAction);
|
250
|
-
}, 100);
|
251
|
-
return;
|
252
|
-
}
|
253
|
-
requestService.request({
|
254
|
-
paymentSessionConfig: paymentSessionConfig,
|
255
|
-
paymentSessionData: paymentSession
|
256
|
-
}, {
|
257
|
-
env: environment,
|
258
|
-
envInfo: {
|
259
|
-
locale: locale
|
260
|
-
},
|
261
|
-
hostSign: hostSign,
|
262
|
-
timeout: 300000,
|
263
|
-
// TODO dev环境接口超时
|
264
|
-
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
265
|
-
}).then(function (result) {
|
266
|
-
resolve(result);
|
267
|
-
}, function () {
|
268
|
-
reject('sdk.action.query Request Error');
|
269
|
-
});
|
270
|
-
});
|
271
|
-
};
|
272
|
-
generateOneAccountQueryPromise = function generateOneAccountQueryPromise() {
|
273
|
-
return new Promise(function (resolve, reject) {
|
274
|
-
if (LOCAL_MOCK) {
|
275
|
-
setTimeout(function () {
|
276
|
-
resolve(oneAccount);
|
277
|
-
}, 100);
|
278
|
-
return;
|
279
|
-
}
|
280
|
-
requestService.request({
|
281
|
-
paymentSessionConfig: paymentSessionConfig,
|
282
|
-
paymentSessionData: paymentSession,
|
283
|
-
accountInfo: {
|
284
|
-
email: ''
|
285
|
-
}
|
286
|
-
}, {
|
287
|
-
env: environment,
|
288
|
-
envInfo: {
|
289
|
-
locale: locale
|
290
|
-
},
|
291
|
-
timeout: 300000,
|
292
|
-
// TODO dev环境接口超时
|
293
|
-
'Operation-Type': 'com.ipay.iexpfront.one.account.query'
|
294
|
-
}).then(function (result) {
|
295
|
-
resolve(result);
|
296
|
-
}, function () {
|
297
|
-
reject('one.account.query Request Error');
|
298
|
-
});
|
299
|
-
});
|
300
|
-
};
|
301
|
-
_context2.next = 11;
|
302
|
-
return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
|
303
|
-
case 11:
|
304
|
-
_yield$Promise$all = _context2.sent;
|
305
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
306
|
-
originActionQueryResult = _yield$Promise$all2[0];
|
307
|
-
originOneAccountQueryResult = _yield$Promise$all2[1];
|
308
|
-
this.obtainDataRes = {
|
309
|
-
originActionQueryResult: originActionQueryResult,
|
310
|
-
originOneAccountQueryResult: originOneAccountQueryResult
|
311
|
-
};
|
312
|
-
return _context2.abrupt("return", {
|
313
|
-
originActionQueryResult: originActionQueryResult,
|
314
|
-
originOneAccountQueryResult: originOneAccountQueryResult
|
315
|
-
});
|
316
|
-
case 17:
|
317
|
-
case "end":
|
318
|
-
return _context2.stop();
|
319
|
-
}
|
320
|
-
}, _callee2, this);
|
321
|
-
}));
|
322
|
-
function obtainData() {
|
323
|
-
return _obtainData.apply(this, arguments);
|
324
|
-
}
|
325
|
-
return obtainData;
|
326
|
-
}()
|
327
|
-
}, {
|
328
|
-
key: "getValue",
|
329
|
-
value: function getValue() {
|
330
|
-
// 实现 getValue 方法
|
331
|
-
return {};
|
332
|
-
}
|
333
|
-
}, {
|
334
|
-
key: "update",
|
335
|
-
value: function update(_ref5) {
|
336
|
-
var data = _ref5.data,
|
337
|
-
paymentSessionData = _ref5.paymentSessionData;
|
338
|
-
var _parseSessionData = parseSessionData(paymentSessionData),
|
339
|
-
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
340
|
-
parseData = _parseSessionData2[0],
|
341
|
-
sessionData = _parseSessionData2[1];
|
342
|
-
// 实现 update 方法的具体逻辑
|
343
|
-
this.eventCenter.dispatchToApp({
|
344
|
-
event: 'updatePayment',
|
345
|
-
data: {
|
346
|
-
paymentSessionData: paymentSessionData,
|
347
|
-
data: data,
|
348
|
-
sessionResult: parseData,
|
349
|
-
sessionData: sessionData
|
350
|
-
}
|
351
|
-
});
|
352
|
-
}
|
353
|
-
}]);
|
354
|
-
return PaymentProcessor;
|
355
|
-
}(BaseElementProcessor);
|
356
|
-
export default PaymentProcessor;
|