@pisell/pisellos 2.3.233 → 2.3.234

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/modules/Order/index.d.ts +9 -8
  2. package/dist/modules/Order/index.js +273 -255
  3. package/dist/modules/Order/utils.d.ts +1 -0
  4. package/dist/modules/Order/utils.js +3 -2
  5. package/dist/shared/payment/loadPaymentMethods.d.ts +2 -1
  6. package/dist/shared/payment/loadPaymentMethods.js +13 -12
  7. package/dist/solution/BaseSales/index.d.ts +3 -0
  8. package/dist/solution/BaseSales/index.js +445 -402
  9. package/dist/solution/BookingTicket/index.d.ts +3 -1
  10. package/dist/solution/BookingTicket/index.js +49 -43
  11. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
  12. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +69 -13
  13. package/dist/utils/platform.d.ts +2 -0
  14. package/dist/utils/platform.js +4 -0
  15. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  16. package/lib/modules/Order/index.d.ts +9 -8
  17. package/lib/modules/Order/index.js +57 -43
  18. package/lib/modules/Order/utils.d.ts +1 -0
  19. package/lib/modules/Order/utils.js +2 -1
  20. package/lib/shared/payment/loadPaymentMethods.d.ts +2 -1
  21. package/lib/shared/payment/loadPaymentMethods.js +10 -9
  22. package/lib/solution/BaseSales/index.d.ts +3 -0
  23. package/lib/solution/BaseSales/index.js +45 -22
  24. package/lib/solution/BookingTicket/index.d.ts +3 -1
  25. package/lib/solution/BookingTicket/index.js +4 -1
  26. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
  27. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +44 -5
  28. package/lib/utils/platform.d.ts +2 -0
  29. package/lib/utils/platform.js +5 -0
  30. package/package.json +1 -1
@@ -55,8 +55,8 @@ import { expandHydratedProductsForDiscountCollection, restoreHydratedBundleDisco
55
55
  import { getOrderCollectionPersistentId, getOrderCollectionUid, normalizeOrderCollections, repairDuplicateProductLineIdentities as repairDuplicateOrderProductLineIdentities, setOrderCollectionUid } from "./utils/orderCollectionIdentity";
56
56
  import { consolidateDiscountFreeProductLines, ensureUniqueProductLineUids } from "./utils/discountProductLineIdentity";
57
57
  import { applyTempOrderSettlementState, getSelectedSettlementSnapshot, getSettlementKey, getTempOrderSettlementKey, getTempOrderSettlementSnapshot, isVirtualSettlementOrder, isVirtualSettlementProduct, normalizeVirtualSettlementOrderProduct, normalizeVirtualSettlementProducts, OrderSettlementConflictError, releaseTempOrderSettlementState, VirtualCurrencyAssetNotFoundError, VirtualCurrencyBalanceError } from "./utils/virtualSettlement";
58
- import { loadPaymentMethods, requirePosVirtualCurrencyPaymentMethod } from "../../shared/payment/loadPaymentMethods";
59
- import { isPosTerminalPlatform } from "../../utils/platform";
58
+ import { loadPaymentMethods, requireTerminalVirtualCurrencyPaymentMethod } from "../../shared/payment/loadPaymentMethods";
59
+ import { resolveTerminalVirtualCurrencyChannel } from "../../utils/platform";
60
60
  import { DiscountModule } from "../Discount";
61
61
  import { RulesModule } from "../Rules";
62
62
  import { isEntitlementPass, isFullCoveragePass } from "../Discount/entitlementPass";
@@ -204,8 +204,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
204
204
  _defineProperty(_assertThisInitialized(_this), "moduleHooksOverride", void 0);
205
205
  _defineProperty(_assertThisInitialized(_this), "orderHooks", void 0);
206
206
  _defineProperty(_assertThisInitialized(_this), "cartCommandQueue", Promise.resolve());
207
- _defineProperty(_assertThisInitialized(_this), "posVirtualPaymentRevision", 0);
208
- _defineProperty(_assertThisInitialized(_this), "posVirtualPaymentSnapshot", void 0);
207
+ _defineProperty(_assertThisInitialized(_this), "terminalVirtualPaymentRevision", 0);
208
+ _defineProperty(_assertThisInitialized(_this), "terminalVirtualPaymentSnapshots", new Map());
209
209
  _defineProperty(_assertThisInitialized(_this), "otherParams", void 0);
210
210
  // ─── 促销/赠品 ────────────────────────────────────
211
211
  /** 评估器引用;由 SalesSdkProvider 注入,未注入时 applyPromotion 静默跳过 */
@@ -5536,94 +5536,109 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5536
5536
  return ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.enableMultiCurrencySettlement) === true;
5537
5537
  }
