@pisell/private-materials 6.6.62 → 6.6.63
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/components/footer/amount.js +4 -3
- package/es/components/booking/components/footer/utils.js +10 -3
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +76 -8
- package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/es/components/booking/info2/service/editService/utils.js +16 -0
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
- package/es/components/eftpos/PairModal/hooks.js +67 -0
- package/es/components/eftpos/PairModal/index.d.ts +11 -0
- package/es/components/eftpos/PairModal/index.js +246 -0
- package/es/components/eftpos/PairModal/index.less +70 -0
- package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
- package/es/components/eftpos/SettlementModal/Action.js +141 -0
- package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
- package/es/components/eftpos/SettlementModal/index.js +135 -0
- package/es/components/eftpos/SettlementModal/index.less +33 -0
- package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
- package/es/components/eftpos/SettlementModal/serve.js +171 -0
- package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
- package/es/components/eftpos/SettlementModal/types.js +35 -0
- package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
- package/es/components/eftpos/SettlementModal/utils.js +351 -0
- package/es/components/eftpos/assets/mx51SCI.svg +15 -0
- package/es/components/eftpos/const.d.ts +3 -1
- package/es/components/eftpos/const.js +2 -0
- package/es/components/eftpos/device.d.ts +3 -1
- package/es/components/eftpos/device.js +14 -3
- package/es/components/eftpos/hooks.d.ts +13 -0
- package/es/components/eftpos/hooks.js +35 -0
- package/es/components/eftpos/index.js +198 -24
- package/es/components/eftpos/index.less +32 -1
- package/es/components/eftpos/locales.d.ts +80 -0
- package/es/components/eftpos/locales.js +205 -25
- package/es/components/eftpos/table.js +47 -3
- package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
- package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
- package/es/components/eftposPay/aggregatePayment/index.js +2 -1
- package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
- package/es/components/eftposPay/aggregatePayment/service.js +1 -0
- package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
- package/es/components/eftposPay/aggregatePayment/types.js +4 -8
- package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
- package/es/components/eftposPay/amount.js +15 -1
- package/es/components/eftposPay/app.js +2 -3
- package/es/components/eftposPay/component/fail/failCustom.js +13 -4
- package/es/components/eftposPay/component/fail/index.js +12 -5
- package/es/components/eftposPay/component/fail/network.js +3 -0
- package/es/components/eftposPay/component/fail/unknow.js +8 -0
- package/es/components/eftposPay/component/manual/index.js +17 -3
- package/es/components/eftposPay/component/signature/index.js +3 -0
- package/es/components/eftposPay/const.d.ts +8 -3
- package/es/components/eftposPay/const.js +2 -0
- package/es/components/eftposPay/device.js +225 -38
- package/es/components/eftposPay/helper.d.ts +3 -0
- package/es/components/eftposPay/helper.js +2 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.js +50 -13
- package/es/components/eftposPay/linkly/const.js +1 -1
- package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
- package/es/components/eftposPay/linkly/index.js +11 -23
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +30 -15
- package/es/components/eftposPay/manufacturer.d.ts +1 -0
- package/es/components/eftposPay/manufacturer.js +4 -0
- package/es/components/eftposPay/mx51/Action.d.ts +6 -0
- package/es/components/eftposPay/mx51/Action.js +144 -0
- package/es/components/eftposPay/mx51/const.d.ts +5 -0
- package/es/components/eftposPay/mx51/const.js +69 -0
- package/es/components/eftposPay/mx51/index.d.ts +6 -0
- package/es/components/eftposPay/mx51/index.js +498 -0
- package/es/components/eftposPay/mx51/types.d.ts +142 -0
- package/es/components/eftposPay/mx51/types.js +35 -0
- package/es/components/eftposPay/mx51/utils.d.ts +10 -0
- package/es/components/eftposPay/mx51/utils.js +121 -0
- package/es/components/eftposPay/pay.js +21 -9
- package/es/components/eftposPay/payo/config.js +39 -5
- package/es/components/eftposPay/payo/const.js +1 -1
- package/es/components/eftposPay/payo/hooks.js +3 -12
- package/es/components/eftposPay/payo/payment.js +69 -136
- package/es/components/eftposPay/store/index.d.ts +4 -8
- package/es/components/eftposPay/tip.js +5 -0
- package/es/components/eftposPay/tyro/const.js +1 -1
- package/es/components/eftposPay/tyro/index.js +44 -11
- package/es/components/eftposPay/utils/payLog.d.ts +81 -0
- package/es/components/eftposPay/utils/payLog.js +458 -0
- package/es/components/eftposPay/windcave/const.js +1 -1
- package/es/components/eftposPay/windcave/receiptAction.js +5 -0
- package/es/components/eftposPay/windcave/windcave.js +37 -38
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +12 -5
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +56 -5
- package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/lib/components/booking/info2/service/editService/utils.js +16 -0
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
- package/lib/components/eftpos/PairModal/hooks.js +70 -0
- package/lib/components/eftpos/PairModal/index.d.ts +11 -0
- package/lib/components/eftpos/PairModal/index.js +197 -0
- package/lib/components/eftpos/PairModal/index.less +70 -0
- package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
- package/lib/components/eftpos/SettlementModal/Action.js +153 -0
- package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
- package/lib/components/eftpos/SettlementModal/index.js +170 -0
- package/lib/components/eftpos/SettlementModal/index.less +33 -0
- package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
- package/lib/components/eftpos/SettlementModal/serve.js +45 -0
- package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
- package/lib/components/eftpos/SettlementModal/types.js +43 -0
- package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
- package/lib/components/eftpos/SettlementModal/utils.js +248 -0
- package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
- package/lib/components/eftpos/const.d.ts +3 -1
- package/lib/components/eftpos/const.js +2 -0
- package/lib/components/eftpos/device.d.ts +3 -1
- package/lib/components/eftpos/device.js +13 -3
- package/lib/components/eftpos/hooks.d.ts +13 -0
- package/lib/components/eftpos/hooks.js +30 -0
- package/lib/components/eftpos/index.js +121 -8
- package/lib/components/eftpos/index.less +32 -1
- package/lib/components/eftpos/locales.d.ts +80 -0
- package/lib/components/eftpos/locales.js +231 -21
- package/lib/components/eftpos/table.js +30 -2
- package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
- package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
- package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
- package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
- package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
- package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
- package/lib/components/eftposPay/amount.js +13 -1
- package/lib/components/eftposPay/app.js +4 -5
- package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
- package/lib/components/eftposPay/component/fail/index.js +10 -2
- package/lib/components/eftposPay/component/fail/network.js +3 -0
- package/lib/components/eftposPay/component/fail/unknow.js +8 -0
- package/lib/components/eftposPay/component/manual/index.js +16 -2
- package/lib/components/eftposPay/component/signature/index.js +3 -0
- package/lib/components/eftposPay/const.d.ts +8 -3
- package/lib/components/eftposPay/const.js +2 -0
- package/lib/components/eftposPay/device.js +114 -25
- package/lib/components/eftposPay/helper.d.ts +3 -0
- package/lib/components/eftposPay/helper.js +2 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.js +38 -13
- package/lib/components/eftposPay/linkly/const.js +1 -1
- package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
- package/lib/components/eftposPay/linkly/index.js +8 -10
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +30 -15
- package/lib/components/eftposPay/manufacturer.d.ts +1 -0
- package/lib/components/eftposPay/manufacturer.js +6 -0
- package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
- package/lib/components/eftposPay/mx51/Action.js +154 -0
- package/lib/components/eftposPay/mx51/const.d.ts +5 -0
- package/lib/components/eftposPay/mx51/const.js +85 -0
- package/lib/components/eftposPay/mx51/index.d.ts +6 -0
- package/lib/components/eftposPay/mx51/index.js +433 -0
- package/lib/components/eftposPay/mx51/types.d.ts +142 -0
- package/lib/components/eftposPay/mx51/types.js +43 -0
- package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
- package/lib/components/eftposPay/mx51/utils.js +115 -0
- package/lib/components/eftposPay/pay.js +13 -3
- package/lib/components/eftposPay/payo/config.js +16 -8
- package/lib/components/eftposPay/payo/const.js +1 -1
- package/lib/components/eftposPay/payo/hooks.js +12 -10
- package/lib/components/eftposPay/payo/payment.js +31 -65
- package/lib/components/eftposPay/store/index.d.ts +4 -8
- package/lib/components/eftposPay/tip.js +5 -0
- package/lib/components/eftposPay/tyro/const.js +1 -1
- package/lib/components/eftposPay/tyro/index.js +21 -17
- package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
- package/lib/components/eftposPay/utils/payLog.js +321 -0
- package/lib/components/eftposPay/windcave/const.js +1 -1
- package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.js +27 -29
- package/package.json +2 -2
- package/es/components/eftposPay/utils/log/index.d.ts +0 -110
- package/es/components/eftposPay/utils/log/index.js +0 -371
- package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
- package/lib/components/eftposPay/utils/log/index.js +0 -294
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
var _excluded = ["pay_param_base64"],
|
|
2
|
-
_excluded2 = ["pay_param_base64"];
|
|
3
|
-
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); }
|
|
4
1
|
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; }
|
|
5
2
|
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; }
|
|
6
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
4
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
5
|
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); }); }; }
|
|
@@ -14,6 +9,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
14
9
|
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; }
|
|
15
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
11
|
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); }
|
|
12
|
+
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); }
|
|
17
13
|
/**
|
|
18
14
|
* 聚合支付方法类
|
|
19
15
|
* 核心点:
|
|
@@ -21,12 +17,32 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
21
17
|
* 2.轮询操作总查询时间2分钟,超时直接失败,单次轮询超时时间5秒,超时直接abort本次请求,间隔两秒后发起新的请求
|
|
22
18
|
* 3.最终成功或者失败都需要把定时器给清理掉,并将未完成的接口abort掉
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
import { locales } from '@pisell/utils';
|
|
25
21
|
import { PayStatus } from "../../const";
|
|
26
|
-
import
|
|
22
|
+
import payLog from "../../utils/payLog";
|
|
27
23
|
import { AGPTPayApi, AGPTQueryApi, AGPTActionApi, AGPTRefundApi, AGPTRefundQueryApi, AGPTRefundActionApi } from "../service";
|
|
28
|
-
import { getUuid } from "../../helper";
|
|
24
|
+
import { cloneDeep, getUuid } from "../../helper";
|
|
29
25
|
import { EPaymentStatus, ActionType, QUERY_START_DELAY, REQUEST_TIMEOUT, QUERY_INTERVAL, GLOBAL_TIMEOUT } from "../types";
|
|
26
|
+
var sanitizePaymentLogContent = function sanitizePaymentLogContent(content) {
|
|
27
|
+
var _content$params;
|
|
28
|
+
if (!content || _typeof(content) !== 'object') {
|
|
29
|
+
return content;
|
|
30
|
+
}
|
|
31
|
+
if (!((_content$params = content.params) !== null && _content$params !== void 0 && (_content$params = _content$params.eftpos) !== null && _content$params !== void 0 && _content$params.pay_param_base64)) {
|
|
32
|
+
return content;
|
|
33
|
+
}
|
|
34
|
+
var clonedContent = cloneDeep(content);
|
|
35
|
+
delete clonedContent.params.eftpos.pay_param_base64;
|
|
36
|
+
return clonedContent;
|
|
37
|
+
};
|
|
38
|
+
var addPaymentLog = function addPaymentLog(_ref) {
|
|
39
|
+
var title = _ref.title,
|
|
40
|
+
content = _ref.content;
|
|
41
|
+
payLog.log(title, sanitizePaymentLogContent(content));
|
|
42
|
+
};
|
|
43
|
+
var paymentLog = {
|
|
44
|
+
addLog: addPaymentLog
|
|
45
|
+
};
|
|
30
46
|
var PaymentMethod = /*#__PURE__*/function () {
|
|
31
47
|
function PaymentMethod(options) {
|
|
32
48
|
_classCallCheck(this, PaymentMethod);
|
|
@@ -36,8 +52,6 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
36
52
|
_defineProperty(this, "paymentNum", void 0);
|
|
37
53
|
// 订单ID
|
|
38
54
|
_defineProperty(this, "orderId", void 0);
|
|
39
|
-
// 设备ID
|
|
40
|
-
_defineProperty(this, "deviceId", void 0);
|
|
41
55
|
// 统一回调函数
|
|
42
56
|
_defineProperty(this, "callback", void 0);
|
|
43
57
|
// 检查是否应该继续处理结果
|
|
@@ -71,18 +85,23 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
71
85
|
this.initOptions = options;
|
|
72
86
|
this.paymentNum = options.paymentNum;
|
|
73
87
|
this.orderId = options.orderId;
|
|
74
|
-
this.deviceId = options.deviceId;
|
|
75
88
|
this.callback = options.callback;
|
|
76
89
|
this.shouldContinue = options.shouldContinue || function () {
|
|
77
90
|
return true;
|
|
78
91
|
};
|
|
79
92
|
this.config = options.config || {};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
payLog.setContext({
|
|
94
|
+
transactionNumber: this.paymentNum,
|
|
95
|
+
extra: {
|
|
96
|
+
paymentCode: (options === null || options === void 0 ? void 0 : options.paymentCode) || ''
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
addPaymentLog({
|
|
100
|
+
title: '聚合支付初始化',
|
|
101
|
+
content: {
|
|
102
|
+
paymentNum: this.paymentNum,
|
|
103
|
+
paymentCode: (options === null || options === void 0 ? void 0 : options.paymentCode) || ''
|
|
104
|
+
}
|
|
86
105
|
});
|
|
87
106
|
}
|
|
88
107
|
|
|
@@ -92,9 +111,34 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
92
111
|
* @param code 错误码
|
|
93
112
|
*/
|
|
94
113
|
_createClass(PaymentMethod, [{
|
|
95
|
-
key: "
|
|
96
|
-
value: function
|
|
97
|
-
|
|
114
|
+
key: "isBusinessFailed",
|
|
115
|
+
value: function isBusinessFailed(res) {
|
|
116
|
+
var _res$data;
|
|
117
|
+
var _ref2 = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.external_unified_response) || {},
|
|
118
|
+
external_unified_status = _ref2.external_unified_status,
|
|
119
|
+
response_code = _ref2.response_code;
|
|
120
|
+
return "".concat(res === null || res === void 0 ? void 0 : res.code) === '200' && external_unified_status === EPaymentStatus.Failed && response_code !== PayStatus.Timeout && response_code !== PayStatus.PayTimeout;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 判断业务是否成功
|
|
125
|
+
*/
|
|
126
|
+
}, {
|
|
127
|
+
key: "isBusinessSuccess",
|
|
128
|
+
value: function isBusinessSuccess(res) {
|
|
129
|
+
var _res$data2;
|
|
130
|
+
var _ref3 = (res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.external_unified_response) || {},
|
|
131
|
+
external_unified_status = _ref3.external_unified_status;
|
|
132
|
+
return "".concat(res === null || res === void 0 ? void 0 : res.code) === '200' && external_unified_status === EPaymentStatus.Success;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 判断最外层code是否是超时错误
|
|
137
|
+
*/
|
|
138
|
+
}, {
|
|
139
|
+
key: "isOuterCodeTimeout",
|
|
140
|
+
value: function isOuterCodeTimeout(code) {
|
|
141
|
+
return code && ("".concat(code) === PayStatus.Timeout || "".concat(code) === PayStatus.PayTimeout);
|
|
98
142
|
}
|
|
99
143
|
|
|
100
144
|
/**
|
|
@@ -297,13 +341,13 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
297
341
|
}, {
|
|
298
342
|
key: "handleResponse",
|
|
299
343
|
value: function handleResponse(res) {
|
|
300
|
-
var _res$
|
|
344
|
+
var _res$data3;
|
|
301
345
|
if (!this.currentActionType) {
|
|
302
346
|
return;
|
|
303
347
|
}
|
|
304
348
|
var needContinue = true;
|
|
305
|
-
var
|
|
306
|
-
external_unified_status =
|
|
349
|
+
var _ref4 = (res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.external_unified_response) || {},
|
|
350
|
+
external_unified_status = _ref4.external_unified_status;
|
|
307
351
|
// 第三方支付结果:success成功 fail失败 processing处理中
|
|
308
352
|
switch (external_unified_status) {
|
|
309
353
|
case EPaymentStatus.Success:
|
|
@@ -349,7 +393,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
349
393
|
key: "performQuery",
|
|
350
394
|
value: (function () {
|
|
351
395
|
var _performQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actionType) {
|
|
352
|
-
var queryId, signal, _this$initOptions, _res$
|
|
396
|
+
var queryId, signal, _this$initOptions, _res$data4, res, needContinue;
|
|
353
397
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
354
398
|
while (1) switch (_context.prev = _context.next) {
|
|
355
399
|
case 0:
|
|
@@ -398,7 +442,8 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
398
442
|
unique_payment_number: this.paymentNum,
|
|
399
443
|
payment_code: (_this$initOptions = this.initOptions) === null || _this$initOptions === void 0 ? void 0 : _this$initOptions.paymentCode,
|
|
400
444
|
request_version: queryId,
|
|
401
|
-
|
|
445
|
+
// TODO: MX51审核需要,后续需要删除
|
|
446
|
+
is_force_request_api: 1
|
|
402
447
|
}, {
|
|
403
448
|
signal: signal
|
|
404
449
|
}), this.createTimeoutPromise(REQUEST_TIMEOUT)]);
|
|
@@ -419,7 +464,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
419
464
|
}
|
|
420
465
|
|
|
421
466
|
// 检查是否是过期的响应(新查询的 ID 一定大于旧查询)
|
|
422
|
-
if (!((res === null || res === void 0 || (_res$
|
|
467
|
+
if (!((res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.request_version) !== this.currentQueryId)) {
|
|
423
468
|
_context.next = 22;
|
|
424
469
|
break;
|
|
425
470
|
}
|
|
@@ -437,8 +482,18 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
437
482
|
});
|
|
438
483
|
return _context.abrupt("return");
|
|
439
484
|
case 25:
|
|
440
|
-
if (!(
|
|
441
|
-
_context.next =
|
|
485
|
+
if (!("".concat(res === null || res === void 0 ? void 0 : res.code) !== '200')) {
|
|
486
|
+
_context.next = 29;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
paymentLog.addLog({
|
|
490
|
+
title: '查询轮询结果:查询返回失败,code非200'
|
|
491
|
+
});
|
|
492
|
+
this.handleOperationError(res);
|
|
493
|
+
return _context.abrupt("return");
|
|
494
|
+
case 29:
|
|
495
|
+
if (!this.isBusinessSuccess(res)) {
|
|
496
|
+
_context.next = 34;
|
|
442
497
|
break;
|
|
443
498
|
}
|
|
444
499
|
paymentLog.addLog({
|
|
@@ -449,9 +504,9 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
449
504
|
this.scheduleNextQuery(actionType);
|
|
450
505
|
}
|
|
451
506
|
return _context.abrupt("return");
|
|
452
|
-
case
|
|
507
|
+
case 34:
|
|
453
508
|
// 查询返回失败但没有明确code或超时code,继续轮询
|
|
454
|
-
if (this.
|
|
509
|
+
if (this.isBusinessFailed(res)) {
|
|
455
510
|
// 有明确错误code,停止轮询
|
|
456
511
|
paymentLog.addLog({
|
|
457
512
|
title: '查询轮询结果:有明确错误code,停止轮询',
|
|
@@ -460,15 +515,16 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
460
515
|
this.handleOperationError(res);
|
|
461
516
|
} else {
|
|
462
517
|
paymentLog.addLog({
|
|
463
|
-
title: '
|
|
518
|
+
title: '查询轮询结果:交易进行中,继续轮询',
|
|
464
519
|
content: res
|
|
465
520
|
});
|
|
521
|
+
this.handleOperationProcess(res);
|
|
466
522
|
this.scheduleNextQuery(actionType);
|
|
467
523
|
}
|
|
468
|
-
_context.next =
|
|
524
|
+
_context.next = 57;
|
|
469
525
|
break;
|
|
470
|
-
case
|
|
471
|
-
_context.prev =
|
|
526
|
+
case 37:
|
|
527
|
+
_context.prev = 37;
|
|
472
528
|
_context.t0 = _context["catch"](13);
|
|
473
529
|
// 清理超时定时器
|
|
474
530
|
if (this.requestTimeoutTimer) {
|
|
@@ -478,22 +534,22 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
478
534
|
|
|
479
535
|
// 检查是否是过期的响应(新查询的 ID 一定大于旧查询)
|
|
480
536
|
if (!(queryId !== this.currentQueryId)) {
|
|
481
|
-
_context.next =
|
|
537
|
+
_context.next = 43;
|
|
482
538
|
break;
|
|
483
539
|
}
|
|
484
540
|
paymentLog.addLog({
|
|
485
541
|
title: '查询轮询结果:error-过期的查询异常,忽略'
|
|
486
542
|
});
|
|
487
543
|
return _context.abrupt("return");
|
|
488
|
-
case
|
|
544
|
+
case 43:
|
|
489
545
|
if (!(this.isFinished || !this.shouldContinue())) {
|
|
490
|
-
_context.next =
|
|
546
|
+
_context.next = 45;
|
|
491
547
|
break;
|
|
492
548
|
}
|
|
493
549
|
return _context.abrupt("return");
|
|
494
|
-
case
|
|
550
|
+
case 45:
|
|
495
551
|
if (!((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.name) === 'AbortError' || (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) === 'REQUEST_TIMEOUT')) {
|
|
496
|
-
_context.next =
|
|
552
|
+
_context.next = 49;
|
|
497
553
|
break;
|
|
498
554
|
}
|
|
499
555
|
paymentLog.addLog({
|
|
@@ -501,26 +557,28 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
501
557
|
});
|
|
502
558
|
this.scheduleNextQuery(actionType);
|
|
503
559
|
return _context.abrupt("return");
|
|
504
|
-
case
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
title: '查询轮询结果:error-有明确错误code,停止轮询',
|
|
509
|
-
content: _context.t0
|
|
510
|
-
});
|
|
511
|
-
this.handleOperationError(_context.t0);
|
|
512
|
-
} else {
|
|
513
|
-
paymentLog.addLog({
|
|
514
|
-
title: '查询轮询结果:error-无明确code或者code不是超时,继续轮询',
|
|
515
|
-
content: _context.t0
|
|
516
|
-
});
|
|
517
|
-
this.scheduleNextQuery(actionType);
|
|
560
|
+
case 49:
|
|
561
|
+
if (!this.isOuterCodeTimeout(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.code)) {
|
|
562
|
+
_context.next = 55;
|
|
563
|
+
break;
|
|
518
564
|
}
|
|
519
|
-
|
|
565
|
+
paymentLog.addLog({
|
|
566
|
+
title: '查询轮询结果:error-code是超时错误,继续轮询',
|
|
567
|
+
content: _context.t0
|
|
568
|
+
});
|
|
569
|
+
this.scheduleNextQuery(actionType);
|
|
570
|
+
return _context.abrupt("return");
|
|
571
|
+
case 55:
|
|
572
|
+
paymentLog.addLog({
|
|
573
|
+
title: '查询轮询结果:error-有明确错误code,停止轮询',
|
|
574
|
+
content: _context.t0
|
|
575
|
+
});
|
|
576
|
+
this.handleOperationError(_context.t0);
|
|
577
|
+
case 57:
|
|
520
578
|
case "end":
|
|
521
579
|
return _context.stop();
|
|
522
580
|
}
|
|
523
|
-
}, _callee, this, [[13,
|
|
581
|
+
}, _callee, this, [[13, 37]]);
|
|
524
582
|
}));
|
|
525
583
|
function performQuery(_x) {
|
|
526
584
|
return _performQuery.apply(this, arguments);
|
|
@@ -569,7 +627,8 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
569
627
|
}, {
|
|
570
628
|
key: "startQuery",
|
|
571
629
|
value: function startQuery(actionType) {
|
|
572
|
-
var
|
|
630
|
+
var _this$config2,
|
|
631
|
+
_this3 = this;
|
|
573
632
|
if (this.isFinished || !this.shouldContinue() || this.isQuerying) {
|
|
574
633
|
return;
|
|
575
634
|
}
|
|
@@ -580,22 +639,30 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
580
639
|
actionType: actionType
|
|
581
640
|
}
|
|
582
641
|
});
|
|
583
|
-
//
|
|
642
|
+
// 设置轮询的全局超时(从开始轮询时计算)
|
|
643
|
+
var _globalQueryTimeout = ((_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.globalQueryTimeout) || GLOBAL_TIMEOUT;
|
|
584
644
|
this.globalTimeoutTimer = setTimeout(function () {
|
|
585
645
|
if (_this3.isFinished) {
|
|
586
646
|
return;
|
|
587
647
|
}
|
|
588
648
|
paymentLog.addLog({
|
|
589
|
-
title:
|
|
649
|
+
title: "\u8F6E\u8BE2\u5168\u5C40\u8D85\u65F6\uFF08".concat(_globalQueryTimeout / 1000, "\u79D2\uFF09\uFF0C\u7EC8\u6B62\u6240\u6709\u8BF7\u6C42"),
|
|
590
650
|
content: {
|
|
591
651
|
actionType: actionType
|
|
592
652
|
}
|
|
593
653
|
});
|
|
654
|
+
// 构建错误信息
|
|
594
655
|
_this3.handleOperationError({
|
|
595
|
-
code:
|
|
596
|
-
|
|
656
|
+
code: '200',
|
|
657
|
+
data: {
|
|
658
|
+
external_unified_response: {
|
|
659
|
+
external_unified_status: EPaymentStatus.Failed,
|
|
660
|
+
response_code: PayStatus.Timeout,
|
|
661
|
+
message: (locales === null || locales === void 0 ? void 0 : locales.getText('page.eftpos-pay.text.transaction.fail.timeout')) || 'Transaction timeout.'
|
|
662
|
+
}
|
|
663
|
+
}
|
|
597
664
|
});
|
|
598
|
-
},
|
|
665
|
+
}, _globalQueryTimeout);
|
|
599
666
|
this.performQuery(actionType);
|
|
600
667
|
}
|
|
601
668
|
|
|
@@ -691,32 +758,29 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
691
758
|
value: (function () {
|
|
692
759
|
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(runOptions) {
|
|
693
760
|
var _this4 = this;
|
|
694
|
-
var actionType, params,
|
|
761
|
+
var actionType, params, config, runId, _this$getActionApi2, actionApi, queryApi, error, signal, _query, _res$data5, res, needContinue;
|
|
695
762
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
696
763
|
while (1) switch (_context3.prev = _context3.next) {
|
|
697
764
|
case 0:
|
|
698
|
-
actionType = runOptions.actionType, params = runOptions.params; // 开始新的操作流程
|
|
699
|
-
runId = this.startNewOperation(actionType); //
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
}
|
|
765
|
+
actionType = runOptions.actionType, params = runOptions.params, config = runOptions.config; // 开始新的操作流程
|
|
766
|
+
runId = this.startNewOperation(actionType); // 记录请求参数
|
|
767
|
+
paymentLog.addLog({
|
|
768
|
+
title: '请求参数',
|
|
769
|
+
content: {
|
|
770
|
+
params: params
|
|
771
|
+
}
|
|
772
|
+
});
|
|
709
773
|
|
|
710
774
|
// 根据操作类型选择对应的API和查询API
|
|
711
775
|
_this$getActionApi2 = this.getActionApi(actionType), actionApi = _this$getActionApi2.actionApi, queryApi = _this$getActionApi2.queryApi;
|
|
712
776
|
if (actionApi) {
|
|
713
|
-
_context3.next =
|
|
777
|
+
_context3.next = 8;
|
|
714
778
|
break;
|
|
715
779
|
}
|
|
716
780
|
error = new Error("".concat(actionType, "\u63A5\u53E3\u4E0D\u5B58\u5728"));
|
|
717
781
|
this.handleOperationError(error);
|
|
718
782
|
return _context3.abrupt("return");
|
|
719
|
-
case
|
|
783
|
+
case 8:
|
|
720
784
|
// 设置当前查询API
|
|
721
785
|
this.currentQueryApi = queryApi;
|
|
722
786
|
|
|
@@ -736,6 +800,18 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
736
800
|
// 创建主请求控制器
|
|
737
801
|
this.controller = new AbortController();
|
|
738
802
|
signal = this.controller.signal;
|
|
803
|
+
_query = function _query(_status, _title, _content) {
|
|
804
|
+
paymentLog.addLog({
|
|
805
|
+
title: _title,
|
|
806
|
+
content: _content
|
|
807
|
+
});
|
|
808
|
+
// 清除定时器
|
|
809
|
+
if (_this4.queryStartTimer) {
|
|
810
|
+
clearTimeout(_this4.queryStartTimer);
|
|
811
|
+
_this4.queryStartTimer = null;
|
|
812
|
+
}
|
|
813
|
+
_this4.startQuery(actionType);
|
|
814
|
+
};
|
|
739
815
|
_context3.prev = 13;
|
|
740
816
|
paymentLog.addLog({
|
|
741
817
|
title: "\u53D1\u8D77".concat(actionType, "\u8BF7\u6C42"),
|
|
@@ -746,8 +822,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
746
822
|
});
|
|
747
823
|
_context3.next = 17;
|
|
748
824
|
return actionApi(_objectSpread(_objectSpread({}, params), {}, {
|
|
749
|
-
request_version: runId
|
|
750
|
-
is_outer_response_info: 1
|
|
825
|
+
request_version: runId
|
|
751
826
|
}), {
|
|
752
827
|
signal: signal
|
|
753
828
|
});
|
|
@@ -763,7 +838,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
763
838
|
});
|
|
764
839
|
|
|
765
840
|
// 检查是否是过期的响应(新执行的 ID 一定大于旧执行)
|
|
766
|
-
if (!(runId != (res === null || res === void 0 || (_res$
|
|
841
|
+
if (!(runId != (res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.request_version))) {
|
|
767
842
|
_context3.next = 22;
|
|
768
843
|
break;
|
|
769
844
|
}
|
|
@@ -787,8 +862,18 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
787
862
|
});
|
|
788
863
|
return _context3.abrupt("return");
|
|
789
864
|
case 25:
|
|
790
|
-
if (!(
|
|
791
|
-
_context3.next =
|
|
865
|
+
if (!("".concat(res === null || res === void 0 ? void 0 : res.code) !== '200')) {
|
|
866
|
+
_context3.next = 29;
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
paymentLog.addLog({
|
|
870
|
+
title: "".concat(actionType, "\u63A5\u53E3\u8FD4\u56DE\u5931\u8D25\uFF0Ccode\u975E200")
|
|
871
|
+
});
|
|
872
|
+
this.handleOperationError(res);
|
|
873
|
+
return _context3.abrupt("return");
|
|
874
|
+
case 29:
|
|
875
|
+
if (!this.isBusinessSuccess(res)) {
|
|
876
|
+
_context3.next = 34;
|
|
792
877
|
break;
|
|
793
878
|
}
|
|
794
879
|
paymentLog.addLog({
|
|
@@ -801,20 +886,13 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
801
886
|
needContinue = this.handleResponse(res);
|
|
802
887
|
if (needContinue) {
|
|
803
888
|
// 如果状态是processing,则开始轮询
|
|
804
|
-
|
|
805
|
-
title: "".concat(actionType, "\u63A5\u53E3\u8FD4\u56DEprocessing\uFF0C\u5F00\u59CB\u8F6E\u8BE2")
|
|
806
|
-
});
|
|
807
|
-
if (this.queryStartTimer) {
|
|
808
|
-
clearTimeout(this.queryStartTimer);
|
|
809
|
-
this.queryStartTimer = null;
|
|
810
|
-
}
|
|
811
|
-
this.startQuery(actionType);
|
|
889
|
+
_query('success', "".concat(actionType, "\u63A5\u53E3\u8FD4\u56DEprocessing\uFF0C\u5F00\u59CB\u8F6E\u8BE2"));
|
|
812
890
|
}
|
|
813
891
|
return _context3.abrupt("return");
|
|
814
|
-
case
|
|
815
|
-
//
|
|
892
|
+
case 34:
|
|
893
|
+
// 业务返回失败
|
|
816
894
|
// 如果有明确的错误code且不是超时,则直接失败
|
|
817
|
-
if (this.
|
|
895
|
+
if (this.isBusinessFailed(res)) {
|
|
818
896
|
paymentLog.addLog({
|
|
819
897
|
title: "".concat(actionType, "\u63A5\u53E3\u8FD4\u56DE\u5931\u8D25"),
|
|
820
898
|
content: {
|
|
@@ -824,27 +902,20 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
824
902
|
});
|
|
825
903
|
this.handleOperationError(res);
|
|
826
904
|
} else {
|
|
827
|
-
|
|
828
|
-
title: "".concat(actionType, "\u8D85\u65F6\u6216\u65E0\u660E\u786E\u9519\u8BEF\uFF0C\u7B49\u5F85\u8F6E\u8BE2\u7ED3\u679C"),
|
|
829
|
-
content: {
|
|
830
|
-
actionType: actionType,
|
|
831
|
-
res: res
|
|
832
|
-
}
|
|
833
|
-
});
|
|
905
|
+
this.handleOperationProcess(res);
|
|
834
906
|
// 直接开始轮询,不等待10秒,startQuery内部会处理竞态问题
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}
|
|
839
|
-
this.startQuery(actionType);
|
|
907
|
+
_query('failed', "".concat(actionType, "\u8D85\u65F6\u6216\u65E0\u660E\u786E\u9519\u8BEF\uFF0C\u5F00\u59CB\u8F6E\u8BE2"), {
|
|
908
|
+
actionType: actionType,
|
|
909
|
+
res: res
|
|
910
|
+
});
|
|
840
911
|
}
|
|
841
|
-
_context3.next =
|
|
912
|
+
_context3.next = 46;
|
|
842
913
|
break;
|
|
843
|
-
case
|
|
844
|
-
_context3.prev =
|
|
914
|
+
case 37:
|
|
915
|
+
_context3.prev = 37;
|
|
845
916
|
_context3.t0 = _context3["catch"](13);
|
|
846
917
|
if (!(runId !== this.currentRunId)) {
|
|
847
|
-
_context3.next =
|
|
918
|
+
_context3.next = 42;
|
|
848
919
|
break;
|
|
849
920
|
}
|
|
850
921
|
paymentLog.addLog({
|
|
@@ -854,9 +925,9 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
854
925
|
}
|
|
855
926
|
});
|
|
856
927
|
return _context3.abrupt("return");
|
|
857
|
-
case
|
|
928
|
+
case 42:
|
|
858
929
|
if (!(this.isFinished || !this.shouldContinue())) {
|
|
859
|
-
_context3.next =
|
|
930
|
+
_context3.next = 45;
|
|
860
931
|
break;
|
|
861
932
|
}
|
|
862
933
|
paymentLog.addLog({
|
|
@@ -866,32 +937,17 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
866
937
|
}
|
|
867
938
|
});
|
|
868
939
|
return _context3.abrupt("return");
|
|
869
|
-
case
|
|
870
|
-
//
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
actionType: actionType,
|
|
877
|
-
error: _context3.t0
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
this.handleOperationError(_context3.t0);
|
|
881
|
-
} else {
|
|
882
|
-
paymentLog.addLog({
|
|
883
|
-
title: "".concat(actionType, "\u8D85\u65F6\u6216\u65E0\u660E\u786E\u9519\u8BEF\uFF0C\u7B49\u5F85\u8F6E\u8BE2\u7ED3\u679C"),
|
|
884
|
-
content: {
|
|
885
|
-
actionType: actionType,
|
|
886
|
-
error: _context3.t0
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
case 42:
|
|
940
|
+
case 45:
|
|
941
|
+
// pay/refund接口异常,直接开始轮询,不能以code非200判断是否错误
|
|
942
|
+
_query('failed', "".concat(actionType, "\u63A5\u53E3\u5F02\u5E38\uFF0C\u5F00\u59CB\u8F6E\u8BE2"), {
|
|
943
|
+
actionType: actionType,
|
|
944
|
+
error: _context3.t0
|
|
945
|
+
});
|
|
946
|
+
case 46:
|
|
891
947
|
case "end":
|
|
892
948
|
return _context3.stop();
|
|
893
949
|
}
|
|
894
|
-
}, _callee3, this, [[13,
|
|
950
|
+
}, _callee3, this, [[13, 37]]);
|
|
895
951
|
}));
|
|
896
952
|
function run(_x3) {
|
|
897
953
|
return _run.apply(this, arguments);
|
|
@@ -906,21 +962,21 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
906
962
|
key: "runAction",
|
|
907
963
|
value: (function () {
|
|
908
964
|
var _runAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(actionOptions) {
|
|
909
|
-
var actionType, params,
|
|
965
|
+
var actionType, params, config, runActionId, _this$getActionApi3, actionApi, queryApi, error, signal, _res$data6, res;
|
|
910
966
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
911
967
|
while (1) switch (_context4.prev = _context4.next) {
|
|
912
968
|
case 0:
|
|
913
|
-
actionType = actionOptions.actionType, params = actionOptions.params
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
}
|
|
969
|
+
actionType = actionOptions.actionType, params = actionOptions.params, config = actionOptions.config;
|
|
970
|
+
console.log('runAction_actionOptions', actionOptions);
|
|
971
|
+
// 开始新的操作流程
|
|
972
|
+
runActionId = this.startNewOperation(actionType); // 记录请求参数
|
|
973
|
+
paymentLog.addLog({
|
|
974
|
+
title: "".concat(actionType, "\u64CD\u4F5C\u8BF7\u6C42\u53C2\u6570"),
|
|
975
|
+
content: {
|
|
976
|
+
actionType: actionType,
|
|
977
|
+
params: params
|
|
978
|
+
}
|
|
979
|
+
});
|
|
924
980
|
|
|
925
981
|
// 根据操作类型选择对应的API和查询API
|
|
926
982
|
_this$getActionApi3 = this.getActionApi(actionType), actionApi = _this$getActionApi3.actionApi, queryApi = _this$getActionApi3.queryApi;
|
|
@@ -939,8 +995,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
939
995
|
_context4.prev = 12;
|
|
940
996
|
_context4.next = 15;
|
|
941
997
|
return actionApi(_objectSpread(_objectSpread({}, params || {}), {}, {
|
|
942
|
-
request_version: runActionId
|
|
943
|
-
is_outer_response_info: 1
|
|
998
|
+
request_version: runActionId
|
|
944
999
|
}), {
|
|
945
1000
|
signal: signal
|
|
946
1001
|
});
|
|
@@ -958,7 +1013,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
958
1013
|
});
|
|
959
1014
|
return _context4.abrupt("return");
|
|
960
1015
|
case 19:
|
|
961
|
-
if (!(runActionId !== (res === null || res === void 0 || (_res$
|
|
1016
|
+
if (!(runActionId !== (res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.request_version))) {
|
|
962
1017
|
_context4.next = 22;
|
|
963
1018
|
break;
|
|
964
1019
|
}
|
|
@@ -970,6 +1025,13 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
970
1025
|
});
|
|
971
1026
|
return _context4.abrupt("return");
|
|
972
1027
|
case 22:
|
|
1028
|
+
if (!(config !== null && config !== void 0 && config.needResponse)) {
|
|
1029
|
+
_context4.next = 25;
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
this.handleResponse(res);
|
|
1033
|
+
return _context4.abrupt("return");
|
|
1034
|
+
case 25:
|
|
973
1035
|
paymentLog.addLog({
|
|
974
1036
|
title: 'Action请求返回,开始轮询',
|
|
975
1037
|
content: {
|
|
@@ -977,13 +1039,13 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
977
1039
|
}
|
|
978
1040
|
});
|
|
979
1041
|
this.startQuery(actionType);
|
|
980
|
-
_context4.next =
|
|
1042
|
+
_context4.next = 39;
|
|
981
1043
|
break;
|
|
982
|
-
case
|
|
983
|
-
_context4.prev =
|
|
1044
|
+
case 29:
|
|
1045
|
+
_context4.prev = 29;
|
|
984
1046
|
_context4.t0 = _context4["catch"](12);
|
|
985
1047
|
if (!(this.isFinished || !this.shouldContinue())) {
|
|
986
|
-
_context4.next =
|
|
1048
|
+
_context4.next = 34;
|
|
987
1049
|
break;
|
|
988
1050
|
}
|
|
989
1051
|
paymentLog.addLog({
|
|
@@ -993,9 +1055,9 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
993
1055
|
}
|
|
994
1056
|
});
|
|
995
1057
|
return _context4.abrupt("return");
|
|
996
|
-
case
|
|
1058
|
+
case 34:
|
|
997
1059
|
if (!(runActionId !== this.currentRunId)) {
|
|
998
|
-
_context4.next =
|
|
1060
|
+
_context4.next = 37;
|
|
999
1061
|
break;
|
|
1000
1062
|
}
|
|
1001
1063
|
paymentLog.addLog({
|
|
@@ -1005,7 +1067,7 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1005
1067
|
}
|
|
1006
1068
|
});
|
|
1007
1069
|
return _context4.abrupt("return");
|
|
1008
|
-
case
|
|
1070
|
+
case 37:
|
|
1009
1071
|
paymentLog.addLog({
|
|
1010
1072
|
title: 'Action请求异常,开始轮询',
|
|
1011
1073
|
content: {
|
|
@@ -1014,11 +1076,11 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1014
1076
|
}
|
|
1015
1077
|
});
|
|
1016
1078
|
this.startQuery(actionType);
|
|
1017
|
-
case
|
|
1079
|
+
case 39:
|
|
1018
1080
|
case "end":
|
|
1019
1081
|
return _context4.stop();
|
|
1020
1082
|
}
|
|
1021
|
-
}, _callee4, this, [[12,
|
|
1083
|
+
}, _callee4, this, [[12, 29]]);
|
|
1022
1084
|
}));
|
|
1023
1085
|
function runAction(_x4) {
|
|
1024
1086
|
return _runAction.apply(this, arguments);
|
|
@@ -1032,10 +1094,11 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1032
1094
|
)
|
|
1033
1095
|
}, {
|
|
1034
1096
|
key: "pay",
|
|
1035
|
-
value: function pay(params) {
|
|
1097
|
+
value: function pay(params, config) {
|
|
1036
1098
|
this.run({
|
|
1037
1099
|
actionType: ActionType.Pay,
|
|
1038
|
-
params: params
|
|
1100
|
+
params: params,
|
|
1101
|
+
config: config
|
|
1039
1102
|
});
|
|
1040
1103
|
}
|
|
1041
1104
|
|
|
@@ -1045,10 +1108,11 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1045
1108
|
*/
|
|
1046
1109
|
}, {
|
|
1047
1110
|
key: "payAction",
|
|
1048
|
-
value: function payAction(params) {
|
|
1111
|
+
value: function payAction(params, config) {
|
|
1049
1112
|
this.runAction({
|
|
1050
1113
|
actionType: ActionType.PayAction,
|
|
1051
|
-
params: params
|
|
1114
|
+
params: params,
|
|
1115
|
+
config: config
|
|
1052
1116
|
});
|
|
1053
1117
|
}
|
|
1054
1118
|
|
|
@@ -1058,10 +1122,11 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1058
1122
|
*/
|
|
1059
1123
|
}, {
|
|
1060
1124
|
key: "refund",
|
|
1061
|
-
value: function refund(params) {
|
|
1125
|
+
value: function refund(params, config) {
|
|
1062
1126
|
this.run({
|
|
1063
1127
|
actionType: ActionType.Refund,
|
|
1064
|
-
params: params
|
|
1128
|
+
params: params,
|
|
1129
|
+
config: config
|
|
1065
1130
|
});
|
|
1066
1131
|
}
|
|
1067
1132
|
|
|
@@ -1071,10 +1136,11 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1071
1136
|
*/
|
|
1072
1137
|
}, {
|
|
1073
1138
|
key: "refundAction",
|
|
1074
|
-
value: function refundAction(params) {
|
|
1139
|
+
value: function refundAction(params, config) {
|
|
1075
1140
|
this.runAction({
|
|
1076
1141
|
actionType: ActionType.RefundAction,
|
|
1077
|
-
params: params
|
|
1142
|
+
params: params,
|
|
1143
|
+
config: config
|
|
1078
1144
|
});
|
|
1079
1145
|
}
|
|
1080
1146
|
|
|
@@ -1123,14 +1189,11 @@ var PaymentMethod = /*#__PURE__*/function () {
|
|
|
1123
1189
|
key: "destroy",
|
|
1124
1190
|
value: function destroy() {
|
|
1125
1191
|
paymentLog.addLog({
|
|
1126
|
-
title: '
|
|
1192
|
+
title: '支付步骤结束,销毁实例'
|
|
1127
1193
|
});
|
|
1128
1194
|
|
|
1129
1195
|
// 清理资源并标记为已完成
|
|
1130
1196
|
this.clean(true);
|
|
1131
|
-
|
|
1132
|
-
// 清理日志(会上传到飞书)
|
|
1133
|
-
paymentLog.clearLogs();
|
|
1134
1197
|
}
|
|
1135
1198
|
}]);
|
|
1136
1199
|
return PaymentMethod;
|