@alipay/ams-checkout 0.0.1755258862-dev.4 → 0.0.1755258862-dev.6
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/foundation/core/index.js +27 -23
- package/esm/foundation/product-processor/easysafepay/index.js +61 -136
- package/esm/foundation/service/requester/requester.js +46 -183
- package/esm/foundation/utils/preload_helper.js +2 -0
- package/package.json +1 -1
@@ -203,8 +203,12 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
203
203
|
// upgrade WebApp version
|
204
204
|
mid = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.clientId;
|
205
205
|
webAppMatchConfig = parseWebAppMatchConfig(this.paymentContext.paymentSessionObj.extendInfo);
|
206
|
-
webAppVersion = getWebAppVersion(this.sdkMetaData, mid, webAppMatchConfig);
|
206
|
+
webAppVersion = getWebAppVersion(this.sdkMetaData, mid, webAppMatchConfig); // TEST: Testing Purpose
|
207
207
|
this.sdkMetaData.webAppVersion = webAppVersion;
|
208
|
+
this.sdkMetaData = _objectSpread(_objectSpread({}, this.sdkMetaData), {}, {
|
209
|
+
"webAppVersion": "1.31.0",
|
210
|
+
"sdkVersion": "1.31.0"
|
211
|
+
});
|
208
212
|
saveWebAppVersion(webAppVersion, this.sdkMetaData);
|
209
213
|
|
210
214
|
// Call service to update via payment context
|
@@ -213,59 +217,59 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
213
217
|
// Invoke processor
|
214
218
|
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;
|
215
219
|
paymentMethod = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
|
216
|
-
_context3.prev =
|
220
|
+
_context3.prev = 14;
|
217
221
|
if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
|
218
|
-
_context3.next =
|
222
|
+
_context3.next = 21;
|
219
223
|
break;
|
220
224
|
}
|
221
|
-
_context3.next =
|
225
|
+
_context3.next = 18;
|
222
226
|
return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
|
223
|
-
case
|
227
|
+
case 18:
|
224
228
|
this.bizFlowStartBehavior = _context3.sent;
|
225
|
-
_context3.next =
|
229
|
+
_context3.next = 25;
|
226
230
|
break;
|
227
|
-
case
|
231
|
+
case 21:
|
228
232
|
if (!this.productProcessors["".concat(productScene)]) {
|
229
|
-
_context3.next =
|
233
|
+
_context3.next = 25;
|
230
234
|
break;
|
231
235
|
}
|
232
|
-
_context3.next =
|
236
|
+
_context3.next = 24;
|
233
237
|
return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
|
234
|
-
case 23:
|
235
|
-
this.bizFlowStartBehavior = _context3.sent;
|
236
238
|
case 24:
|
237
|
-
|
239
|
+
this.bizFlowStartBehavior = _context3.sent;
|
240
|
+
case 25:
|
241
|
+
_context3.next = 30;
|
238
242
|
break;
|
239
|
-
case
|
240
|
-
_context3.prev =
|
241
|
-
_context3.t0 = _context3["catch"](
|
243
|
+
case 27:
|
244
|
+
_context3.prev = 27;
|
245
|
+
_context3.t0 = _context3["catch"](14);
|
242
246
|
console.error('Invoke processor failed', _context3.t0);
|
243
|
-
case
|
247
|
+
case 30:
|
244
248
|
if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
|
245
|
-
_context3.next =
|
249
|
+
_context3.next = 32;
|
246
250
|
break;
|
247
251
|
}
|
248
252
|
return _context3.abrupt("return");
|
249
|
-
case
|
253
|
+
case 32:
|
250
254
|
if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
|
251
|
-
_context3.next =
|
255
|
+
_context3.next = 35;
|
252
256
|
break;
|
253
257
|
}
|
254
258
|
this.handleBehaviorRender();
|
255
259
|
return _context3.abrupt("return");
|
256
|
-
case
|
260
|
+
case 35:
|
257
261
|
if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
|
258
|
-
_context3.next =
|
262
|
+
_context3.next = 39;
|
259
263
|
break;
|
260
264
|
}
|
261
265
|
payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
|
262
266
|
redirect(payload, this.instanceId);
|
263
267
|
return _context3.abrupt("return");
|
264
|
-
case
|
268
|
+
case 39:
|
265
269
|
case "end":
|
266
270
|
return _context3.stop();
|
267
271
|
}
|
268
|
-
}, _callee3, this, [[
|
272
|
+
}, _callee3, this, [[14, 27]]);
|
269
273
|
}));
|
270
274
|
function startBizFlow(_x5) {
|
271
275
|
return _startBizFlow.apply(this, arguments);
|
@@ -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; }
|
4
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
4
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
9
7
|
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); }); }; }
|
@@ -53,16 +53,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
53
53
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
54
54
|
while (1) switch (_context.prev = _context.next) {
|
55
55
|
case 0:
|
56
|
-
console.log('[DEBUG] - startBizFlow
|
57
|
-
paymentContext: paymentContext
|
58
|
-
});
|
59
|
-
this.logger.logInfo({
|
60
|
-
title: '[DEBUG] - startBizFlow - START',
|
61
|
-
msg: JSON.stringify(paymentContext)
|
62
|
-
});
|
63
|
-
|
56
|
+
console.log('[DEBUG] - startBizFlow begin with paymentContext:', paymentContext);
|
64
57
|
// 放在最前面的逻辑
|
65
58
|
// 在PC场景下,几乎所有渠道都是没有拉端的逻辑的,所以需要改成1.0, 这个是历史原因
|
59
|
+
console.log('[DEBUG] - startBizFlow check isPC:', isPC());
|
66
60
|
if (isPC()) {
|
67
61
|
// 非TOSS渠道,在PC场景需要改成1.0
|
68
62
|
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)) {
|
@@ -77,45 +71,22 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
77
71
|
requireFastSdk = paymentContext.paymentSessionObj.action.requireFastSdk;
|
78
72
|
authUrlInfo = ((_paymentContext$payme2 = paymentContext.paymentSessionObj) === null || _paymentContext$payme2 === void 0 ? void 0 : _paymentContext$payme2.authUrlInfo) || {};
|
79
73
|
this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
|
80
|
-
console.log('[DEBUG] - startBizFlow - variables initialized', {
|
81
|
-
productSceneVersion: productSceneVersion,
|
82
|
-
paymentMethodCategoryType: paymentMethodCategoryType,
|
83
|
-
autoDebitWithToken: autoDebitWithToken,
|
84
|
-
requireFastSdk: requireFastSdk,
|
85
|
-
hostSign: this.hostSign
|
86
|
-
});
|
87
|
-
this.logger.logInfo({
|
88
|
-
title: '[DEBUG] - startBizFlow - variables initialized',
|
89
|
-
msg: JSON.stringify({
|
90
|
-
productSceneVersion: productSceneVersion,
|
91
|
-
paymentMethodCategoryType: paymentMethodCategoryType,
|
92
|
-
autoDebitWithToken: autoDebitWithToken,
|
93
|
-
requireFastSdk: requireFastSdk,
|
94
|
-
hostSign: this.hostSign
|
95
|
-
})
|
96
|
-
});
|
97
74
|
// 首次支付
|
98
75
|
isFirstTimeToPay = !autoDebitWithToken; // 处理ESP1.0极速外跳支付场景
|
76
|
+
console.log('[DEBUG] - startBizFlow check fastSdk conditions:', {
|
77
|
+
productSceneVersion: productSceneVersion,
|
78
|
+
isFirstTimeToPay: isFirstTimeToPay,
|
79
|
+
requireFastSdk: requireFastSdk
|
80
|
+
});
|
99
81
|
if (!(productSceneVersion === '1.0' && isFirstTimeToPay && requireFastSdk)) {
|
100
|
-
_context.next =
|
82
|
+
_context.next = 15;
|
101
83
|
break;
|
102
84
|
}
|
103
|
-
console.log('[DEBUG] - startBizFlow - ESP1.0 fast redirect scenario');
|
104
|
-
this.logger.logInfo({
|
105
|
-
title: '[DEBUG] - startBizFlow - ESP1.0 fast redirect scenario'
|
106
|
-
});
|
107
|
-
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
108
85
|
return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
|
109
|
-
case
|
86
|
+
case 15:
|
110
87
|
// 下面的场景是需要渲染UI的渠道, 打开WebUrl
|
111
88
|
webAppUrl = this.buildWebAppUrl();
|
112
|
-
console.log('[DEBUG] - startBizFlow
|
113
|
-
webAppUrl: webAppUrl
|
114
|
-
});
|
115
|
-
this.logger.logInfo({
|
116
|
-
title: '[DEBUG] - startBizFlow - webAppUrl built',
|
117
|
-
msg: webAppUrl
|
118
|
-
});
|
89
|
+
console.log('[DEBUG] - startBizFlow webAppUrl:', webAppUrl);
|
119
90
|
// const webAppUrl = 'http://svc-9kvjxwjf68cptha8.cloudide.svc.et15-sqa.alipay.net:5173/src/component-app/index.html';
|
120
91
|
resultPayload = {
|
121
92
|
url: webAppUrl,
|
@@ -126,28 +97,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
126
97
|
hostSign: this.hostSign,
|
127
98
|
productSceneVersion: productSceneVersion
|
128
99
|
});
|
129
|
-
|
130
|
-
this.logger.logInfo({
|
131
|
-
title: '[DEBUG] - startBizFlow - START'
|
132
|
-
});
|
100
|
+
// 返回结果之前,发送 sessionData,并且等待Web应用启动的事件,内部是异步处理,不阻塞。
|
133
101
|
this.sendRequestAndWaitWebLaunch();
|
134
|
-
console.log('[DEBUG] - startBizFlow - sendRequestAndWaitWebLaunch completed');
|
135
|
-
this.logger.logInfo({
|
136
|
-
title: '[DEBUG] - startBizFlow - sendRequestAndWaitWebLaunch completed'
|
137
|
-
});
|
138
102
|
// 返回结果,RENDER,让外层去处理iframe加载等逻辑
|
139
|
-
console.log('[DEBUG] - startBizFlow - returning RENDER behavior', {
|
140
|
-
resultPayload: resultPayload
|
141
|
-
});
|
142
|
-
this.logger.logInfo({
|
143
|
-
title: '[DEBUG] - startBizFlow - returning RENDER behavior',
|
144
|
-
msg: JSON.stringify(resultPayload)
|
145
|
-
});
|
146
103
|
return _context.abrupt("return", {
|
147
104
|
behaviorType: 'RENDER',
|
148
105
|
payload: resultPayload
|
149
106
|
});
|
150
|
-
case
|
107
|
+
case 21:
|
151
108
|
case "end":
|
152
109
|
return _context.stop();
|
153
110
|
}
|
@@ -169,7 +126,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
169
126
|
var webAppUrl = WebAppUrlUtil.getWebAppUrl({
|
170
127
|
environment: this.initConfig.environment,
|
171
128
|
paymentMethodCategoryType: paymentMethodCategoryType,
|
172
|
-
|
129
|
+
// TEST: Testing Purpose
|
130
|
+
sdkMetaData: _objectSpread(_objectSpread({}, paymentContext.sdkMetaData), {}, {
|
131
|
+
"webAppVersion": "1.31.0",
|
132
|
+
"sdkVersion": "1.31.0"
|
133
|
+
}),
|
173
134
|
productSceneVersion: productSceneVersion,
|
174
135
|
isPreload: false,
|
175
136
|
query: {
|
@@ -214,51 +175,24 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
214
175
|
key: "sendRequestAndWaitWebLaunch",
|
215
176
|
value: function sendRequestAndWaitWebLaunch() {
|
216
177
|
var _this = this;
|
217
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch
|
218
|
-
this.logger.logInfo({
|
219
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - START'
|
220
|
-
});
|
178
|
+
console.log('[DEBUG] - sendRequestAndWaitWebLaunch start');
|
221
179
|
var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
222
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch - eventCenter initialized');
|
223
|
-
this.logger.logInfo({
|
224
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - eventCenter initialized'
|
225
|
-
});
|
226
180
|
var webLaunchPromise = new Promise(function (resolve) {
|
227
181
|
eventCenter.listen('onLaunch', function (res) {
|
228
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch - onLaunch event received', res);
|
229
|
-
_this.logger.logInfo({
|
230
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - onLaunch event received',
|
231
|
-
msg: res
|
232
|
-
});
|
233
182
|
resolve(res);
|
234
183
|
});
|
235
184
|
});
|
236
185
|
|
237
186
|
// 等请求和 Web启动都Ready之后,发送renderComponent
|
238
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch
|
239
|
-
this.logger.logInfo({
|
240
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - waiting for promises'
|
241
|
-
});
|
187
|
+
console.log('[DEBUG] - sendRequestAndWaitWebLaunch waiting for promises');
|
242
188
|
Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
|
243
189
|
var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
|
244
190
|
var _ref2 = _slicedToArray(_ref, 3),
|
245
191
|
_initSecurityRes = _ref2[0],
|
246
192
|
submitRes = _ref2[1],
|
247
193
|
_webLaunchRes = _ref2[2];
|
248
|
-
|
249
|
-
_this.logger.logInfo({
|
250
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - all promises resolved'
|
251
|
-
});
|
194
|
+
console.log('[DEBUG] - sendRequestAndWaitWebLaunch all promises resolved');
|
252
195
|
var logMetaData = _this.logger.getLogConfig().mdata;
|
253
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch - logMetaData', logMetaData);
|
254
|
-
_this.logger.logInfo({
|
255
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - logMetaData',
|
256
|
-
msg: JSON.stringify(logMetaData)
|
257
|
-
});
|
258
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch - dispatching renderComponent');
|
259
|
-
_this.logger.logInfo({
|
260
|
-
title: '[DEBUG] - sendRequestAndWaitWebLaunch - dispatching renderComponent'
|
261
|
-
});
|
262
196
|
eventCenter.dispatchToApp({
|
263
197
|
event: 'renderComponent',
|
264
198
|
data: {
|
@@ -289,8 +223,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
289
223
|
})
|
290
224
|
}
|
291
225
|
});
|
292
|
-
}, function (error) {
|
293
|
-
console.log('[DEBUG] - sendRequestAndWaitWebLaunch - ERROR', error);
|
294
226
|
});
|
295
227
|
}
|
296
228
|
}, {
|
@@ -302,16 +234,17 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
302
234
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
303
235
|
while (1) switch (_context2.prev = _context2.next) {
|
304
236
|
case 0:
|
305
|
-
console.log('[DEBUG] processSubmitPay start');
|
306
|
-
this.logger.logInfo({
|
307
|
-
title: '[DEBUG] processSubmitPay start'
|
308
|
-
});
|
237
|
+
console.log('[DEBUG] - processSubmitPay start');
|
309
238
|
submitParams = {
|
310
239
|
paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
|
311
240
|
paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
|
312
241
|
};
|
313
242
|
_ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
|
314
243
|
_ref4 = ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.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;
|
244
|
+
console.log('[DEBUG] - processSubmitPay check productSceneVersion:', {
|
245
|
+
productSceneVersion: productSceneVersion,
|
246
|
+
autoDebitWithToken: autoDebitWithToken
|
247
|
+
});
|
315
248
|
if (productSceneVersion === '2.0' && !autoDebitWithToken) {
|
316
249
|
///EasyPay 2.0 首次传signAgreement字段
|
317
250
|
submitParams['signAgreement'] = enableSignAgreement;
|
@@ -326,15 +259,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
326
259
|
}
|
327
260
|
this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
|
328
261
|
//console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
|
262
|
+
console.log('[DEBUG] - processSubmitPay check allowSubmitPayCallAhead:', this.allowSubmitPayCallAhead);
|
329
263
|
if (this.allowSubmitPayCallAhead) {
|
330
|
-
_context2.next =
|
264
|
+
_context2.next = 10;
|
331
265
|
break;
|
332
266
|
}
|
333
267
|
return _context2.abrupt("return", {
|
334
268
|
message: 'sdk no need to make submitPay request',
|
335
269
|
success: true
|
336
270
|
});
|
337
|
-
case
|
271
|
+
case 10:
|
338
272
|
requestBizId = uuid(); // 下面真实发请求
|
339
273
|
this.logger.logInfo({
|
340
274
|
title: 'sdk_event_submitPay'
|
@@ -354,13 +288,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
354
288
|
extParams.complianceSDK = true;
|
355
289
|
submitParams.extParams = extParams;
|
356
290
|
requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
357
|
-
_context2.prev =
|
291
|
+
_context2.prev = 16;
|
292
|
+
console.log('[DEBUG] - processSubmitPay making request with params:', submitParams);
|
293
|
+
// console.log('[web-sdk] DO call submitPay');
|
294
|
+
console.log('[DEBUG] - processSubmitPay request config:', {
|
295
|
+
env: this.initConfig.environment,
|
296
|
+
timeout: 15000,
|
297
|
+
hostSign: this.hostSign,
|
298
|
+
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
299
|
+
});
|
358
300
|
_context2.t0 = requester;
|
359
301
|
_context2.t1 = submitParams;
|
360
302
|
_context2.t2 = this.initConfig.environment;
|
361
|
-
_context2.next =
|
303
|
+
_context2.next = 24;
|
362
304
|
return this.acquireApdidToken();
|
363
|
-
case
|
305
|
+
case 24:
|
364
306
|
_context2.t3 = _context2.sent;
|
365
307
|
_context2.t4 = {
|
366
308
|
deviceId: _context2.t3
|
@@ -374,9 +316,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
374
316
|
needEnvInfo: true,
|
375
317
|
'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
|
376
318
|
};
|
377
|
-
_context2.next =
|
319
|
+
_context2.next = 30;
|
378
320
|
return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
|
379
|
-
case
|
321
|
+
case 30:
|
380
322
|
res = _context2.sent;
|
381
323
|
this.logger.logInfo({
|
382
324
|
title: 'sdk_event_submitPayEnd'
|
@@ -385,15 +327,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
385
327
|
requestId: requestBizId,
|
386
328
|
rpcTraceId: res.traceId
|
387
329
|
});
|
388
|
-
console.log('[DEBUG] processSubmitPay
|
389
|
-
this.logger.logInfo({
|
390
|
-
title: '[DEBUG] processSubmitPay completed',
|
391
|
-
msg: JSON.stringify(res)
|
392
|
-
});
|
330
|
+
console.log('[DEBUG] - processSubmitPay request success:', res);
|
393
331
|
return _context2.abrupt("return", res);
|
394
|
-
case
|
395
|
-
_context2.prev =
|
396
|
-
_context2.t7 = _context2["catch"](
|
332
|
+
case 36:
|
333
|
+
_context2.prev = 36;
|
334
|
+
_context2.t7 = _context2["catch"](16);
|
397
335
|
this.logger.logError({
|
398
336
|
title: 'sdk_event_submitPay_failed'
|
399
337
|
}, {
|
@@ -402,17 +340,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
402
340
|
requestId: requestBizId,
|
403
341
|
rpcTraceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
|
404
342
|
});
|
405
|
-
console.log('[DEBUG] processSubmitPay
|
406
|
-
this.logger.logError({
|
407
|
-
title: '[DEBUG] processSubmitPay ERROR',
|
408
|
-
msg: _context2.t7
|
409
|
-
});
|
343
|
+
console.log('[DEBUG] - processSubmitPay request failed:', _context2.t7);
|
410
344
|
throw _context2.t7;
|
411
|
-
case
|
345
|
+
case 41:
|
412
346
|
case "end":
|
413
347
|
return _context2.stop();
|
414
348
|
}
|
415
|
-
}, _callee2, this, [[
|
349
|
+
}, _callee2, this, [[16, 36]]);
|
416
350
|
}));
|
417
351
|
function processSubmitPay() {
|
418
352
|
return _processSubmitPay.apply(this, arguments);
|
@@ -453,11 +387,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
453
387
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
454
388
|
while (1) switch (_context4.prev = _context4.next) {
|
455
389
|
case 0:
|
456
|
-
console.log('[DEBUG] initSecuritySDK start');
|
457
|
-
|
458
|
-
title: '[DEBUG] initSecuritySDK start'
|
459
|
-
});
|
460
|
-
_context4.prev = 2;
|
390
|
+
console.log('[DEBUG] - initSecuritySDK start');
|
391
|
+
_context4.prev = 1;
|
461
392
|
productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
|
462
393
|
nonCompliant = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.nonCompliant;
|
463
394
|
nonInitSecuritySDK = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.nonInitSecuritySDK;
|
@@ -489,6 +420,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
489
420
|
}
|
490
421
|
}
|
491
422
|
}
|
423
|
+
console.log('[DEBUG] - initSecuritySDK shouldInitSecuritySDK:', shouldInitSecuritySDK);
|
492
424
|
if (!shouldInitSecuritySDK) {
|
493
425
|
_context4.next = 12;
|
494
426
|
break;
|
@@ -496,31 +428,24 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
496
428
|
_context4.next = 12;
|
497
429
|
return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
|
498
430
|
case 12:
|
499
|
-
console.log('[DEBUG] initSecuritySDK completed');
|
500
|
-
this.logger.logInfo({
|
501
|
-
title: '[DEBUG] initSecuritySDK completed'
|
502
|
-
});
|
503
431
|
this.logger.logInfo({
|
504
432
|
title: 'a3753.b101271.c388193.d514078'
|
505
433
|
}, {
|
506
434
|
riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
|
507
435
|
});
|
508
|
-
|
436
|
+
console.log('[DEBUG] - initSecuritySDK completed');
|
437
|
+
_context4.next = 19;
|
509
438
|
break;
|
510
|
-
case
|
511
|
-
_context4.prev =
|
512
|
-
_context4.t0 = _context4["catch"](
|
513
|
-
console.log('[DEBUG] initSecuritySDK ERROR');
|
514
|
-
this.logger.logError({
|
515
|
-
title: '[DEBUG] initSecuritySDK ERROR',
|
516
|
-
msg: _context4.t0
|
517
|
-
});
|
439
|
+
case 16:
|
440
|
+
_context4.prev = 16;
|
441
|
+
_context4.t0 = _context4["catch"](1);
|
518
442
|
// do nothing when init security failed
|
519
|
-
|
443
|
+
console.log('[DEBUG] - initSecuritySDK catch');
|
444
|
+
case 19:
|
520
445
|
case "end":
|
521
446
|
return _context4.stop();
|
522
447
|
}
|
523
|
-
}, _callee4, this, [[
|
448
|
+
}, _callee4, this, [[1, 16]]);
|
524
449
|
}));
|
525
450
|
function initSecuritySDK() {
|
526
451
|
return _initSecuritySDK.apply(this, arguments);
|