5538
5538
  }, {
5539
- key: "requiresPosVirtualCurrencyPayment",
5540
- value: function requiresPosVirtualCurrencyPayment(product) {
5541
- var _this$otherParams5;
5542
- return this.isMultiCurrencySettlementEnabled() && isPosTerminalPlatform((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform) && isVirtualSettlementProduct(product);
5539
+ key: "getVirtualCurrencyPaymentChannel",
5540
+ value: function getVirtualCurrencyPaymentChannel() {
5541
+ var _this$otherParams5, _this$otherParams$bus, _this$otherParams6, _this$otherParams7;
5542
+ if (!this.isMultiCurrencySettlementEnabled()) return undefined;
5543
+ return resolveTerminalVirtualCurrencyChannel((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform, (_this$otherParams$bus = (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code);
5543
5544
  }
5544
5545
  }, {
5545
- key: "getPosVirtualPaymentShopId",
5546
- value: function getPosVirtualPaymentShopId() {
5546
+ key: "getVirtualPaymentShopId",
5547
+ value: function getVirtualPaymentShopId() {
5547
5548
  var _this$core$context$ge, _this$core3, _this$core3$getData;
5548
5549
  return String((_this$core$context$ge = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 || (_this$core3$getData = _this$core3.getData) === null || _this$core3$getData === void 0 ? void 0 : _this$core3$getData.call(_this$core3, 'shop_id')) !== null && _this$core$context$ge !== void 0 ? _this$core$context$ge : '');
5549
5550
  }
5550
5551
  }, {
5551
- key: "syncPosVirtualCurrencyPaymentMethods",
5552
- value: function syncPosVirtualCurrencyPaymentMethods(methods) {
5552
+ key: "syncTerminalVirtualCurrencyPaymentMethods",
5553
+ value: function syncTerminalVirtualCurrencyPaymentMethods(channel, methods) {
5553
5554
  var _methods$find;
5554
- var shopId = this.getPosVirtualPaymentShopId();
5555
+ var shopId = this.getVirtualPaymentShopId();
5555
5556
  var sourceShopId = (_methods$find = methods.find(function (method) {
5556
5557
  return Number(method === null || method === void 0 ? void 0 : method.shop_id) > 0;
5557
5558
  })) === null || _methods$find === void 0 ? void 0 : _methods$find.shop_id;
5558
5559
  if (shopId && sourceShopId != null && String(sourceShopId) !== shopId) return;
5559
- this.posVirtualPaymentSnapshot = {
5560
+ this.terminalVirtualPaymentSnapshots.set(channel, {
5560
5561
  shopId: shopId,
5561
5562
  methods: methods,
5562
- revision: ++this.posVirtualPaymentRevision
5563
- };
5563
+ revision: ++this.terminalVirtualPaymentRevision
5564
+ });
5564
5565
  }
5565
5566
  }, {
5566
- key: "getPosVirtualCurrencyPaymentMethod",
5567
- value: function getPosVirtualCurrencyPaymentMethod() {
5568
- var initialMethods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5569
- var shopId = this.getPosVirtualPaymentShopId();
5570
- var snapshot = this.posVirtualPaymentSnapshot;
5571
- return requirePosVirtualCurrencyPaymentMethod((snapshot === null || snapshot === void 0 ? void 0 : snapshot.shopId) === shopId ? snapshot.methods : initialMethods, shopId);
5567
+ key: "getTerminalVirtualCurrencyPaymentMethod",
5568
+ value: function getTerminalVirtualCurrencyPaymentMethod(channel) {
5569
+ var initialMethods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
5570
+ var shopId = this.getVirtualPaymentShopId();
5571
+ var snapshot = this.terminalVirtualPaymentSnapshots.get(channel);
5572
+ return requireTerminalVirtualCurrencyPaymentMethod((snapshot === null || snapshot === void 0 ? void 0 : snapshot.shopId) === shopId ? snapshot.methods : initialMethods, channel, shopId);
5572
5573
  }
5573
5574
  }, {
5574
- key: "refreshPosVirtualCurrencyPaymentMethod",
5575
+ key: "refreshTerminalVirtualCurrencyPaymentMethod",
5575
5576
  value: function () {
5576
- var _refreshPosVirtualCurrencyPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
5577
- var shopId, revision, methods, snapshot;
5577
+ var _refreshTerminalVirtualCurrencyPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(channel) {
5578
+ var _this38 = this;
5579
+ var shopId, revision, publish, methods;
5578
5580
  return _regeneratorRuntime().wrap(function _callee26$(_context29) {
5579
5581
  while (1) switch (_context29.prev = _context29.next) {
5580
5582
  case 0:
5581
- shopId = this.getPosVirtualPaymentShopId();
5582
- revision = ++this.posVirtualPaymentRevision;
5583
- _context29.next = 4;
5583
+ shopId = this.getVirtualPaymentShopId();
5584
+ revision = ++this.terminalVirtualPaymentRevision;
5585
+ publish = function publish(methods) {
5586
+ var snapshot = _this38.terminalVirtualPaymentSnapshots.get(channel);
5587
+ // A slow lookup must not overwrite a newer lookup or payment methods event.
5588
+ if ((snapshot === null || snapshot === void 0 ? void 0 : snapshot.shopId) !== shopId || snapshot.revision < revision) {
5589
+ _this38.terminalVirtualPaymentSnapshots.set(channel, {
5590
+ shopId: shopId,
5591
+ methods: methods,
5592
+ revision: revision
5593
+ });
5594
+ }
5595
+ };
5596
+ _context29.prev = 3;
5597
+ _context29.next = 6;
5584
5598
  return loadPaymentMethods(this.request, {
5585
5599
  transport: 'remote',
5586
5600
  filterPaymentMethods: false
5587
5601
  });
5588
- case 4:
5602
+ case 6:
5589
5603
  methods = _context29.sent;
5590
- if (!(shopId !== this.getPosVirtualPaymentShopId())) {
5591
- _context29.next = 7;
5604
+ _context29.next = 13;
5605
+ break;
5606
+ case 9:
5607
+ _context29.prev = 9;
5608
+ _context29.t0 = _context29["catch"](3);
5609
+ if (channel === 'kiosk' && shopId === this.getVirtualPaymentShopId()) publish([]);
5610
+ throw _context29.t0;
5611
+ case 13:
5612
+ if (!(shopId !== this.getVirtualPaymentShopId())) {
5613
+ _context29.next = 15;
5592
5614
  break;
5593
5615
  }
5594
5616
  throw new Error('[Order] Payment methods belong to a previous shop');
5595
- case 7:
5596
- snapshot = this.posVirtualPaymentSnapshot; // Slow reads must not overwrite a newer lookup or a payment methods sync event.
5597
- if ((snapshot === null || snapshot === void 0 ? void 0 : snapshot.shopId) !== shopId || snapshot.revision < revision) {
5598
- this.posVirtualPaymentSnapshot = {
5599
- shopId: shopId,
5600
- methods: methods,
5601
- revision: revision
5602
- };
5603
- }
5604
- return _context29.abrupt("return", this.getPosVirtualCurrencyPaymentMethod());
5605
- case 10:
5617
+ case 15:
5618
+ publish(methods);
5619
+ return _context29.abrupt("return", this.getTerminalVirtualCurrencyPaymentMethod(channel));
5620
+ case 17:
5606
5621
  case "end":
5607
5622
  return _context29.stop();
5608
5623
  }
5609
- }, _callee26, this);
5624
+ }, _callee26, this, [[3, 9]]);
5610
5625
  }));
5611
- function refreshPosVirtualCurrencyPaymentMethod() {
5612
- return _refreshPosVirtualCurrencyPaymentMethod.apply(this, arguments);
5626
+ function refreshTerminalVirtualCurrencyPaymentMethod(_x26) {
5627
+ return _refreshTerminalVirtualCurrencyPaymentMethod.apply(this, arguments);
5613
5628
  }
5614
- return refreshPosVirtualCurrencyPaymentMethod;
5629
+ return refreshTerminalVirtualCurrencyPaymentMethod;
5615
5630
  }()
5616
5631
  }, {
5617
- key: "validatePosVirtualCurrencyCart",
5632
+ key: "validateTerminalVirtualCurrencyCart",
5618
5633
  value: function () {
5619
- var _validatePosVirtualCurrencyCart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(order) {
5634
+ var _validateTerminalVirtualCurrencyCart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(order, channel) {
5620
5635
  return _regeneratorRuntime().wrap(function _callee27$(_context30) {
5621
5636
  while (1) switch (_context30.prev = _context30.next) {
5622
5637
  case 0:
5623
5638
  _context30.next = 2;
5624
- return this.refreshPosVirtualCurrencyPaymentMethod();
5639
+ return this.refreshTerminalVirtualCurrencyPaymentMethod(channel);
5625
5640
  case 2:
5626
- if (!(this.getTempOrder() !== order)) {
5641
+ if (!(this.getTempOrder() !== order || this.getVirtualCurrencyPaymentChannel() !== channel)) {
5627
5642
  _context30.next = 4;
5628
5643
  break;
5629
5644
  }
@@ -5634,10 +5649,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5634
5649
  }
5635
5650
  }, _callee27, this);
5636
5651
  }));
5637
- function validatePosVirtualCurrencyCart(_x26) {
5638
- return _validatePosVirtualCurrencyCart.apply(this, arguments);
5652
+ function validateTerminalVirtualCurrencyCart(_x27, _x28) {
5653
+ return _validateTerminalVirtualCurrencyCart.apply(this, arguments);
5639
5654
  }
5640
- return validatePosVirtualCurrencyCart;
5655
+ return validateTerminalVirtualCurrencyCart;
5641
5656
  }()
5642
5657
  }, {
5643
5658
  key: "isActiveVirtualSettlementOrder",
@@ -5814,7 +5829,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5814
5829
  }
5815
5830
  }, _callee28, this);
5816
5831
  }));
5817
- function finalizeProductOrderMutation(_x27, _x28) {
5832
+ function finalizeProductOrderMutation(_x29, _x30) {
5818
5833
  return _finalizeProductOrderMutation.apply(this, arguments);
5819
5834
  }
5820
5835
  return finalizeProductOrderMutation;
@@ -5843,7 +5858,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5843
5858
  _productToAdd$_extend,
5844
5859
  _productToAdd$metadat,
5845
5860
  _origin,
5846
- _this38 = this;
5861
+ _this39 = this;
5847
5862
  var incomingBookingUuid = (_booking = booking) === null || _booking === void 0 ? void 0 : _booking.uuid;
5848
5863
  if (booking && incomingBookingUuid && (_tempOrder$bookings3 = tempOrder.bookings) !== null && _tempOrder$bookings3 !== void 0 && _tempOrder$bookings3.some(function (item) {
5849
5864
  return item.uuid === incomingBookingUuid;
@@ -5893,27 +5908,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5893
5908
  var matchedIndex = shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
5894
5909
  var _item$metadata4;
5895
5910
  if (productVoucherGroupKey(tempOrder, item) !== productToAdd._productVoucherGroupKey) return false;
5896
- if (_this38.hasGoodPassDiscount(item)) return false;
5911
+ if (_this39.hasGoodPassDiscount(item)) return false;
5897
5912
  if (getProductHolderRelations(tempOrder, item).length > 0 || hasAssignedHolderId((_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.holder_id)) return false;
5898
- var isRuntimeEntitlementPass = _this38.isRuntimeEntitlementAppend(item, tempOrder);
5913
+ var isRuntimeEntitlementPass = _this39.isRuntimeEntitlementAppend(item, tempOrder);
5899
5914
  if (isIncomingEntitlementAppend !== isRuntimeEntitlementPass) {
5900
5915
  return false;
5901
5916
  }
5902
- if (isIncomingEntitlementAppend && _this38.isPersistedProductLine(item)) {
5917
+ if (isIncomingEntitlementAppend && _this39.isPersistedProductLine(item)) {
5903
5918
  return false;
5904
5919
  }
5905
- var hasExistingProductNote = _this38.hasOrderProductLineNote(item);
5920
+ var hasExistingProductNote = _this39.hasOrderProductLineNote(item);
5906
5921
  if ((hasIncomingProductNote || hasExistingProductNote) && (!isRuntimeEntitlementPass || String(normalizedIncoming.note || '').trim() !== String(item.note || '').trim())) {
5907
5922
  return false;
5908
5923
  }
5909
5924
  var hasExistingManualProductDiscount = isManualProductDiscountProduct(item);
5910
- if (isRuntimeEntitlementPass && !_this38.hasSameEntitlementMergePriceConfig(normalizedIncoming, item)) {
5925
+ if (isRuntimeEntitlementPass && !_this39.hasSameEntitlementMergePriceConfig(normalizedIncoming, item)) {
5911
5926
  return false;
5912
5927
  }
5913
5928
  if ((hasIncomingManualProductDiscount || hasExistingManualProductDiscount) && !isRuntimeEntitlementPass) {
5914
5929
  return false;
5915
5930
  }
5916
- if (_this38.isPersistedProductLine(item)) return false;
5931
+ if (_this39.isPersistedProductLine(item)) return false;
5917
5932
  if (item.product_id !== productToAdd.product_id) return false;
5918
5933
  if (item.product_variant_id !== productToAdd.product_variant_id) return false;
5919
5934
  var existedFingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
@@ -5924,10 +5939,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5924
5939
  var commitProductLine = function commitProductLine(shouldMerge) {
5925
5940
  var _options$beforeCommit2;
5926
5941
  options === null || options === void 0 || (_options$beforeCommit2 = options.beforeCommit) === null || _options$beforeCommit2 === void 0 || _options$beforeCommit2.call(options);
5927
- _this38.assertAndLockProductSettlement(tempOrder, productToAdd);
5942
+ _this39.assertAndLockProductSettlement(tempOrder, productToAdd);
5928
5943
  var committedProduct;
5929
5944
  if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
5930
- _this38.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
5945
+ _this39.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
5931
5946
  if (linked) {
5932
5947
  normalizedIncoming.booking_uid = linked.bookingUid;
5933
5948
  normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, {
@@ -5945,7 +5960,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5945
5960
  var _targetProduct$metada;
5946
5961
  var targetProduct = matchedProduct;
5947
5962
  var targetUid = (_targetProduct$metada = targetProduct.metadata) === null || _targetProduct$metada === void 0 ? void 0 : _targetProduct$metada.unique_identification_number;
5948
- var normalizedProduct = _this38.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(targetProduct, normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
5963
+ var normalizedProduct = _this39.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(targetProduct, normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
5949
5964
  metadata: _objectSpread(_objectSpread({}, productToAdd.metadata || {}), {}, {
5950
5965
  unique_identification_number: targetUid
5951
5966
  })
@@ -5968,7 +5983,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5968
5983
  order_detail_id: targetProduct.order_detail_id,
5969
5984
  num: nextNum
5970
5985
  });
5971
- _this38.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
5986
+ _this39.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
5972
5987
  committedProduct = tempOrder.products[matchedIndex];
5973
5988
  if (matchedIndex !== tempOrder.products.length - 1) {
5974
5989
  var mergedProduct = tempOrder.products[matchedIndex];
@@ -6085,12 +6100,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6085
6100
  key: "addProductToOrder",
6086
6101
  value: (function () {
6087
6102
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(product, booking, options) {
6088
- var _this39 = this;
6103
+ var _this40 = this;
6089
6104
  return _regeneratorRuntime().wrap(function _callee29$(_context32) {
6090
6105
  while (1) switch (_context32.prev = _context32.next) {
6091
6106
  case 0:
6092
6107
  return _context32.abrupt("return", this.queueCartCommand(function () {
6093
- return _this39.addProductToOrderDraft(product, booking, options);
6108
+ return _this40.addProductToOrderDraft(product, booking, options);
6094
6109
  }));
6095
6110
  case 1:
6096
6111
  case "end":
@@ -6098,7 +6113,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6098
6113
  }
6099
6114
  }, _callee29, this);
6100
6115
  }));
6101
- function addProductToOrder(_x29, _x30, _x31) {
6116
+ function addProductToOrder(_x31, _x32, _x33) {
6102
6117
  return _addProductToOrder.apply(this, arguments);
6103
6118
  }
6104
6119
  return addProductToOrder;
@@ -6108,8 +6123,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6108
6123
  value: function () {
6109
6124
  var _addProductToOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(product, booking, options) {
6110
6125
  var _product$_extend2,
6111
- _this40 = this;
6112
- var availabilityCommitGuard, liveTempOrder, beforeCommit, mutation, tempOrder, beforeAppend, guardedMutationFields, readGuardedMutationFields, guardedMutationBaseline, beforePublish, _tempOrder$_extend13, salesNoteDrafts, mutationSnapshot, attachSalesNoteDrafts, rollbackProductAndNotesMutation, insertAfterProductUid, anchorIndex, insertAtIndex, _ref73, _productRecord$num, productRecord, splitCount, i, splitLine, committedProduct, _committedProduct, _committedProduct2, committedIdentity, isCurrentOrder;
6126
+ _this41 = this;
6127
+ var availabilityCommitGuard, liveTempOrder, beforeCommit, virtualPaymentChannel, mutation, tempOrder, beforeAppend, guardedMutationFields, readGuardedMutationFields, guardedMutationBaseline, beforePublish, _tempOrder$_extend13, salesNoteDrafts, mutationSnapshot, attachSalesNoteDrafts, rollbackProductAndNotesMutation, insertAfterProductUid, anchorIndex, insertAtIndex, _ref73, _productRecord$num, productRecord, splitCount, i, splitLine, committedProduct, _committedProduct, _committedProduct2, committedIdentity, isCurrentOrder;
6113
6128
  return _regeneratorRuntime().wrap(function _callee30$(_context33) {
6114
6129
  while (1) switch (_context33.prev = _context33.next) {
6115
6130
  case 0:
@@ -6117,15 +6132,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6117
6132
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6118
6133
  liveTempOrder = this.ensureTempOrder();
6119
6134
  beforeCommit = this.createCartIntentCommitGuard('add_product', liveTempOrder);
6120
- if (!this.requiresPosVirtualCurrencyPayment(product)) {
6121
- _context33.next = 8;
6135
+ virtualPaymentChannel = this.getVirtualCurrencyPaymentChannel();
6136
+ if (!(virtualPaymentChannel && isVirtualSettlementProduct(product))) {
6137
+ _context33.next = 9;
6122
6138
  break;
6123
6139
  }
6124
- _context33.next = 7;
6125
- return this.validatePosVirtualCurrencyCart(liveTempOrder);
6126
- case 7:
6127
- availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6140
+ _context33.next = 8;
6141
+ return this.validateTerminalVirtualCurrencyCart(liveTempOrder, virtualPaymentChannel);
6128
6142
  case 8:
6143
+ availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6144
+ case 9:
6129
6145
  mutation = this.beginCartMutation(); // 库存/商品券校验与自动预约共用草稿,全部门禁通过后才发布完整批次。
6130
6146
  tempOrder = availabilityCommitGuard && !mutation.commit ? cloneDeep(liveTempOrder) : mutation.draft;
6131
6147
  beforeAppend = mutation.commit ? undefined : beforeCommit;
@@ -6147,21 +6163,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6147
6163
  }
6148
6164
  };
6149
6165
  if (!(options !== null && options !== void 0 && options.productVoucherGroupKey)) {
6150
- _context33.next = 19;
6166
+ _context33.next = 20;
6151
6167
  break;
6152
6168
  }
6153
6169
  if ((_tempOrder$_extend13 = tempOrder._extend) !== null && _tempOrder$_extend13 !== void 0 && (_tempOrder$_extend13 = _tempOrder$_extend13.productVoucherGroups) !== null && _tempOrder$_extend13 !== void 0 && _tempOrder$_extend13.some(function (group) {
6154
6170
  return group.key === options.productVoucherGroupKey;
6155
6171
  })) {
6156
- _context33.next = 18;
6172
+ _context33.next = 19;
6157
6173
  break;
6158
6174
  }
6159
6175
  throw voucherGroupError();
6160
- case 18:
6176
+ case 19:
6161
6177
  product = _objectSpread(_objectSpread({}, product), {}, {
6162
6178
  _productVoucherGroupKey: options.productVoucherGroupKey
6163
6179
  });
6164
- case 19:
6180
+ case 20:
6165
6181
  salesNoteDrafts = ((options === null || options === void 0 ? void 0 : options.salesNotes) || []).map(function (draft) {
6166
6182
  return {
6167
6183
  note_type: String(draft.note_type || '').trim(),
@@ -6186,7 +6202,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6186
6202
  throw new Error('[Order Notes] 商品行缺少 unique_identification_number');
6187
6203
  }
6188
6204
  salesNoteDrafts.forEach(function (draft) {
6189
- _this40.setSalesNoteOnTempOrder(tempOrder, {
6205
+ _this41.setSalesNoteOnTempOrder(tempOrder, {
6190
6206
  note_type: draft.note_type,
6191
6207
  target: {
6192
6208
  target_type: 'order_detail',
@@ -6211,21 +6227,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6211
6227
  return uid !== undefined && uid !== null && String(uid) === String(insertAfterProductUid);
6212
6228
  }) : -1;
6213
6229
  insertAtIndex = options !== null && options !== void 0 && options.insertAtStart ? 0 : anchorIndex >= 0 ? anchorIndex + 1 : undefined;
6214
- _context33.prev = 26;
6230
+ _context33.prev = 27;
6215
6231
  if (!booking) {
6216
- _context33.next = 53;
6232
+ _context33.next = 54;
6217
6233
  break;
6218
6234
  }
6219
6235
  productRecord = product;
6220
6236
  splitCount = getSafeProductNum((_ref73 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref73 !== void 0 ? _ref73 : 1);
6221
6237
  if (!(splitCount > 1)) {
6222
- _context33.next = 46;
6238
+ _context33.next = 47;
6223
6239
  break;
6224
6240
  }
6225
6241
  i = 0;
6226
- case 32:
6242
+ case 33:
6227
6243
  if (!(i < splitCount)) {
6228
- _context33.next = 44;
6244
+ _context33.next = 45;
6229
6245
  break;
6230
6246
  }
6231
6247
  splitLine = this.createSplitBookingLine(productRecord, booking, i, splitCount);
@@ -6243,124 +6259,124 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6243
6259
  delete splitLine.booking.metadata.unique_identification_number;
6244
6260
  }
6245
6261
  }
6246
- _context33.next = 37;
6262
+ _context33.next = 38;
6247
6263
  return this.appendProductLineToTempOrder(tempOrder, splitLine.product, splitLine.booking, {
6248
6264
  insertAtIndex: insertAtIndex,
6249
6265
  disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge,
6250
6266
  beforeCommit: beforeAppend
6251
6267
  });
6252
- case 37:
6268
+ case 38:
6253
6269
  committedProduct = _context33.sent;
6254
6270
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6255
6271
  attachSalesNoteDrafts(committedProduct);
6256
6272
  if (insertAtIndex !== undefined) insertAtIndex += 1;
6257
- case 41:
6273
+ case 42:
6258
6274
  i += 1;
6259
- _context33.next = 32;
6275
+ _context33.next = 33;
6260
6276
  break;
6261
- case 44:
6262
- _context33.next = 51;
6277
+ case 45:
6278
+ _context33.next = 52;
6263
6279
  break;
6264
- case 46:
6265
- _context33.next = 48;
6280
+ case 47:
6281
+ _context33.next = 49;
6266
6282
  return this.appendProductLineToTempOrder(tempOrder, product, cloneDeep(booking), {
6267
6283
  insertAtIndex: insertAtIndex,
6268
6284
  disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge,
6269
6285
  beforeCommit: beforeAppend
6270
6286
  });
6271
- case 48:
6287
+ case 49:
6272
6288
  _committedProduct = _context33.sent;
6273
6289
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6274
6290
  attachSalesNoteDrafts(_committedProduct);
6275
- case 51:
6276
- _context33.next = 58;
6291
+ case 52:
6292
+ _context33.next = 59;
6277
6293
  break;
6278
- case 53:
6279
- _context33.next = 55;
6294
+ case 54:
6295
+ _context33.next = 56;
6280
6296
  return this.appendProductLineToTempOrder(tempOrder, product, undefined, {
6281
6297
  insertAtIndex: insertAtIndex,
6282
6298
  disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge,
6283
6299
  beforeCommit: beforeAppend
6284
6300
  });
6285
- case 55:
6301
+ case 56:
6286
6302
  _committedProduct2 = _context33.sent;
6287
6303
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
6288
6304
  attachSalesNoteDrafts(_committedProduct2);
6289
- case 58:
6305
+ case 59:
6290
6306
  if (!mutation.commit) {
6291
- _context33.next = 63;
6307
+ _context33.next = 64;
6292
6308
  break;
6293
6309
  }
6294
- _context33.next = 61;
6310
+ _context33.next = 62;
6295
6311
  return mutation.commit({
6296
6312
  beforeCommit: beforePublish
6297
6313
  });
6298
- case 61:
6299
- _context33.next = 64;
6314
+ case 62:
6315
+ _context33.next = 65;
6300
6316
  break;
6301
- case 63:
6317
+ case 64:
6302
6318
  if (availabilityCommitGuard) {
6303
6319
  beforePublish();
6304
6320
  // 从最后一次门禁到真正新增之间不再 await。只发布本次新增会改写的
6305
6321
  // 字段;其余订单字段继续使用 live 对象,外部持有的订单引用也不变。
6306
6322
  Object.assign(liveTempOrder, readGuardedMutationFields(tempOrder));
6307
6323
  }
6308
- case 64:
6309
- _context33.next = 70;
6324
+ case 65:
6325
+ _context33.next = 71;
6310
6326
  break;
6311
- case 66:
6312
- _context33.prev = 66;
6313
- _context33.t0 = _context33["catch"](26);
6327
+ case 67:
6328
+ _context33.prev = 67;
6329
+ _context33.t0 = _context33["catch"](27);
6314
6330
  rollbackProductAndNotesMutation();
6315
6331
  throw _context33.t0;
6316
- case 70:
6332
+ case 71:
6317
6333
  if (!availabilityCommitGuard) {
6318
- _context33.next = 84;
6334
+ _context33.next = 85;
6319
6335
  break;
6320
6336
  }
6321
6337
  committedIdentity = [liveTempOrder.order_id, liveTempOrder.external_sale_number];
6322
6338
  isCurrentOrder = function isCurrentOrder() {
6323
6339
  var _options$availability, _options$availability2;
6324
- return _this40.store.tempOrder === liveTempOrder && liveTempOrder.order_id === committedIdentity[0] && liveTempOrder.external_sale_number === committedIdentity[1] && ((_options$availability = options === null || options === void 0 || (_options$availability2 = options.availabilityCommitTargetGuard) === null || _options$availability2 === void 0 ? void 0 : _options$availability2.call(options)) !== null && _options$availability !== void 0 ? _options$availability : true);
6340
+ return _this41.store.tempOrder === liveTempOrder && liveTempOrder.order_id === committedIdentity[0] && liveTempOrder.external_sale_number === committedIdentity[1] && ((_options$availability = options === null || options === void 0 || (_options$availability2 = options.availabilityCommitTargetGuard) === null || _options$availability2 === void 0 ? void 0 : _options$availability2.call(options)) !== null && _options$availability !== void 0 ? _options$availability : true);
6325
6341
  };
6326
- _context33.prev = 73;
6342
+ _context33.prev = 74;
6327
6343
  // 新增已发布,即使后续报价/促销收尾失败,也不能向调用方报告未加购。
6328
6344
  // 先保存已提交行;异步结果只允许写回仍属于本次提交的订单。
6329
6345
  if (isCurrentOrder()) this.persistTempOrder();
6330
- _context33.next = 77;
6346
+ _context33.next = 78;
6331
6347
  return this.finalizeProductOrderMutation(liveTempOrder, {
6332
6348
  isCurrentOrder: isCurrentOrder
6333
6349
  });
6334
- case 77:
6335
- _context33.next = 82;
6350
+ case 78:
6351
+ _context33.next = 83;
6336
6352
  break;
6337
- case 79:
6338
- _context33.prev = 79;
6339
- _context33.t1 = _context33["catch"](73);
6353
+ case 80:
6354
+ _context33.prev = 80;
6355
+ _context33.t1 = _context33["catch"](74);
6340
6356
  this.logWarning('addProductToOrder committed; finalization failed', {
6341
6357
  product_id: product.product_id,
6342
6358
  committed: true,
6343
6359
  error: _context33.t1 instanceof Error ? _context33.t1.message : String(_context33.t1)
6344
6360
  });
6345
- case 82:
6346
- _context33.next = 86;
6361
+ case 83:
6362
+ _context33.next = 87;
6347
6363
  break;
6348
- case 84:
6349
- _context33.next = 86;
6364
+ case 85:
6365
+ _context33.next = 87;
6350
6366
  return this.finalizeProductOrderMutation(liveTempOrder);
6351
- case 86:
6367
+ case 87:
6352
6368
  this.logInfo('addProductToOrder success', {
6353
6369
  product_id: product.product_id,
6354
6370
  with_booking: !!booking
6355
6371
  });
6356
6372
  return _context33.abrupt("return", liveTempOrder.products);
6357
- case 88:
6373
+ case 89:
6358
6374
  case "end":
6359
6375
  return _context33.stop();
6360
6376
  }
6361
- }, _callee30, this, [[26, 66], [73, 79]]);
6377
+ }, _callee30, this, [[27, 67], [74, 80]]);
6362
6378
  }));
6363
- function addProductToOrderDraft(_x32, _x33, _x34) {
6379
+ function addProductToOrderDraft(_x34, _x35, _x36) {
6364
6380
  return _addProductToOrderDraft.apply(this, arguments);
6365
6381
  }
6366
6382
  return addProductToOrderDraft;
@@ -6374,12 +6390,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6374
6390
  key: "replaceBookingProductWithRelatedRetail",
6375
6391
  value: (function () {
6376
6392
  var _replaceBookingProductWithRelatedRetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
6377
- var _this41 = this;
6393
+ var _this42 = this;
6378
6394
  return _regeneratorRuntime().wrap(function _callee31$(_context34) {
6379
6395
  while (1) switch (_context34.prev = _context34.next) {
6380
6396
  case 0:
6381
6397
  return _context34.abrupt("return", this.queueCartCommand(function () {
6382
- return _this41.replaceBookingProductWithRelatedRetailDraft(params);
6398
+ return _this42.replaceBookingProductWithRelatedRetailDraft(params);
6383
6399
  }));
6384
6400
  case 1:
6385
6401
  case "end":
@@ -6387,7 +6403,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6387
6403
  }
6388
6404
  }, _callee31, this);
6389
6405
  }));
6390
- function replaceBookingProductWithRelatedRetail(_x35) {
6406
+ function replaceBookingProductWithRelatedRetail(_x37) {
6391
6407
  return _replaceBookingProductWithRelatedRetail.apply(this, arguments);
6392
6408
  }
6393
6409
  return replaceBookingProductWithRelatedRetail;
@@ -6398,7 +6414,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6398
6414
  var _replaceBookingProductWithRelatedRetailDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
6399
6415
  var _target$metadata,
6400
6416
  _target$metadata2,
6401
- _this42 = this,
6417
+ _this43 = this,
6402
6418
  _params$product$num,
6403
6419
  _target$metadata3,
6404
6420
  _params$product$metad,
@@ -6424,7 +6440,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6424
6440
  scopeKey = String((target === null || target === void 0 || (_target$metadata = target.metadata) === null || _target$metadata === void 0 ? void 0 : _target$metadata.venue_booking_scope_key) || '');
6425
6441
  targetBookingUid = String((target === null || target === void 0 ? void 0 : target.booking_uid) || (target === null || target === void 0 || (_target$metadata2 = target.metadata) === null || _target$metadata2 === void 0 ? void 0 : _target$metadata2.booking_uid) || '');
6426
6442
  targetBookings = (live.bookings || []).filter(function (row) {
6427
- return _this42.getBookingUniqueIdentificationNumber(row) === targetBookingUid;
6443
+ return _this43.getBookingUniqueIdentificationNumber(row) === targetBookingUid;
6428
6444
  });
6429
6445
  if (!(!uid || !target || !scopeKey || live.order_id || target.order_detail_id != null || Number(target.num) !== 1 || Number((_params$product$num = params.product.num) !== null && _params$product$num !== void 0 ? _params$product$num : 1) !== 1 || ((_target$metadata3 = target.metadata) === null || _target$metadata3 === void 0 ? void 0 : _target$metadata3.venue_booking_role) !== 'party_main' || ((_params$product$metad = params.product.metadata) === null || _params$product$metad === void 0 ? void 0 : _params$product$metad.venue_booking_role) !== 'party_main' || ((_params$product$metad2 = params.product.metadata) === null || _params$product$metad2 === void 0 ? void 0 : _params$product$metad2.venue_booking_scope_key) !== scopeKey || !Array.isArray(params.relatedRetailProducts) || (live.payments || []).length > 0 || !targetBookingUid || String(((_params$booking$metad = params.booking.metadata) === null || _params$booking$metad === void 0 ? void 0 : _params$booking$metad.unique_identification_number) || '') !== targetBookingUid || targetBookings.length !== 1 || live.products.filter(function (line) {
6430
6446
  var _line$metadata3, _line$metadata4;
@@ -6441,7 +6457,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6441
6457
  });
6442
6458
  if (!children.some(function (line) {
6443
6459
  var _line$metadata7;
6444
- return !getUid(line) || ((_line$metadata7 = line.metadata) === null || _line$metadata7 === void 0 ? void 0 : _line$metadata7.venue_booking_scope_key) !== scopeKey || line.order_detail_id != null || _this42.hasLinkedBookingUid(line);
6460
+ return !getUid(line) || ((_line$metadata7 = line.metadata) === null || _line$metadata7 === void 0 ? void 0 : _line$metadata7.venue_booking_scope_key) !== scopeKey || line.order_detail_id != null || _this43.hasLinkedBookingUid(line);
6445
6461
  })) {
6446
6462
  _context36.next = 16;
6447
6463
  break;
@@ -6472,7 +6488,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6472
6488
  childUid = getUid(child);
6473
6489
  purchaseDatetime = String(((_child$metadata = child.metadata) === null || _child$metadata === void 0 ? void 0 : _child$metadata.venue_booking_service_datetime) || '');
6474
6490
  normalizedPurchaseDatetime = purchaseDatetime.length === 16 ? "".concat(purchaseDatetime, ":00") : purchaseDatetime;
6475
- if (!(((_child$metadata2 = child.metadata) === null || _child$metadata2 === void 0 ? void 0 : _child$metadata2.venue_booking_role) !== 'party_extra' || String(((_child$metadata3 = child.metadata) === null || _child$metadata3 === void 0 ? void 0 : _child$metadata3.venue_booking_parent_uid) || '') !== uid || ((_child$metadata4 = child.metadata) === null || _child$metadata4 === void 0 ? void 0 : _child$metadata4.venue_booking_scope_key) !== scopeKey || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(purchaseDatetime) || !dayjs(purchaseDatetime).isValid() || dayjs(purchaseDatetime).format('YYYY-MM-DD HH:mm:ss') !== normalizedPurchaseDatetime || _this42.hasLinkedBookingUid(child) || child.order_detail_id != null || childUid && (nextUids.has(childUid) || live.products.some(function (line) {
6491
+ if (!(((_child$metadata2 = child.metadata) === null || _child$metadata2 === void 0 ? void 0 : _child$metadata2.venue_booking_role) !== 'party_extra' || String(((_child$metadata3 = child.metadata) === null || _child$metadata3 === void 0 ? void 0 : _child$metadata3.venue_booking_parent_uid) || '') !== uid || ((_child$metadata4 = child.metadata) === null || _child$metadata4 === void 0 ? void 0 : _child$metadata4.venue_booking_scope_key) !== scopeKey || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/.test(purchaseDatetime) || !dayjs(purchaseDatetime).isValid() || dayjs(purchaseDatetime).format('YYYY-MM-DD HH:mm:ss') !== normalizedPurchaseDatetime || _this43.hasLinkedBookingUid(child) || child.order_detail_id != null || childUid && (nextUids.has(childUid) || live.products.some(function (line) {
6476
6492
  return getUid(line) === childUid && !ownedUids.has(childUid);
6477
6493
  })))) {
6478
6494
  _context35.next = 6;
@@ -6534,7 +6550,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6534
6550
  identity = [live.order_id, live.external_sale_number];
6535
6551
  isCurrentOrder = function isCurrentOrder() {
6536
6552
  var _params$availabilityC, _params$availabilityC2;
6537
- return _this42.store.tempOrder === live && live.order_id === identity[0] && live.external_sale_number === identity[1] && ((_params$availabilityC = (_params$availabilityC2 = params.availabilityCommitTargetGuard) === null || _params$availabilityC2 === void 0 ? void 0 : _params$availabilityC2.call(params)) !== null && _params$availabilityC !== void 0 ? _params$availabilityC : true);
6553
+ return _this43.store.tempOrder === live && live.order_id === identity[0] && live.external_sale_number === identity[1] && ((_params$availabilityC = (_params$availabilityC2 = params.availabilityCommitTargetGuard) === null || _params$availabilityC2 === void 0 ? void 0 : _params$availabilityC2.call(params)) !== null && _params$availabilityC !== void 0 ? _params$availabilityC : true);
6538
6554
  };
6539
6555
  draft = mutation.commit ? mutation.draft : cloneDeep(live);
6540
6556
  this.ensureSalesNotesLoadedForMutation(draft);
@@ -6669,7 +6685,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6669
6685
  }
6670
6686
  }, _callee32, this, [[25, 34, 37, 40], [63, 73, 76, 79], [89, 95]]);
6671
6687
  }));
6672
- function replaceBookingProductWithRelatedRetailDraft(_x36) {
6688
+ function replaceBookingProductWithRelatedRetailDraft(_x38) {
6673
6689
  return _replaceBookingProductWithRelatedRetailDraft.apply(this, arguments);
6674
6690
  }
6675
6691
  return replaceBookingProductWithRelatedRetailDraft;
@@ -6687,12 +6703,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6687
6703
  key: "addProductsToOrder",
6688
6704
  value: (function () {
6689
6705
  var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(items, options) {
6690
- var _this43 = this;
6706
+ var _this44 = this;
6691
6707
  return _regeneratorRuntime().wrap(function _callee33$(_context37) {
6692
6708
  while (1) switch (_context37.prev = _context37.next) {
6693
6709
  case 0:
6694
6710
  return _context37.abrupt("return", this.queueCartCommand(function () {
6695
- return _this43.addProductsToOrderDraft(items, options);
6711
+ return _this44.addProductsToOrderDraft(items, options);
6696
6712
  }));
6697
6713
  case 1:
6698
6714
  case "end":
@@ -6700,7 +6716,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6700
6716
  }
6701
6717
  }, _callee33, this);
6702
6718
  }));
6703
- function addProductsToOrder(_x37, _x38) {
6719
+ function addProductsToOrder(_x39, _x40) {
6704
6720
  return _addProductsToOrder.apply(this, arguments);
6705
6721
  }
6706
6722
  return addProductsToOrder;
@@ -6709,8 +6725,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6709
6725
  key: "addProductsToOrderDraft",
6710
6726
  value: function () {
6711
6727
  var _addProductsToOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(items, options) {
6712
- var _this44 = this;
6713
- var mutation, tempOrder, beforeCommit, beforeAppend, _iterator29, _step29, item, product, booking, _ref75, _productRecord$num2, productRecord, splitCount, i, splitLine, _appendResult, appendResult;
6728
+ var mutation, tempOrder, beforeCommit, beforeAppend, virtualPaymentChannel, _iterator29, _step29, item, product, booking, _ref75, _productRecord$num2, productRecord, splitCount, i, splitLine, _appendResult, appendResult;
6714
6729
  return _regeneratorRuntime().wrap(function _callee34$(_context38) {
6715
6730
  while (1) switch (_context38.prev = _context38.next) {
6716
6731
  case 0:
@@ -6724,46 +6739,47 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6724
6739
  case 4:
6725
6740
  beforeCommit = this.createCartIntentCommitGuard('add_product');
6726
6741
  beforeAppend = mutation.commit ? undefined : beforeCommit;
6727
- if (!items.some(function (_ref74) {
6742
+ virtualPaymentChannel = this.getVirtualCurrencyPaymentChannel();
6743
+ if (!(virtualPaymentChannel && items.some(function (_ref74) {
6728
6744
  var product = _ref74.product;
6729
- return product && _this44.requiresPosVirtualCurrencyPayment(product);
6730
- })) {
6731
- _context38.next = 9;
6745
+ return product && isVirtualSettlementProduct(product);
6746
+ }))) {
6747
+ _context38.next = 10;
6732
6748
  break;
6733
6749
  }
6734
- _context38.next = 9;
6735
- return this.validatePosVirtualCurrencyCart(this.ensureTempOrder());
6736
- case 9:
6750
+ _context38.next = 10;
6751
+ return this.validateTerminalVirtualCurrencyCart(this.ensureTempOrder(), virtualPaymentChannel);
6752
+ case 10:
6737
6753
  _iterator29 = _createForOfIteratorHelper(items || []);
6738
- _context38.prev = 10;
6754
+ _context38.prev = 11;
6739
6755
  _iterator29.s();
6740
- case 12:
6756
+ case 13:
6741
6757
  if ((_step29 = _iterator29.n()).done) {
6742
- _context38.next = 38;
6758
+ _context38.next = 39;
6743
6759
  break;
6744
6760
  }
6745
6761
  item = _step29.value;
6746
6762
  product = item.product, booking = item.booking;
6747
6763
  if (product) {
6748
- _context38.next = 17;
6764
+ _context38.next = 18;
6749
6765
  break;
6750
6766
  }
6751
- return _context38.abrupt("continue", 36);
6752
- case 17:
6767
+ return _context38.abrupt("continue", 37);
6768
+ case 18:
6753
6769
  if (!booking) {
6754
- _context38.next = 32;
6770
+ _context38.next = 33;
6755
6771
  break;
6756
6772
  }
6757
6773
  productRecord = product;
6758
6774
  splitCount = getSafeProductNum((_ref75 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref75 !== void 0 ? _ref75 : 1);
6759
6775
  if (!(splitCount > 1)) {
6760
- _context38.next = 32;
6776
+ _context38.next = 33;
6761
6777
  break;
6762
6778
  }
6763
6779
  i = 0;
6764
- case 22:
6780
+ case 23:
6765
6781
  if (!(i < splitCount)) {
6766
- _context38.next = 31;
6782
+ _context38.next = 32;
6767
6783
  break;
6768
6784
  }
6769
6785
  splitLine = this.createSplitBookingLine(productRecord, booking, i, splitCount);
@@ -6771,67 +6787,67 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6771
6787
  beforeCommit: beforeAppend
6772
6788
  });
6773
6789
  if (!_appendResult) {
6774
- _context38.next = 28;
6790
+ _context38.next = 29;
6775
6791
  break;
6776
6792
  }
6777
- _context38.next = 28;
6793
+ _context38.next = 29;
6778
6794
  return _appendResult;
6779
- case 28:
6795
+ case 29:
6780
6796
  i += 1;
6781
- _context38.next = 22;
6797
+ _context38.next = 23;
6782
6798
  break;
6783
- case 31:
6784
- return _context38.abrupt("continue", 36);
6785
6799
  case 32:
6800
+ return _context38.abrupt("continue", 37);
6801
+ case 33:
6786
6802
  appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
6787
6803
  beforeCommit: beforeAppend
6788
6804
  });
6789
6805
  if (!appendResult) {
6790
- _context38.next = 36;
6806
+ _context38.next = 37;
6791
6807
  break;
6792
6808
  }
6793
- _context38.next = 36;
6809
+ _context38.next = 37;
6794
6810
  return appendResult;
6795
- case 36:
6796
- _context38.next = 12;
6811
+ case 37:
6812
+ _context38.next = 13;
6797
6813
  break;
6798
- case 38:
6799
- _context38.next = 43;
6814
+ case 39:
6815
+ _context38.next = 44;
6800
6816
  break;
6801
- case 40:
6802
- _context38.prev = 40;
6803
- _context38.t0 = _context38["catch"](10);
6817
+ case 41:
6818
+ _context38.prev = 41;
6819
+ _context38.t0 = _context38["catch"](11);
6804
6820
  _iterator29.e(_context38.t0);
6805
- case 43:
6806
- _context38.prev = 43;
6821
+ case 44:
6822
+ _context38.prev = 44;
6807
6823
  _iterator29.f();
6808
- return _context38.finish(43);
6809
- case 46:
6824
+ return _context38.finish(44);
6825
+ case 47:
6810
6826
  if (!mutation.commit) {
6811
- _context38.next = 50;
6827
+ _context38.next = 51;
6812
6828
  break;
6813
6829
  }
6814
- _context38.next = 49;
6830
+ _context38.next = 50;
6815
6831
  return mutation.commit({
6816
6832
  beforeCommit: beforeCommit
6817
6833
  });
6818
- case 49:
6819
- tempOrder = _context38.sent;
6820
6834
  case 50:
6821
- _context38.next = 52;
6835
+ tempOrder = _context38.sent;
6836
+ case 51:
6837
+ _context38.next = 53;
6822
6838
  return this.finalizeProductOrderMutation(tempOrder, options);
6823
- case 52:
6839
+ case 53:
6824
6840
  this.logInfo('addProductsToOrder success', {
6825
6841
  itemsCount: items.length
6826
6842
  });
6827
6843
  return _context38.abrupt("return", tempOrder.products);
6828
- case 54:
6844
+ case 55:
6829
6845
  case "end":
6830
6846
  return _context38.stop();
6831
6847
  }
6832
- }, _callee34, this, [[10, 40, 43, 46]]);
6848
+ }, _callee34, this, [[11, 41, 44, 47]]);
6833
6849
  }));
6834
- function addProductsToOrderDraft(_x39, _x40) {
6850
+ function addProductsToOrderDraft(_x41, _x42) {
6835
6851
  return _addProductsToOrderDraft.apply(this, arguments);
6836
6852
  }
6837
6853
  return addProductsToOrderDraft;
@@ -7228,7 +7244,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7228
7244
  }
7229
7245
  }, _callee35, this);
7230
7246
  }));
7231
- function updateOrderProduct(_x41) {
7247
+ function updateOrderProduct(_x43) {
7232
7248
  return _updateOrderProduct.apply(this, arguments);
7233
7249
  }
7234
7250
  return updateOrderProduct;
@@ -7284,7 +7300,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7284
7300
  }
7285
7301
  }, _callee36, this);
7286
7302
  }));
7287
- function updateOrderProductDraft(_x42) {
7303
+ function updateOrderProductDraft(_x44) {
7288
7304
  return _updateOrderProductDraft.apply(this, arguments);
7289
7305
  }
7290
7306
  return updateOrderProductDraft;
@@ -7306,7 +7322,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7306
7322
  }
7307
7323
  }, _callee37, this);
7308
7324
  }));
7309
- function updateOrderProducts(_x43, _x44) {
7325
+ function updateOrderProducts(_x45, _x46) {
7310
7326
  return _updateOrderProducts.apply(this, arguments);
7311
7327
  }
7312
7328
  return updateOrderProducts;
@@ -7374,7 +7390,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7374
7390
  }
7375
7391
  }, _callee38, this);
