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