@alipay/ams-checkout 1.27.0 → 1.29.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/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +9 -0
- package/esm/constant/index.js +9 -0
- package/esm/core/component/element/index.d.ts +1 -0
- package/esm/core/component/element/index.js +75 -67
- package/esm/core/component/element/mock.d.ts +2 -0
- package/esm/core/component/element/mock.js +129 -53
- package/esm/core/component/element/type.d.ts +2 -2
- package/esm/core/component/element/type.js +2 -2
- package/esm/core/component/index.js +2 -2
- package/esm/foundation/core/index.js +4 -4
- package/esm/plugin/applepay/interface.d.ts +2 -2
- package/esm/plugin/component/channel.d.ts +41 -1
- package/esm/plugin/component/channel.js +589 -1
- package/esm/plugin/component/index.d.ts +1 -1
- package/esm/plugin/component/index.js +75 -39
- package/esm/types/index.d.ts +32 -2
- package/esm/types/index.js +3 -2
- package/package.json +1 -1
@@ -1,3 +1,33 @@
|
|
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 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; }
|
3
|
+
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; }
|
4
|
+
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; }
|
5
|
+
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); } }
|
6
|
+
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); }); }; }
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8
|
+
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); } }
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
10
|
+
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; }
|
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
|
+
import { BusManager, BusMessage } from "../../core/bus";
|
14
|
+
import { SecuritySDKActionEnum } from "../../core/bus/interface";
|
15
|
+
import { getApplePayPaymentSession, submitPayInfo } from "../../service";
|
16
|
+
import { EnvironmentEnum } from "../../types";
|
17
|
+
import { device } from "../../util";
|
18
|
+
var APPLEPAYERRORENUM = /*#__PURE__*/function (APPLEPAYERRORENUM) {
|
19
|
+
APPLEPAYERRORENUM["APPLE_PAY_MISSING_DATA"] = "APPLE_PAY_MISSING_DATA";
|
20
|
+
APPLEPAYERRORENUM["APPLE_PAY_NOT_SUPPORTED"] = "APPLE_PAY_NOT_SUPPORTED";
|
21
|
+
APPLEPAYERRORENUM["APPLE_PAY_PAYMENT_SESSION_REQUEST_FAILED"] = "APPLE_PAY_PAYMENT_SESSION_REQUEST_FAILED";
|
22
|
+
APPLEPAYERRORENUM["APPLE_PAY_TOKEN_ERROR"] = "APPLE_PAY_TOKEN_ERROR";
|
23
|
+
APPLEPAYERRORENUM["APPLE_PAY_CANCEL"] = "APPLE_PAY_CANCEL";
|
24
|
+
return APPLEPAYERRORENUM;
|
25
|
+
}(APPLEPAYERRORENUM || {});
|
26
|
+
var PAYMENT_STATUS = /*#__PURE__*/function (PAYMENT_STATUS) {
|
27
|
+
PAYMENT_STATUS["PENDING"] = "PENDING";
|
28
|
+
PAYMENT_STATUS["NORMAL"] = "NORMAL";
|
29
|
+
return PAYMENT_STATUS;
|
30
|
+
}(PAYMENT_STATUS || {});
|
1
31
|
export function getChannelBehavior(paymentSessionMetaData) {
|
2
32
|
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5, _paymentSessionMetaDa6, _paymentSessionMetaDa7, _paymentSessionMetaDa8;
|
3
33
|
// TOSS EASYPAY 2.0
|
@@ -86,4 +116,562 @@ export var handleGooglePay = function handleGooglePay(data) {
|
|
86
116
|
});
|
87
117
|
};
|
88
118
|
});
|
89
|
-
};
|
119
|
+
};
|
120
|
+
export var ApplePayService = /*#__PURE__*/function () {
|
121
|
+
function ApplePayService(_ref) {
|
122
|
+
var _paymentMethod$paymen;
|
123
|
+
var sessionData = _ref.sessionData,
|
124
|
+
paymentSessionMetaData = _ref.paymentSessionMetaData,
|
125
|
+
paymentMethod = _ref.paymentMethod,
|
126
|
+
logger = _ref.logger,
|
127
|
+
dispatchToApp = _ref.dispatchToApp;
|
128
|
+
_classCallCheck(this, ApplePayService);
|
129
|
+
_defineProperty(this, "APPLESDKURL", 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js');
|
130
|
+
_defineProperty(this, "applePaySession", void 0);
|
131
|
+
_defineProperty(this, "paymentSessionData", void 0);
|
132
|
+
_defineProperty(this, "sessionResult", void 0);
|
133
|
+
/**
|
134
|
+
* @description 支付状态,pending:支付中,normal:正常
|
135
|
+
*/
|
136
|
+
_defineProperty(this, "paymentStatus", void 0);
|
137
|
+
/**
|
138
|
+
* @description paymentRequest
|
139
|
+
*/
|
140
|
+
_defineProperty(this, "paymentRequest", void 0);
|
141
|
+
_defineProperty(this, "logger", void 0);
|
142
|
+
_defineProperty(this, "dispatchToApp", void 0);
|
143
|
+
_defineProperty(this, "paymentMethod", void 0);
|
144
|
+
this.paymentMethod = paymentMethod;
|
145
|
+
this.dispatchToApp = dispatchToApp;
|
146
|
+
this.logger = logger;
|
147
|
+
this.paymentSessionData = sessionData;
|
148
|
+
this.sessionResult = paymentSessionMetaData;
|
149
|
+
this.paymentRequest = paymentMethod === null || paymentMethod === void 0 || (_paymentMethod$paymen = paymentMethod.paymentMethodDetail) === null || _paymentMethod$paymen === void 0 || (_paymentMethod$paymen = _paymentMethod$paymen.applePayProps) === null || _paymentMethod$paymen === void 0 ? void 0 : _paymentMethod$paymen.paymentRequest;
|
150
|
+
}
|
151
|
+
_createClass(ApplePayService, [{
|
152
|
+
key: "startPay",
|
153
|
+
value: function () {
|
154
|
+
var _startPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
155
|
+
var _this = this;
|
156
|
+
var _this$logger2, _this$logger;
|
157
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
158
|
+
while (1) switch (_context2.prev = _context2.next) {
|
159
|
+
case 0:
|
160
|
+
_context2.prev = 0;
|
161
|
+
if (!(this.paymentStatus === PAYMENT_STATUS.PENDING)) {
|
162
|
+
_context2.next = 3;
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
return _context2.abrupt("return");
|
166
|
+
case 3:
|
167
|
+
if (this.isRequiredParameters) {
|
168
|
+
_context2.next = 7;
|
169
|
+
break;
|
170
|
+
}
|
171
|
+
(_this$logger = this.logger) === null || _this$logger === void 0 || _this$logger.logError({
|
172
|
+
code: 'a3753.b103030.c386485.d507448'
|
173
|
+
}, {
|
174
|
+
paymentRequest: JSON.stringify(this.paymentRequest)
|
175
|
+
});
|
176
|
+
this.paymentStatus = PAYMENT_STATUS.NORMAL;
|
177
|
+
return _context2.abrupt("return", Promise.reject({
|
178
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_MISSING_DATA
|
179
|
+
}));
|
180
|
+
case 7:
|
181
|
+
(_this$logger2 = this.logger) === null || _this$logger2 === void 0 || _this$logger2.logInfo({
|
182
|
+
code: 'a3753.b103030.c386485.d507459'
|
183
|
+
}, {
|
184
|
+
paymentRequest: JSON.stringify(this.paymentRequest)
|
185
|
+
});
|
186
|
+
_context2.next = 10;
|
187
|
+
return this.initApplePaySession();
|
188
|
+
case 10:
|
189
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
190
|
+
_this.applePaySession.onvalidatemerchant = /*#__PURE__*/function () {
|
191
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
192
|
+
var requestParams, res, merchantSession, _this$logger3, _this$logger4;
|
193
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
194
|
+
while (1) switch (_context.prev = _context.next) {
|
195
|
+
case 0:
|
196
|
+
_context.prev = 0;
|
197
|
+
requestParams = {
|
198
|
+
validateUrl: event === null || event === void 0 ? void 0 : event.validationURL,
|
199
|
+
paymentSessionData: _this.paymentSessionData
|
200
|
+
};
|
201
|
+
_context.t0 = getApplePayPaymentSession;
|
202
|
+
_context.t1 = _this.paymentSessionData;
|
203
|
+
_context.t2 = requestParams;
|
204
|
+
_context.t3 = EnvironmentEnum.prod;
|
205
|
+
_context.next = 8;
|
206
|
+
return _this.getDeviceId();
|
207
|
+
case 8:
|
208
|
+
_context.t4 = _context.sent;
|
209
|
+
_context.t5 = {
|
210
|
+
deviceId: _context.t4
|
211
|
+
};
|
212
|
+
_context.t6 = {
|
213
|
+
env: _context.t3,
|
214
|
+
envInfo: _context.t5
|
215
|
+
};
|
216
|
+
_context.t7 = _this.logger;
|
217
|
+
_context.next = 14;
|
218
|
+
return (0, _context.t0)(_context.t1, _context.t2, _context.t6, _context.t7);
|
219
|
+
case 14:
|
220
|
+
res = _context.sent;
|
221
|
+
if (res !== null && res !== void 0 && res.success && res.merchantSessionObject) {
|
222
|
+
merchantSession = JSON.parse(res.merchantSessionObject);
|
223
|
+
_this.applePaySession.completeMerchantValidation(merchantSession);
|
224
|
+
} else {
|
225
|
+
(_this$logger3 = _this.logger) === null || _this$logger3 === void 0 || _this$logger3.logError({
|
226
|
+
code: 'a3753.b103030.c386485.d507483'
|
227
|
+
});
|
228
|
+
_this.abortPaySession();
|
229
|
+
reject({
|
230
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_PAYMENT_SESSION_REQUEST_FAILED
|
231
|
+
});
|
232
|
+
}
|
233
|
+
_context.next = 23;
|
234
|
+
break;
|
235
|
+
case 18:
|
236
|
+
_context.prev = 18;
|
237
|
+
_context.t8 = _context["catch"](0);
|
238
|
+
(_this$logger4 = _this.logger) === null || _this$logger4 === void 0 || _this$logger4.logError({
|
239
|
+
code: 'a3753.b103030.c386485.d507483'
|
240
|
+
});
|
241
|
+
_this.abortPaySession();
|
242
|
+
reject({
|
243
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_PAYMENT_SESSION_REQUEST_FAILED
|
244
|
+
});
|
245
|
+
case 23:
|
246
|
+
case "end":
|
247
|
+
return _context.stop();
|
248
|
+
}
|
249
|
+
}, _callee, null, [[0, 18]]);
|
250
|
+
}));
|
251
|
+
return function (_x) {
|
252
|
+
return _ref2.apply(this, arguments);
|
253
|
+
};
|
254
|
+
}();
|
255
|
+
_this.applePaySession.onpaymentauthorized = function (event) {
|
256
|
+
var exception = function exception() {
|
257
|
+
var _this$applePaySession, _this$applePaySession2;
|
258
|
+
(_this$applePaySession = _this.applePaySession) === null || _this$applePaySession === void 0 || (_this$applePaySession2 = _this$applePaySession.completePayment) === null || _this$applePaySession2 === void 0 || _this$applePaySession2.call(_this$applePaySession, window.ApplePaySession.STATUS_FAILURE);
|
259
|
+
_this.abortPaySession();
|
260
|
+
reject({
|
261
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_TOKEN_ERROR
|
262
|
+
});
|
263
|
+
};
|
264
|
+
var _event$payment = event === null || event === void 0 ? void 0 : event.payment,
|
265
|
+
token = _event$payment.token,
|
266
|
+
billingContact = _event$payment.billingContact,
|
267
|
+
shippingContact = _event$payment.shippingContact;
|
268
|
+
if (token) {
|
269
|
+
var _this$paymentRequest, _this$paymentRequest2;
|
270
|
+
var obj = {
|
271
|
+
instPaymentToken: JSON.stringify(token)
|
272
|
+
};
|
273
|
+
if ((_this$paymentRequest = _this.paymentRequest) !== null && _this$paymentRequest !== void 0 && _this$paymentRequest.requiredBillingContactFields && billingContact) {
|
274
|
+
obj['applePayBillingContact'] = JSON.stringify(billingContact);
|
275
|
+
}
|
276
|
+
if ((_this$paymentRequest2 = _this.paymentRequest) !== null && _this$paymentRequest2 !== void 0 && _this$paymentRequest2.requiredShippingContactFields && shippingContact) {
|
277
|
+
obj['applePayShippingContact'] = JSON.stringify(shippingContact);
|
278
|
+
}
|
279
|
+
_this.submitPay(obj).then(function (res) {
|
280
|
+
_this.setApplePayStatus(res);
|
281
|
+
resolve(res);
|
282
|
+
});
|
283
|
+
} else {
|
284
|
+
var _this$logger5;
|
285
|
+
(_this$logger5 = _this.logger) === null || _this$logger5 === void 0 || _this$logger5.logError({
|
286
|
+
code: 'a3753.b103030.c386485.d507486'
|
287
|
+
});
|
288
|
+
exception();
|
289
|
+
}
|
290
|
+
};
|
291
|
+
_this.applePaySession.oncancel = function () {
|
292
|
+
if (_this.paymentStatus === PAYMENT_STATUS.PENDING) {
|
293
|
+
var _this$logger6;
|
294
|
+
(_this$logger6 = _this.logger) === null || _this$logger6 === void 0 || _this$logger6.logError({
|
295
|
+
code: 'a3753.b103030.c386485.d507497'
|
296
|
+
});
|
297
|
+
} else {
|
298
|
+
var _this$logger7;
|
299
|
+
(_this$logger7 = _this.logger) === null || _this$logger7 === void 0 || _this$logger7.logInfo({
|
300
|
+
code: 'a3753.b103030.c386485.d507498'
|
301
|
+
});
|
302
|
+
}
|
303
|
+
_this.abortPaySession();
|
304
|
+
reject({
|
305
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_CANCEL
|
306
|
+
});
|
307
|
+
};
|
308
|
+
_this.applePaySession.begin();
|
309
|
+
_this.addEventListener(reject);
|
310
|
+
}));
|
311
|
+
case 13:
|
312
|
+
_context2.prev = 13;
|
313
|
+
_context2.t0 = _context2["catch"](0);
|
314
|
+
return _context2.abrupt("return", Promise.reject(_context2.t0));
|
315
|
+
case 16:
|
316
|
+
case "end":
|
317
|
+
return _context2.stop();
|
318
|
+
}
|
319
|
+
}, _callee2, this, [[0, 13]]);
|
320
|
+
}));
|
321
|
+
function startPay() {
|
322
|
+
return _startPay.apply(this, arguments);
|
323
|
+
}
|
324
|
+
return startPay;
|
325
|
+
}()
|
326
|
+
}, {
|
327
|
+
key: "setApplePayStatus",
|
328
|
+
value: function setApplePayStatus(result) {
|
329
|
+
var _this$applePaySession3, _this$applePaySession4;
|
330
|
+
var payStatus = {
|
331
|
+
success: window.ApplePaySession.STATUS_SUCCESS,
|
332
|
+
fail: window.ApplePaySession.STATUS_FAILURE
|
333
|
+
};
|
334
|
+
var status;
|
335
|
+
if (result !== null && result !== void 0 && result.success || (result === null || result === void 0 ? void 0 : result.errorStatus) === 'U') {
|
336
|
+
status = 'success';
|
337
|
+
} else {
|
338
|
+
status = 'fail';
|
339
|
+
}
|
340
|
+
this.paymentStatus = PAYMENT_STATUS.NORMAL;
|
341
|
+
(_this$applePaySession3 = this.applePaySession) === null || _this$applePaySession3 === void 0 || (_this$applePaySession4 = _this$applePaySession3.completePayment) === null || _this$applePaySession4 === void 0 || _this$applePaySession4.call(_this$applePaySession3, payStatus[status]);
|
342
|
+
}
|
343
|
+
}, {
|
344
|
+
key: "submitPay",
|
345
|
+
value: function () {
|
346
|
+
var _submitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
347
|
+
var _this$sessionResult, _this$paymentMethod, _this$paymentMethod2, _this$paymentMethod3;
|
348
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
349
|
+
while (1) switch (_context3.prev = _context3.next) {
|
350
|
+
case 0:
|
351
|
+
_context3.prev = 0;
|
352
|
+
_context3.t0 = submitPayInfo;
|
353
|
+
_context3.t1 = {
|
354
|
+
paymentSessionConfig: (_this$sessionResult = this.sessionResult) === null || _this$sessionResult === void 0 ? void 0 : _this$sessionResult.paymentSessionConfig,
|
355
|
+
paymentSessionData: this.paymentSessionData,
|
356
|
+
paymentFactors: params,
|
357
|
+
paymentMethod: {
|
358
|
+
paymentMethodType: (_this$paymentMethod = this.paymentMethod) === null || _this$paymentMethod === void 0 ? void 0 : _this$paymentMethod.paymentMethodType,
|
359
|
+
category: (_this$paymentMethod2 = this.paymentMethod) === null || _this$paymentMethod2 === void 0 ? void 0 : _this$paymentMethod2.category,
|
360
|
+
paymentMethodDetail: (_this$paymentMethod3 = this.paymentMethod) === null || _this$paymentMethod3 === void 0 ? void 0 : _this$paymentMethod3.paymentMethodDetail
|
361
|
+
}
|
362
|
+
};
|
363
|
+
_context3.t2 = EnvironmentEnum.prod;
|
364
|
+
_context3.next = 6;
|
365
|
+
return this.getDeviceId();
|
366
|
+
case 6:
|
367
|
+
_context3.t3 = _context3.sent;
|
368
|
+
_context3.t4 = {
|
369
|
+
deviceId: _context3.t3
|
370
|
+
};
|
371
|
+
_context3.t5 = {
|
372
|
+
env: _context3.t2,
|
373
|
+
envInfo: _context3.t4
|
374
|
+
};
|
375
|
+
_context3.t6 = this.logger;
|
376
|
+
_context3.next = 12;
|
377
|
+
return (0, _context3.t0)(_context3.t1, _context3.t5, _context3.t6);
|
378
|
+
case 12:
|
379
|
+
return _context3.abrupt("return", _context3.sent);
|
380
|
+
case 15:
|
381
|
+
_context3.prev = 15;
|
382
|
+
_context3.t7 = _context3["catch"](0);
|
383
|
+
case 17:
|
384
|
+
case "end":
|
385
|
+
return _context3.stop();
|
386
|
+
}
|
387
|
+
}, _callee3, this, [[0, 15]]);
|
388
|
+
}));
|
389
|
+
function submitPay(_x2) {
|
390
|
+
return _submitPay.apply(this, arguments);
|
391
|
+
}
|
392
|
+
return submitPay;
|
393
|
+
}()
|
394
|
+
}, {
|
395
|
+
key: "submit",
|
396
|
+
value: function () {
|
397
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
398
|
+
var result;
|
399
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
400
|
+
while (1) switch (_context4.prev = _context4.next) {
|
401
|
+
case 0:
|
402
|
+
_context4.prev = 0;
|
403
|
+
_context4.next = 3;
|
404
|
+
return this.startPay();
|
405
|
+
case 3:
|
406
|
+
result = _context4.sent;
|
407
|
+
this.dispatchToApp({
|
408
|
+
context: {
|
409
|
+
event: 'getApplePayToken',
|
410
|
+
data: {
|
411
|
+
success: true,
|
412
|
+
result: result
|
413
|
+
}
|
414
|
+
}
|
415
|
+
});
|
416
|
+
_context4.next = 10;
|
417
|
+
break;
|
418
|
+
case 7:
|
419
|
+
_context4.prev = 7;
|
420
|
+
_context4.t0 = _context4["catch"](0);
|
421
|
+
this.dispatchToApp({
|
422
|
+
context: {
|
423
|
+
event: 'getApplePayToken',
|
424
|
+
data: {
|
425
|
+
success: false,
|
426
|
+
result: _context4.t0
|
427
|
+
}
|
428
|
+
}
|
429
|
+
});
|
430
|
+
case 10:
|
431
|
+
case "end":
|
432
|
+
return _context4.stop();
|
433
|
+
}
|
434
|
+
}, _callee4, this, [[0, 7]]);
|
435
|
+
}));
|
436
|
+
function submit() {
|
437
|
+
return _submit.apply(this, arguments);
|
438
|
+
}
|
439
|
+
return submit;
|
440
|
+
}()
|
441
|
+
}, {
|
442
|
+
key: "getDeviceId",
|
443
|
+
value: function () {
|
444
|
+
var _getDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
445
|
+
var _yield$BusManager$pub, _this$sessionResult2;
|
446
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
447
|
+
while (1) switch (_context5.prev = _context5.next) {
|
448
|
+
case 0:
|
449
|
+
_context5.next = 2;
|
450
|
+
return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId, JSON.stringify({
|
451
|
+
deviceIdParameter: {
|
452
|
+
productScene: (_this$sessionResult2 = this.sessionResult) === null || _this$sessionResult2 === void 0 || (_this$sessionResult2 = _this$sessionResult2.paymentSessionConfig) === null || _this$sessionResult2 === void 0 ? void 0 : _this$sessionResult2.productScene
|
453
|
+
}
|
454
|
+
})), {
|
455
|
+
fallback: ''
|
456
|
+
});
|
457
|
+
case 2:
|
458
|
+
_context5.t1 = _yield$BusManager$pub = _context5.sent;
|
459
|
+
_context5.t0 = _context5.t1 === null;
|
460
|
+
if (_context5.t0) {
|
461
|
+
_context5.next = 6;
|
462
|
+
break;
|
463
|
+
}
|
464
|
+
_context5.t0 = _yield$BusManager$pub === void 0;
|
465
|
+
case 6:
|
466
|
+
if (!_context5.t0) {
|
467
|
+
_context5.next = 10;
|
468
|
+
break;
|
469
|
+
}
|
470
|
+
_context5.t2 = void 0;
|
471
|
+
_context5.next = 11;
|
472
|
+
break;
|
473
|
+
case 10:
|
474
|
+
_context5.t2 = _yield$BusManager$pub.getJSONObject();
|
475
|
+
case 11:
|
476
|
+
return _context5.abrupt("return", _context5.t2);
|
477
|
+
case 12:
|
478
|
+
case "end":
|
479
|
+
return _context5.stop();
|
480
|
+
}
|
481
|
+
}, _callee5, this);
|
482
|
+
}));
|
483
|
+
function getDeviceId() {
|
484
|
+
return _getDeviceId.apply(this, arguments);
|
485
|
+
}
|
486
|
+
return getDeviceId;
|
487
|
+
}()
|
488
|
+
}, {
|
489
|
+
key: "initApplePaySession",
|
490
|
+
value: function () {
|
491
|
+
var _initApplePaySession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
492
|
+
var version, _this$logger8;
|
493
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
494
|
+
while (1) switch (_context6.prev = _context6.next) {
|
495
|
+
case 0:
|
496
|
+
_context6.prev = 0;
|
497
|
+
_context6.next = 3;
|
498
|
+
return this.loadApplePaySdk();
|
499
|
+
case 3:
|
500
|
+
if ('ApplePaySession' in window) {
|
501
|
+
_context6.next = 5;
|
502
|
+
break;
|
503
|
+
}
|
504
|
+
throw new Error('Apple Pay not supported');
|
505
|
+
case 5:
|
506
|
+
version = this.paymentRequest.version;
|
507
|
+
if (this.isCanMakePayments(version)) {
|
508
|
+
_context6.next = 8;
|
509
|
+
break;
|
510
|
+
}
|
511
|
+
throw new Error('Apple Pay not supported');
|
512
|
+
case 8:
|
513
|
+
this.applePaySession = new window.ApplePaySession(version, this.initSessionParams);
|
514
|
+
_context6.next = 15;
|
515
|
+
break;
|
516
|
+
case 11:
|
517
|
+
_context6.prev = 11;
|
518
|
+
_context6.t0 = _context6["catch"](0);
|
519
|
+
(_this$logger8 = this.logger) === null || _this$logger8 === void 0 || _this$logger8.logError({
|
520
|
+
code: 'a3753.b103030.c386485.d507471'
|
521
|
+
}, {
|
522
|
+
paymentRequest: JSON.stringify(this.paymentRequest)
|
523
|
+
});
|
524
|
+
return _context6.abrupt("return", Promise.reject({
|
525
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_NOT_SUPPORTED
|
526
|
+
}));
|
527
|
+
case 15:
|
528
|
+
case "end":
|
529
|
+
return _context6.stop();
|
530
|
+
}
|
531
|
+
}, _callee6, this, [[0, 11]]);
|
532
|
+
}));
|
533
|
+
function initApplePaySession() {
|
534
|
+
return _initApplePaySession.apply(this, arguments);
|
535
|
+
}
|
536
|
+
return initApplePaySession;
|
537
|
+
}()
|
538
|
+
}, {
|
539
|
+
key: "isCanMakePayments",
|
540
|
+
value: function isCanMakePayments() {
|
541
|
+
var _window$ApplePaySessi, _window$ApplePaySessi2;
|
542
|
+
var version = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
|
543
|
+
return ((_window$ApplePaySessi = window.ApplePaySession) === null || _window$ApplePaySessi === void 0 ? void 0 : _window$ApplePaySessi.canMakePayments()) && ((_window$ApplePaySessi2 = window.ApplePaySession) === null || _window$ApplePaySessi2 === void 0 ? void 0 : _window$ApplePaySessi2.supportsVersion(version));
|
544
|
+
}
|
545
|
+
}, {
|
546
|
+
key: "loadApplePaySdk",
|
547
|
+
value: function loadApplePaySdk() {
|
548
|
+
var _this2 = this;
|
549
|
+
if (device.Android) {
|
550
|
+
return Promise.reject('APPLE_PAY_NOT_SUPPORTED');
|
551
|
+
}
|
552
|
+
// 如果支持或者已经加载sdk直接返回
|
553
|
+
if (this.checkScriptIsLoaded || this.isCanMakePayments()) {
|
554
|
+
return Promise.resolve(true);
|
555
|
+
}
|
556
|
+
return new Promise(function (resolve, reject) {
|
557
|
+
var script = document.createElement('script');
|
558
|
+
script.src = _this2.APPLESDKURL;
|
559
|
+
script.onload = function () {
|
560
|
+
resolve(true);
|
561
|
+
};
|
562
|
+
script.onerror = function () {
|
563
|
+
reject(false);
|
564
|
+
};
|
565
|
+
document.body.appendChild(script);
|
566
|
+
});
|
567
|
+
}
|
568
|
+
}, {
|
569
|
+
key: "abortPaySession",
|
570
|
+
value: function abortPaySession() {
|
571
|
+
try {
|
572
|
+
var _this$applePaySession5, _this$applePaySession6;
|
573
|
+
this.paymentStatus = PAYMENT_STATUS.NORMAL;
|
574
|
+
this.applePaySession && ((_this$applePaySession5 = (_this$applePaySession6 = this.applePaySession).abort) === null || _this$applePaySession5 === void 0 ? void 0 : _this$applePaySession5.call(_this$applePaySession6));
|
575
|
+
} catch (e) {
|
576
|
+
console.error('abortPaySession error', e);
|
577
|
+
}
|
578
|
+
}
|
579
|
+
}, {
|
580
|
+
key: "addEventListener",
|
581
|
+
value: function addEventListener(reject) {
|
582
|
+
var _this3 = this;
|
583
|
+
var appleModal = document.querySelector('apple-pay-modal');
|
584
|
+
var shadowRoot = appleModal === null || appleModal === void 0 ? void 0 : appleModal.shadowRoot;
|
585
|
+
var closeButton = (shadowRoot === null || shadowRoot === void 0 ? void 0 : shadowRoot.querySelector('.modal-close-button')) || null;
|
586
|
+
var callFn = function callFn() {
|
587
|
+
var _this3$logger;
|
588
|
+
(_this3$logger = _this3.logger) === null || _this3$logger === void 0 || _this3$logger.logInfo({
|
589
|
+
code: 'a3753.b103030.c386485.d507470'
|
590
|
+
});
|
591
|
+
_this3.abortPaySession();
|
592
|
+
closeButton === null || closeButton === void 0 || closeButton.removeEventListener('click', callFn);
|
593
|
+
return reject === null || reject === void 0 ? void 0 : reject({
|
594
|
+
errorCode: APPLEPAYERRORENUM.APPLE_PAY_CANCEL
|
595
|
+
});
|
596
|
+
};
|
597
|
+
closeButton === null || closeButton === void 0 || closeButton.addEventListener('click', callFn, {
|
598
|
+
once: true
|
599
|
+
});
|
600
|
+
}
|
601
|
+
}, {
|
602
|
+
key: "initSessionParams",
|
603
|
+
get: function get() {
|
604
|
+
var _this$sessionResult3;
|
605
|
+
var _this$paymentRequest3 = this.paymentRequest,
|
606
|
+
supportedNetworks = _this$paymentRequest3.supportedNetworks,
|
607
|
+
requiredBillingContactFields = _this$paymentRequest3.requiredBillingContactFields,
|
608
|
+
requiredShippingContactFields = _this$paymentRequest3.requiredShippingContactFields,
|
609
|
+
merchantCapabilities = _this$paymentRequest3.merchantCapabilities;
|
610
|
+
var _ref3 = ((_this$sessionResult3 = this.sessionResult) === null || _this$sessionResult3 === void 0 ? void 0 : _this$sessionResult3.paymentSessionFactor) || {},
|
611
|
+
merchantInfo = _ref3.merchantInfo,
|
612
|
+
order = _ref3.order,
|
613
|
+
paymentAmount = _ref3.paymentAmount,
|
614
|
+
recurringInfo = _ref3.recurringInfo;
|
615
|
+
var request = _objectSpread(_objectSpread({
|
616
|
+
countryCode: merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.registeredCountry,
|
617
|
+
currencyCode: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.currency,
|
618
|
+
merchantCapabilities: merchantCapabilities,
|
619
|
+
supportedNetworks: supportedNetworks,
|
620
|
+
total: {
|
621
|
+
label: merchantInfo === null || merchantInfo === void 0 ? void 0 : merchantInfo.merchantName,
|
622
|
+
type: 'final',
|
623
|
+
amount: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.value
|
624
|
+
}
|
625
|
+
}, requiredBillingContactFields ? requiredBillingContactFields : null), requiredShippingContactFields ? requiredShippingContactFields : null);
|
626
|
+
if (recurringInfo) {
|
627
|
+
var _recurringInfo$interv;
|
628
|
+
if (!(order !== null && order !== void 0 && order.orderDescription) || !(recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.managementURL)) {
|
629
|
+
return;
|
630
|
+
}
|
631
|
+
var lineItem = {
|
632
|
+
type: 'final',
|
633
|
+
label: recurringInfo.title,
|
634
|
+
amount: paymentAmount === null || paymentAmount === void 0 ? void 0 : paymentAmount.value,
|
635
|
+
paymentTiming: 'recurring',
|
636
|
+
recurringPaymentStartDate: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.startDate ? new Date(Number(recurringInfo.startDate) * 1000) : undefined,
|
637
|
+
recurringPaymentEndDate: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.endDate ? new Date(Number(recurringInfo.endDate) * 1000) : undefined,
|
638
|
+
recurringPaymentIntervalUnit: recurringInfo !== null && recurringInfo !== void 0 && recurringInfo.intervalUnit ? recurringInfo.intervalUnit : 'month',
|
639
|
+
recurringPaymentIntervalCount: (_recurringInfo$interv = recurringInfo === null || recurringInfo === void 0 ? void 0 : recurringInfo.intervalCount) !== null && _recurringInfo$interv !== void 0 ? _recurringInfo$interv : 1
|
640
|
+
};
|
641
|
+
var recurringRequest = {
|
642
|
+
paymentDescription: order === null || order === void 0 ? void 0 : order.orderDescription,
|
643
|
+
billingAgreement: recurringInfo.agreementDescription,
|
644
|
+
regularBilling: lineItem,
|
645
|
+
managementURL: recurringInfo === null || recurringInfo === void 0 ? void 0 : recurringInfo.managementURL,
|
646
|
+
tokenNotificationURL: recurringInfo === null || recurringInfo === void 0 ? void 0 : recurringInfo.tokenNotificationURL
|
647
|
+
};
|
648
|
+
request.total = lineItem;
|
649
|
+
request.lineItems = [lineItem];
|
650
|
+
request.recurringPaymentRequest = recurringRequest;
|
651
|
+
}
|
652
|
+
return request;
|
653
|
+
}
|
654
|
+
}, {
|
655
|
+
key: "isRequiredParameters",
|
656
|
+
get: function get() {
|
657
|
+
if (!this.paymentRequest) return false;
|
658
|
+
var _this$paymentRequest4 = this.paymentRequest,
|
659
|
+
_this$paymentRequest5 = _this$paymentRequest4.supportedNetworks,
|
660
|
+
supportedNetworks = _this$paymentRequest5 === void 0 ? [] : _this$paymentRequest5,
|
661
|
+
_this$paymentRequest6 = _this$paymentRequest4.merchantCapabilities,
|
662
|
+
merchantCapabilities = _this$paymentRequest6 === void 0 ? [] : _this$paymentRequest6,
|
663
|
+
version = _this$paymentRequest4.version;
|
664
|
+
var _ref4 = this.sessionResult || {},
|
665
|
+
paymentSessionFactor = _ref4.paymentSessionFactor;
|
666
|
+
var isSupportedNetworks = Array.isArray(supportedNetworks) && supportedNetworks.length > 0;
|
667
|
+
var isMerchantCapabilities = Array.isArray(merchantCapabilities) && merchantCapabilities.length > 0;
|
668
|
+
return !(!version || !isSupportedNetworks || !(paymentSessionFactor !== null && paymentSessionFactor !== void 0 && paymentSessionFactor.merchantInfo) || !(paymentSessionFactor !== null && paymentSessionFactor !== void 0 && paymentSessionFactor.paymentAmount) || !isMerchantCapabilities);
|
669
|
+
}
|
670
|
+
}, {
|
671
|
+
key: "checkScriptIsLoaded",
|
672
|
+
get: function get() {
|
673
|
+
return !!document.querySelector("script[src=\"".concat(this.APPLESDKURL, "\"]"));
|
674
|
+
}
|
675
|
+
}]);
|
676
|
+
return ApplePayService;
|
677
|
+
}();
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type AMSCheckout from '../../core/instance';
|
2
2
|
import type { EventPayload, EventPayloadContext, IappendIframeNodesParams, IMerchantAppointParam, Iselector } from '../../types';
|
3
|
-
import { ComponentSignEnum, DeviceIdParameter,
|
3
|
+
import { ComponentSignEnum, DeviceIdParameter, DisplayTypeEnum, PlatformEnum } from '../../types';
|
4
4
|
type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: DisplayTypeEnum) => Promise<void>;
|
5
5
|
export default class ComponentApp {
|
6
6
|
app: null | HTMLIFrameElement;
|