7376
7392
  }));
7377
- function updateOrderProductsDraft(_x45, _x46) {
7393
+ function updateOrderProductsDraft(_x47, _x48) {
7378
7394
  return _updateOrderProductsDraft.apply(this, arguments);
7379
7395
  }
7380
7396
  return updateOrderProductsDraft;
@@ -7525,7 +7541,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7525
7541
  }
7526
7542
  }, _callee39, this, [[20, 29, 32, 35], [43, 49]]);
7527
7543
  }));
7528
- function updateOrderProductsGuarded(_x47, _x48) {
7544
+ function updateOrderProductsGuarded(_x49, _x50) {
7529
7545
  return _updateOrderProductsGuarded.apply(this, arguments);
7530
7546
  }
7531
7547
  return updateOrderProductsGuarded;
@@ -7547,7 +7563,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7547
7563
  }
7548
7564
  }, _callee40, this);
7549
7565
  }));
7550
- function updateOrderProductQuantity(_x49, _x50) {
7566
+ function updateOrderProductQuantity(_x51, _x52) {
7551
7567
  return _updateOrderProductQuantity.apply(this, arguments);
7552
7568
  }
7553
7569
  return updateOrderProductQuantity;
@@ -7557,7 +7573,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7557
7573
  value: function () {
7558
7574
  var _updateOrderProductQuantityDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params, options) {
7559
7575
  var _this$store$tempOrder10, _targetProduct$metada23;
7560
- var isCurrentOrder, product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, mutation, tempOrder, identityLookup, productIndex, targetUid, targetProduct, isPersistedOrderLine, normalizedProduct, settlementSnapshot, currencyProductId, asset, requiredAmount, balance, beforeCommit, liveOrder, products, customerId, isVirtualSettlement, promotionPayload;
7576
+ var isCurrentOrder, product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, mutation, tempOrder, identityLookup, productIndex, targetUid, targetProduct, isPersistedOrderLine, normalizedProduct, settlementSnapshot, currencyProductId, asset, requiredAmount, balance, beforeCommit, virtualPaymentChannel, liveOrder, products, customerId, isVirtualSettlement, promotionPayload;
7561
7577
  return _regeneratorRuntime().wrap(function _callee41$(_context46) {
7562
7578
  while (1) switch (_context46.prev = _context46.next) {
7563
7579
  case 0:
@@ -7639,96 +7655,97 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7639
7655
  throw new VirtualCurrencyBalanceError(balance.toFixed(2), requiredAmount.toFixed(2));
7640
7656
  case 31:
7641
7657
  beforeCommit = normalizedProduct.num > targetProduct.num ? this.createCartIntentCommitGuard('increase_quantity') : undefined;
7642
- if (!(beforeCommit && this.requiresPosVirtualCurrencyPayment(normalizedProduct))) {
7643
- _context46.next = 40;
7658
+ virtualPaymentChannel = this.getVirtualCurrencyPaymentChannel();
7659
+ if (!(beforeCommit && virtualPaymentChannel && isVirtualSettlementProduct(normalizedProduct))) {
7660
+ _context46.next = 41;
7644
7661
  break;
7645
7662
  }
7646
7663
  liveOrder = this.ensureTempOrder();
7647
7664
  products = cloneDeep(liveOrder.products);
7648
7665
  customerId = liveOrder.customer_id;
7649
- _context46.next = 38;
7650
- return this.validatePosVirtualCurrencyCart(liveOrder);
7651
- case 38:
7666
+ _context46.next = 39;
7667
+ return this.validateTerminalVirtualCurrencyCart(liveOrder, virtualPaymentChannel);
7668
+ case 39:
7652
7669
  if (!(liveOrder.customer_id !== customerId || !isEqual(liveOrder.products, products))) {
7653
- _context46.next = 40;
7670
+ _context46.next = 41;
7654
7671
  break;
7655
7672
  }
7656
7673
  throw Object.assign(new Error('The cart changed. Please try again.'), {
7657
7674
  code: 'SALES_GUARD_REJECTED'
7658
7675
  });
7659
- case 40:
7676
+ case 41:
7660
7677
  if (!mutation.commit) beforeCommit === null || beforeCommit === void 0 || beforeCommit();
7661
7678
  if (!(isCurrentOrder && !isCurrentOrder())) {
7662
- _context46.next = 43;
7679
+ _context46.next = 44;
7663
7680
  break;
7664
7681
  }
7665
7682
  return _context46.abrupt("return", tempOrder.products);
7666
- case 43:
7683
+ case 44:
7667
7684
  tempOrder.products[productIndex] = normalizedProduct;
7668
7685
  if (!mutation.commit) {
7669
- _context46.next = 48;
7686
+ _context46.next = 49;
7670
7687
  break;
7671
7688
  }
7672
- _context46.next = 47;
7689
+ _context46.next = 48;
7673
7690
  return mutation.commit({
7674
7691
  beforeCommit: beforeCommit,
7675
7692
  isCurrentOrder: isCurrentOrder
7676
7693
  });
7677
- case 47:
7678
- tempOrder = _context46.sent;
7679
7694
  case 48:
7695
+ tempOrder = _context46.sent;
7696
+ case 49:
7680
7697
  if (!isCurrentOrder) {
7681
- _context46.next = 53;
7698
+ _context46.next = 54;
7682
7699
  break;
7683
7700
  }
7684
- _context46.next = 51;
7701
+ _context46.next = 52;
7685
7702
  return this.finalizeProductOrderMutation(tempOrder, {
7686
7703
  skipEditDiscountConfigRefresh: true,
7687
7704
  isCurrentOrder: isCurrentOrder
7688
7705
  });
7689
- case 51:
7690
- _context46.next = 69;
7706
+ case 52:
7707
+ _context46.next = 70;
7691
7708
  break;
7692
- case 53:
7709
+ case 54:
7693
7710
  this.prepareVirtualSettlementTempOrder(tempOrder);
7694
7711
  isVirtualSettlement = this.isActiveVirtualSettlementOrder(tempOrder);
7695
7712
  if (isVirtualSettlement) {
7696
- _context46.next = 61;
7713
+ _context46.next = 62;
7697
7714
  break;
7698
7715
  }
7699
- _context46.next = 58;
7716
+ _context46.next = 59;
7700
7717
  return this.evaluatePromotion();
7701
- case 58:
7718
+ case 59:
7702
7719
  _context46.t0 = _context46.sent;
7703
- _context46.next = 62;
7720
+ _context46.next = 63;
7704
7721
  break;
7705
- case 61:
7706
- _context46.t0 = null;
7707
7722
  case 62:
7723
+ _context46.t0 = null;
7724
+ case 63:
7708
7725
  promotionPayload = _context46.t0;
7709
7726
  if (!isVirtualSettlement) {
7710
7727
  this.applyDiscount();
7711
7728
  }
7712
7729
  this.sanitizeTempOrderProducts(tempOrder);
7713
- _context46.next = 67;
7730
+ _context46.next = 68;
7714
7731
  return this.recalculateSummary({
7715
7732
  createIfMissing: true
7716
7733
  });
7717
- case 67:
7734
+ case 68:
7718
7735
  this.persistTempOrder();
7719
7736
  this.emitPromotionApplied(promotionPayload);
7720
- case 69:
7737
+ case 70:
7721
7738
  this.logInfo('updateOrderProductQuantity success', {
7722
7739
  params: params
7723
7740
  });
7724
7741
  return _context46.abrupt("return", tempOrder.products);
7725
- case 71:
7742
+ case 72:
7726
7743
  case "end":
7727
7744
  return _context46.stop();
7728
7745
  }
7729
7746
  }, _callee41, this);
7730
7747
  }));
