@alipay/ams-checkout 0.0.1730107332-dev.3 → 0.0.1730441340-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.
Files changed (127) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +7 -7
  3. package/esm/config/index.js +7 -7
  4. package/esm/constant/index.d.ts +6 -7
  5. package/esm/constant/index.js +80 -11
  6. package/esm/{foundation/service/api-bus → core/bus}/ability/callback.d.ts +2 -2
  7. package/esm/{foundation/service/api-bus → core/bus}/ability/callback.js +1 -1
  8. package/esm/{foundation/service/api-bus → core/bus}/ability/security.d.ts +4 -6
  9. package/esm/{foundation/service/api-bus → core/bus}/ability/security.js +35 -92
  10. package/esm/{foundation/service/api-bus → core/bus}/ability/tracker.d.ts +4 -4
  11. package/esm/{foundation/service/api-bus → core/bus}/ability/tracker.js +3 -6
  12. package/esm/{foundation/service/api-bus/busManager.d.ts → core/bus/index.d.ts} +15 -17
  13. package/esm/{foundation/service/api-bus/busManager.js → core/bus/index.js} +35 -67
  14. package/esm/{foundation/service/api-bus → core/bus}/interface.d.ts +0 -12
  15. package/esm/{foundation/service/api-bus → core/bus}/interface.js +2 -16
  16. package/esm/core/component/address.d.ts +8 -0
  17. package/esm/{foundation/service/api-bus/ability/globalData.js → core/component/address.js} +58 -75
  18. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  19. package/esm/{foundation/service/container/popup.js → core/component/appPreloadProcessing.js} +83 -97
  20. package/esm/core/component/ckp/index.d.ts +27 -0
  21. package/esm/core/component/ckp/index.js +166 -0
  22. package/esm/core/component/index.d.ts +51 -0
  23. package/esm/core/component/index.js +531 -0
  24. package/esm/core/drop-in/index.d.ts +22 -0
  25. package/esm/core/drop-in/index.js +104 -0
  26. package/esm/core/instance/index.d.ts +89 -0
  27. package/esm/core/instance/index.js +499 -0
  28. package/esm/index.d.ts +28 -5
  29. package/esm/index.js +158 -28
  30. package/esm/plugin/applepay/component.d.ts +50 -0
  31. package/esm/plugin/applepay/component.js +339 -0
  32. package/esm/plugin/applepay/index.d.ts +17 -0
  33. package/esm/plugin/applepay/index.js +117 -0
  34. package/esm/plugin/applepay/interface.d.ts +161 -0
  35. package/esm/plugin/applepay/interface.js +69 -0
  36. package/esm/plugin/applepay/service.d.ts +54 -0
  37. package/esm/plugin/applepay/service.js +289 -0
  38. package/esm/plugin/component/cashierApp.d.ts +34 -0
  39. package/esm/plugin/component/cashierApp.js +237 -0
  40. package/esm/{component → plugin/component}/channel.d.ts +4 -3
  41. package/esm/{component → plugin/component}/channel.js +37 -1
  42. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  43. package/esm/{component → plugin/component}/component.inline.style.js +9 -11
  44. package/esm/{component → plugin/component}/component.popup.style.d.ts +6 -15
  45. package/esm/{component → plugin/component}/component.popup.style.js +18 -36
  46. package/esm/plugin/component/index.d.ts +126 -0
  47. package/esm/plugin/component/index.js +1839 -0
  48. package/esm/{component → plugin/component}/popupWindow.style.js +2 -2
  49. package/esm/plugin/const.d.ts +2 -0
  50. package/esm/plugin/const.js +33 -0
  51. package/esm/plugin/drop-in/index.d.ts +71 -0
  52. package/esm/plugin/drop-in/index.js +324 -0
  53. package/esm/plugin/payment-element/utils.d.ts +2 -0
  54. package/esm/plugin/payment-element/utils.js +6 -0
  55. package/esm/plugin/paypal/index.d.ts +20 -0
  56. package/esm/plugin/paypal/index.js +390 -0
  57. package/esm/plugin/type.d.ts +34 -0
  58. package/esm/plugin/utils.d.ts +6 -0
  59. package/esm/plugin/utils.js +21 -0
  60. package/esm/types/index.d.ts +38 -66
  61. package/esm/types/index.js +59 -63
  62. package/esm/util/createIframeNode.d.ts +6 -0
  63. package/esm/util/createIframeNode.js +48 -0
  64. package/esm/util/getBackScheme.d.ts +5 -0
  65. package/esm/util/getBackScheme.js +42 -0
  66. package/esm/util/index.d.ts +1 -1
  67. package/esm/util/index.js +4 -3
  68. package/esm/util/intl-callapp/es/index.js +0 -1
  69. package/esm/{foundation/service/security → util}/security.d.ts +2 -2
  70. package/esm/{foundation/service/security → util}/security.js +3 -3
  71. package/esm/util/ua/index.d.ts +2 -0
  72. package/esm/util/ua/index.js +2 -0
  73. package/esm/util/ua/isAndroid.d.ts +4 -0
  74. package/esm/util/ua/isAndroid.js +7 -0
  75. package/esm/util/ua/isIOS.d.ts +4 -0
  76. package/esm/util/ua/isIOS.js +7 -0
  77. package/package.json +2 -2
  78. package/esm/component/component.inline.style.d.ts +0 -10
  79. package/esm/foundation/core/index.d.ts +0 -26
  80. package/esm/foundation/core/index.js +0 -362
  81. package/esm/foundation/index.d.ts +0 -71
  82. package/esm/foundation/index.js +0 -42
  83. package/esm/foundation/product-processor/easysafepay/deps.d.ts +0 -17
  84. package/esm/foundation/product-processor/easysafepay/deps.js +0 -11
  85. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -27
  86. package/esm/foundation/product-processor/easysafepay/index.js +0 -587
  87. package/esm/foundation/service/api-bus/ability/globalData.d.ts +0 -10
  88. package/esm/foundation/service/api-bus/ability/request.d.ts +0 -10
  89. package/esm/foundation/service/api-bus/ability/request.js +0 -151
  90. package/esm/foundation/service/api-bus/index.d.ts +0 -20
  91. package/esm/foundation/service/api-bus/index.js +0 -88
  92. package/esm/foundation/service/container/index.d.ts +0 -28
  93. package/esm/foundation/service/container/index.js +0 -257
  94. package/esm/foundation/service/container/popup.d.ts +0 -17
  95. package/esm/foundation/service/container/utils.d.ts +0 -7
  96. package/esm/foundation/service/container/utils.js +0 -48
  97. package/esm/foundation/service/event-center.d.ts +0 -74
  98. package/esm/foundation/service/event-center.js +0 -213
  99. package/esm/foundation/service/global-data/index.d.ts +0 -11
  100. package/esm/foundation/service/global-data/index.js +0 -68
  101. package/esm/foundation/service/index.d.ts +0 -19
  102. package/esm/foundation/service/index.js +0 -82
  103. package/esm/foundation/service/log/index.d.ts +0 -43
  104. package/esm/foundation/service/log/index.js +0 -235
  105. package/esm/foundation/service/log/types.d.ts +0 -32
  106. package/esm/foundation/service/requester/deps.d.ts +0 -17
  107. package/esm/foundation/service/requester/deps.js +0 -11
  108. package/esm/foundation/service/requester/requester.d.ts +0 -22
  109. package/esm/foundation/service/requester/requester.js +0 -214
  110. package/esm/foundation/service/security/index.d.ts +0 -28
  111. package/esm/foundation/service/security/index.js +0 -285
  112. package/esm/foundation/types/index.d.ts +0 -4
  113. package/esm/foundation/types/index.js +0 -4
  114. package/esm/foundation/utils/gray_scale_utils.d.ts +0 -7
  115. package/esm/foundation/utils/gray_scale_utils.js +0 -40
  116. package/esm/foundation/utils/payment_context_utils.d.ts +0 -13
  117. package/esm/foundation/utils/payment_context_utils.js +0 -57
  118. package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
  119. package/esm/foundation/utils/payment_product_utils.js +0 -38
  120. package/esm/foundation/utils/redirect_utils.d.ts +0 -6
  121. package/esm/foundation/utils/redirect_utils.js +0 -99
  122. package/esm/foundation/utils/system_events.d.ts +0 -4
  123. package/esm/foundation/utils/system_events.js +0 -71
  124. package/esm/foundation/utils/web_app_url_utils.d.ts +0 -46
  125. package/esm/foundation/utils/web_app_url_utils.js +0 -112
  126. /package/esm/{component → plugin/component}/popupWindow.style.d.ts +0 -0
  127. /package/esm/{foundation/service/log/types.js → plugin/type.js} +0 -0
