@pisell/pisellos 2.2.277 → 2.2.800
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/core/index.d.ts +0 -2
- package/dist/core/index.js +1 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -5
- package/dist/model/strategy/adapter/walletPass/utils.js +26 -57
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +0 -8
- package/dist/modules/Order/index.d.ts +8 -28
- package/dist/modules/Order/index.js +496 -808
- package/dist/modules/Order/types.d.ts +1 -35
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.js +6 -10
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +49 -78
- package/dist/modules/Payment/types.d.ts +25 -106
- package/dist/modules/Payment/types.js +0 -17
- package/dist/modules/Payment/utils.js +1 -4
- package/dist/modules/Payment/walletpass.d.ts +1 -49
- package/dist/modules/Payment/walletpass.js +124 -1081
- package/dist/modules/Rules/index.d.ts +0 -3
- package/dist/modules/Rules/index.js +70 -100
- package/dist/server/index.d.ts +0 -25
- package/dist/server/index.js +1069 -2001
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +4 -70
- package/dist/server/modules/order/index.js +728 -1816
- package/dist/server/modules/order/types.d.ts +3 -25
- package/dist/server/modules/order/types.js +1 -7
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +5 -109
- package/dist/solution/BaseSales/index.js +436 -1802
- package/dist/solution/BaseSales/types.d.ts +1 -55
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -7
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -21
- package/dist/solution/BookingTicket/index.js +56 -139
- package/dist/solution/BookingTicket/types.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +83 -173
- package/dist/solution/Sales/index.d.ts +0 -2
- package/dist/solution/Sales/index.js +4 -26
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/VenueBooking/index.d.ts +0 -1
- package/dist/solution/VenueBooking/index.js +19 -30
- package/dist/types/index.d.ts +0 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +1 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -5
- package/lib/model/strategy/adapter/walletPass/utils.js +11 -62
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +0 -5
- package/lib/modules/Order/index.d.ts +8 -28
- package/lib/modules/Order/index.js +69 -231
- package/lib/modules/Order/types.d.ts +1 -35
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.js +4 -11
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +12 -33
- package/lib/modules/Payment/types.d.ts +25 -106
- package/lib/modules/Payment/types.js +0 -1
- package/lib/modules/Payment/utils.js +1 -5
- package/lib/modules/Payment/walletpass.d.ts +1 -49
- package/lib/modules/Payment/walletpass.js +22 -898
- package/lib/modules/Rules/index.d.ts +0 -3
- package/lib/modules/Rules/index.js +9 -38
- package/lib/server/index.d.ts +0 -25
- package/lib/server/index.js +31 -726
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +4 -70
- package/lib/server/modules/order/index.js +69 -818
- package/lib/server/modules/order/types.d.ts +3 -25
- package/lib/server/modules/order/types.js +0 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +5 -109
- package/lib/solution/BaseSales/index.js +27 -874
- package/lib/solution/BaseSales/types.d.ts +1 -55
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -21
- package/lib/solution/BookingTicket/index.js +13 -64
- package/lib/solution/BookingTicket/types.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +5 -37
- package/lib/solution/Sales/index.d.ts +0 -2
- package/lib/solution/Sales/index.js +6 -20
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/VenueBooking/index.d.ts +0 -1
- package/lib/solution/VenueBooking/index.js +0 -8
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -1,122 +1,27 @@
|
|
|
1
|
-
function
|
|
2
|
-
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); } }
|
|
3
|
-
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); }); }; }
|
|
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 _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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); }
|
|
8
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
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); }
|
|
11
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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); }
|
|
13
9
|
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; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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); } }
|
|
16
|
+
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
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
18
|
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); } }
|
|
16
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
20
|
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; }
|
|
20
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
21
22
|
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); }
|
|
22
|
-
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); }
|
|
23
23
|
import { WalletPassHooks } from "./types";
|
|
24
24
|
import { formatWalletPassList2PreparePayments as formatWalletPassList2PreparePaymentsUtils, sortUserIdentificationCodeList } from "./utils";
|
|
25
|
-
var WALLET_PAYMENT_ASSET_TAGS = new Set(['product_voucher', 'gift_card', 'point_card']);
|
|
26
|
-
function isWalletPaymentAsset(asset) {
|
|
27
|
-
return WALLET_PAYMENT_ASSET_TAGS.has(String((asset === null || asset === void 0 ? void 0 : asset.tag) || '').toLowerCase());
|
|
28
|
-
}
|
|
29
|
-
function getWalletAssetId(asset) {
|
|
30
|
-
var _ref, _asset$id;
|
|
31
|
-
return (_ref = (_asset$id = asset === null || asset === void 0 ? void 0 : asset.id) !== null && _asset$id !== void 0 ? _asset$id : asset === null || asset === void 0 ? void 0 : asset.voucher_id) !== null && _ref !== void 0 ? _ref : asset === null || asset === void 0 ? void 0 : asset.code;
|
|
32
|
-
}
|
|
33
|
-
function getWalletAssetKey(assetOrId) {
|
|
34
|
-
var id = assetOrId && _typeof(assetOrId) === 'object' ? getWalletAssetId(assetOrId) : assetOrId;
|
|
35
|
-
return id === undefined || id === null ? '' : String(id);
|
|
36
|
-
}
|
|
37
|
-
function matchesWalletAssetCode(asset, normalizedCode) {
|
|
38
|
-
return [asset === null || asset === void 0 ? void 0 : asset.code, asset === null || asset === void 0 ? void 0 : asset.encoded].some(function (identifier) {
|
|
39
|
-
return String(identifier !== null && identifier !== void 0 ? identifier : '').trim() === normalizedCode;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function normalizeWalletAssetCode(code) {
|
|
43
|
-
return String(code !== null && code !== void 0 ? code : '').trim().toUpperCase();
|
|
44
|
-
}
|
|
45
|
-
function getWalletAssetCodeKeys(asset) {
|
|
46
|
-
return [asset === null || asset === void 0 ? void 0 : asset.code, asset === null || asset === void 0 ? void 0 : asset.encoded].map(normalizeWalletAssetCode).filter(Boolean);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 保存货币类扫码资产自身的可用余额,供后续前端策略重新计算。
|
|
51
|
-
* 搜索接口的 recommended_usage_amount 已扣除了搜索时的已选券,不能作为
|
|
52
|
-
* 取消勾选后的永久上限。积分卡的 balance_par_value 是积分值,不能直接
|
|
53
|
-
* 当作货币金额,因此继续沿用接口推荐金额。
|
|
54
|
-
*/
|
|
55
|
-
function withWalletAssetRecalculationBaseAmount(asset) {
|
|
56
|
-
var existingBaseAmount = Number(asset === null || asset === void 0 ? void 0 : asset._wallet_asset_recalculation_base_amount);
|
|
57
|
-
if (Number.isFinite(existingBaseAmount) && existingBaseAmount >= 0) {
|
|
58
|
-
return asset;
|
|
59
|
-
}
|
|
60
|
-
if (!['product_voucher', 'gift_card'].includes(asset === null || asset === void 0 ? void 0 : asset.tag)) {
|
|
61
|
-
return asset;
|
|
62
|
-
}
|
|
63
|
-
var balanceParValue = Number(asset === null || asset === void 0 ? void 0 : asset.balance_par_value);
|
|
64
|
-
if (!Number.isFinite(balanceParValue) || balanceParValue < 0) {
|
|
65
|
-
return asset;
|
|
66
|
-
}
|
|
67
|
-
return _objectSpread(_objectSpread({}, asset), {}, {
|
|
68
|
-
_wallet_asset_recalculation_base_amount: balanceParValue
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function isWalletAssetAvailable(asset) {
|
|
72
|
-
if (!asset) return false;
|
|
73
|
-
if (asset.unified_available_status !== undefined && Number(asset.unified_available_status) !== 1) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
if (asset._unified_available_status !== undefined && Number(asset._unified_available_status) !== 1) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
if (asset.available === false || asset.isDisabled === true) return false;
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
function getWalletAssetDeductionAmount(asset) {
|
|
83
|
-
var _ref2, _ref3, _ref4, _ref5, _ref6, _asset$actualDeductio;
|
|
84
|
-
var value = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_asset$actualDeductio = asset === null || asset === void 0 ? void 0 : asset.actualDeduction) !== null && _asset$actualDeductio !== void 0 ? _asset$actualDeductio : asset === null || asset === void 0 ? void 0 : asset._available_max_amount) !== null && _ref6 !== void 0 ? _ref6 : asset === null || asset === void 0 ? void 0 : asset.edit_current_amount) !== null && _ref5 !== void 0 ? _ref5 : asset === null || asset === void 0 ? void 0 : asset.recommended_usage_amount) !== null && _ref4 !== void 0 ? _ref4 : asset === null || asset === void 0 ? void 0 : asset.available_max_amount) !== null && _ref3 !== void 0 ? _ref3 : asset === null || asset === void 0 ? void 0 : asset.amount) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
85
|
-
var amount = Number(value);
|
|
86
|
-
return Number.isFinite(amount) && amount > 0 ? amount : 0;
|
|
87
|
-
}
|
|
88
|
-
function mergeWalletAssets() {
|
|
89
|
-
var merged = [];
|
|
90
|
-
var indexByKey = new Map();
|
|
91
|
-
for (var _len = arguments.length, groups = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
92
|
-
groups[_key] = arguments[_key];
|
|
93
|
-
}
|
|
94
|
-
groups.flat().forEach(function (asset) {
|
|
95
|
-
var key = getWalletAssetKey(asset);
|
|
96
|
-
if (!key) return;
|
|
97
|
-
var existedIndex = indexByKey.get(key);
|
|
98
|
-
if (existedIndex === undefined) {
|
|
99
|
-
indexByKey.set(key, merged.length);
|
|
100
|
-
merged.push(asset);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
merged[existedIndex] = _objectSpread(_objectSpread({}, merged[existedIndex]), asset);
|
|
104
|
-
});
|
|
105
|
-
return merged;
|
|
106
|
-
}
|
|
107
|
-
function createInitialWalletAssetsState() {
|
|
108
|
-
return {
|
|
109
|
-
status: 'idle',
|
|
110
|
-
items: [],
|
|
111
|
-
selectedIds: [],
|
|
112
|
-
selectedItems: [],
|
|
113
|
-
committedIds: [],
|
|
114
|
-
selectionSources: {},
|
|
115
|
-
totalSelectedAmount: 0,
|
|
116
|
-
error: null,
|
|
117
|
-
revision: 0
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
25
|
|
|
121
26
|
/**
|
|
122
27
|
* 钱包支付实现
|
|
@@ -129,33 +34,14 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
129
34
|
_defineProperty(this, "searchResults", []);
|
|
130
35
|
_defineProperty(this, "walletParams", null);
|
|
131
36
|
_defineProperty(this, "walletInitData", null);
|
|
132
|
-
_defineProperty(this, "walletAssetsState", createInitialWalletAssetsState());
|
|
133
|
-
_defineProperty(this, "walletAssetsRequestSequence", 0);
|
|
134
|
-
_defineProperty(this, "walletAssetsBehavior", {
|
|
135
|
-
autoSelectAfterSearch: true
|
|
136
|
-
});
|
|
137
|
-
_defineProperty(this, "pendingAutoSelectSearchCodes", new Set());
|
|
138
|
-
_defineProperty(this, "walletAssetsCalculationContext", {
|
|
139
|
-
orderTotalAmount: 0,
|
|
140
|
-
products: []
|
|
141
|
-
});
|
|
142
37
|
this.paymentModule = paymentModule;
|
|
143
38
|
}
|
|
144
|
-
_createClass(WalletPassPaymentImpl, [{
|
|
145
|
-
key: "configureWalletAssetsBehavior",
|
|
146
|
-
value: function configureWalletAssetsBehavior(options) {
|
|
147
|
-
if (options.autoSelectAfterSearch === undefined) return;
|
|
148
|
-
this.walletAssetsBehavior.autoSelectAfterSearch = options.autoSelectAfterSearch;
|
|
149
|
-
if (!options.autoSelectAfterSearch) {
|
|
150
|
-
this.pendingAutoSelectSearchCodes.clear();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
39
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
40
|
+
/**
|
|
41
|
+
* 发送事件的辅助方法
|
|
42
|
+
* 支持使用WalletPassHooks或PaymentHooks
|
|
43
|
+
*/
|
|
44
|
+
_createClass(WalletPassPaymentImpl, [{
|
|
159
45
|
key: "emitEvent",
|
|
160
46
|
value: function emitEvent(hook, data) {
|
|
161
47
|
try {
|
|
@@ -169,197 +55,6 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
169
55
|
});
|
|
170
56
|
}
|
|
171
57
|
}
|
|
172
|
-
}, {
|
|
173
|
-
key: "publishWalletAssetsState",
|
|
174
|
-
value: function publishWalletAssetsState(patch) {
|
|
175
|
-
var _patch$items, _patch$selectedIds, _patch$selectedItems, _patch$committedIds, _patch$selectionSourc;
|
|
176
|
-
this.walletAssetsState = _objectSpread(_objectSpread(_objectSpread({}, this.walletAssetsState), patch), {}, {
|
|
177
|
-
items: _toConsumableArray((_patch$items = patch.items) !== null && _patch$items !== void 0 ? _patch$items : this.walletAssetsState.items),
|
|
178
|
-
selectedIds: _toConsumableArray((_patch$selectedIds = patch.selectedIds) !== null && _patch$selectedIds !== void 0 ? _patch$selectedIds : this.walletAssetsState.selectedIds),
|
|
179
|
-
selectedItems: _toConsumableArray((_patch$selectedItems = patch.selectedItems) !== null && _patch$selectedItems !== void 0 ? _patch$selectedItems : this.walletAssetsState.selectedItems),
|
|
180
|
-
committedIds: _toConsumableArray((_patch$committedIds = patch.committedIds) !== null && _patch$committedIds !== void 0 ? _patch$committedIds : this.walletAssetsState.committedIds),
|
|
181
|
-
selectionSources: _objectSpread({}, (_patch$selectionSourc = patch.selectionSources) !== null && _patch$selectionSourc !== void 0 ? _patch$selectionSourc : this.walletAssetsState.selectionSources),
|
|
182
|
-
revision: this.walletAssetsState.revision + 1
|
|
183
|
-
});
|
|
184
|
-
var state = this.getWalletAssetsState();
|
|
185
|
-
this.emitEvent(WalletPassHooks.OnWalletAssetsStateChanged, {
|
|
186
|
-
state: state
|
|
187
|
-
});
|
|
188
|
-
return state;
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
key: "recalculateWalletAssets",
|
|
192
|
-
value: function recalculateWalletAssets(items, requestedIds, selectionSources) {
|
|
193
|
-
var _this$paymentModule$w, _this$paymentModule$w2;
|
|
194
|
-
var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
|
|
195
|
-
return String(id);
|
|
196
|
-
}));
|
|
197
|
-
var itemsByKey = new Map(items.map(function (item) {
|
|
198
|
-
return [getWalletAssetKey(item), item];
|
|
199
|
-
}));
|
|
200
|
-
var requested = requestedIds.map(function (id) {
|
|
201
|
-
return String(id);
|
|
202
|
-
}).filter(function (id) {
|
|
203
|
-
return !committedKeys.has(id);
|
|
204
|
-
}).map(function (id) {
|
|
205
|
-
return itemsByKey.get(id);
|
|
206
|
-
}).filter(function (item) {
|
|
207
|
-
return item && isWalletAssetAvailable(item);
|
|
208
|
-
});
|
|
209
|
-
var nextItems = items;
|
|
210
|
-
var selectedItems = requested;
|
|
211
|
-
var evaluator = (_this$paymentModule$w = this.paymentModule.window) === null || _this$paymentModule$w === void 0 || (_this$paymentModule$w2 = _this$paymentModule$w.getWalletPassEvaluator) === null || _this$paymentModule$w2 === void 0 ? void 0 : _this$paymentModule$w2.call(_this$paymentModule$w);
|
|
212
|
-
if (evaluator !== null && evaluator !== void 0 && evaluator.recalculateVouchers) {
|
|
213
|
-
try {
|
|
214
|
-
var result = evaluator.recalculateVouchers(items, requested, this.walletAssetsCalculationContext.orderTotalAmount, this.walletAssetsCalculationContext.products);
|
|
215
|
-
nextItems = mergeWalletAssets(items, (result === null || result === void 0 ? void 0 : result.allWithUpdatedStatus) || []);
|
|
216
|
-
selectedItems = ((result === null || result === void 0 ? void 0 : result.selectedWithDetails) || []).filter(function (item) {
|
|
217
|
-
return isWalletAssetAvailable(item) && getWalletAssetDeductionAmount(item) > 0;
|
|
218
|
-
});
|
|
219
|
-
} catch (error) {
|
|
220
|
-
this.paymentModule.logWarning('[WalletPass] 共享钱包资产重新计算失败,回退接口可用状态', {
|
|
221
|
-
error: error instanceof Error ? error.message : String(error)
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
var selectedIds = selectedItems.map(function (item) {
|
|
226
|
-
return getWalletAssetId(item);
|
|
227
|
-
}).filter(function (id) {
|
|
228
|
-
return id !== undefined && id !== null;
|
|
229
|
-
});
|
|
230
|
-
var selectedKeys = new Set(selectedIds.map(function (id) {
|
|
231
|
-
return String(id);
|
|
232
|
-
}));
|
|
233
|
-
var nextSources = Object.entries(selectionSources).reduce(function (result, _ref7) {
|
|
234
|
-
var _ref8 = _slicedToArray(_ref7, 2),
|
|
235
|
-
key = _ref8[0],
|
|
236
|
-
source = _ref8[1];
|
|
237
|
-
if (selectedKeys.has(key)) result[key] = source;
|
|
238
|
-
return result;
|
|
239
|
-
}, {});
|
|
240
|
-
var totalSelectedAmount = selectedItems.reduce(function (total, item) {
|
|
241
|
-
return total + getWalletAssetDeductionAmount(item);
|
|
242
|
-
}, 0);
|
|
243
|
-
return this.publishWalletAssetsState({
|
|
244
|
-
status: 'ready',
|
|
245
|
-
items: nextItems,
|
|
246
|
-
selectedIds: selectedIds,
|
|
247
|
-
selectedItems: selectedItems,
|
|
248
|
-
selectionSources: nextSources,
|
|
249
|
-
totalSelectedAmount: totalSelectedAmount,
|
|
250
|
-
error: null
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* 搜索接口只返回后端 Wallet Pass 数据,不包含前端策略 config。
|
|
256
|
-
* 在资产进入共享选择状态前补齐策略结果,避免增量重算回退到接口状态。
|
|
257
|
-
*/
|
|
258
|
-
}, {
|
|
259
|
-
key: "formatSearchedWalletPaymentAssets",
|
|
260
|
-
value: function formatSearchedWalletPaymentAssets(assets) {
|
|
261
|
-
var _this$paymentModule$w3, _this$paymentModule$w4, _this$walletParams, _this$walletParams2;
|
|
262
|
-
if (!assets.length) return assets;
|
|
263
|
-
var assetsWithRecalculationBase = assets.map(withWalletAssetRecalculationBaseAmount);
|
|
264
|
-
var evaluator = (_this$paymentModule$w3 = this.paymentModule.window) === null || _this$paymentModule$w3 === void 0 || (_this$paymentModule$w4 = _this$paymentModule$w3.getWalletPassEvaluator) === null || _this$paymentModule$w4 === void 0 ? void 0 : _this$paymentModule$w4.call(_this$paymentModule$w3);
|
|
265
|
-
if (!(evaluator !== null && evaluator !== void 0 && evaluator.searchVoucherFormat)) return assetsWithRecalculationBase;
|
|
266
|
-
var hasCalculationProducts = this.walletAssetsCalculationContext.products.length > 0;
|
|
267
|
-
var products = hasCalculationProducts ? this.walletAssetsCalculationContext.products : ((_this$walletParams = this.walletParams) === null || _this$walletParams === void 0 ? void 0 : _this$walletParams.products) || [];
|
|
268
|
-
var orderTotalAmount = Number(hasCalculationProducts ? this.walletAssetsCalculationContext.orderTotalAmount : ((_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.order_wait_pay_amount) || 0);
|
|
269
|
-
try {
|
|
270
|
-
var formattedAssets = evaluator.searchVoucherFormat({
|
|
271
|
-
orderTotalAmount: orderTotalAmount,
|
|
272
|
-
products: products,
|
|
273
|
-
vouchers: assetsWithRecalculationBase
|
|
274
|
-
});
|
|
275
|
-
return formattedAssets;
|
|
276
|
-
} catch (error) {
|
|
277
|
-
this.paymentModule.logWarning('[WalletPass] 搜索资产策略格式化失败,保留接口结果', {
|
|
278
|
-
error: error instanceof Error ? error.message : String(error)
|
|
279
|
-
});
|
|
280
|
-
return assetsWithRecalculationBase;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
|
|
285
|
-
}, {
|
|
286
|
-
key: "getSearchedWalletAssetCodes",
|
|
287
|
-
value: function getSearchedWalletAssetCodes() {
|
|
288
|
-
var cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
289
|
-
var seenCodes = new Set();
|
|
290
|
-
return cachedAssets.map(function (item) {
|
|
291
|
-
return String((item === null || item === void 0 ? void 0 : item.code) || '').trim();
|
|
292
|
-
}).filter(function (code) {
|
|
293
|
-
var normalizedCode = code.toUpperCase();
|
|
294
|
-
if (!normalizedCode || seenCodes.has(normalizedCode)) return false;
|
|
295
|
-
seenCodes.add(normalizedCode);
|
|
296
|
-
return true;
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* 用订单重算接口返回的数据更新扫码 Wallet 缓存。
|
|
302
|
-
* 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
|
|
303
|
-
*/
|
|
304
|
-
}, {
|
|
305
|
-
key: "syncSearchedWalletAssets",
|
|
306
|
-
value: function syncSearchedWalletAssets(refreshedCandidates) {
|
|
307
|
-
var cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
308
|
-
var searchedCodeKeys = new Set(this.getSearchedWalletAssetCodes().map(function (code) {
|
|
309
|
-
return code.toUpperCase();
|
|
310
|
-
}));
|
|
311
|
-
if (searchedCodeKeys.size === 0) return cachedAssets;
|
|
312
|
-
var cachedAssetByCode = new Map();
|
|
313
|
-
cachedAssets.forEach(function (item) {
|
|
314
|
-
getWalletAssetCodeKeys(item).forEach(function (code) {
|
|
315
|
-
cachedAssetByCode.set(code, item);
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
var refreshedAssets = refreshedCandidates.filter(function (item) {
|
|
319
|
-
return isWalletPaymentAsset(item) && searchedCodeKeys.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
|
|
320
|
-
}).map(function (item) {
|
|
321
|
-
var cachedAsset = getWalletAssetCodeKeys(item).map(function (code) {
|
|
322
|
-
return cachedAssetByCode.get(code);
|
|
323
|
-
}).find(Boolean);
|
|
324
|
-
return withWalletAssetRecalculationBaseAmount(_objectSpread(_objectSpread({}, cachedAsset), item));
|
|
325
|
-
});
|
|
326
|
-
if (refreshedAssets.length > 0) {
|
|
327
|
-
var replacedCodes = new Set(refreshedAssets.map(function (item) {
|
|
328
|
-
return String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase();
|
|
329
|
-
}));
|
|
330
|
-
this.searchResults = [].concat(_toConsumableArray(this.searchResults.filter(function (item) {
|
|
331
|
-
return !replacedCodes.has(String((item === null || item === void 0 ? void 0 : item.code) || '').trim().toUpperCase());
|
|
332
|
-
})), _toConsumableArray(refreshedAssets));
|
|
333
|
-
}
|
|
334
|
-
return mergeWalletAssets(cachedAssets, refreshedAssets);
|
|
335
|
-
}
|
|
336
|
-
}, {
|
|
337
|
-
key: "isPendingAutoSelectAsset",
|
|
338
|
-
value: function isPendingAutoSelectAsset(asset) {
|
|
339
|
-
var _this = this;
|
|
340
|
-
return getWalletAssetCodeKeys(asset).some(function (code) {
|
|
341
|
-
return _this.pendingAutoSelectSearchCodes.has(code);
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
}, {
|
|
345
|
-
key: "clearPendingAutoSelectForAsset",
|
|
346
|
-
value: function clearPendingAutoSelectForAsset(asset) {
|
|
347
|
-
var _this2 = this;
|
|
348
|
-
getWalletAssetCodeKeys(asset).forEach(function (code) {
|
|
349
|
-
_this2.pendingAutoSelectSearchCodes.delete(code);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
}, {
|
|
353
|
-
key: "queuePendingAutoSelectForAssets",
|
|
354
|
-
value: function queuePendingAutoSelectForAssets(assets) {
|
|
355
|
-
var _this3 = this;
|
|
356
|
-
if (!this.walletAssetsBehavior.autoSelectAfterSearch) return;
|
|
357
|
-
assets.forEach(function (asset) {
|
|
358
|
-
getWalletAssetCodeKeys(asset).forEach(function (code) {
|
|
359
|
-
_this3.pendingAutoSelectSearchCodes.add(code);
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
58
|
|
|
364
59
|
/**
|
|
365
60
|
* 生成钱包API默认参数
|
|
@@ -390,21 +85,15 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
390
85
|
// 订单小计金额
|
|
391
86
|
order_product_amount: subTotal,
|
|
392
87
|
// 订单待支付金额
|
|
393
|
-
order_wait_pay_amount: order_wait_pay_amount
|
|
88
|
+
order_wait_pay_amount: order_wait_pay_amount || (amountInfo !== null && amountInfo !== void 0 && amountInfo.isDeposit ? Number(amountInfo === null || amountInfo === void 0 ? void 0 : amountInfo.depositAmount) : totalAmount),
|
|
394
89
|
// order_behavior_count_customer_id: 1,
|
|
395
90
|
products: products,
|
|
396
91
|
prepare_payments: [],
|
|
397
92
|
payment_order_id: payment_order_id
|
|
398
93
|
};
|
|
399
94
|
|
|
400
|
-
//
|
|
401
|
-
// 必须使用同一份当前购物车上下文,避免搜索按真实金额判断可用,
|
|
402
|
-
// 随后的 recalculateVouchers 却仍读取初始的 0 元/空商品上下文。
|
|
95
|
+
// 存储生成的参数到模块中
|
|
403
96
|
this.walletParams = walletParams;
|
|
404
|
-
this.walletAssetsCalculationContext = {
|
|
405
|
-
orderTotalAmount: Number(walletParams.order_wait_pay_amount || 0),
|
|
406
|
-
products: Array.isArray(walletParams.products) ? walletParams.products : []
|
|
407
|
-
};
|
|
408
97
|
this.paymentModule.logInfo('[WalletPass] 钱包默认参数已生成并存储', {
|
|
409
98
|
customer_id: walletParams.customer_id,
|
|
410
99
|
holder_id: walletParams.holder_id,
|
|
@@ -581,7 +270,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
581
270
|
key: "initializeWalletDataAsync",
|
|
582
271
|
value: (function () {
|
|
583
272
|
var _initializeWalletDataAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(baseParams) {
|
|
584
|
-
var _this$paymentModule$
|
|
273
|
+
var _this$paymentModule$w, _this$paymentModule$w2, identificationParams, _yield$Promise$all, _yield$Promise$all2, allList, orderBasicDetail, walletPassEvaluator, products, res, recommended, transformList, noApplicableVoucher, recommendedAmount;
|
|
585
274
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
586
275
|
while (1) switch (_context3.prev = _context3.next) {
|
|
587
276
|
case 0:
|
|
@@ -600,7 +289,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
600
289
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
601
290
|
allList = _yield$Promise$all2[0];
|
|
602
291
|
orderBasicDetail = _yield$Promise$all2[1];
|
|
603
|
-
walletPassEvaluator = (_this$paymentModule$
|
|
292
|
+
walletPassEvaluator = (_this$paymentModule$w = this.paymentModule.window) === null || _this$paymentModule$w === void 0 || (_this$paymentModule$w2 = _this$paymentModule$w.getWalletPassEvaluator) === null || _this$paymentModule$w2 === void 0 ? void 0 : _this$paymentModule$w2.call(_this$paymentModule$w);
|
|
604
293
|
if (walletPassEvaluator) {
|
|
605
294
|
_context3.next = 11;
|
|
606
295
|
break;
|
|
@@ -620,6 +309,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
620
309
|
vouchers: allList
|
|
621
310
|
});
|
|
622
311
|
recommended = res.recommended, transformList = res.transformList, noApplicableVoucher = res.noApplicableVoucher, recommendedAmount = res.recommendedAmount;
|
|
312
|
+
console.log(res, 'resres12');
|
|
623
313
|
this.walletRecommendList = recommended;
|
|
624
314
|
|
|
625
315
|
// 存储初始化数据到内存中,供 useWalletPass 使用
|
|
@@ -639,149 +329,48 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
639
329
|
noApplicableVoucher: noApplicableVoucher,
|
|
640
330
|
products: products || []
|
|
641
331
|
});
|
|
642
|
-
case
|
|
643
|
-
_context3.prev =
|
|
332
|
+
case 20:
|
|
333
|
+
_context3.prev = 20;
|
|
644
334
|
_context3.t0 = _context3["catch"](0);
|
|
645
335
|
this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', _context3.t0, {
|
|
646
336
|
customer_id: baseParams.customer_id,
|
|
647
337
|
order_expect_amount: baseParams.order_expect_amount
|
|
648
338
|
});
|
|
649
339
|
throw _context3.t0;
|
|
650
|
-
case
|
|
340
|
+
case 24:
|
|
651
341
|
case "end":
|
|
652
342
|
return _context3.stop();
|
|
653
343
|
}
|
|
654
|
-
}, _callee3, this, [[0,
|
|
344
|
+
}, _callee3, this, [[0, 20]]);
|
|
655
345
|
}));
|
|
656
346
|
function initializeWalletDataAsync(_x3) {
|
|
657
347
|
return _initializeWalletDataAsync.apply(this, arguments);
|
|
658
348
|
}
|
|
659
349
|
return initializeWalletDataAsync;
|
|
660
|
-
}()
|
|
661
|
-
/**
|
|
662
|
-
* 商品或订单金额变化后,使用聚合接口一次重算已选与剩余 WalletPass。
|
|
663
|
-
* Walk-In 不发送 customer_id;会员才携带真实 customer_id。
|
|
664
|
-
*/
|
|
665
|
-
)
|
|
666
|
-
}, {
|
|
667
|
-
key: "aggregateRecalculateWalletAssetsAsync",
|
|
668
|
-
value: (function () {
|
|
669
|
-
var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
|
|
670
|
-
var _this$paymentModule$w7, _this$paymentModule$w8;
|
|
671
|
-
var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
|
|
672
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
673
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
674
|
-
case 0:
|
|
675
|
-
walletParams = this.generateWalletParams(businessData);
|
|
676
|
-
customerId = Number(walletParams.customer_id || 0);
|
|
677
|
-
requestParams = {
|
|
678
|
-
ids: selectedIds.map(function (id) {
|
|
679
|
-
return String(id);
|
|
680
|
-
}),
|
|
681
|
-
exact_codes: this.getSearchedWalletAssetCodes(),
|
|
682
|
-
order_product_amount: walletParams.order_product_amount,
|
|
683
|
-
order_expect_amount: walletParams.order_expect_amount,
|
|
684
|
-
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
685
|
-
products: walletParams.products,
|
|
686
|
-
available: 2,
|
|
687
|
-
filter_prepare_wallet_pass: 1,
|
|
688
|
-
sale_channel: walletParams.sale_channel || 'pos'
|
|
689
|
-
};
|
|
690
|
-
if (customerId > 1) {
|
|
691
|
-
requestParams.customer_id = customerId;
|
|
692
|
-
}
|
|
693
|
-
_context4.next = 6;
|
|
694
|
-
return this.paymentModule.request.post('/machinecode/prepare/deduction/aggregate-recalculate', requestParams);
|
|
695
|
-
case 6:
|
|
696
|
-
response = _context4.sent;
|
|
697
|
-
responseData = response === null || response === void 0 ? void 0 : response.data;
|
|
698
|
-
hasAggregateLists = responseData && (Object.prototype.hasOwnProperty.call(responseData, 'recalculate_list') || Object.prototype.hasOwnProperty.call(responseData, 'customer_wallet_pass_list'));
|
|
699
|
-
if (hasAggregateLists) {
|
|
700
|
-
_context4.next = 11;
|
|
701
|
-
break;
|
|
702
|
-
}
|
|
703
|
-
throw new Error('WalletPass aggregate response is missing list data');
|
|
704
|
-
case 11:
|
|
705
|
-
recalculateList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
|
|
706
|
-
customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
|
|
707
|
-
allList = mergeWalletAssets(recalculateList, customerWalletPassList);
|
|
708
|
-
walletPassEvaluator = (_this$paymentModule$w7 = this.paymentModule.window) === null || _this$paymentModule$w7 === void 0 || (_this$paymentModule$w8 = _this$paymentModule$w7.getWalletPassEvaluator) === null || _this$paymentModule$w8 === void 0 ? void 0 : _this$paymentModule$w8.call(_this$paymentModule$w7);
|
|
709
|
-
evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
|
|
710
|
-
orderTotalAmount: walletParams.order_wait_pay_amount,
|
|
711
|
-
products: walletParams.products,
|
|
712
|
-
vouchers: allList
|
|
713
|
-
}) : {
|
|
714
|
-
recommended: [],
|
|
715
|
-
transformList: allList.filter(isWalletAssetAvailable),
|
|
716
|
-
noApplicableVoucher: allList.filter(function (item) {
|
|
717
|
-
return !isWalletAssetAvailable(item);
|
|
718
|
-
})
|
|
719
|
-
}; // 聚合接口只负责刷新资产数据;选中资格最终由前端 evaluator 重算。
|
|
720
|
-
// 这里仅移除接口完全未返回的资产,不能把 recalculate_list 当作
|
|
721
|
-
// 策略选中结果,否则 customer_wallet_pass_list 中的可用券会被误取消。
|
|
722
|
-
returnedSelectedKeys = new Set(allList.map(function (item) {
|
|
723
|
-
return getWalletAssetKey(item);
|
|
724
|
-
}));
|
|
725
|
-
authoritativeSelectedIds = selectedIds.filter(function (id) {
|
|
726
|
-
return returnedSelectedKeys.has(String(id));
|
|
727
|
-
});
|
|
728
|
-
this.walletRecommendList = evaluated.recommended || [];
|
|
729
|
-
this.userIdentificationCodes = allList;
|
|
730
|
-
this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
731
|
-
userIdentificationCodes: this.userIdentificationCodes
|
|
732
|
-
});
|
|
733
|
-
this.walletInitData = {
|
|
734
|
-
transformList: evaluated.transformList || [],
|
|
735
|
-
noApplicableVoucher: evaluated.noApplicableVoucher || [],
|
|
736
|
-
products: walletParams.products || []
|
|
737
|
-
};
|
|
738
|
-
this.paymentModule.logInfo('[WalletPass] 聚合重算 WalletPass 完成', {
|
|
739
|
-
selected_count: recalculateList.length,
|
|
740
|
-
remaining_count: customerWalletPassList.length,
|
|
741
|
-
searched_codes_count: requestParams.exact_codes.length
|
|
742
|
-
});
|
|
743
|
-
return _context4.abrupt("return", {
|
|
744
|
-
walletRecommendList: this.walletRecommendList,
|
|
745
|
-
userIdentificationCodes: this.userIdentificationCodes,
|
|
746
|
-
transformList: evaluated.transformList || [],
|
|
747
|
-
noApplicableVoucher: evaluated.noApplicableVoucher || [],
|
|
748
|
-
products: walletParams.products || [],
|
|
749
|
-
authoritativeSelectedIds: authoritativeSelectedIds
|
|
750
|
-
});
|
|
751
|
-
case 24:
|
|
752
|
-
case "end":
|
|
753
|
-
return _context4.stop();
|
|
754
|
-
}
|
|
755
|
-
}, _callee4, this);
|
|
756
|
-
}));
|
|
757
|
-
function aggregateRecalculateWalletAssetsAsync(_x4, _x5) {
|
|
758
|
-
return _aggregateRecalculateWalletAssetsAsync.apply(this, arguments);
|
|
759
|
-
}
|
|
760
|
-
return aggregateRecalculateWalletAssetsAsync;
|
|
761
350
|
}())
|
|
762
351
|
}, {
|
|
763
352
|
key: "getWalletPassRecommendListAsync",
|
|
764
353
|
value: function () {
|
|
765
|
-
var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
766
|
-
var _this$
|
|
767
|
-
return _regeneratorRuntime().wrap(function
|
|
768
|
-
while (1) switch (
|
|
354
|
+
var _getWalletPassRecommendListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
355
|
+
var _this$walletParams, response;
|
|
356
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
357
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
769
358
|
case 0:
|
|
770
|
-
|
|
359
|
+
_context4.prev = 0;
|
|
771
360
|
this.paymentModule.logInfo('[WalletPass] 开始获取钱包推荐列表', {
|
|
772
361
|
customer_id: params.customer_id,
|
|
773
362
|
order_expect_amount: params.order_expect_amount,
|
|
774
363
|
sale_channel: params.sale_channel,
|
|
775
|
-
payment_order_id: (_this$
|
|
364
|
+
payment_order_id: (_this$walletParams = this.walletParams) === null || _this$walletParams === void 0 ? void 0 : _this$walletParams.payment_order_id
|
|
776
365
|
});
|
|
777
366
|
if (typeof params.payment_order_id === 'string' && params.payment_order_id.startsWith('LOCAL_')) {
|
|
778
367
|
params.payment_order_id = undefined;
|
|
779
368
|
}
|
|
780
|
-
|
|
369
|
+
_context4.next = 5;
|
|
781
370
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/recommend', params // 将 params 作为请求体数据
|
|
782
371
|
);
|
|
783
372
|
case 5:
|
|
784
|
-
response =
|
|
373
|
+
response = _context4.sent;
|
|
785
374
|
this.walletRecommendList = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
786
375
|
|
|
787
376
|
// 发送钱包推荐列表更新事件(使用专用的WalletPassHooks)
|
|
@@ -799,24 +388,24 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
799
388
|
};
|
|
800
389
|
})
|
|
801
390
|
});
|
|
802
|
-
return
|
|
391
|
+
return _context4.abrupt("return", this.walletRecommendList);
|
|
803
392
|
case 12:
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败',
|
|
393
|
+
_context4.prev = 12;
|
|
394
|
+
_context4.t0 = _context4["catch"](0);
|
|
395
|
+
this.paymentModule.logError('[WalletPass] 获取钱包推荐列表失败', _context4.t0, {
|
|
807
396
|
customer_id: params.customer_id,
|
|
808
397
|
order_expect_amount: params.order_expect_amount,
|
|
809
398
|
sale_channel: params.sale_channel
|
|
810
399
|
});
|
|
811
400
|
// throw error;
|
|
812
|
-
return
|
|
401
|
+
return _context4.abrupt("return", []);
|
|
813
402
|
case 16:
|
|
814
403
|
case "end":
|
|
815
|
-
return
|
|
404
|
+
return _context4.stop();
|
|
816
405
|
}
|
|
817
|
-
},
|
|
406
|
+
}, _callee4, this, [[0, 12]]);
|
|
818
407
|
}));
|
|
819
|
-
function getWalletPassRecommendListAsync(
|
|
408
|
+
function getWalletPassRecommendListAsync(_x4) {
|
|
820
409
|
return _getWalletPassRecommendListAsync.apply(this, arguments);
|
|
821
410
|
}
|
|
822
411
|
return getWalletPassRecommendListAsync;
|
|
@@ -829,19 +418,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
829
418
|
}, {
|
|
830
419
|
key: "getUserIdentificationCodeListAsync",
|
|
831
420
|
value: function () {
|
|
832
|
-
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
833
|
-
var _newParams$products, _newParams$prepare_pa, _this$
|
|
834
|
-
return _regeneratorRuntime().wrap(function
|
|
835
|
-
while (1) switch (
|
|
421
|
+
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
422
|
+
var _newParams$products, _newParams$prepare_pa, _this$walletParams2, newParams, response, sortedData;
|
|
423
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
424
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
836
425
|
case 0:
|
|
837
|
-
|
|
426
|
+
_context5.prev = 0;
|
|
838
427
|
newParams = _objectSpread(_objectSpread({}, this.walletParams), params);
|
|
839
428
|
if ((_newParams$products = newParams.products) !== null && _newParams$products !== void 0 && _newParams$products.length) {
|
|
840
|
-
|
|
429
|
+
_context5.next = 5;
|
|
841
430
|
break;
|
|
842
431
|
}
|
|
843
432
|
this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
|
|
844
|
-
return
|
|
433
|
+
return _context5.abrupt("return", []);
|
|
845
434
|
case 5:
|
|
846
435
|
if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
|
|
847
436
|
newParams.payment_order_id = undefined;
|
|
@@ -851,12 +440,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
851
440
|
available: newParams.available,
|
|
852
441
|
prepare_payments_count: ((_newParams$prepare_pa = newParams.prepare_payments) === null || _newParams$prepare_pa === void 0 ? void 0 : _newParams$prepare_pa.length) || 0,
|
|
853
442
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
854
|
-
payment_order_id: (_this$
|
|
443
|
+
payment_order_id: (_this$walletParams2 = this.walletParams) === null || _this$walletParams2 === void 0 ? void 0 : _this$walletParams2.payment_order_id
|
|
855
444
|
});
|
|
856
|
-
|
|
445
|
+
_context5.next = 9;
|
|
857
446
|
return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
858
447
|
case 9:
|
|
859
|
-
response =
|
|
448
|
+
response = _context5.sent;
|
|
860
449
|
// 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
|
|
861
450
|
sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
|
|
862
451
|
this.userIdentificationCodes = sortedData;
|
|
@@ -875,22 +464,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
875
464
|
};
|
|
876
465
|
})
|
|
877
466
|
});
|
|
878
|
-
return
|
|
467
|
+
return _context5.abrupt("return", this.userIdentificationCodes);
|
|
879
468
|
case 17:
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败',
|
|
469
|
+
_context5.prev = 17;
|
|
470
|
+
_context5.t0 = _context5["catch"](0);
|
|
471
|
+
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context5.t0, {
|
|
883
472
|
customer_id: params.customer_id,
|
|
884
473
|
available: params.available
|
|
885
474
|
});
|
|
886
|
-
return
|
|
475
|
+
return _context5.abrupt("return", []);
|
|
887
476
|
case 21:
|
|
888
477
|
case "end":
|
|
889
|
-
return
|
|
478
|
+
return _context5.stop();
|
|
890
479
|
}
|
|
891
|
-
},
|
|
480
|
+
}, _callee5, this, [[0, 17]]);
|
|
892
481
|
}));
|
|
893
|
-
function getUserIdentificationCodeListAsync(
|
|
482
|
+
function getUserIdentificationCodeListAsync(_x5) {
|
|
894
483
|
return _getUserIdentificationCodeListAsync.apply(this, arguments);
|
|
895
484
|
}
|
|
896
485
|
return getUserIdentificationCodeListAsync;
|
|
@@ -904,21 +493,10 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
904
493
|
}, {
|
|
905
494
|
key: "searchIdentificationCodeAsync",
|
|
906
495
|
value: (function () {
|
|
907
|
-
var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
496
|
+
var _searchIdentificationCodeAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
908
497
|
var config,
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
_params$customer_id,
|
|
912
|
-
_params$order_expect_,
|
|
913
|
-
_params$order_product,
|
|
914
|
-
_params$order_wait_pa,
|
|
915
|
-
_ref10,
|
|
916
|
-
_ref11,
|
|
917
|
-
_params$order_behavio,
|
|
918
|
-
_ref12,
|
|
919
|
-
_params$products,
|
|
920
|
-
_ref13,
|
|
921
|
-
_params$prepare_payme,
|
|
498
|
+
_ref,
|
|
499
|
+
_response2,
|
|
922
500
|
code,
|
|
923
501
|
isWalletCode,
|
|
924
502
|
walletDetailParams,
|
|
@@ -931,12 +509,12 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
931
509
|
_this$searchResults,
|
|
932
510
|
existingCodes,
|
|
933
511
|
newResults,
|
|
934
|
-
|
|
935
|
-
return _regeneratorRuntime().wrap(function
|
|
936
|
-
while (1) switch (
|
|
512
|
+
_args6 = arguments;
|
|
513
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
514
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
937
515
|
case 0:
|
|
938
|
-
config =
|
|
939
|
-
|
|
516
|
+
config = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
517
|
+
_context6.prev = 1;
|
|
940
518
|
code = params.code;
|
|
941
519
|
this.paymentModule.logInfo('[WalletPass] 开始搜索识别码', {
|
|
942
520
|
code: code,
|
|
@@ -947,7 +525,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
947
525
|
// 新钱包规则
|
|
948
526
|
isWalletCode = code.startsWith('WL') || code.startsWith('200') && code.length === 10;
|
|
949
527
|
if (!isWalletCode) {
|
|
950
|
-
|
|
528
|
+
_context6.next = 14;
|
|
951
529
|
break;
|
|
952
530
|
}
|
|
953
531
|
// 钱包识别码直接调用专门接口,不缓存,直接返回
|
|
@@ -961,17 +539,17 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
961
539
|
with_customer: walletDetailParams.with_customer,
|
|
962
540
|
with: walletDetailParams.with
|
|
963
541
|
});
|
|
964
|
-
|
|
542
|
+
_context6.next = 10;
|
|
965
543
|
return this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
966
544
|
case 10:
|
|
967
|
-
_response =
|
|
545
|
+
_response = _context6.sent;
|
|
968
546
|
_searchResults = (_response === null || _response === void 0 ? void 0 : _response.data) || [];
|
|
969
547
|
this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
|
|
970
548
|
code: code,
|
|
971
549
|
results_count: _searchResults.length,
|
|
972
550
|
type: 'walletCode'
|
|
973
551
|
});
|
|
974
|
-
return
|
|
552
|
+
return _context6.abrupt("return", {
|
|
975
553
|
type: 'walletCode',
|
|
976
554
|
data: _searchResults
|
|
977
555
|
});
|
|
@@ -980,14 +558,14 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
980
558
|
baseWalletParams = this.walletParams; // 构建完整的搜索参数,包含钱包扣款推荐的所有参数
|
|
981
559
|
searchParams = {
|
|
982
560
|
// 基础钱包参数
|
|
983
|
-
sale_channel:
|
|
984
|
-
customer_id:
|
|
985
|
-
order_expect_amount:
|
|
986
|
-
order_product_amount:
|
|
987
|
-
order_wait_pay_amount:
|
|
988
|
-
order_behavior_count_customer_id:
|
|
989
|
-
products:
|
|
990
|
-
prepare_payments:
|
|
561
|
+
sale_channel: params.sale_channel || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.sale_channel) || 'pos',
|
|
562
|
+
customer_id: params.customer_id || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id),
|
|
563
|
+
order_expect_amount: params.order_expect_amount || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_expect_amount),
|
|
564
|
+
order_product_amount: params.order_product_amount || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_product_amount),
|
|
565
|
+
order_wait_pay_amount: params.order_wait_pay_amount || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_wait_pay_amount),
|
|
566
|
+
order_behavior_count_customer_id: params.order_behavior_count_customer_id || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_behavior_count_customer_id) || params.customer_id || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id),
|
|
567
|
+
products: params.products || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.products),
|
|
568
|
+
prepare_payments: params.prepare_payments || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.prepare_payments),
|
|
991
569
|
multiple: 1,
|
|
992
570
|
// 搜索特有参数
|
|
993
571
|
code: params.code,
|
|
@@ -1003,20 +581,31 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1003
581
|
if (typeof searchParams.payment_order_id === 'string' && searchParams.payment_order_id.startsWith('LOCAL_')) {
|
|
1004
582
|
searchParams.payment_order_id = undefined;
|
|
1005
583
|
}
|
|
1006
|
-
|
|
584
|
+
if (!(!searchParams.products || ((_ref = searchParams.products || []) === null || _ref === void 0 ? void 0 : _ref.length) === 0)) {
|
|
585
|
+
_context6.next = 22;
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
response = {
|
|
589
|
+
data: []
|
|
590
|
+
};
|
|
591
|
+
_context6.next = 25;
|
|
592
|
+
break;
|
|
593
|
+
case 22:
|
|
594
|
+
_context6.next = 24;
|
|
1007
595
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
|
|
1008
|
-
case
|
|
1009
|
-
response =
|
|
1010
|
-
|
|
596
|
+
case 24:
|
|
597
|
+
response = _context6.sent;
|
|
598
|
+
case 25:
|
|
599
|
+
searchResults = ((_response2 = response) === null || _response2 === void 0 ? void 0 : _response2.data) || [];
|
|
1011
600
|
if (!config.noCache) {
|
|
1012
|
-
|
|
601
|
+
_context6.next = 28;
|
|
1013
602
|
break;
|
|
1014
603
|
}
|
|
1015
|
-
return
|
|
604
|
+
return _context6.abrupt("return", {
|
|
1016
605
|
type: 'normalCode',
|
|
1017
606
|
data: searchResults
|
|
1018
607
|
});
|
|
1019
|
-
case
|
|
608
|
+
case 28:
|
|
1020
609
|
// 将搜索结果存储到缓存数组中
|
|
1021
610
|
if (searchResults.length > 0) {
|
|
1022
611
|
// 避免重复存储相同的识别码
|
|
@@ -1042,586 +631,49 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1042
631
|
cached_results_count: this.searchResults.length,
|
|
1043
632
|
type: 'normalCode'
|
|
1044
633
|
});
|
|
1045
|
-
return
|
|
634
|
+
return _context6.abrupt("return", {
|
|
1046
635
|
type: 'normalCode',
|
|
1047
636
|
data: searchResults
|
|
1048
637
|
});
|
|
1049
|
-
case
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败',
|
|
638
|
+
case 34:
|
|
639
|
+
_context6.prev = 34;
|
|
640
|
+
_context6.t0 = _context6["catch"](1);
|
|
641
|
+
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', _context6.t0, {
|
|
1053
642
|
code: params.code,
|
|
1054
643
|
customer_id: params.customer_id,
|
|
1055
644
|
order_expect_amount: params.order_expect_amount
|
|
1056
645
|
});
|
|
1057
|
-
throw
|
|
1058
|
-
case
|
|
646
|
+
throw _context6.t0;
|
|
647
|
+
case 38:
|
|
1059
648
|
case "end":
|
|
1060
|
-
return
|
|
649
|
+
return _context6.stop();
|
|
1061
650
|
}
|
|
1062
|
-
},
|
|
651
|
+
}, _callee6, this, [[1, 34]]);
|
|
1063
652
|
}));
|
|
1064
|
-
function searchIdentificationCodeAsync(
|
|
653
|
+
function searchIdentificationCodeAsync(_x6) {
|
|
1065
654
|
return _searchIdentificationCodeAsync.apply(this, arguments);
|
|
1066
655
|
}
|
|
1067
656
|
return searchIdentificationCodeAsync;
|
|
1068
|
-
}()
|
|
1069
|
-
/**
|
|
1070
|
-
* 刷新购物车与结账共享的钱包资产。
|
|
1071
|
-
*
|
|
1072
|
-
* 与 legacy initializeWalletDataFromBusinessAsync 不同,这里维护选择状态;
|
|
1073
|
-
* 推荐结果只作为可用性/金额计算输入,不会自动成为 selectedIds。
|
|
1074
|
-
*/
|
|
1075
|
-
)
|
|
1076
|
-
}, {
|
|
1077
|
-
key: "refreshWalletAssetsFromBusinessAsync",
|
|
1078
|
-
value: (function () {
|
|
1079
|
-
var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(businessData) {
|
|
1080
|
-
var _businessData$product2,
|
|
1081
|
-
_this4 = this;
|
|
1082
|
-
var options,
|
|
1083
|
-
requestSequence,
|
|
1084
|
-
nextCustomerId,
|
|
1085
|
-
previousCustomerId,
|
|
1086
|
-
customerChanged,
|
|
1087
|
-
preserveSelection,
|
|
1088
|
-
committedKeys,
|
|
1089
|
-
committedItems,
|
|
1090
|
-
selectedIds,
|
|
1091
|
-
selectionSources,
|
|
1092
|
-
scanSelectedAssets,
|
|
1093
|
-
manualEditAmountByKey,
|
|
1094
|
-
restoredSearchedAssets,
|
|
1095
|
-
searchedWalletAssetCodes,
|
|
1096
|
-
useAggregateRecalculate,
|
|
1097
|
-
aggregateResult,
|
|
1098
|
-
result,
|
|
1099
|
-
authoritativeSelectedIds,
|
|
1100
|
-
returnedAggregateKeys,
|
|
1101
|
-
missingSelectedKeys,
|
|
1102
|
-
searchedWalletAssets,
|
|
1103
|
-
recommendedKeys,
|
|
1104
|
-
items,
|
|
1105
|
-
latestSelectedIds,
|
|
1106
|
-
latestSelectionSources,
|
|
1107
|
-
pendingAutoSelectAssets,
|
|
1108
|
-
requestedKeySet,
|
|
1109
|
-
nextState,
|
|
1110
|
-
selectedKeySet,
|
|
1111
|
-
droppedScanSelectedAssets,
|
|
1112
|
-
_args8 = arguments;
|
|
1113
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1114
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
1115
|
-
case 0:
|
|
1116
|
-
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
1117
|
-
requestSequence = ++this.walletAssetsRequestSequence;
|
|
1118
|
-
nextCustomerId = businessData.customer_id;
|
|
1119
|
-
previousCustomerId = this.walletAssetsState.customerId;
|
|
1120
|
-
customerChanged = String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '');
|
|
1121
|
-
preserveSelection = options.preserveSelection !== false && !customerChanged;
|
|
1122
|
-
if (customerChanged) {
|
|
1123
|
-
this.clearSearchResults();
|
|
1124
|
-
}
|
|
1125
|
-
committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
|
|
1126
|
-
return String(id);
|
|
1127
|
-
}));
|
|
1128
|
-
committedItems = this.walletAssetsState.items.filter(function (item) {
|
|
1129
|
-
return committedKeys.has(getWalletAssetKey(item));
|
|
1130
|
-
});
|
|
1131
|
-
selectedIds = preserveSelection ? _toConsumableArray(this.walletAssetsState.selectedIds) : [];
|
|
1132
|
-
selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
|
|
1133
|
-
scanSelectedAssets = preserveSelection ? this.walletAssetsState.selectedItems.filter(function (asset) {
|
|
1134
|
-
var assetId = getWalletAssetId(asset);
|
|
1135
|
-
return assetId !== undefined && assetId !== null && selectionSources[String(assetId)] === 'scan';
|
|
1136
|
-
}) : [];
|
|
1137
|
-
manualEditAmountByKey = new Map();
|
|
1138
|
-
if (preserveSelection) {
|
|
1139
|
-
this.walletAssetsState.selectedItems.forEach(function (asset) {
|
|
1140
|
-
if (typeof (asset === null || asset === void 0 ? void 0 : asset.edit_current_amount) !== 'number') return;
|
|
1141
|
-
manualEditAmountByKey.set(getWalletAssetKey(asset), asset.edit_current_amount);
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
// aggregate-recalculate 不接受空商品列表。
|
|
1146
|
-
// 清空购物车时保留扫码资产供后续加购恢复;只有手动 Remove/Clear
|
|
1147
|
-
// 会取消自动应用资格,商品变化导致的自动失效需要重新进入待选队列。
|
|
1148
|
-
if ((_businessData$product2 = businessData.products) !== null && _businessData$product2 !== void 0 && _businessData$product2.length) {
|
|
1149
|
-
_context8.next = 24;
|
|
1150
|
-
break;
|
|
1151
|
-
}
|
|
1152
|
-
this.queuePendingAutoSelectForAssets(scanSelectedAssets);
|
|
1153
|
-
this.generateWalletParams(businessData);
|
|
1154
|
-
restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map(function (item) {
|
|
1155
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1156
|
-
actualDeduction: 0,
|
|
1157
|
-
deductionDetails: [],
|
|
1158
|
-
_available_max_amount: 0,
|
|
1159
|
-
_unified_available_status: 0,
|
|
1160
|
-
_wallet_asset_recommended: false
|
|
1161
|
-
});
|
|
1162
|
-
});
|
|
1163
|
-
this.walletRecommendList = [];
|
|
1164
|
-
this.userIdentificationCodes = [];
|
|
1165
|
-
this.walletInitData = {
|
|
1166
|
-
transformList: [],
|
|
1167
|
-
noApplicableVoucher: restoredSearchedAssets,
|
|
1168
|
-
products: []
|
|
1169
|
-
};
|
|
1170
|
-
this.walletAssetsCalculationContext = {
|
|
1171
|
-
orderTotalAmount: 0,
|
|
1172
|
-
products: []
|
|
1173
|
-
};
|
|
1174
|
-
this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
1175
|
-
userIdentificationCodes: []
|
|
1176
|
-
});
|
|
1177
|
-
return _context8.abrupt("return", this.publishWalletAssetsState({
|
|
1178
|
-
status: 'ready',
|
|
1179
|
-
customerId: nextCustomerId,
|
|
1180
|
-
items: mergeWalletAssets(restoredSearchedAssets, committedItems),
|
|
1181
|
-
selectedIds: [],
|
|
1182
|
-
selectedItems: [],
|
|
1183
|
-
selectionSources: {},
|
|
1184
|
-
totalSelectedAmount: 0,
|
|
1185
|
-
error: null
|
|
1186
|
-
}));
|
|
1187
|
-
case 24:
|
|
1188
|
-
this.publishWalletAssetsState({
|
|
1189
|
-
status: 'loading',
|
|
1190
|
-
customerId: nextCustomerId,
|
|
1191
|
-
items: preserveSelection ? this.walletAssetsState.items : committedItems,
|
|
1192
|
-
selectedIds: selectedIds,
|
|
1193
|
-
selectedItems: preserveSelection ? this.walletAssetsState.selectedItems : [],
|
|
1194
|
-
selectionSources: selectionSources,
|
|
1195
|
-
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
1196
|
-
error: null
|
|
1197
|
-
});
|
|
1198
|
-
_context8.prev = 25;
|
|
1199
|
-
searchedWalletAssetCodes = preserveSelection ? this.getSearchedWalletAssetCodes() : [];
|
|
1200
|
-
useAggregateRecalculate = preserveSelection && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
|
|
1201
|
-
if (!useAggregateRecalculate) {
|
|
1202
|
-
_context8.next = 34;
|
|
1203
|
-
break;
|
|
1204
|
-
}
|
|
1205
|
-
_context8.next = 31;
|
|
1206
|
-
return this.aggregateRecalculateWalletAssetsAsync(businessData, selectedIds);
|
|
1207
|
-
case 31:
|
|
1208
|
-
_context8.t0 = _context8.sent;
|
|
1209
|
-
_context8.next = 35;
|
|
1210
|
-
break;
|
|
1211
|
-
case 34:
|
|
1212
|
-
_context8.t0 = null;
|
|
1213
|
-
case 35:
|
|
1214
|
-
aggregateResult = _context8.t0;
|
|
1215
|
-
_context8.t1 = aggregateResult;
|
|
1216
|
-
if (_context8.t1) {
|
|
1217
|
-
_context8.next = 41;
|
|
1218
|
-
break;
|
|
1219
|
-
}
|
|
1220
|
-
_context8.next = 40;
|
|
1221
|
-
return this.initializeWalletDataFromBusinessAsync(businessData);
|
|
1222
|
-
case 40:
|
|
1223
|
-
_context8.t1 = _context8.sent;
|
|
1224
|
-
case 41:
|
|
1225
|
-
result = _context8.t1;
|
|
1226
|
-
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1227
|
-
_context8.next = 44;
|
|
1228
|
-
break;
|
|
1229
|
-
}
|
|
1230
|
-
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1231
|
-
case 44:
|
|
1232
|
-
this.walletAssetsCalculationContext = {
|
|
1233
|
-
orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
|
|
1234
|
-
products: result.products || businessData.products || []
|
|
1235
|
-
};
|
|
1236
|
-
authoritativeSelectedIds = (aggregateResult === null || aggregateResult === void 0 ? void 0 : aggregateResult.authoritativeSelectedIds) || selectedIds;
|
|
1237
|
-
if (aggregateResult) {
|
|
1238
|
-
returnedAggregateKeys = new Set([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || [])).map(function (item) {
|
|
1239
|
-
return getWalletAssetKey(item);
|
|
1240
|
-
}));
|
|
1241
|
-
missingSelectedKeys = new Set(selectedIds.map(function (id) {
|
|
1242
|
-
return String(id);
|
|
1243
|
-
}).filter(function (id) {
|
|
1244
|
-
return !returnedAggregateKeys.has(id);
|
|
1245
|
-
}));
|
|
1246
|
-
if (missingSelectedKeys.size > 0) {
|
|
1247
|
-
this.searchResults = this.searchResults.filter(function (item) {
|
|
1248
|
-
return !missingSelectedKeys.has(getWalletAssetKey(item));
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
searchedWalletAssets = preserveSelection ? this.syncSearchedWalletAssets([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || []))) : [];
|
|
1253
|
-
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1254
|
-
_context8.next = 50;
|
|
1255
|
-
break;
|
|
1256
|
-
}
|
|
1257
|
-
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1258
|
-
case 50:
|
|
1259
|
-
recommendedKeys = new Set((result.walletRecommendList || []).map(function (asset) {
|
|
1260
|
-
return getWalletAssetKey(asset);
|
|
1261
|
-
}));
|
|
1262
|
-
items = mergeWalletAssets(preserveSelection && !aggregateResult ? this.walletAssetsState.selectedItems : [], searchedWalletAssets, result.transformList || [], result.noApplicableVoucher || []).map(function (asset) {
|
|
1263
|
-
var assetKey = getWalletAssetKey(asset);
|
|
1264
|
-
return _objectSpread(_objectSpread(_objectSpread({}, asset), manualEditAmountByKey.has(assetKey) ? {
|
|
1265
|
-
edit_current_amount: manualEditAmountByKey.get(assetKey)
|
|
1266
|
-
} : {}), {}, {
|
|
1267
|
-
_wallet_asset_recommended: recommendedKeys.has(assetKey)
|
|
1268
|
-
});
|
|
1269
|
-
});
|
|
1270
|
-
latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
|
|
1271
|
-
latestSelectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
|
|
1272
|
-
pendingAutoSelectAssets = this.walletAssetsBehavior.autoSelectAfterSearch ? items.filter(function (asset) {
|
|
1273
|
-
return _this4.isPendingAutoSelectAsset(asset) && isWalletAssetAvailable(asset);
|
|
1274
|
-
}) : [];
|
|
1275
|
-
requestedKeySet = new Set(latestSelectedIds.map(function (id) {
|
|
1276
|
-
return String(id);
|
|
1277
|
-
}));
|
|
1278
|
-
pendingAutoSelectAssets.forEach(function (asset) {
|
|
1279
|
-
var assetId = getWalletAssetId(asset);
|
|
1280
|
-
if (assetId === undefined || assetId === null) return;
|
|
1281
|
-
var assetKey = String(assetId);
|
|
1282
|
-
if (!requestedKeySet.has(assetKey)) {
|
|
1283
|
-
requestedKeySet.add(assetKey);
|
|
1284
|
-
latestSelectedIds.push(assetId);
|
|
1285
|
-
}
|
|
1286
|
-
latestSelectionSources[assetKey] = 'scan';
|
|
1287
|
-
});
|
|
1288
|
-
nextState = this.recalculateWalletAssets(items, latestSelectedIds, latestSelectionSources);
|
|
1289
|
-
selectedKeySet = new Set(nextState.selectedIds.map(function (id) {
|
|
1290
|
-
return String(id);
|
|
1291
|
-
}));
|
|
1292
|
-
pendingAutoSelectAssets.forEach(function (asset) {
|
|
1293
|
-
var assetId = getWalletAssetId(asset);
|
|
1294
|
-
if (assetId !== undefined && assetId !== null && selectedKeySet.has(String(assetId))) {
|
|
1295
|
-
_this4.clearPendingAutoSelectForAsset(asset);
|
|
1296
|
-
}
|
|
1297
|
-
});
|
|
1298
|
-
droppedScanSelectedAssets = scanSelectedAssets.filter(function (asset) {
|
|
1299
|
-
var assetId = getWalletAssetId(asset);
|
|
1300
|
-
return assetId !== undefined && assetId !== null && !selectedKeySet.has(String(assetId));
|
|
1301
|
-
});
|
|
1302
|
-
this.queuePendingAutoSelectForAssets(droppedScanSelectedAssets);
|
|
1303
|
-
return _context8.abrupt("return", nextState);
|
|
1304
|
-
case 65:
|
|
1305
|
-
_context8.prev = 65;
|
|
1306
|
-
_context8.t2 = _context8["catch"](25);
|
|
1307
|
-
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1308
|
-
_context8.next = 69;
|
|
1309
|
-
break;
|
|
1310
|
-
}
|
|
1311
|
-
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1312
|
-
case 69:
|
|
1313
|
-
this.paymentModule.logError('[WalletPass] 刷新共享钱包资产失败,保留刷新前状态', _context8.t2, {
|
|
1314
|
-
customer_id: businessData.customer_id,
|
|
1315
|
-
selected_ids: selectedIds,
|
|
1316
|
-
searched_codes: this.getSearchedWalletAssetCodes()
|
|
1317
|
-
});
|
|
1318
|
-
return _context8.abrupt("return", this.publishWalletAssetsState({
|
|
1319
|
-
status: 'error',
|
|
1320
|
-
items: preserveSelection ? this.walletAssetsState.items : committedItems,
|
|
1321
|
-
selectedIds: preserveSelection ? this.walletAssetsState.selectedIds : [],
|
|
1322
|
-
selectedItems: preserveSelection ? this.walletAssetsState.selectedItems : [],
|
|
1323
|
-
selectionSources: preserveSelection ? this.walletAssetsState.selectionSources : {},
|
|
1324
|
-
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
1325
|
-
customerId: nextCustomerId,
|
|
1326
|
-
error: _context8.t2 instanceof Error ? _context8.t2.message : String(_context8.t2)
|
|
1327
|
-
}));
|
|
1328
|
-
case 71:
|
|
1329
|
-
case "end":
|
|
1330
|
-
return _context8.stop();
|
|
1331
|
-
}
|
|
1332
|
-
}, _callee8, this, [[25, 65]]);
|
|
1333
|
-
}));
|
|
1334
|
-
function refreshWalletAssetsFromBusinessAsync(_x9) {
|
|
1335
|
-
return _refreshWalletAssetsFromBusinessAsync.apply(this, arguments);
|
|
1336
|
-
}
|
|
1337
|
-
return refreshWalletAssetsFromBusinessAsync;
|
|
1338
657
|
}())
|
|
1339
|
-
}, {
|
|
1340
|
-
key: "getWalletAssetsState",
|
|
1341
|
-
value: function getWalletAssetsState() {
|
|
1342
|
-
return _objectSpread(_objectSpread({}, this.walletAssetsState), {}, {
|
|
1343
|
-
items: _toConsumableArray(this.walletAssetsState.items),
|
|
1344
|
-
selectedIds: _toConsumableArray(this.walletAssetsState.selectedIds),
|
|
1345
|
-
selectedItems: _toConsumableArray(this.walletAssetsState.selectedItems),
|
|
1346
|
-
committedIds: _toConsumableArray(this.walletAssetsState.committedIds),
|
|
1347
|
-
selectionSources: _objectSpread({}, this.walletAssetsState.selectionSources)
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
}, {
|
|
1351
|
-
key: "exportWalletAssetsSnapshot",
|
|
1352
|
-
value: function exportWalletAssetsSnapshot() {
|
|
1353
|
-
return {
|
|
1354
|
-
state: this.getWalletAssetsState(),
|
|
1355
|
-
searchResults: _toConsumableArray(this.searchResults),
|
|
1356
|
-
pendingAutoSelectSearchCodes: _toConsumableArray(this.pendingAutoSelectSearchCodes),
|
|
1357
|
-
walletParams: this.walletParams ? _objectSpread({}, this.walletParams) : null,
|
|
1358
|
-
calculationContext: {
|
|
1359
|
-
orderTotalAmount: this.walletAssetsCalculationContext.orderTotalAmount,
|
|
1360
|
-
products: _toConsumableArray(this.walletAssetsCalculationContext.products)
|
|
1361
|
-
}
|
|
1362
|
-
};
|
|
1363
|
-
}
|
|
1364
|
-
}, {
|
|
1365
|
-
key: "importWalletAssetsSnapshot",
|
|
1366
|
-
value: function importWalletAssetsSnapshot(snapshot) {
|
|
1367
|
-
var _snapshot$calculation, _snapshot$calculation2;
|
|
1368
|
-
if (!(snapshot !== null && snapshot !== void 0 && snapshot.state)) return this.getWalletAssetsState();
|
|
1369
|
-
this.walletAssetsRequestSequence += 1;
|
|
1370
|
-
this.searchResults = Array.isArray(snapshot.searchResults) ? _toConsumableArray(snapshot.searchResults) : [];
|
|
1371
|
-
this.pendingAutoSelectSearchCodes = this.walletAssetsBehavior.autoSelectAfterSearch && Array.isArray(snapshot.pendingAutoSelectSearchCodes) ? new Set(snapshot.pendingAutoSelectSearchCodes.map(normalizeWalletAssetCode).filter(Boolean)) : new Set();
|
|
1372
|
-
this.walletParams = snapshot.walletParams ? _objectSpread({}, snapshot.walletParams) : null;
|
|
1373
|
-
this.walletAssetsCalculationContext = {
|
|
1374
|
-
orderTotalAmount: Number(((_snapshot$calculation = snapshot.calculationContext) === null || _snapshot$calculation === void 0 ? void 0 : _snapshot$calculation.orderTotalAmount) || 0),
|
|
1375
|
-
products: Array.isArray((_snapshot$calculation2 = snapshot.calculationContext) === null || _snapshot$calculation2 === void 0 ? void 0 : _snapshot$calculation2.products) ? _toConsumableArray(snapshot.calculationContext.products) : []
|
|
1376
|
-
};
|
|
1377
|
-
return this.publishWalletAssetsState(_objectSpread(_objectSpread({}, snapshot.state), {}, {
|
|
1378
|
-
items: Array.isArray(snapshot.state.items) ? snapshot.state.items : [],
|
|
1379
|
-
selectedIds: Array.isArray(snapshot.state.selectedIds) ? snapshot.state.selectedIds : [],
|
|
1380
|
-
selectedItems: Array.isArray(snapshot.state.selectedItems) ? snapshot.state.selectedItems : [],
|
|
1381
|
-
committedIds: Array.isArray(snapshot.state.committedIds) ? snapshot.state.committedIds : [],
|
|
1382
|
-
selectionSources: snapshot.state.selectionSources || {}
|
|
1383
|
-
}));
|
|
1384
|
-
}
|
|
1385
|
-
}, {
|
|
1386
|
-
key: "updateWalletAssetEditAmountInCaches",
|
|
1387
|
-
value: function updateWalletAssetEditAmountInCaches(assetKey, amount) {
|
|
1388
|
-
var updateAsset = function updateAsset(asset) {
|
|
1389
|
-
return getWalletAssetKey(asset) === assetKey ? _objectSpread(_objectSpread({}, asset), {}, {
|
|
1390
|
-
edit_current_amount: amount
|
|
1391
|
-
}) : asset;
|
|
1392
|
-
};
|
|
1393
|
-
this.searchResults = this.searchResults.map(updateAsset);
|
|
1394
|
-
return this.walletAssetsState.items.map(updateAsset);
|
|
1395
|
-
}
|
|
1396
|
-
}, {
|
|
1397
|
-
key: "selectWalletAsset",
|
|
1398
|
-
value: function selectWalletAsset(assetId, options) {
|
|
1399
|
-
var assetKey = String(assetId);
|
|
1400
|
-
var asset = this.walletAssetsState.items.find(function (item) {
|
|
1401
|
-
return getWalletAssetKey(item) === assetKey;
|
|
1402
|
-
});
|
|
1403
|
-
var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
|
|
1404
|
-
return String(id);
|
|
1405
|
-
}));
|
|
1406
|
-
if (committedKeys.has(assetKey)) return this.getWalletAssetsState();
|
|
1407
|
-
var selectedIds = this.walletAssetsState.selectedIds.filter(function (id) {
|
|
1408
|
-
return String(id) !== assetKey;
|
|
1409
|
-
});
|
|
1410
|
-
var selectionSources = _objectSpread({}, this.walletAssetsState.selectionSources);
|
|
1411
|
-
delete selectionSources[assetKey];
|
|
1412
|
-
var nextItems = this.walletAssetsState.items;
|
|
1413
|
-
if (options.selected) {
|
|
1414
|
-
if (!asset || !isWalletAssetAvailable(asset)) {
|
|
1415
|
-
return this.getWalletAssetsState();
|
|
1416
|
-
}
|
|
1417
|
-
selectedIds.push(assetId);
|
|
1418
|
-
selectionSources[assetKey] = options.source || 'manual';
|
|
1419
|
-
} else if (asset) {
|
|
1420
|
-
this.clearPendingAutoSelectForAsset(asset);
|
|
1421
|
-
nextItems = this.updateWalletAssetEditAmountInCaches(assetKey, undefined);
|
|
1422
|
-
}
|
|
1423
|
-
var nextState = this.recalculateWalletAssets(nextItems, selectedIds, selectionSources);
|
|
1424
|
-
if (options.selected && asset && nextState.selectedIds.some(function (id) {
|
|
1425
|
-
return String(id) === assetKey;
|
|
1426
|
-
})) {
|
|
1427
|
-
this.clearPendingAutoSelectForAsset(asset);
|
|
1428
|
-
}
|
|
1429
|
-
return nextState;
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
/**
|
|
1433
|
-
* 更新已选资产的手动金额。只允许在当前实际抵扣额内向下调整,
|
|
1434
|
-
* 金额为 0 时沿用 legacy 行为取消选择。
|
|
1435
|
-
*/
|
|
1436
|
-
}, {
|
|
1437
|
-
key: "updateWalletAssetAmount",
|
|
1438
|
-
value: function updateWalletAssetAmount(assetId, amount) {
|
|
1439
|
-
var assetKey = String(assetId);
|
|
1440
|
-
var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
|
|
1441
|
-
return String(id);
|
|
1442
|
-
}));
|
|
1443
|
-
var selectedKeys = new Set(this.walletAssetsState.selectedIds.map(function (id) {
|
|
1444
|
-
return String(id);
|
|
1445
|
-
}));
|
|
1446
|
-
var asset = this.walletAssetsState.items.find(function (item) {
|
|
1447
|
-
return getWalletAssetKey(item) === assetKey;
|
|
1448
|
-
});
|
|
1449
|
-
var requestedAmount = Number(amount);
|
|
1450
|
-
if (!asset || committedKeys.has(assetKey) || !selectedKeys.has(assetKey) || !Number.isFinite(requestedAmount) || requestedAmount < 0) {
|
|
1451
|
-
return this.getWalletAssetsState();
|
|
1452
|
-
}
|
|
1453
|
-
var selectedIds = _toConsumableArray(this.walletAssetsState.selectedIds);
|
|
1454
|
-
var selectionSources = _objectSpread({}, this.walletAssetsState.selectionSources);
|
|
1455
|
-
if (requestedAmount === 0) {
|
|
1456
|
-
var _nextItems = this.updateWalletAssetEditAmountInCaches(assetKey, undefined);
|
|
1457
|
-
delete selectionSources[assetKey];
|
|
1458
|
-
this.clearPendingAutoSelectForAsset(asset);
|
|
1459
|
-
return this.recalculateWalletAssets(_nextItems, selectedIds.filter(function (id) {
|
|
1460
|
-
return String(id) !== assetKey;
|
|
1461
|
-
}), selectionSources);
|
|
1462
|
-
}
|
|
1463
|
-
var currentDeductionAmount = getWalletAssetDeductionAmount(asset);
|
|
1464
|
-
var editAmount = Math.min(requestedAmount, currentDeductionAmount);
|
|
1465
|
-
if (editAmount <= 0) return this.getWalletAssetsState();
|
|
1466
|
-
var nextItems = this.updateWalletAssetEditAmountInCaches(assetKey, editAmount);
|
|
1467
|
-
return this.recalculateWalletAssets(nextItems, selectedIds, selectionSources);
|
|
1468
|
-
}
|
|
1469
|
-
}, {
|
|
1470
|
-
key: "scanWalletAssetAsync",
|
|
1471
|
-
value: function () {
|
|
1472
|
-
var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
|
|
1473
|
-
var normalizedCode, selectedAsset, result, paymentAssets, asset, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
|
|
1474
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1475
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
1476
|
-
case 0:
|
|
1477
|
-
normalizedCode = String(code || '').trim();
|
|
1478
|
-
if (normalizedCode) {
|
|
1479
|
-
_context9.next = 3;
|
|
1480
|
-
break;
|
|
1481
|
-
}
|
|
1482
|
-
return _context9.abrupt("return", {
|
|
1483
|
-
type: 'normalCode',
|
|
1484
|
-
selected: false,
|
|
1485
|
-
state: this.getWalletAssetsState()
|
|
1486
|
-
});
|
|
1487
|
-
case 3:
|
|
1488
|
-
selectedAsset = this.walletAssetsState.selectedItems.find(function (asset) {
|
|
1489
|
-
return matchesWalletAssetCode(asset, normalizedCode);
|
|
1490
|
-
});
|
|
1491
|
-
if (!selectedAsset) {
|
|
1492
|
-
_context9.next = 6;
|
|
1493
|
-
break;
|
|
1494
|
-
}
|
|
1495
|
-
return _context9.abrupt("return", {
|
|
1496
|
-
type: 'normalCode',
|
|
1497
|
-
asset: selectedAsset,
|
|
1498
|
-
selected: true,
|
|
1499
|
-
state: this.getWalletAssetsState()
|
|
1500
|
-
});
|
|
1501
|
-
case 6:
|
|
1502
|
-
this.walletAssetsRequestSequence += 1;
|
|
1503
|
-
_context9.next = 9;
|
|
1504
|
-
return this.searchIdentificationCodeAsync(_objectSpread(_objectSpread({}, this.walletParams || {}), {}, {
|
|
1505
|
-
code: normalizedCode,
|
|
1506
|
-
prepare_payments: this.formatWalletPassList2PreparePayments(this.walletAssetsState.selectedItems)
|
|
1507
|
-
}));
|
|
1508
|
-
case 9:
|
|
1509
|
-
result = _context9.sent;
|
|
1510
|
-
paymentAssets = this.formatSearchedWalletPaymentAssets(result.data.filter(isWalletPaymentAsset));
|
|
1511
|
-
if (paymentAssets.length > 0) {
|
|
1512
|
-
this.searchResults = mergeWalletAssets(this.searchResults, paymentAssets);
|
|
1513
|
-
}
|
|
1514
|
-
asset = paymentAssets.find(function (item) {
|
|
1515
|
-
return String((item === null || item === void 0 ? void 0 : item.code) || '') === normalizedCode;
|
|
1516
|
-
}) || paymentAssets[0];
|
|
1517
|
-
if (!(!asset || result.type === 'walletCode')) {
|
|
1518
|
-
_context9.next = 15;
|
|
1519
|
-
break;
|
|
1520
|
-
}
|
|
1521
|
-
return _context9.abrupt("return", {
|
|
1522
|
-
type: result.type,
|
|
1523
|
-
asset: asset,
|
|
1524
|
-
selected: false,
|
|
1525
|
-
state: this.getWalletAssetsState()
|
|
1526
|
-
});
|
|
1527
|
-
case 15:
|
|
1528
|
-
items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
|
|
1529
|
-
recalculatedState = this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
|
|
1530
|
-
assetId = getWalletAssetId(asset);
|
|
1531
|
-
recalculatedAsset = assetId === undefined ? undefined : recalculatedState.items.find(function (item) {
|
|
1532
|
-
return getWalletAssetKey(item) === String(assetId);
|
|
1533
|
-
});
|
|
1534
|
-
selected = this.walletAssetsBehavior.autoSelectAfterSearch && assetId !== undefined && isWalletAssetAvailable(recalculatedAsset) ? this.selectWalletAsset(assetId, {
|
|
1535
|
-
selected: true,
|
|
1536
|
-
source: 'scan'
|
|
1537
|
-
}) : recalculatedState;
|
|
1538
|
-
isSelected = assetId !== undefined && selected.selectedIds.some(function (id) {
|
|
1539
|
-
return String(id) === String(assetId);
|
|
1540
|
-
});
|
|
1541
|
-
selectedStateAsset = assetId === undefined ? undefined : selected.items.find(function (item) {
|
|
1542
|
-
return getWalletAssetKey(item) === String(assetId);
|
|
1543
|
-
});
|
|
1544
|
-
resolvedAsset = selectedStateAsset || recalculatedAsset || asset;
|
|
1545
|
-
if (isSelected) {
|
|
1546
|
-
this.clearPendingAutoSelectForAsset(resolvedAsset);
|
|
1547
|
-
} else if (this.walletAssetsBehavior.autoSelectAfterSearch) {
|
|
1548
|
-
this.pendingAutoSelectSearchCodes.add(normalizeWalletAssetCode(normalizedCode));
|
|
1549
|
-
this.queuePendingAutoSelectForAssets([resolvedAsset]);
|
|
1550
|
-
}
|
|
1551
|
-
return _context9.abrupt("return", {
|
|
1552
|
-
type: result.type,
|
|
1553
|
-
asset: resolvedAsset,
|
|
1554
|
-
selected: isSelected,
|
|
1555
|
-
state: selected
|
|
1556
|
-
});
|
|
1557
|
-
case 25:
|
|
1558
|
-
case "end":
|
|
1559
|
-
return _context9.stop();
|
|
1560
|
-
}
|
|
1561
|
-
}, _callee9, this);
|
|
1562
|
-
}));
|
|
1563
|
-
function scanWalletAssetAsync(_x10) {
|
|
1564
|
-
return _scanWalletAssetAsync.apply(this, arguments);
|
|
1565
|
-
}
|
|
1566
|
-
return scanWalletAssetAsync;
|
|
1567
|
-
}()
|
|
1568
|
-
}, {
|
|
1569
|
-
key: "clearWalletAssetSelection",
|
|
1570
|
-
value: function clearWalletAssetSelection() {
|
|
1571
|
-
this.pendingAutoSelectSearchCodes.clear();
|
|
1572
|
-
var selectedKeys = new Set(this.walletAssetsState.selectedIds.map(function (id) {
|
|
1573
|
-
return String(id);
|
|
1574
|
-
}));
|
|
1575
|
-
var clearSelectedEditAmount = function clearSelectedEditAmount(asset) {
|
|
1576
|
-
return selectedKeys.has(getWalletAssetKey(asset)) ? _objectSpread(_objectSpread({}, asset), {}, {
|
|
1577
|
-
edit_current_amount: undefined
|
|
1578
|
-
}) : asset;
|
|
1579
|
-
};
|
|
1580
|
-
this.searchResults = this.searchResults.map(clearSelectedEditAmount);
|
|
1581
|
-
return this.recalculateWalletAssets(this.walletAssetsState.items.map(clearSelectedEditAmount), [], {});
|
|
1582
|
-
}
|
|
1583
|
-
}, {
|
|
1584
|
-
key: "setCommittedWalletAssets",
|
|
1585
|
-
value: function setCommittedWalletAssets(committedIds) {
|
|
1586
|
-
var committedAssets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1587
|
-
var committedKeys = new Set(committedIds.map(function (id) {
|
|
1588
|
-
return String(id);
|
|
1589
|
-
}));
|
|
1590
|
-
var selectedIds = this.walletAssetsState.selectedIds.filter(function (id) {
|
|
1591
|
-
return !committedKeys.has(String(id));
|
|
1592
|
-
});
|
|
1593
|
-
var selectionSources = Object.entries(this.walletAssetsState.selectionSources).reduce(function (result, _ref14) {
|
|
1594
|
-
var _ref15 = _slicedToArray(_ref14, 2),
|
|
1595
|
-
key = _ref15[0],
|
|
1596
|
-
source = _ref15[1];
|
|
1597
|
-
if (!committedKeys.has(key)) result[key] = source;
|
|
1598
|
-
return result;
|
|
1599
|
-
}, {});
|
|
1600
|
-
this.publishWalletAssetsState({
|
|
1601
|
-
items: mergeWalletAssets(this.walletAssetsState.items, committedAssets),
|
|
1602
|
-
committedIds: committedIds
|
|
1603
|
-
});
|
|
1604
|
-
return this.recalculateWalletAssets(this.walletAssetsState.items, selectedIds, selectionSources);
|
|
1605
|
-
}
|
|
1606
658
|
}, {
|
|
1607
659
|
key: "processWalletPayment",
|
|
1608
660
|
value: function () {
|
|
1609
|
-
var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
661
|
+
var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(amount, orderUuid, voucherId) {
|
|
1610
662
|
var walletMethod, paymentItem;
|
|
1611
|
-
return _regeneratorRuntime().wrap(function
|
|
1612
|
-
while (1) switch (
|
|
663
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
664
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1613
665
|
case 0:
|
|
1614
666
|
this.paymentModule.logInfo('[WalletPass] 开始处理钱包支付', {
|
|
1615
667
|
amount: amount,
|
|
1616
668
|
orderUuid: orderUuid,
|
|
1617
669
|
voucherId: voucherId || 'none'
|
|
1618
670
|
});
|
|
1619
|
-
|
|
671
|
+
_context7.next = 3;
|
|
1620
672
|
return this.paymentModule.getWalletPaymentMethod();
|
|
1621
673
|
case 3:
|
|
1622
|
-
walletMethod =
|
|
674
|
+
walletMethod = _context7.sent;
|
|
1623
675
|
if (walletMethod) {
|
|
1624
|
-
|
|
676
|
+
_context7.next = 7;
|
|
1625
677
|
break;
|
|
1626
678
|
}
|
|
1627
679
|
this.paymentModule.logError('[WalletPass] 钱包支付方式未找到', null, {
|
|
@@ -1639,7 +691,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1639
691
|
type: walletMethod.type,
|
|
1640
692
|
voucher_id: voucherId || ''
|
|
1641
693
|
};
|
|
1642
|
-
|
|
694
|
+
_context7.next = 10;
|
|
1643
695
|
return this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
1644
696
|
case 10:
|
|
1645
697
|
this.paymentModule.logInfo('[WalletPass] 钱包支付处理完成', {
|
|
@@ -1650,11 +702,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1650
702
|
});
|
|
1651
703
|
case 11:
|
|
1652
704
|
case "end":
|
|
1653
|
-
return
|
|
705
|
+
return _context7.stop();
|
|
1654
706
|
}
|
|
1655
|
-
},
|
|
707
|
+
}, _callee7, this);
|
|
1656
708
|
}));
|
|
1657
|
-
function processWalletPayment(
|
|
709
|
+
function processWalletPayment(_x7, _x8, _x9) {
|
|
1658
710
|
return _processWalletPayment.apply(this, arguments);
|
|
1659
711
|
}
|
|
1660
712
|
return processWalletPayment;
|
|
@@ -1662,18 +714,18 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1662
714
|
}, {
|
|
1663
715
|
key: "getWalletBalance",
|
|
1664
716
|
value: function () {
|
|
1665
|
-
var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1666
|
-
return _regeneratorRuntime().wrap(function
|
|
1667
|
-
while (1) switch (
|
|
717
|
+
var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(voucherId) {
|
|
718
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
719
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1668
720
|
case 0:
|
|
1669
|
-
return
|
|
721
|
+
return _context8.abrupt("return", 0);
|
|
1670
722
|
case 1:
|
|
1671
723
|
case "end":
|
|
1672
|
-
return
|
|
724
|
+
return _context8.stop();
|
|
1673
725
|
}
|
|
1674
|
-
},
|
|
726
|
+
}, _callee8);
|
|
1675
727
|
}));
|
|
1676
|
-
function getWalletBalance(
|
|
728
|
+
function getWalletBalance(_x10) {
|
|
1677
729
|
return _getWalletBalance.apply(this, arguments);
|
|
1678
730
|
}
|
|
1679
731
|
return getWalletBalance;
|
|
@@ -1753,7 +805,6 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1753
805
|
key: "clearSearchResults",
|
|
1754
806
|
value: function clearSearchResults() {
|
|
1755
807
|
this.searchResults = [];
|
|
1756
|
-
this.pendingAutoSelectSearchCodes.clear();
|
|
1757
808
|
this.paymentModule.logInfo('[WalletPass] 搜索结果缓存已清除');
|
|
1758
809
|
}
|
|
1759
810
|
|
|
@@ -1785,16 +836,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1785
836
|
this.walletRecommendList = [];
|
|
1786
837
|
this.userIdentificationCodes = [];
|
|
1787
838
|
this.searchResults = [];
|
|
1788
|
-
this.pendingAutoSelectSearchCodes.clear();
|
|
1789
839
|
this.walletParams = null;
|
|
1790
840
|
this.walletInitData = null;
|
|
1791
|
-
this.walletAssetsRequestSequence += 1;
|
|
1792
|
-
this.walletAssetsCalculationContext = {
|
|
1793
|
-
orderTotalAmount: 0,
|
|
1794
|
-
products: []
|
|
1795
|
-
};
|
|
1796
|
-
this.walletAssetsState = createInitialWalletAssetsState();
|
|
1797
|
-
this.publishWalletAssetsState({});
|
|
1798
841
|
|
|
1799
842
|
// 发送所有缓存清除事件
|
|
1800
843
|
this.emitEvent(WalletPassHooks.OnWalletCacheCleared, {
|