7731
- function updateOrderProductQuantityDraft(_x51, _x52) {
7748
+ function updateOrderProductQuantityDraft(_x53, _x54) {
7732
7749
  return _updateOrderProductQuantityDraft.apply(this, arguments);
7733
7750
  }
7734
7751
  return updateOrderProductQuantityDraft;
@@ -7828,7 +7845,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7828
7845
  }
7829
7846
  }, _callee42, this);
7830
7847
  }));
7831
- function finalizeAfterProductsMutation(_x53, _x54) {
7848
+ function finalizeAfterProductsMutation(_x55, _x56) {
7832
7849
  return _finalizeAfterProductsMutation.apply(this, arguments);
7833
7850
  }
7834
7851
  return finalizeAfterProductsMutation;
@@ -7857,7 +7874,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7857
7874
  }
7858
7875
  }, _callee43, this);
7859
7876
  }));
7860
- function removeProductsFromOrder(_x55, _x56) {
7877
+ function removeProductsFromOrder(_x57, _x58) {
7861
7878
  return _removeProductsFromOrder.apply(this, arguments);
7862
7879
  }
7863
7880
  return removeProductsFromOrder;
@@ -8062,7 +8079,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8062
8079
  }
8063
8080
  }, _callee44, this, [[23, 34, 37, 40]]);