@@ -1,587 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function 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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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; }
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; } }
9
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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
- 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
- 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); }); }; }
13
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
- import { uuid, ProductSceneEnum, ChannelCustomize, DisplayTypeEnum, isLocalMock, isPC, ServiceProvider, ProductInfoCacheUtil, WebAppUrlUtil } from "./deps";
20
- export var EasySafePayProcessor = /*#__PURE__*/function () {
21
- function EasySafePayProcessor() {
22
- _classCallCheck(this, EasySafePayProcessor);
23
- _defineProperty(this, "paymentContext", void 0);
24
- _defineProperty(this, "initConfig", void 0);
25
- _defineProperty(this, "logger", void 0);
26
- _defineProperty(this, "securityService", void 0);
27
- _defineProperty(this, "instanceId", void 0);
28
- // 服务端接口区域信息,请求时决定API域名
29
- _defineProperty(this, "hostSign", void 0);
30
- // 是否允许submitPay提前调用,在ESP非首次的性能优化场景使用
31
- _defineProperty(this, "allowSubmitPayCallAhead", void 0);
32
- _defineProperty(this, "channelBehavior", void 0);
33
- _defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT", 18000);
34
- }
35
- _createClass(EasySafePayProcessor, [{
36
- key: "init",
37
- value: function init(config, instanceId, sdkMetaData) {
38
- this.initConfig = config;
39
- this.instanceId = instanceId;
40
- this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
41
- this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
42
- this.preloadWebApp(config, this.instanceId, sdkMetaData);
43
- }
44
- }, {
45
- key: "startBizFlow",
46
- value: function () {
47
- var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentContext) {
48
- var _paymentContext$payme2, _this$channelBehavior;
49
- var _paymentContext$payme, productSceneVersion, paymentMethodCategoryType, autoDebitWithToken, requireFastSdk, authUrlInfo, isFirstTimeToPay, webAppUrl, resultPayload;
50
- return _regeneratorRuntime().wrap(function _callee$(_context) {
51
- while (1) switch (_context.prev = _context.next) {
52
- case 0:
53
- // 放在最前面的逻辑
54
- // 在PC场景下,几乎所有渠道都是没有拉端的逻辑的,所以需要改成1.0, 这个是历史原因
55
- if (isPC()) {
56
- // 非TOSS渠道,在PC场景需要改成1.0
57
- 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)) {
58
- paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion = '1.0';
59
- }
60
- }
61
- this.paymentContext = paymentContext;
62
- this.hostSign = ((paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSession) || '').split('&&')[1] || '';
63
- productSceneVersion = paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
64
- paymentMethodCategoryType = paymentContext.paymentSessionObj.paymentSessionConfig.paymentMethodCategoryType;
65
- autoDebitWithToken = paymentContext.paymentSessionObj.action.autoDebitWithToken;
66
- requireFastSdk = paymentContext.paymentSessionObj.action.requireFastSdk;
67
- authUrlInfo = ((_paymentContext$payme2 = paymentContext.paymentSessionObj) === null || _paymentContext$payme2 === void 0 ? void 0 : _paymentContext$payme2.authUrlInfo) || {};
68
- this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
69
- // 首次支付
70
- isFirstTimeToPay = !autoDebitWithToken; // 处理ESP1.0极速外跳支付场景
71
- if (!(productSceneVersion === '1.0' && isFirstTimeToPay && requireFastSdk)) {
72
- _context.next = 12;
73
- break;
74
- }
75
- return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
76
- case 12:
77
- _context.next = 14;
78
- return this.initSecuritySDK();
79
- case 14:
80
- // 下面的场景是需要渲染UI的渠道, 打开WebUrl
81
- webAppUrl = this.buildWebAppUrl(); // const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
82
- resultPayload = {
83
- url: webAppUrl,
84
- allowClickPopupOutsideClose: (_this$channelBehavior = this.channelBehavior) === null || _this$channelBehavior === void 0 ? void 0 : _this$channelBehavior.allowClickOutsideClose
85
- };
86
- ProductInfoCacheUtil.savePreviousProductInfo(ProductSceneEnum.EASY_PAY, {
87
- paymentMethodCategoryType: paymentMethodCategoryType,
88
- hostSign: this.hostSign,
89
- productSceneVersion: productSceneVersion
90
- });
91
- // 返回结果之前,发送actionquery,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
92
- this.sendRequestAndWaitWebLaunch();
93
- // 返回结果,RENDER,让外层去处理iframe加载等逻辑
94
- return _context.abrupt("return", {
95
- behaviorType: 'RENDER',
96
- payload: resultPayload
97
- });
98
- case 19:
99
- case "end":
100
- return _context.stop();
101
- }
102
- }, _callee, this);
103
- }));
104
- function startBizFlow(_x) {
105
- return _startBizFlow.apply(this, arguments);
106
- }
107
- return startBizFlow;
108
- }()
109
- }, {
110
- key: "preloadWebApp",
111
- value: function preloadWebApp(config, instanceId, sdkMetaData) {
112
- // trigger preload
113
- var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
114
- var _this$buildWebAppPrel = this.buildWebAppPreloadUrl(config, instanceId, sdkMetaData),
115
- taskId = _this$buildWebAppPrel.taskId,
116
- webUrl = _this$buildWebAppPrel.webUrl;
117
- containerService.preload(taskId, webUrl);
118
- }
119
- }, {
120
- key: "buildWebAppPreloadUrl",
121
- value: function buildWebAppPreloadUrl(initConfig, instanceId, sdkMetaData) {
122
- var _this = this;
123
- var previousProductInfo = ProductInfoCacheUtil.getPreviousProductInfo(ProductSceneEnum.EASY_PAY, function (erorrMsg) {
124
- if (erorrMsg) {
125
- _this.logger.logError({
126
- title: 'performance_optimization_get_previousChannel_error'
127
- }, {
128
- error: erorrMsg
129
- });
130
- }
131
- });
132
- var paymentMethodCategoryType = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.paymentMethodCategoryType;
133
- var productSceneVersion = (previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.productSceneVersion) || '2.0';
134
- var taskId = "ams-checkout-component-".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
135
- var hostSign = previousProductInfo === null || previousProductInfo === void 0 ? void 0 : previousProductInfo.hostSign;
136
- var webUrl = WebAppUrlUtil.getWebAppUrl({
137
- environment: initConfig.environment,
138
- paymentMethodCategoryType: paymentMethodCategoryType,
139
- sdkMetaData: sdkMetaData,
140
- isPreload: true,
141
- productSceneVersion: productSceneVersion,
142
- query: {
143
- analyticsEnabled: initConfig.analytics.enabled,
144
- displayType: DisplayTypeEnum.popup,
145
- instanceId: instanceId,
146
- locale: initConfig.locale,
147
- hostSign: hostSign
148
- }
149
- });
150
- return {
151
- webUrl: webUrl,
152
- taskId: taskId
153
- };
154
- }
155
- }, {
156
- key: "buildWebAppUrl",
157
- value: function buildWebAppUrl() {
158
- var _paymentContext$payme3, _paymentContext$payme4;
159
- var paymentContext = this.paymentContext;
160
- var paymentMethodCategoryType = (_paymentContext$payme3 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme3 === void 0 ? void 0 : _paymentContext$payme3.paymentMethodCategoryType;
161
- var productSceneVersion = (_paymentContext$payme4 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme4 === void 0 ? void 0 : _paymentContext$payme4.productSceneVersion;
162
- var hostSign = this.hostSign;
163
- var webAppUrl = WebAppUrlUtil.getWebAppUrl({
164
- environment: this.initConfig.environment,
165
- paymentMethodCategoryType: paymentMethodCategoryType,
166
- sdkMetaData: paymentContext.sdkMetaData,
167
- productSceneVersion: productSceneVersion,
168
- isPreload: false,
169
- query: {
170
- analyticsEnabled: this.initConfig.analytics.enabled,
171
- displayType: DisplayTypeEnum.popup,
172
- instanceId: this.instanceId,
173
- locale: this.initConfig.locale,
174
- hostSign: hostSign
175
- }
176
- });
177
- return webAppUrl;
178
- }
179
- }, {
180
- key: "buildRedirectResult",
181
- value: function buildRedirectResult(authUrlInfo) {
182
- var data;
183
- if (!(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.normalUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.schemeUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.applinkUrl) && authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.authUrl) {
184
- data = {
185
- url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
186
- schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
187
- applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl
188
- };
189
- } else {
190
- data = {
191
- url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
192
- schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
193
- applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
194
- };
195
- }
196
- var result = {
197
- behaviorType: 'REDIRECT',
198
- payload: data
199
- };
200
- return result;
201
- }
202
-
203
- /**
204
- * 等待Web应用启动,然后发送renderComponent事件
205
- * start waiting web launch, then send renderComponent event
206
- * */
207
- }, {
208
- key: "sendRequestAndWaitWebLaunch",
209
- value: function sendRequestAndWaitWebLaunch() {
210
- var _this2 = this;
211
- var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
212
- var requestPromise = Promise.all([this.processPaymentQuery(), this.processSubmitPay()]).then(function (_ref) {
213
- var _ref2 = _slicedToArray(_ref, 2),
214
- queryRes = _ref2[0],
215
- submitRes = _ref2[1];
216
- return {
217
- queryRes: queryRes,
218
- submitRes: submitRes
219
- };
220
- });
221
- var webLaunchPromise = new Promise(function (resolve) {
222
- eventCenter.listen('onLaunch', function (res) {
223
- resolve(res);
224
- });
225
- });
226
-
227
- // 等请求和 Web启动都Ready之后,发送renderComponent
228
- Promise.all([requestPromise, webLaunchPromise]).then(function (_ref3) {
229
- var _this2$paymentContext, _this2$paymentContext2, _this2$paymentContext3, _this2$paymentContext4, _this2$paymentContext5, _this2$paymentContext6;
230
- var _ref4 = _slicedToArray(_ref3, 2),
231
- requestResult = _ref4[0],
232
- launchRes = _ref4[1];
233
- var logMetaData = _this2.logger.getLogConfig().mdata;
234
- eventCenter.dispatchToApp({
235
- event: 'renderComponent',
236
- data: {
237
- queryResult: requestResult.queryRes,
238
- submitResult: requestResult.submitRes,
239
- sessionResult: (_this2$paymentContext = _this2.paymentContext) === null || _this2$paymentContext === void 0 ? void 0 : _this2$paymentContext.paymentSessionObj,
240
- paymentSessionData: (_this2$paymentContext2 = _this2.paymentContext) === null || _this2$paymentContext2 === void 0 ? void 0 : _this2$paymentContext2.paymentSession,
241
- heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
242
- renderDisplayType: _this2.paymentContext.displayInfo.type,
243
- appearance: (_this2$paymentContext3 = _this2.paymentContext.displayInfo) === null || _this2$paymentContext3 === void 0 ? void 0 : _this2$paymentContext3.appearance,
244
- notRedirectAfterComplete: ((_this2$paymentContext4 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext4 === void 0 ? void 0 : _this2$paymentContext4.notRedirectAfterComplete) === true,
245
- merchantAppointParam: (_this2$paymentContext5 = _this2.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this2$paymentContext5 === void 0 ? void 0 : _this2$paymentContext5.merchantAppointParam,
246
- allowSubmitPayCallAhead: _this2.allowSubmitPayCallAhead,
247
- envInfo: {
248
- screenHeight: screen.height,
249
- screenWidth: screen.width
250
- },
251
- logMetaData: _objectSpread(_objectSpread({
252
- trackId: logMetaData.requestSeq,
253
- platform: logMetaData.platform,
254
- firstLogTime: logMetaData.firstLogTime
255
- }, ((_this2$paymentContext6 = _this2.paymentContext.paymentSessionObj) === null || _this2$paymentContext6 === void 0 ? void 0 : _this2$paymentContext6.paymentSessionConfig) || {}), {}, {
256
- renderDisplayType: logMetaData.renderDisplayType,
257
- sdkVersion: logMetaData.sdkVersion,
258
- merchantId: logMetaData.merchantId,
259
- instanceId: logMetaData.instanceId,
260
- paymentMethodType: logMetaData.paymentMethodType
261
- })
262
- }
263
- });
264
- });
265
- }
266
- }, {
267
- key: "processPaymentQuery",
268
- value: function () {
269
- var _processPaymentQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
270
- var _this$paymentContext, _this$paymentContext2, _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2;
271
- var envInfo, requestData, extendInfo, actionData, enableEasypayApiOptimize, extendInfoData, productSceneVersion, requestBizId, requester, res;
272
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
273
- while (1) switch (_context2.prev = _context2.next) {
274
- case 0:
275
- envInfo = {
276
- locale: this.initConfig.locale
277
- }; //
278
- requestData = {
279
- paymentSessionData: ((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSession) || '',
280
- paymentSessionConfig: (_this$paymentContext2 = this.paymentContext) === null || _this$paymentContext2 === void 0 || (_this$paymentContext2 = _this$paymentContext2.paymentSessionObj) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionConfig,
281
- notRedirectAfterComplete: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.startBizFlowOptions.submitPayRequestExtra.notRedirectAfterComplete) === true
282
- // merchantAppointParam: this._merchantAppointParam,
283
- };
284
- extendInfo = ((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.extendInfo) || '';
285
- actionData = (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 || (_this$paymentContext5 = _this$paymentContext5.paymentSessionObj) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.action;
286
- enableEasypayApiOptimize = false;
287
- try {
288
- extendInfoData = JSON.parse(extendInfo);
289
- enableEasypayApiOptimize = extendInfoData.enableEasypayApiOptimize || false;
290
- } catch (error) {
291
- console.log(error);
292
- }
293
- if (!isLocalMock()) {
294
- _context2.next = 8;
295
- break;
296
- }
297
- return _context2.abrupt("return", {
298
- message: 'sdk no need to make query request',
299
- success: true
300
- });
301
- case 8:
302
- if (!((_this$channelBehavior2 = this.channelBehavior) !== null && _this$channelBehavior2 !== void 0 && _this$channelBehavior2.usePaymentSessionAsQueryResult)) {
303
- _context2.next = 10;
304
- break;
305
- }
306
- return _context2.abrupt("return", {
307
- autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
308
- amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
309
- success: true
310
- });
311
- case 10:
312
- if (!(actionData.skipSdkQuery && enableEasypayApiOptimize)) {
313
- _context2.next = 12;
314
- break;
315
- }
316
- return _context2.abrupt("return", {
317
- message: 'sdk no need to make query request',
318
- success: true
319
- });
320
- case 12:
321
- productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion; // ESP 2.0 无需Query
322
- if (!(productSceneVersion === '2.0')) {
323
- _context2.next = 15;
324
- break;
325
- }
326
- return _context2.abrupt("return", {
327
- message: 'sdk no need to make query request',
328
- success: true
329
- });
330
- case 15:
331
- _context2.next = 17;
332
- return this.acquireApdidToken();
333
- case 17:
334
- envInfo.deviceId = _context2.sent;
335
- requestBizId = uuid(); // 打日志
336
- this.logger.logInfo({
337
- title: 'sdk_event_sdkQuery'
338
- }, {
339
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
340
- requestBizId: requestBizId
341
- });
342
-
343
- // 真正发请求
344
- requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
345
- _context2.prev = 21;
346
- _context2.next = 24;
347
- return requester.request(requestData, {
348
- env: this.initConfig.environment,
349
- envInfo: envInfo,
350
- hostSign: this.hostSign,
351
- 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
352
- });
353
- case 24:
354
- res = _context2.sent;
355
- this.logger.logInfo({
356
- title: 'sdk_event_sdkQueryEnd'
357
- }, {
358
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
359
- requestBizId: requestBizId,
360
- traceId: res.traceId
361
- });
362
- return _context2.abrupt("return", res);
363
- case 29:
364
- _context2.prev = 29;
365
- _context2.t0 = _context2["catch"](21);
366
- this.logger.logError({
367
- title: 'sdk_event_sdkQuery_failed'
368
- }, {
369
- paymentSessionConfig: JSON.stringify(requestData.paymentSessionConfig),
370
- errorReason: _context2.t0,
371
- requestBizId: requestBizId,
372
- traceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
373
- });
374
- throw _context2.t0;
375
- case 33:
376
- case "end":
377
- return _context2.stop();
378
- }
379
- }, _callee2, this, [[21, 29]]);
380
- }));
381
- function processPaymentQuery() {
382
- return _processPaymentQuery.apply(this, arguments);
383
- }
384
- return processPaymentQuery;
385
- }()
386
- }, {
387
- key: "processSubmitPay",
388
- value: function () {
389
- var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
390
- var _this$paymentContext6, _this$paymentContext7, _this$paymentContext9, _this$channelBehavior3, _this$channelBehavior4, _this$paymentContext$;
391
- var submitParams, shouldSkipSubmitPayInSDK, _this$paymentContext8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref6, _ref6$action, _ref6$action2, _ref6$action2$enableS, enableSignAgreement, _ref6$action2$autoDeb, autoDebitWithToken, requestBizId, extParams, requester, res;
392
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
393
- while (1) switch (_context3.prev = _context3.next) {
394
- case 0:
395
- submitParams = {
396
- paymentSessionData: ((_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSession) || '',
397
- paymentSessionConfig: (_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 || (_this$paymentContext7 = _this$paymentContext7.paymentSessionObj) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionConfig
398
- };
399
- shouldSkipSubmitPayInSDK = false;
400
- if (this.channelBehavior) {
401
- // 新逻辑走 channelBehavior判断
402
- shouldSkipSubmitPayInSDK = !this.channelBehavior.submitPayInSdk;
403
- } else {
404
- // TODO: 拉会找栎昂、甘颜一起对下
405
- // 老逻辑,只要服务端标记不跳过sdkquery,就需要跳过submitpay
406
- shouldSkipSubmitPayInSDK = !((_this$paymentContext8 = this.paymentContext) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.paymentSessionObj) !== null && _this$paymentContext8 !== void 0 && (_this$paymentContext8 = _this$paymentContext8.action) !== null && _this$paymentContext8 !== void 0 && _this$paymentContext8.skipSdkQuery);
407
- }
408
- _ref5 = submitParams.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer;
409
- _ref6 = ((_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionObj) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$enableS = _ref6$action2.enableSignAgreement, enableSignAgreement = _ref6$action2$enableS === void 0 ? false : _ref6$action2$enableS, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
410
- if (productSceneVersion === '2.0' && !autoDebitWithToken) {
411
- ///EasyPay 2.0 首次传signAgreement字段
412
- submitParams['signAgreement'] = enableSignAgreement;
413
- }
414
- // 带上标记告知WebCheckOut SDK已发送submitpay请求
415
- this.allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
416
- if (!shouldSkipSubmitPayInSDK) {
417
- _context3.next = 9;
418
- break;
419
- }
420
- return _context3.abrupt("return", {
421
- message: 'sdk no need to make submitPay request',
422
- success: true
423
- });
424
- case 9:
425
- requestBizId = uuid(); // 下面真实发请求
426
- this.logger.logInfo({
427
- title: 'sdk_event_submitPay'
428
- }, {
429
- paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
430
- requestBizId: requestBizId
431
- });
432
- // 由渠道定制点来构建额外参数
433
- extParams = ((_this$channelBehavior3 = this.channelBehavior) === null || _this$channelBehavior3 === void 0 || (_this$channelBehavior4 = _this$channelBehavior3.buildSubmitPayExtParams) === null || _this$channelBehavior4 === void 0 ? void 0 : _this$channelBehavior4.call(_this$channelBehavior3, {
434
- instanceId: this.instanceId,
435
- locale: this.initConfig.locale,
436
- paymentMethodType: (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.paymentMethodType,
437
- paymentSessionData: this.paymentContext.paymentSession,
438
- env: this.initConfig.environment,
439
- sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
440
- })) || {};
441
- submitParams.extParams = extParams;
442
- requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
443
- _context3.prev = 14;
444
- _context3.t0 = requester;
445
- _context3.t1 = submitParams;
446
- _context3.t2 = this.initConfig.environment;
447
- _context3.next = 20;
448
- return this.acquireApdidToken();
449
- case 20:
450
- _context3.t3 = _context3.sent;
451
- _context3.t4 = {
452
- deviceId: _context3.t3
453
- };
454
- _context3.t5 = this.hostSign;
455
- _context3.t6 = {
456
- env: _context3.t2,
457
- timeout: 15000,
458
- envInfo: _context3.t4,
459
- hostSign: _context3.t5,
460
- needEnvInfo: true,
461
- 'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
462
- };
463
- _context3.next = 26;
464
- return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t6);
465
- case 26:
466
- res = _context3.sent;
467
- this.logger.logInfo({
468
- title: 'sdk_event_submitPayEnd'
469
- }, {
470
- paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
471
- requestBizId: requestBizId,
472
- traceId: res.traceId
473
- });
474
- return _context3.abrupt("return", res);
475
- case 31:
476
- _context3.prev = 31;
477
- _context3.t7 = _context3["catch"](14);
478
- this.logger.logError({
479
- title: 'sdk_event_submitPay_failed'
480
- }, {
481
- paymentSessionConfig: JSON.stringify(submitParams.paymentSessionConfig),
482
- errorReason: _context3.t7,
483
- requestBizId: requestBizId,
484
- traceId: _context3.t7 === null || _context3.t7 === void 0 ? void 0 : _context3.t7.traceId
485
- });
486
- throw _context3.t7;
487
- case 35:
488
- case "end":
489
- return _context3.stop();
490
- }
491
- }, _callee3, this, [[14, 31]]);
492
- }));
493
- function processSubmitPay() {
494
- return _processSubmitPay.apply(this, arguments);
495
- }
496
- return processSubmitPay;
497
- }() // TOOD: 讨论下是否放到 requester里面
498
- }, {
499
- key: "acquireApdidToken",
500
- value: function () {
501
- var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
502
- var _this$paymentContext$2;
503
- var securityService, productScene, deviceId;
504
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
505
- while (1) switch (_context4.prev = _context4.next) {
506
- case 0:
507
- securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
508
- productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
509
- deviceId = securityService.getDeviceId({
510
- productScene: productScene
511
- });
512
- return _context4.abrupt("return", deviceId);
513
- case 4:
514
- case "end":
515
- return _context4.stop();
516
- }
517
- }, _callee4, this);
518
- }));
519
- function acquireApdidToken() {
520
- return _acquireApdidToken.apply(this, arguments);
521
- }
522
- return acquireApdidToken;
523
- }()
524
- }, {
525
- key: "initSecuritySDK",
526
- value: function () {
527
- var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
528
- var _this$paymentContext$3, productSceneVersion, nonCompliant, isFirstTimeToPay;
529
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
530
- while (1) switch (_context5.prev = _context5.next) {
531
- case 0:
532
- _context5.prev = 0;
533
- productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
534
- nonCompliant = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.nonCompliant;
535
- isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
536
- if (!(productSceneVersion === '1.0')) {
537
- _context5.next = 9;
538
- break;
539
- }
540
- console.log('[web-sdk][security-sdk] skip init security sdk for easypay 1.0');
541
- // 1.0 不初始化 SecuritySDK
542
- return _context5.abrupt("return");
543
- case 9:
544
- if (!(productSceneVersion === '2.0')) {
545
- _context5.next = 20;
546
- break;
547
- }
548
- if (!(nonCompliant === true)) {
549
- _context5.next = 16;
550
- break;
551
- }
552
- // 未切流「隐私合规」
553
- console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and nonCompliant is true');
554
- _context5.next = 14;
555
- return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
556
- case 14:
557
- _context5.next = 20;
558
- break;
559
- case 16:
560
- if (isFirstTimeToPay) {
561
- _context5.next = 20;
562
- break;
563
- }
564
- // 切流「隐私合规」且非首次支付
565
- console.log('[web-sdk][security-sdk] init security sdk for easypay 2.0 and when not first time to pay');
566
- _context5.next = 20;
567
- return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
568
- case 20:
569
- _context5.next = 24;
570
- break;
571
- case 22:
572
- _context5.prev = 22;
573
- _context5.t0 = _context5["catch"](0);
574
- case 24:
575
- case "end":
576
- return _context5.stop();
577
- }
578
- }, _callee5, this, [[0, 22]]);
579
- }));
580
- function initSecuritySDK() {
581
- return _initSecuritySDK.apply(this, arguments);
582
- }
583
- return initSecuritySDK;
584
- }()
585
- }]);
586
- return EasySafePayProcessor;
587
- }();
@@ -1,10 +0,0 @@
1
- import { BusContext, BusMessage, BusSubscriber } from '../../../../foundation/service/api-bus/busManager';
2
- export declare class DataBusSubscriber extends BusSubscriber {
3
- private instanceId;
4
- constructor(instanceId: string);
5
- actionNames(): string[];
6
- protected getGlobalData(context: BusContext, message: BusMessage): void;
7
- protected setGlobalData(context: BusContext, message: BusMessage): void;
8
- protected clearGlobalData(context: BusContext, message: BusMessage): void;
9
- onMessage(context: BusContext, message: BusMessage): void;
10
- }
@@ -1,10 +0,0 @@
1
- import { BusContext, BusMessage, BusSubscriber } from "../../../../foundation/service/api-bus/busManager";
2
- export declare class RequestBusSubscriber extends BusSubscriber {
3
- private instanceId;
4
- constructor(instanceId: string);
5
- actionNames(): string[];
6
- protected request(context: BusContext, message: BusMessage): Promise<void>;
7
- protected getEnvInfo(context: BusContext, message: BusMessage): Promise<void>;
8
- protected getUserAgent(context: BusContext, message: BusMessage): void;
9
- onMessage(context: BusContext, message: BusMessage): void;
10
- }