8064
8081
  }));
8065
- function removeProductsFromOrderDraft(_x57, _x58) {
8082
+ function removeProductsFromOrderDraft(_x59, _x60) {
8066
8083
  return _removeProductsFromOrderDraft.apply(this, arguments);
8067
8084
  }
8068
8085
  return removeProductsFromOrderDraft;
@@ -8081,7 +8098,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8081
8098
  }
8082
8099
  }, _callee45, this);
8083
8100
  }));
8084
- function removeProductFromOrder(_x59, _x60) {
8101
+ function removeProductFromOrder(_x61, _x62) {
8085
8102
  return _removeProductFromOrder.apply(this, arguments);
8086
8103
  }
8087
8104
  return removeProductFromOrder;
@@ -8233,14 +8250,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8233
8250
  }, {
8234
8251
  key: "buildCurrentSubmitPayloadForLocalPrint",
8235
8252
  value: function buildCurrentSubmitPayloadForLocalPrint(params) {
8236
- var _params$cacheId, _this$otherParams6, _ref91, _params$businessCode, _this$otherParams7, _this$otherParams8;
8253
+ var _params$cacheId, _this$otherParams8, _ref91, _params$businessCode, _this$otherParams9, _this$otherParams10;
8237
8254
  var tempOrder = this.ensureTempOrder();
8238
8255
  this.persistTempOrder();
8239
8256
  var payload = buildSubmitPayload({
8240
8257
  tempOrder: tempOrder,
8241
8258
  cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
8242
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform),
8243
- businessCode: (_ref91 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) !== null && _ref91 !== void 0 ? _ref91 : (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code,
8259
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform),
8260
+ businessCode: (_ref91 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode) !== null && _ref91 !== void 0 ? _ref91 : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.business_code,
8244
8261
  channel: params === null || params === void 0 ? void 0 : params.channel,
8245
8262
  type: params === null || params === void 0 ? void 0 : params.type,
8246
8263
  summary: this.store.summary || createEmptySummary(),
@@ -8291,7 +8308,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8291
8308
  }
8292
8309
  }, _callee49, this);
8293
8310
  }));
8294
- function applyLocalPrintOrderNumbers(_x61) {
8311
+ function applyLocalPrintOrderNumbers(_x63) {
8295
8312
  return _applyLocalPrintOrderNumbers.apply(this, arguments);
8296
8313
  }
8297
8314
  return applyLocalPrintOrderNumbers;
@@ -8300,7 +8317,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8300
8317
  key: "saveTempOrderAsDraft",
8301
8318
  value: function () {
8302
8319
  var _saveTempOrderAsDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
8303
- var _params$cacheId2, _this$otherParams9, _this$otherParams10, _this$otherParams11, _params$type, _this$otherParams12, _payload$products;
8320
+ var _params$cacheId2, _this$otherParams11, _this$otherParams12, _this$otherParams13, _params$type, _this$otherParams14, _payload$products;
8304
8321
  var tempOrder, latestSummary, payload;
8305
8322
  return _regeneratorRuntime().wrap(function _callee50$(_context56) {
8306
8323
  while (1) switch (_context56.prev = _context56.next) {
@@ -8331,10 +8348,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8331
8348
  payload = buildSubmitPayload({
8332
8349
  tempOrder: tempOrder,
8333
8350
  cacheId: (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId,
8334
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform),
8335
- businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.business_code) || tempOrder.business_code,
8351
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform),
8352
+ businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.business_code) || tempOrder.business_code,
8336
8353
  channel: params === null || params === void 0 ? void 0 : params.channel,
8337
- type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.type,
8354
+ type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type,
8338
8355
  summary: latestSummary,
8339
8356
  enhance: params === null || params === void 0 ? void 0 : params.enhancePayload
8340
8357
  });
@@ -8358,7 +8375,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8358
8375
  }
8359
8376
  }, _callee50, this);
8360
8377
  }));
8361
- function saveTempOrderAsDraft(_x62) {
8378
+ function saveTempOrderAsDraft(_x64) {
8362
8379
  return _saveTempOrderAsDraft.apply(this, arguments);
8363
8380
  }
8364
8381
  return saveTempOrderAsDraft;
@@ -8383,7 +8400,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8383
8400
  }
8384
8401
  }, _callee51, this);
8385
8402
  }));
8386
- function submitTempOrder(_x63) {
8403
+ function submitTempOrder(_x65) {
8387
8404
  return _submitTempOrder.apply(this, arguments);
8388
8405
  }
8389
8406
  return submitTempOrder;
@@ -8404,7 +8421,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8404
8421
  }
8405
8422
  }, _callee52, this);
8406
8423
  }));
8407
- function submitTempOrderAsync(_x64) {
8424
+ function submitTempOrderAsync(_x66) {
8408
8425
  return _submitTempOrderAsync.apply(this, arguments);
8409
8426
  }
8410
8427
  return submitTempOrderAsync;
@@ -8413,7 +8430,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8413
8430
  key: "runSubmitTempOrder",
8414
8431
  value: function () {
8415
8432
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
8416
- var _params$cacheId3, _this$otherParams13, _ref95, _ref96, _submitSnapshot$busin, _this$otherParams14, _this$otherParams15, _submitSnapshot$type;
8433
+ var _params$cacheId3, _this$otherParams15, _ref95, _ref96, _submitSnapshot$busin, _this$otherParams16, _this$otherParams17, _submitSnapshot$type;
8417
8434
  var tempOrder, isOnlineStorePlatform, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, shouldOverridePaymentStatus, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, isLocalPendingSubmit, salesNotesState, submittedOrderId, resultRecord;
8418
8435
  return _regeneratorRuntime().wrap(function _callee53$(_context59) {
8419
8436
  while (1) switch (_context59.prev = _context59.next) {
@@ -8486,13 +8503,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8486
8503
  payload = buildSubmitPayload({
8487
8504
  tempOrder: tempOrder,
8488
8505
  cacheId: effectiveCacheId,
8489
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform),
8490
- businessCode: (_ref95 = (_ref96 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref96 !== void 0 ? _ref96 : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode) !== null && _ref95 !== void 0 ? _ref95 : (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.business_code,
8506
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform),
8507
+ businessCode: (_ref95 = (_ref96 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref96 !== void 0 ? _ref96 : (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode) !== null && _ref95 !== void 0 ? _ref95 : (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.business_code,
8491
8508
  channel: params === null || params === void 0 ? void 0 : params.channel,
8492
8509
  type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
8493
8510
  summary: latestSummary,
8494
8511
  request_unique_idempotency_token: params === null || params === void 0 ? void 0 : params.request_unique_idempotency_token,
8495
8512
  includePaymentStatus: !isOnlineStorePlatform,
8513
+ enableMultiCurrencySettlement: this.isMultiCurrencySettlementEnabled(),
8496
8514
  enhance: enhancePayload
8497
8515
  });
8498
8516
  if (params !== null && params !== void 0 && params.syncMode) {
@@ -8587,7 +8605,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8587
8605
  }
8588
8606
  }, _callee53, this, [[31, 38]]);
8589
8607
  }));
8590
- function runSubmitTempOrder(_x65) {
8608
+ function runSubmitTempOrder(_x67) {
8591
8609
  return _runSubmitTempOrder.apply(this, arguments);
8592
8610
  }
8593
8611
  return runSubmitTempOrder;
@@ -8614,7 +8632,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8614
8632
  }
8615
8633
  }, _callee54, this);
8616
8634
  }));
8617
- function markLocalOrderSynced(_x66, _x67) {
8635
+ function markLocalOrderSynced(_x68, _x69) {
8618
8636
  return _markLocalOrderSynced.apply(this, arguments);
8619
8637
  }
8620
8638
  return markLocalOrderSynced;
@@ -8784,7 +8802,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8784
8802
  }
8785
8803
  }, _callee55, this);
8786
8804
  }));
8787
- function syncPaymentsToOrder(_x68) {
8805
+ function syncPaymentsToOrder(_x70) {
8788
8806
  return _syncPaymentsToOrder.apply(this, arguments);
8789
8807
  }
8790
8808
  return syncPaymentsToOrder;
@@ -8912,7 +8930,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8912
8930
  }
8913
8931
  }, _callee56, this);
8914
8932
  }));
8915
- function submitOrder(_x69) {
8933
+ function submitOrder(_x71) {
8916
8934
  return _submitOrder.apply(this, arguments);
8917
8935
  }
8918
8936
  return submitOrder;
@@ -8951,7 +8969,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8951
8969
  }
8952
8970
  }, _callee57, this);
8953
8971
  }));
8954
- function cancelOrder(_x70) {
8972
+ function cancelOrder(_x72) {
8955
8973
  return _cancelOrder.apply(this, arguments);
8956
8974
  }
8957
8975
  return cancelOrder;
@@ -8995,7 +9013,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8995
9013
  }
8996
9014
  }, _callee58, this);
8997
9015
  }));
8998
- function changeBookingStatus(_x71) {
9016
+ function changeBookingStatus(_x73) {
8999
9017
  return _changeBookingStatus.apply(this, arguments);
9000
9018
  }
9001
9019
  return changeBookingStatus;
@@ -9116,7 +9134,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9116
9134
  }
9117
9135
  }, _callee59, this, [[4, 16]]);
9118
9136
  }));
9119
- function createOrderByCheckout(_x72) {
9137
+ function createOrderByCheckout(_x74) {
9120
9138
  return _createOrderByCheckout.apply(this, arguments);
9121
9139
  }
9122
9140
  return createOrderByCheckout;
@@ -9148,7 +9166,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9148
9166
  }
9149
9167
  }, _callee60, this);
9150
9168
  }));
9151
- function submitSalesOrder(_x73) {
9169
+ function submitSalesOrder(_x75) {
9152
9170
  return _submitSalesOrder.apply(this, arguments);
9153
9171
  }
9154
9172
  return submitSalesOrder;
@@ -9205,7 +9223,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9205
9223
  }
9206
9224
  }, _callee61, this);
9207
9225
  }));
9208
- function sendCustomerPayLink(_x74) {
9226
+ function sendCustomerPayLink(_x76) {
9209
9227
  return _sendCustomerPayLink.apply(this, arguments);
9210
9228
  }
9211
9229
  return sendCustomerPayLink;
@@ -9247,7 +9265,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9247
9265
  }
9248
9266
  }, _callee62, this);
9249
9267
  }));
9250
- function getSalesOrderByLookup(_x75) {
9268
+ function getSalesOrderByLookup(_x77) {
9251
9269
  return _getSalesOrderByLookup.apply(this, arguments);
9252
9270
  }
9253
9271
  return getSalesOrderByLookup;
@@ -9289,7 +9307,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9289
9307
  }
9290
9308
  }, _callee63, this, [[1, 11]]);
9291
9309
  }));
9292
- function hydrateTempOrderFromRecord(_x76, _x77) {
9310
+ function hydrateTempOrderFromRecord(_x78, _x79) {
9293
9311
  return _hydrateTempOrderFromRecord.apply(this, arguments);
9294
9312
  }
9295
9313
  return hydrateTempOrderFromRecord;
@@ -9490,7 +9508,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9490
9508
  }
9491
9509
  }, _callee64, this);
9492
9510
  }));
9493
- function prepareHydratedTempOrder(_x78, _x79, _x80) {
9511
+ function prepareHydratedTempOrder(_x80, _x81, _x82) {
9494
9512
  return _prepareHydratedTempOrder.apply(this, arguments);
9495
9513
  }
9496
9514
  return prepareHydratedTempOrder;
@@ -9935,7 +9953,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9935
9953
  }
9936
9954
  }, _callee65, this);
9937
9955
  }));
9938
- function getOrderInfo(_x81) {
9956
+ function getOrderInfo(_x83) {
9939
9957
  return _getOrderInfo.apply(this, arguments);
9940
9958
  }
9941
9959
  return getOrderInfo;