@pisell/pisellos 2.3.232 → 2.3.233

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 (42) hide show
  1. package/dist/modules/Customer/types.d.ts +4 -0
  2. package/dist/modules/Order/index.d.ts +9 -0
  3. package/dist/modules/Order/index.js +1350 -1133
  4. package/dist/modules/Order/types.d.ts +3 -0
  5. package/dist/modules/Order/utils/bookingUuid.d.ts +4 -0
  6. package/dist/modules/Order/utils/bookingUuid.js +24 -0
  7. package/dist/modules/Order/utils/virtualSettlement.d.ts +4 -0
  8. package/dist/modules/Order/utils/virtualSettlement.js +13 -0
  9. package/dist/modules/Order/utils.js +11 -6
  10. package/dist/shared/payment/loadPaymentMethods.d.ts +4 -1
  11. package/dist/shared/payment/loadPaymentMethods.js +35 -2
  12. package/dist/solution/BaseSales/index.d.ts +1 -0
  13. package/dist/solution/BaseSales/index.js +516 -423
  14. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +1 -0
  15. package/dist/solution/Checkout/index.js +104 -69
  16. package/dist/solution/Checkout/types.d.ts +1 -0
  17. package/dist/solution/ScanOrder/index.js +10 -2
  18. package/dist/solution/VenueBooking/index.js +522 -490
  19. package/dist/utils/platform.d.ts +1 -0
  20. package/dist/utils/platform.js +4 -0
  21. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  22. package/lib/modules/Customer/types.d.ts +4 -0
  23. package/lib/modules/Order/index.d.ts +9 -0
  24. package/lib/modules/Order/index.js +141 -20
  25. package/lib/modules/Order/types.d.ts +3 -0
  26. package/lib/modules/Order/utils/bookingUuid.d.ts +4 -0
  27. package/lib/modules/Order/utils/bookingUuid.js +25 -0
  28. package/lib/modules/Order/utils/virtualSettlement.d.ts +4 -0
  29. package/lib/modules/Order/utils/virtualSettlement.js +9 -1
  30. package/lib/modules/Order/utils.js +13 -5
  31. package/lib/shared/payment/loadPaymentMethods.d.ts +4 -1
  32. package/lib/shared/payment/loadPaymentMethods.js +13 -0
  33. package/lib/solution/BaseSales/index.d.ts +1 -0
  34. package/lib/solution/BaseSales/index.js +49 -10
  35. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +1 -0
  36. package/lib/solution/Checkout/index.js +21 -0
  37. package/lib/solution/Checkout/types.d.ts +1 -0
  38. package/lib/solution/ScanOrder/index.js +6 -0
  39. package/lib/solution/VenueBooking/index.js +6 -1
  40. package/lib/utils/platform.d.ts +1 -0
  41. package/lib/utils/platform.js +5 -0
  42. package/package.json +1 -1
@@ -49,14 +49,14 @@ import Decimal from 'decimal.js';
49
49
  import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
50
50
  import { createModule } from "../BookingByStep/types";
51
51
  import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
52
- import { buildCurrencyDisplaySnapshot, getTempOrderSettlementSnapshot, isVirtualSettlementOrder } from "../../modules/Order/utils/virtualSettlement";
52
+ import { buildCurrencyDisplaySnapshot, getTempOrderSettlementKey, getTempOrderSettlementSnapshot, isVirtualSettlementOrder, VirtualCurrencyAssetNotFoundError, VirtualCurrencyBalanceError, VirtualCurrencyCustomerRequiredError } from "../../modules/Order/utils/virtualSettlement";
53
53
  import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
54
54
  import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
55
55
  import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
56
56
  import dayjs from 'dayjs';
57
57
  export * from "./types";
58
58
  import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
59
- import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
59
+ import { isCustomerUserPlatform, isPosTerminalPlatform, normalizeRuntimePlatform } from "../../utils/platform";
60
60
  import { OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD } from "../../utils/pos-receipt-auto-print";
61
61
  import { QuotationModule } from "../../modules/Quotation";
62
62
  import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
@@ -256,6 +256,9 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
256
256
  }
257
257
  }
258
258
  var mergedItem = mergedUid ? setOrderCollectionUid(kind, incomingItem, mergedUid) : cloneDeep(incomingItem);
259
+ if (kind === 'booking' && !mergedItem.uuid && currentItem.uuid !== undefined) {
260
+ mergedItem.uuid = currentItem.uuid;
261
+ }
259
262
  var persistentIdField = BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND[kind];
260
263
  if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
261
264
  mergedItem[persistentIdField] = identityMergedItem[persistentIdField];
@@ -1017,6 +1020,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1017
1020
  if (!effects || typeof effects.on !== 'function') return;
1018
1021
  this.paymentMethodsChangedUnsubscribe = effects.on(PAYMENT_METHODS_CHANGED_EVENT, /*#__PURE__*/function () {
1019
1022
  var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(payload) {
1023
+ var _this5$otherParams;
1024
+ var _this5$store$order;
1020
1025
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1021
1026
  while (1) switch (_context6.prev = _context6.next) {
1022
1027
  case 0:
@@ -1026,9 +1031,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1026
1031
  }
1027
1032
  return _context6.abrupt("return");
1028
1033
  case 2:
1029
- _context6.next = 4;
1034
+ if (_this5.isMultiCurrencySettlementEnabled() && isPosTerminalPlatform((_this5$otherParams = _this5.otherParams) === null || _this5$otherParams === void 0 ? void 0 : _this5$otherParams.platform)) {
1035
+ (_this5$store$order = _this5.store.order) === null || _this5$store$order === void 0 || _this5$store$order.syncPosVirtualCurrencyPaymentMethods(payload.newMethods);
1036
+ }
1037
+ _context6.next = 5;
1030
1038
  return _this5.getPaymentMethodsAsync();
1031
- case 4:
1039
+ case 5:
1032
1040
  case "end":
1033
1041
  return _context6.stop();
1034
1042
  }
@@ -4683,68 +4691,73 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4683
4691
  }, {
4684
4692
  key: "buildVirtualSettlementSubmitData",
4685
4693
  value: function () {
4686
- var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
4687
- var settlement, tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
4694
+ var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(settlement, posPaymentMethod) {
4695
+ var tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethod;
4688
4696
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4689
4697
  while (1) switch (_context43.prev = _context43.next) {
4690
4698
  case 0:
4691
- settlement = this.buildVirtualSettlementOrderData();
4692
4699
  if (!(!settlement || !this.store.order)) {
4693
- _context43.next = 3;
4700
+ _context43.next = 2;
4694
4701
  break;
4695
4702
  }
4696
4703
  return _context43.abrupt("return", null);
4697
- case 3:
4704
+ case 2:
4698
4705
  tempOrder = this.store.order.getTempOrder();
4699
4706
  currencyProductId = settlement.currencyProductId;
4700
- _context43.next = 7;
4707
+ _context43.next = 6;
4701
4708
  return this.store.order.recalculateSummary({
4702
4709
  createIfMissing: true
4703
4710
  });
4704
- case 7:
4711
+ case 6:
4705
4712
  summary = _context43.sent;
4706
4713
  amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
4707
4714
  customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
4715
+ if (!(posPaymentMethod && amount.gt(0) && !(customerId > 1))) {
4716
+ _context43.next = 11;
4717
+ break;
4718
+ }
4719
+ throw new VirtualCurrencyCustomerRequiredError();
4720
+ case 11:
4708
4721
  if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
4709
- _context43.next = 13;
4722
+ _context43.next = 14;
4710
4723
  break;
4711
4724
  }
4712
- _context43.next = 13;
4725
+ _context43.next = 14;
4713
4726
  return this.store.order.loadDiscountConfig({
4714
4727
  customerId: customerId,
4715
4728
  action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
4716
4729
  orderId: Number(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || undefined,
4717
4730
  apply: false
4718
4731
  });
4719
- case 13:
4732
+ case 14:
4720
4733
  asset = this.store.order.getVirtualCurrencyList().find(function (item) {
4721
4734
  return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
4722
4735
  });
4723
4736
  if (!amount.lte(0)) {
4724
- _context43.next = 16;
4737
+ _context43.next = 17;
4725
4738
  break;
4726
4739
  }
4727
4740
  return _context43.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4728
4741
  payments: []
4729
4742
  }));
4730
- case 16:
4743
+ case 17:
4731
4744
  if (asset) {
4732
- _context43.next = 18;
4745
+ _context43.next = 19;
4733
4746
  break;
4734
4747
  }
4735
- throw new Error('No matching virtual currency card is available.');
4736
- case 18:
4748
+ throw new VirtualCurrencyAssetNotFoundError(currencyProductId);
4749
+ case 19:
4737
4750
  balance = new Decimal(asset.balance || 0);
4738
4751
  if (!balance.lt(amount)) {
4739
- _context43.next = 21;
4752
+ _context43.next = 22;
4740
4753
  break;
4741
4754
  }
4742
- throw new Error('Insufficient virtual currency balance.');
4743
- case 21:
4755
+ throw new VirtualCurrencyBalanceError(balance.toFixed(2), amount.toFixed(2));
4756
+ case 22:
4744
4757
  amountText = amount.toFixed(2);
4745
4758
  paymentNumber = "LOCAL_".concat(createUuidV4());
4746
- if (!this.store.order.isOnlineStorePlatform()) {
4747
- _context43.next = 27;
4759
+ if (!(!posPaymentMethod && this.store.order.isOnlineStorePlatform())) {
4760
+ _context43.next = 28;
4748
4761
  break;
4749
4762
  }
4750
4763
  payment = {
@@ -4761,22 +4774,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4761
4774
  },
4762
4775
  wallet_pass_use_value: amountText
4763
4776
  };
4764
- _context43.next = 34;
4777
+ _context43.next = 39;
4765
4778
  break;
4766
- case 27:
4767
- _context43.next = 29;
4779
+ case 28:
4780
+ if (!(posPaymentMethod !== null && posPaymentMethod !== void 0)) {
4781
+ _context43.next = 32;
4782
+ break;
4783
+ }
4784
+ _context43.t0 = posPaymentMethod;
4785
+ _context43.next = 35;
4786
+ break;
4787
+ case 32:
4788
+ _context43.next = 34;
4768
4789
  return this.getPaymentMethodsAsync();
4769
- case 29:
4770
- paymentMethods = _context43.sent;
4771
- paymentMethod = paymentMethods.find(function (method) {
4790
+ case 34:
4791
+ _context43.t0 = _context43.sent.find(function (method) {
4772
4792
  return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
4773
4793
  });
4794
+ case 35:
4795
+ paymentMethod = _context43.t0;
4774
4796
  if (paymentMethod) {
4775
- _context43.next = 33;
4797
+ _context43.next = 38;
4776
4798
  break;
4777
4799
  }
4778
4800
  throw new Error('PRODUCTVOUCHER payment method is unavailable.');
4779
- case 33:
4801
+ case 38:
4780
4802
  payment = {
4781
4803
  payment_number: paymentNumber,
4782
4804
  amount: amountText,
@@ -4795,17 +4817,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4795
4817
  wallet_pass_use_value: amountText,
4796
4818
  metadata: {}
4797
4819
  };
4798
- case 34:
4820
+ case 39:
4799
4821
  return _context43.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
4800
4822
  payments: [payment]
4801
4823
  }));
4802
- case 35:
4824
+ case 40:
4803
4825
  case "end":
4804
4826
  return _context43.stop();
4805
4827
  }
4806
4828
  }, _callee43, this);
4807
4829
  }));
4808
- function buildVirtualSettlementSubmitData() {
4830
+ function buildVirtualSettlementSubmitData(_x33, _x34) {
4809
4831
  return _buildVirtualSettlementSubmitData.apply(this, arguments);
4810
4832
  }
4811
4833
  return buildVirtualSettlementSubmitData;
@@ -4820,8 +4842,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4820
4842
  key: "submitSalesOrder",
4821
4843
  value: (function () {
4822
4844
  var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
4823
- var _params$smallTicketDa, _this$otherParams21, _this$otherParams22, _this$otherParams23, _this$otherParams24;
4824
- var isDeferredPayment, virtualPaymentSettlement, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, _enhancePayload, submitParams;
4845
+ var _this$otherParams21,
4846
+ _this21 = this,
4847
+ _params$smallTicketDa,
4848
+ _this$otherParams22,
4849
+ _this$otherParams23,
4850
+ _this$otherParams24,
4851
+ _this$otherParams25;
4852
+ var isDeferredPayment, checkoutOrder, virtualOrderData, checkoutCustomerId, checkoutSettlementKey, posPaymentMethod, readCheckoutLines, checkoutLines, assertCheckoutCartUnchanged, virtualPaymentSettlement, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, _enhancePayload, submitParams, waitForVirtualPayment;
4825
4853
  return _regeneratorRuntime().wrap(function _callee44$(_context44) {
4826
4854
  while (1) switch (_context44.prev = _context44.next) {
4827
4855
  case 0:
@@ -4844,21 +4872,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4844
4872
  });
4845
4873
  case 7:
4846
4874
  isDeferredPayment = (params === null || params === void 0 ? void 0 : params.paymentExecution) === 'deferred';
4875
+ checkoutOrder = this.store.order.getTempOrder();
4876
+ virtualOrderData = this.buildVirtualSettlementOrderData();
4877
+ checkoutCustomerId = checkoutOrder === null || checkoutOrder === void 0 ? void 0 : checkoutOrder.customer_id;
4878
+ checkoutSettlementKey = getTempOrderSettlementKey(checkoutOrder);
4879
+ posPaymentMethod = virtualOrderData && isPosTerminalPlatform((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform) ? this.store.order.getPosVirtualCurrencyPaymentMethod(this.getPaymentMethods()) : undefined;
4880
+ readCheckoutLines = function readCheckoutLines() {
4881
+ return checkoutOrder === null || checkoutOrder === void 0 ? void 0 : checkoutOrder.products.map(function (product) {
4882
+ var _product$product_vari3, _product$num2;
4883
+ return [String(product.product_id), String((_product$product_vari3 = product.product_variant_id) !== null && _product$product_vari3 !== void 0 ? _product$product_vari3 : 0), Number((_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : 1)];
4884
+ });
4885
+ };
4886
+ checkoutLines = posPaymentMethod && !isDeferredPayment ? readCheckoutLines() : undefined;
4887
+ assertCheckoutCartUnchanged = function assertCheckoutCartUnchanged() {
4888
+ var _this21$store$order;
4889
+ if (posPaymentMethod && (((_this21$store$order = _this21.store.order) === null || _this21$store$order === void 0 ? void 0 : _this21$store$order.getTempOrder()) !== checkoutOrder || (checkoutOrder === null || checkoutOrder === void 0 ? void 0 : checkoutOrder.customer_id) !== checkoutCustomerId || getTempOrderSettlementKey(checkoutOrder) !== checkoutSettlementKey || checkoutLines && !isEqual(readCheckoutLines(), checkoutLines))) {
4890
+ throw salesGuardError('The cart changed. Please try again.');
4891
+ }
4892
+ };
4847
4893
  if (!isDeferredPayment) {
4848
- _context44.next = 12;
4894
+ _context44.next = 20;
4849
4895
  break;
4850
4896
  }
4851
4897
  _context44.t0 = null;
4852
- _context44.next = 15;
4898
+ _context44.next = 23;
4853
4899
  break;
4854
- case 12:
4855
- _context44.next = 14;
4856
- return this.buildVirtualSettlementSubmitData();
4857
- case 14:
4900
+ case 20:
4901
+ _context44.next = 22;
4902
+ return this.buildVirtualSettlementSubmitData(virtualOrderData, posPaymentMethod);
4903
+ case 22:
4858
4904
  _context44.t0 = _context44.sent;
4859
- case 15:
4905
+ case 23:
4860
4906
  virtualPaymentSettlement = _context44.t0;
4861
- virtualSettlement = isDeferredPayment ? this.buildVirtualSettlementOrderData() : virtualPaymentSettlement; // this.store.order.persistTempOrder();
4907
+ assertCheckoutCartUnchanged();
4908
+ virtualSettlement = isDeferredPayment ? virtualOrderData : virtualPaymentSettlement; // this.store.order.persistTempOrder();
4862
4909
  inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
4863
4910
  smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
4864
4911
  virtualSettlementEnhancePayload = virtualSettlement ? function (payload, ctx) {
@@ -4890,10 +4937,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4890
4937
  } : configuredEnhancePayload;
4891
4938
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
4892
4939
  cacheId: this.cacheId,
4893
- platform: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform,
4894
- businessCode: ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.businessCode) || ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.business_code),
4940
+ platform: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
4941
+ businessCode: ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode) || ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.business_code),
4895
4942
  channel: this.getSubmitOrderSalesChannel(),
4896
- type: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.type,
4943
+ type: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type,
4897
4944
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
4898
4945
  }, isDeferredPayment ? {
4899
4946
  payments: []
@@ -4913,6 +4960,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4913
4960
  enhancePayload: function enhancePayload(payload, ctx) {
4914
4961
  var _callerPayload$metada2, _currencySettlementCo2;
4915
4962
  var callerPayload = _enhancePayload ? _enhancePayload(payload, ctx) : payload;
4963
+ if (posPaymentMethod && virtualPaymentSettlement) {
4964
+ var _callerPayload$summar, _summary$total_amount, _callerPayload$paymen, _payment$amount;
4965
+ assertCheckoutCartUnchanged();
4966
+ var summary = (_callerPayload$summar = callerPayload.summary) !== null && _callerPayload$summar !== void 0 ? _callerPayload$summar : payload.summary;
4967
+ var orderAmount = Decimal.max(0, (_summary$total_amount = summary === null || summary === void 0 ? void 0 : summary.total_amount) !== null && _summary$total_amount !== void 0 ? _summary$total_amount : 0).toDecimalPlaces(2);
4968
+ var payment = (_callerPayload$paymen = callerPayload.payments) === null || _callerPayload$paymen === void 0 ? void 0 : _callerPayload$paymen.find(function (item) {
4969
+ return item.code === posPaymentMethod.code;
4970
+ });
4971
+ if (!orderAmount.eq((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : 0)) {
4972
+ throw salesGuardError('The cart changed. Please try again.');
4973
+ }
4974
+ }
4916
4975
  var currencySettlementConfig = ((_callerPayload$metada2 = callerPayload.metadata) === null || _callerPayload$metada2 === void 0 ? void 0 : _callerPayload$metada2.currency_settlement_config) || {};
4917
4976
  return _objectSpread(_objectSpread({}, callerPayload), {}, {
4918
4977
  metadata: _objectSpread(_objectSpread({}, callerPayload.metadata || {}), {}, {
@@ -4930,14 +4989,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4930
4989
  } : _enhancePayload !== undefined ? {
4931
4990
  enhancePayload: _enhancePayload
4932
4991
  } : {});
4933
- return _context44.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4934
- case 24:
4992
+ waitForVirtualPayment = Boolean(posPaymentMethod && (virtualPaymentSettlement === null || virtualPaymentSettlement === void 0 ? void 0 : virtualPaymentSettlement.payments.length));
4993
+ return _context44.abrupt("return", !waitForVirtualPayment && this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
4994
+ case 34:
4935
4995
  case "end":
4936
4996
  return _context44.stop();
4937
4997
  }
4938
4998
  }, _callee44, this);
4939
4999
  }));
4940
- function submitSalesOrder(_x33) {
5000
+ function submitSalesOrder(_x35) {
4941
5001
  return _submitSalesOrder.apply(this, arguments);
4942
5002
  }
4943
5003
  return submitSalesOrder;
@@ -5040,7 +5100,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5040
5100
  }
5041
5101
  }, _callee45, this, [[18, 23]]);
5042
5102
  }));
5043
- function finalizeLocalEftposPayment(_x34) {
5103
+ function finalizeLocalEftposPayment(_x36) {
5044
5104
  return _finalizeLocalEftposPayment.apply(this, arguments);
5045
5105
  }
5046
5106
  return finalizeLocalEftposPayment;
@@ -5160,7 +5220,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5160
5220
  key: "saveSalesOrderDraft",
5161
5221
  value: function () {
5162
5222
  var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5163
- var _params$platform, _this$otherParams25, _this$otherParams26, _this$otherParams27, _params$channel, _params$type, _this$otherParams28;
5223
+ var _params$platform, _this$otherParams26, _this$otherParams27, _this$otherParams28, _params$channel, _params$type, _this$otherParams29;
5164
5224
  return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5165
5225
  while (1) switch (_context47.prev = _context47.next) {
5166
5226
  case 0:
@@ -5181,10 +5241,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5181
5241
  case 5:
5182
5242
  return _context47.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
5183
5243
  cacheId: this.cacheId,
5184
- platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform,
5185
- businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.businessCode) || ((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.business_code),
5244
+ platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.platform,
5245
+ businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.businessCode) || ((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.business_code),
5186
5246
  channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
5187
- type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.type
5247
+ type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.type
5188
5248
  }, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
5189
5249
  enhancePayload: params.enhancePayload
5190
5250
  } : {})));
@@ -5194,7 +5254,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5194
5254
  }
5195
5255
  }, _callee47, this);
5196
5256
  }));
5197
- function saveSalesOrderDraft(_x35) {
5257
+ function saveSalesOrderDraft(_x37) {
5198
5258
  return _saveSalesOrderDraft.apply(this, arguments);
5199
5259
  }
5200
5260
  return saveSalesOrderDraft;
@@ -5203,7 +5263,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5203
5263
  key: "submitTempOrderAsync",
5204
5264
  value: function () {
5205
5265
  var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
5206
- var _params$smallTicketDa2, _this$otherParams29, _this$otherParams30, _this$otherParams31, _this$otherParams32;
5266
+ var _params$smallTicketDa2, _this$otherParams30, _this$otherParams31, _this$otherParams32, _this$otherParams33;
5207
5267
  var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
5208
5268
  return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5209
5269
  while (1) switch (_context48.prev = _context48.next) {
@@ -5231,10 +5291,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5231
5291
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
5232
5292
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5233
5293
  cacheId: this.cacheId,
5234
- platform: (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.platform,
5235
- businessCode: ((_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.businessCode) || ((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.business_code),
5294
+ platform: (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.platform,
5295
+ businessCode: ((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) || ((_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.business_code),
5236
5296
  channel: this.getSubmitOrderSalesChannel(),
5237
- type: (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.type,
5297
+ type: (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.type,
5238
5298
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
5239
5299
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
5240
5300
  payments: params.payments
@@ -5254,7 +5314,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5254
5314
  }
5255
5315
  }, _callee48, this);
5256
5316
  }));
5257
- function submitTempOrderAsync(_x36) {
5317
+ function submitTempOrderAsync(_x38) {
5258
5318
  return _submitTempOrderAsync.apply(this, arguments);
5259
5319
  }
5260
5320
  return submitTempOrderAsync;
@@ -5266,8 +5326,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5266
5326
  }, {
5267
5327
  key: "shouldUseCheckoutSyncTask",
5268
5328
  value: function shouldUseCheckoutSyncTask() {
5269
- var _this$otherParams33;
5270
- var configured = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.checkoutSyncTaskEnabled;
5329
+ var _this$otherParams34;
5330
+ var configured = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.checkoutSyncTaskEnabled;
5271
5331
  return typeof configured === 'boolean' ? configured : true;
5272
5332
  }
5273
5333
 
@@ -5281,7 +5341,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5281
5341
  key: "printLocalOrderReceipt",
5282
5342
  value: function () {
5283
5343
  var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(lookup) {
5284
- var _this$otherParams34, _this$otherParams35, _this$otherParams36, _this$otherParams37;
5344
+ var _this$otherParams35, _this$otherParams36, _this$otherParams37, _this$otherParams38;
5285
5345
  var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order19, _data;
5286
5346
  return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5287
5347
  while (1) switch (_context49.prev = _context49.next) {
@@ -5299,10 +5359,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5299
5359
  external_sale_number: lookup
5300
5360
  };
5301
5361
  context = {
5302
- platform: (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.platform,
5303
- businessCode: ((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.businessCode) || ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.business_code),
5362
+ platform: (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.platform,
5363
+ businessCode: ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.businessCode) || ((_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.business_code),
5304
5364
  channel: this.getSubmitOrderSalesChannel(),
5305
- type: (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.type
5365
+ type: (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.type
5306
5366
  };
5307
5367
  payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
5308
5368
  lookup_order_from_db: 1,
@@ -5346,7 +5406,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5346
5406
  }
5347
5407
  }, _callee49, this);
5348
5408
  }));
5349
- function printLocalOrderReceipt(_x37) {
5409
+ function printLocalOrderReceipt(_x39) {
5350
5410
  return _printLocalOrderReceipt.apply(this, arguments);
5351
5411
  }
5352
5412
  return printLocalOrderReceipt;
@@ -5368,7 +5428,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5368
5428
  key: "syncPaymentsToOrder",
5369
5429
  value: function () {
5370
5430
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
5371
- var _ref51, _params$businessCode, _this$otherParams38, _this$otherParams39, _params$channel2;
5431
+ var _ref51, _params$businessCode, _this$otherParams39, _this$otherParams40, _params$channel2;
5372
5432
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
5373
5433
  return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5374
5434
  while (1) switch (_context50.prev = _context50.next) {
@@ -5379,7 +5439,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5379
5439
  }
5380
5440
  throw new Error('order 模块未初始化');
5381
5441
  case 2:
5382
- businessCode = (_ref51 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.businessCode) !== null && _ref51 !== void 0 ? _ref51 : (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.business_code;
5442
+ businessCode = (_ref51 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.businessCode) !== null && _ref51 !== void 0 ? _ref51 : (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.business_code;
5383
5443
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
5384
5444
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
5385
5445
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -5463,7 +5523,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5463
5523
  }
5464
5524
  }, _callee50, this, [[13, 30]]);
5465
5525
  }));
5466
- function syncPaymentsToOrder(_x38) {
5526
+ function syncPaymentsToOrder(_x40) {
5467
5527
  return _syncPaymentsToOrder.apply(this, arguments);
5468
5528
  }
5469
5529
  return syncPaymentsToOrder;
@@ -5500,13 +5560,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5500
5560
  }, {
5501
5561
  key: "scheduleQueuedAutoPaymentSyncFlush",
5502
5562
  value: function scheduleQueuedAutoPaymentSyncFlush() {
5503
- var _this21 = this;
5563
+ var _this22 = this;
5504
5564
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
5505
5565
  if (!this.queuedAutoPaymentSync) return;
5506
5566
  if (this.autoPaymentSyncTimer) return;
5507
5567
  this.autoPaymentSyncTimer = setTimeout(function () {
5508
- _this21.autoPaymentSyncTimer = null;
5509
- void _this21.flushQueuedAutoPaymentSync();
5568
+ _this22.autoPaymentSyncTimer = null;
5569
+ void _this22.flushQueuedAutoPaymentSync();
5510
5570
  }, delay);
5511
5571
  }
5512
5572
  }, {
@@ -5633,7 +5693,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5633
5693
  }
5634
5694
  }, _callee52, this);
5635
5695
  }));
5636
- function addOrderPaymentAsync(_x39) {
5696
+ function addOrderPaymentAsync(_x41) {
5637
5697
  return _addOrderPaymentAsync.apply(this, arguments);
5638
5698
  }
5639
5699
  return addOrderPaymentAsync;
@@ -5641,12 +5701,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5641
5701
  }, {
5642
5702
  key: "addOrderPaymentWithDevicePrefix",
5643
5703
  value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
5644
- var _this$otherParams40,
5704
+ var _this$otherParams41,
5645
5705
  _paymentRecord$paymen,
5646
5706
  _paymentRecord$create,
5647
5707
  _ref52,
5648
5708
  _paymentRecord$origin,
5649
- _this22 = this;
5709
+ _this23 = this;
5650
5710
  if (!this.store.order) throw new Error('order 模块未初始化');
5651
5711
  var paymentRecord = payment;
5652
5712
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -5657,7 +5717,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5657
5717
  return this.store.order.getOrderPayments();
5658
5718
  }
5659
5719
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
5660
- var shopWalletPassId = (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.shop_wallet_pass_id;
5720
+ var shopWalletPassId = (_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.shop_wallet_pass_id;
5661
5721
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
5662
5722
  metadata.shop_wallet_pass_id = shopWalletPassId;
5663
5723
  }
@@ -5690,7 +5750,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5690
5750
  submitWhenPaid: true,
5691
5751
  smallTicketDataFlag: 1
5692
5752
  }).catch(function (error) {
5693
- _this22.logError('auto sync payments failed', {
5753
+ _this23.logError('auto sync payments failed', {
5694
5754
  error: error instanceof Error ? error.message : String(error)
5695
5755
  });
5696
5756
  });
@@ -5821,7 +5881,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5821
5881
  }
5822
5882
  }, _callee53, this, [[17, 23]]);
5823
5883
  }));
5824
- function updateOrderPayment(_x40, _x41) {
5884
+ function updateOrderPayment(_x42, _x43) {
5825
5885
  return _updateOrderPayment.apply(this, arguments);
5826
5886
  }
5827
5887
  return updateOrderPayment;
@@ -5860,7 +5920,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5860
5920
  }
5861
5921
  }, _callee54, this);
5862
5922
  }));
5863
- function updateVoucherOrderPaymentsAsync(_x42, _x43) {
5923
+ function updateVoucherOrderPaymentsAsync(_x44, _x45) {
5864
5924
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
5865
5925
  }
5866
5926
  return updateVoucherOrderPaymentsAsync;
@@ -5894,7 +5954,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5894
5954
  // const products = tempOrder?.products?.filter(n => n.product_id)
5895
5955
 
5896
5956
  var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
5897
- var _product$holder_id, _product$product_vari3, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
5957
+ var _product$holder_id, _product$product_vari4, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
5898
5958
  var metadata = product.metadata || {};
5899
5959
  var rawHolderId = hasProductBooking(product) ? (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id : getProductHolderRelations(tempOrder, product).filter(function (relation) {
5900
5960
  return relation.holder_type === 'form';
@@ -5905,7 +5965,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5905
5965
  var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
5906
5966
  return {
5907
5967
  product_id: product.product_id || 0,
5908
- product_variant_id: String((_product$product_vari3 = product.product_variant_id) !== null && _product$product_vari3 !== void 0 ? _product$product_vari3 : ''),
5968
+ product_variant_id: String((_product$product_vari4 = product.product_variant_id) !== null && _product$product_vari4 !== void 0 ? _product$product_vari4 : ''),
5909
5969
  quantity: product.num || 1,
5910
5970
  is_price_include_tax: tempOrder.is_price_include_tax,
5911
5971
  is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
@@ -6034,7 +6094,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6034
6094
  }
6035
6095
  }, _callee55, this);
6036
6096
  }));
6037
- function initWalletData(_x44) {
6097
+ function initWalletData(_x46) {
6038
6098
  return _initWalletData.apply(this, arguments);
6039
6099
  }
6040
6100
  return initWalletData;
@@ -6105,7 +6165,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6105
6165
  }
6106
6166
  }, _callee56, this);
6107
6167
  }));
6108
- function publishWalletAssetsState(_x45) {
6168
+ function publishWalletAssetsState(_x47) {
6109
6169
  return _publishWalletAssetsState.apply(this, arguments);
6110
6170
  }
6111
6171
  return publishWalletAssetsState;
@@ -6186,7 +6246,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6186
6246
  }
6187
6247
  }, _callee57, this);
6188
6248
  }));
6189
- function syncSelectedWalletAssets(_x46) {
6249
+ function syncSelectedWalletAssets(_x48) {
6190
6250
  return _syncSelectedWalletAssets.apply(this, arguments);
6191
6251
  }
6192
6252
  return syncSelectedWalletAssets;
@@ -6244,7 +6304,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6244
6304
  }
6245
6305
  }, _callee58, this);
6246
6306
  }));
6247
- function importWalletAssetsSnapshot(_x47) {
6307
+ function importWalletAssetsSnapshot(_x49) {
6248
6308
  return _importWalletAssetsSnapshot.apply(this, arguments);
6249
6309
  }
6250
6310
  return importWalletAssetsSnapshot;
@@ -6338,7 +6398,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6338
6398
  }
6339
6399
  }, _callee59, this);
6340
6400
  }));
6341
- function refreshWalletAssets(_x48) {
6401
+ function refreshWalletAssets(_x50) {
6342
6402
  return _refreshWalletAssets.apply(this, arguments);
6343
6403
  }
6344
6404
  return refreshWalletAssets;
@@ -6371,7 +6431,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6371
6431
  }
6372
6432
  }, _callee60, this);
6373
6433
  }));
6374
- function selectWalletAsset(_x49) {
6434
+ function selectWalletAsset(_x51) {
6375
6435
  return _selectWalletAsset.apply(this, arguments);
6376
6436
  }
6377
6437
  return selectWalletAsset;
@@ -6401,7 +6461,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6401
6461
  }
6402
6462
  }, _callee61, this);
6403
6463
  }));
6404
- function updateWalletAssetAmount(_x50) {
6464
+ function updateWalletAssetAmount(_x52) {
6405
6465
  return _updateWalletAssetAmount.apply(this, arguments);
6406
6466
  }
6407
6467
  return updateWalletAssetAmount;
@@ -6446,7 +6506,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6446
6506
  }
6447
6507
  }, _callee62, this);
6448
6508
  }));
6449
- function scanWalletAsset(_x51) {
6509
+ function scanWalletAsset(_x53) {
6450
6510
  return _scanWalletAsset.apply(this, arguments);
6451
6511
  }
6452
6512
  return scanWalletAsset;
@@ -6551,6 +6611,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6551
6611
  value: function getPaymentMethods() {
6552
6612
  return _toConsumableArray(this.paymentMethodsCache);
6553
6613
  }
6614
+ }, {
6615
+ key: "hasPosVirtualCurrencyPaymentMethod",
6616
+ value: function () {
6617
+ var _hasPosVirtualCurrencyPaymentMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
6618
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6619
+ while (1) switch (_context65.prev = _context65.next) {
6620
+ case 0:
6621
+ if (this.store.order) {
6622
+ _context65.next = 2;
6623
+ break;
6624
+ }
6625
+ return _context65.abrupt("return", false);
6626
+ case 2:
6627
+ _context65.prev = 2;
6628
+ _context65.next = 5;
6629
+ return this.store.order.refreshPosVirtualCurrencyPaymentMethod();
6630
+ case 5:
6631
+ return _context65.abrupt("return", true);
6632
+ case 8:
6633
+ _context65.prev = 8;
6634
+ _context65.t0 = _context65["catch"](2);
6635
+ return _context65.abrupt("return", false);
6636
+ case 11:
6637
+ case "end":
6638
+ return _context65.stop();
6639
+ }
6640
+ }, _callee65, this, [[2, 8]]);
6641
+ }));
6642
+ function hasPosVirtualCurrencyPaymentMethod() {
6643
+ return _hasPosVirtualCurrencyPaymentMethod.apply(this, arguments);
6644
+ }
6645
+ return hasPosVirtualCurrencyPaymentMethod;
6646
+ }()
6554
6647
  }, {
6555
6648
  key: "findCashPaymentMethod",
6556
6649
  value: function findCashPaymentMethod(paymentMethods, paymentMethodId) {
@@ -6578,7 +6671,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6578
6671
  }
6579
6672
  try {
6580
6673
  return total.plus(payment.amount || 0).plus(payment.rounding_amount || 0);
6581
- } catch (_unused8) {
6674
+ } catch (_unused9) {
6582
6675
  return total;
6583
6676
  }
6584
6677
  }, new Decimal(0));
@@ -6588,8 +6681,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6588
6681
  }, {
6589
6682
  key: "getCashPaymentConfig",
6590
6683
  value: (function () {
6591
- var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
6592
- var _this$store$order30, _this$store$order30$g, _this$store$order31, _this$store$order31$g, _this$otherParams41;
6684
+ var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
6685
+ var _this$store$order30, _this$store$order30$g, _this$store$order31, _this$store$order31$g, _this$otherParams42;
6593
6686
  var options,
6594
6687
  paymentMethods,
6595
6688
  paymentMethod,
@@ -6598,13 +6691,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6598
6691
  amountDue,
6599
6692
  currency,
6600
6693
  recommendedAmounts,
6601
- _args65 = arguments;
6602
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6603
- while (1) switch (_context65.prev = _context65.next) {
6694
+ _args66 = arguments;
6695
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6696
+ while (1) switch (_context66.prev = _context66.next) {
6604
6697
  case 0:
6605
- options = _args65.length > 0 && _args65[0] !== undefined ? _args65[0] : {};
6698
+ options = _args66.length > 0 && _args66[0] !== undefined ? _args66[0] : {};
6606
6699
  if (this.store.payment) {
6607
- _context65.next = 3;
6700
+ _context66.next = 3;
6608
6701
  break;
6609
6702
  }
6610
6703
  throw new Error('payment 模块未初始化');
@@ -6612,17 +6705,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6612
6705
  paymentMethods = this.getPaymentMethods();
6613
6706
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
6614
6707
  if (paymentMethod) {
6615
- _context65.next = 10;
6708
+ _context66.next = 10;
6616
6709
  break;
6617
6710
  }
6618
- _context65.next = 8;
6711
+ _context66.next = 8;
6619
6712
  return this.getPaymentMethodsAsync();
6620
6713
  case 8:
6621
- paymentMethods = _context65.sent;
6714
+ paymentMethods = _context66.sent;
6622
6715
  paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
6623
6716
  case 10:
6624
6717
  if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
6625
- _context65.next = 12;
6718
+ _context66.next = 12;
6626
6719
  break;
6627
6720
  }
6628
6721
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
@@ -6630,9 +6723,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6630
6723
  amountSnapshot = (_this$store$order30 = this.store.order) === null || _this$store$order30 === void 0 || (_this$store$order30$g = _this$store$order30.getOrderAmountSnapshot) === null || _this$store$order30$g === void 0 ? void 0 : _this$store$order30$g.call(_this$store$order30);
6631
6724
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
6632
6725
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
6633
- currency = ((_this$store$order31 = this.store.order) === null || _this$store$order31 === void 0 || (_this$store$order31$g = _this$store$order31.getTempOrder) === null || _this$store$order31$g === void 0 || (_this$store$order31$g = _this$store$order31$g.call(_this$store$order31)) === null || _this$store$order31$g === void 0 ? void 0 : _this$store$order31$g.currency_code) || ((_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41.currency) || 'USD';
6726
+ currency = ((_this$store$order31 = this.store.order) === null || _this$store$order31 === void 0 || (_this$store$order31$g = _this$store$order31.getTempOrder) === null || _this$store$order31$g === void 0 || (_this$store$order31$g = _this$store$order31$g.call(_this$store$order31)) === null || _this$store$order31$g === void 0 ? void 0 : _this$store$order31$g.currency_code) || ((_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.currency) || 'USD';
6634
6727
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
6635
- return _context65.abrupt("return", {
6728
+ return _context66.abrupt("return", {
6636
6729
  available: Boolean(paymentMethod && amountDue > 0),
6637
6730
  paymentMethod: paymentMethod,
6638
6731
  amountDue: amountDue,
@@ -6640,9 +6733,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6640
6733
  });
6641
6734
  case 18:
6642
6735
  case "end":
6643
- return _context65.stop();
6736
+ return _context66.stop();
6644
6737
  }
6645
- }, _callee65, this);
6738
+ }, _callee66, this);
6646
6739
  }));
6647
6740
  function getCashPaymentConfig() {
6648
6741
  return _getCashPaymentConfig.apply(this, arguments);
@@ -6659,45 +6752,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6659
6752
  }, {
6660
6753
  key: "confirmWalletPayment",
6661
6754
  value: (function () {
6662
- var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
6755
+ var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
6663
6756
  var _this$store$order$get9, _this$store$order32, _this$store$order$get11, _this$store$order$get12, _this$store$order34;
6664
6757
  var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order33, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
6665
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6666
- while (1) switch (_context66.prev = _context66.next) {
6758
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6759
+ while (1) switch (_context67.prev = _context67.next) {
6667
6760
  case 0:
6668
6761
  if (this.store.order) {
6669
- _context66.next = 2;
6762
+ _context67.next = 2;
6670
6763
  break;
6671
6764
  }
6672
6765
  throw new Error('order 模块未初始化');
6673
6766
  case 2:
6674
- _context66.next = 4;
6767
+ _context67.next = 4;
6675
6768
  return this.validateContactInfo();
6676
6769
  case 4:
6677
6770
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
6678
6771
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
6679
6772
  amountSnapshot = (_this$store$order$get9 = (_this$store$order32 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order32);
6680
6773
  if (!pendingWalletAmount.lte(0)) {
6681
- _context66.next = 16;
6774
+ _context67.next = 16;
6682
6775
  break;
6683
6776
  }
6684
6777
  this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
6685
6778
  amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
6686
6779
  });
6687
- _context66.next = 11;
6780
+ _context67.next = 11;
6688
6781
  return this.submitSalesOrder({
6689
6782
  smallTicketDataFlag: 1
6690
6783
  });
6691
6784
  case 11:
6692
- _submitResult = _context66.sent;
6785
+ _submitResult = _context67.sent;
6693
6786
  if (!isRejectedSalesSubmitResult(_submitResult)) {
6694
- _context66.next = 14;
6787
+ _context67.next = 14;
6695
6788
  break;
6696
6789
  }
6697
6790
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
6698
6791
  case 14:
6699
6792
  _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order33 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order33);
6700
- return _context66.abrupt("return", {
6793
+ return _context67.abrupt("return", {
6701
6794
  submitResult: _submitResult,
6702
6795
  payments: this.store.order.getOrderPayments(),
6703
6796
  isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
@@ -6705,74 +6798,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6705
6798
  case 16:
6706
6799
  effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
6707
6800
  if (!effectiveAmountDue.gt(0.01)) {
6708
- _context66.next = 19;
6801
+ _context67.next = 19;
6709
6802
  break;
6710
6803
  }
6711
6804
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
6712
6805
  case 19:
6713
6806
  beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
6714
- _context66.prev = 20;
6715
- _context66.next = 23;
6807
+ _context67.prev = 20;
6808
+ _context67.next = 23;
6716
6809
  return this.submitSalesOrder({
6717
6810
  smallTicketDataFlag: 1,
6718
6811
  confirmPendingVoucherPayments: true
6719
6812
  });
6720
6813
  case 23:
6721
- submitResult = _context66.sent;
6814
+ submitResult = _context67.sent;
6722
6815
  if (!isRejectedSalesSubmitResult(submitResult)) {
6723
- _context66.next = 26;
6816
+ _context67.next = 26;
6724
6817
  break;
6725
6818
  }
6726
6819
  throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
6727
6820
  case 26:
6728
- _context66.next = 36;
6821
+ _context67.next = 36;
6729
6822
  break;
6730
6823
  case 28:
6731
- _context66.prev = 28;
6732
- _context66.t0 = _context66["catch"](20);
6824
+ _context67.prev = 28;
6825
+ _context67.t0 = _context67["catch"](20);
6733
6826
  this.store.order.setOrderPayments(beforePayments);
6734
6827
  restoredTempOrder = this.store.order.getTempOrder();
6735
6828
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6736
6829
  restoredTempOrder.payment_status = beforePaymentStatus;
6737
6830
  this.store.order.persistTempOrder();
6738
6831
  }
6739
- _context66.next = 35;
6832
+ _context67.next = 35;
6740
6833
  return this.store.order.recalculateSummary({
6741
6834
  createIfMissing: true
6742
6835
  });
6743
6836
  case 35:
6744
- throw _context66.t0;
6837
+ throw _context67.t0;
6745
6838
  case 36:
6746
6839
  if (!this.store.payment) {
6747
- _context66.next = 47;
6840
+ _context67.next = 47;
6748
6841
  break;
6749
6842
  }
6750
- _context66.prev = 37;
6843
+ _context67.prev = 37;
6751
6844
  committed = this.getCommittedWalletAssets();
6752
6845
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6753
- _context66.next = 42;
6846
+ _context67.next = 42;
6754
6847
  return this.publishWalletAssetsState(walletState, 'local');
6755
6848
  case 42:
6756
- _context66.next = 47;
6849
+ _context67.next = 47;
6757
6850
  break;
6758
6851
  case 44:
6759
- _context66.prev = 44;
6760
- _context66.t1 = _context66["catch"](37);
6852
+ _context67.prev = 44;
6853
+ _context67.t1 = _context67["catch"](37);
6761
6854
  this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
6762
- error: _context66.t1 instanceof Error ? _context66.t1.message : String(_context66.t1)
6855
+ error: _context67.t1 instanceof Error ? _context67.t1.message : String(_context67.t1)
6763
6856
  });
6764
6857
  case 47:
6765
6858
  latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order34 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order34);
6766
- return _context66.abrupt("return", {
6859
+ return _context67.abrupt("return", {
6767
6860
  submitResult: submitResult,
6768
6861
  payments: this.store.order.getOrderPayments(),
6769
6862
  isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
6770
6863
  });
6771
6864
  case 49:
6772
6865
  case "end":
6773
- return _context66.stop();
6866
+ return _context67.stop();
6774
6867
  }
6775
- }, _callee66, this, [[20, 28], [37, 44]]);
6868
+ }, _callee67, this, [[20, 28], [37, 44]]);
6776
6869
  }));
6777
6870
  function confirmWalletPayment() {
6778
6871
  return _confirmWalletPayment.apply(this, arguments);
@@ -6787,56 +6880,56 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6787
6880
  }, {
6788
6881
  key: "payCash",
6789
6882
  value: (function () {
6790
- var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6791
- var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams42, _this$window, _this$window$postMess;
6883
+ var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6884
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams43, _this$window, _this$window$postMess;
6792
6885
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, actualPaidAmount, changeAmount, shopWalletPassId, paymentTimestamp, payments, payment, syncResult, committed, walletState, restoredTempOrder;
6793
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6794
- while (1) switch (_context67.prev = _context67.next) {
6886
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6887
+ while (1) switch (_context68.prev = _context68.next) {
6795
6888
  case 0:
6796
6889
  if (this.store.order) {
6797
- _context67.next = 2;
6890
+ _context68.next = 2;
6798
6891
  break;
6799
6892
  }
6800
6893
  throw new Error('order 模块未初始化');
6801
6894
  case 2:
6802
- _context67.next = 4;
6895
+ _context68.next = 4;
6803
6896
  return this.validateContactInfo();
6804
6897
  case 4:
6805
6898
  amount = Number(params.amount || 0);
6806
6899
  if (!(!Number.isFinite(amount) || amount <= 0)) {
6807
- _context67.next = 7;
6900
+ _context68.next = 7;
6808
6901
  break;
6809
6902
  }
6810
6903
  throw new Error('现金支付金额必须大于 0');
6811
6904
  case 7:
6812
6905
  if (!(params.paymentMethodId === undefined)) {
6813
- _context67.next = 13;
6906
+ _context68.next = 13;
6814
6907
  break;
6815
6908
  }
6816
- _context67.next = 10;
6909
+ _context68.next = 10;
6817
6910
  return this.getCashPaymentConfig();
6818
6911
  case 10:
6819
- _context67.t0 = _context67.sent;
6820
- _context67.next = 16;
6912
+ _context68.t0 = _context68.sent;
6913
+ _context68.next = 16;
6821
6914
  break;
6822
6915
  case 13:
6823
- _context67.next = 15;
6916
+ _context68.next = 15;
6824
6917
  return this.getCashPaymentConfig({
6825
6918
  paymentMethodId: params.paymentMethodId
6826
6919
  });
6827
6920
  case 15:
6828
- _context67.t0 = _context67.sent;
6921
+ _context68.t0 = _context68.sent;
6829
6922
  case 16:
6830
- config = _context67.t0;
6923
+ config = _context68.t0;
6831
6924
  paymentMethod = config.paymentMethod;
6832
6925
  if (paymentMethod) {
6833
- _context67.next = 20;
6926
+ _context68.next = 20;
6834
6927
  break;
6835
6928
  }
6836
6929
  throw new Error('未找到可用的 CASHMANUAL 支付方式');
6837
6930
  case 20:
6838
6931
  if (!(config.amountDue <= 0)) {
6839
- _context67.next = 22;
6932
+ _context68.next = 22;
6840
6933
  break;
6841
6934
  }
6842
6935
  throw new Error('当前订单没有待支付金额');
@@ -6844,7 +6937,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6844
6937
  roundingAmount = Number(params.roundingAmount || 0);
6845
6938
  effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
6846
6939
  if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
6847
- _context67.next = 26;
6940
+ _context68.next = 26;
6848
6941
  break;
6849
6942
  }
6850
6943
  throw new Error('现金支付金额超过当前待支付金额');
@@ -6854,18 +6947,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6854
6947
  uniquePaymentNumber = createUuidV4();
6855
6948
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
6856
6949
  changeAmount = Number(params.changeAmount || 0);
6857
- shopWalletPassId = (_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.shop_wallet_pass_id;
6950
+ shopWalletPassId = (_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.shop_wallet_pass_id;
6858
6951
  if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
6859
- _context67.next = 34;
6952
+ _context68.next = 34;
6860
6953
  break;
6861
6954
  }
6862
6955
  throw new Error('顾客实收现金不能小于支付金额');
6863
6956
  case 34:
6864
6957
  if (!this.isPickupTimingEnabled()) {
6865
- _context67.next = 37;
6958
+ _context68.next = 37;
6866
6959
  break;
6867
6960
  }
6868
- _context67.next = 37;
6961
+ _context68.next = 37;
6869
6962
  return this.preparePickupTimingForCheckout({
6870
6963
  freeze: true
6871
6964
  });
@@ -6902,8 +6995,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6902
6995
  var _item$metadata2;
6903
6996
  return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
6904
6997
  });
6905
- _context67.prev = 42;
6906
- _context67.next = 45;
6998
+ _context68.prev = 42;
6999
+ _context68.next = 45;
6907
7000
  return this.syncPaymentsToOrder({
6908
7001
  payments: payments,
6909
7002
  submitWhenPaid: true,
@@ -6911,50 +7004,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6911
7004
  confirmPendingVoucherPayments: true
6912
7005
  });
6913
7006
  case 45:
6914
- syncResult = _context67.sent;
7007
+ syncResult = _context68.sent;
6915
7008
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
6916
- _context67.next = 48;
7009
+ _context68.next = 48;
6917
7010
  break;
6918
7011
  }
6919
7012
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
6920
7013
  case 48:
6921
7014
  if (!this.store.payment) {
6922
- _context67.next = 53;
7015
+ _context68.next = 53;
6923
7016
  break;
6924
7017
  }
6925
7018
  committed = this.getCommittedWalletAssets();
6926
7019
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
6927
- _context67.next = 53;
7020
+ _context68.next = 53;
6928
7021
  return this.publishWalletAssetsState(walletState, 'local');
6929
7022
  case 53:
6930
- return _context67.abrupt("return", {
7023
+ return _context68.abrupt("return", {
6931
7024
  payment: payment || {},
6932
7025
  payments: this.store.order.getOrderPayments(),
6933
7026
  syncResult: syncResult,
6934
7027
  isOrderFullyPaid: syncResult.isOrderFullyPaid
6935
7028
  });
6936
7029
  case 56:
6937
- _context67.prev = 56;
6938
- _context67.t1 = _context67["catch"](42);
7030
+ _context68.prev = 56;
7031
+ _context68.t1 = _context68["catch"](42);
6939
7032
  this.store.order.setOrderPayments(beforePayments);
6940
7033
  restoredTempOrder = this.store.order.getTempOrder();
6941
7034
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
6942
7035
  restoredTempOrder.payment_status = beforePaymentStatus;
6943
7036
  this.store.order.persistTempOrder();
6944
7037
  }
6945
- _context67.next = 63;
7038
+ _context68.next = 63;
6946
7039
  return this.store.order.recalculateSummary({
6947
7040
  createIfMissing: true
6948
7041
  });
6949
7042
  case 63:
6950
- throw _context67.t1;
7043
+ throw _context68.t1;
6951
7044
  case 64:
6952
7045
  case "end":
6953
- return _context67.stop();
7046
+ return _context68.stop();
6954
7047
  }
6955
- }, _callee67, this, [[42, 56]]);
7048
+ }, _callee68, this, [[42, 56]]);
6956
7049
  }));
6957
- function payCash(_x52) {
7050
+ function payCash(_x54) {
6958
7051
  return _payCash.apply(this, arguments);
6959
7052
  }
6960
7053
  return payCash;
@@ -6970,21 +7063,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6970
7063
  }, {
6971
7064
  key: "commitPaymentMethodPayment",
6972
7065
  value: (function () {
6973
- var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
7066
+ var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(params) {
6974
7067
  var _this$store$order$get14, _this$store$order35, _this$store$order$get15, _params$metadata, _params$originAmount;
6975
7068
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
6976
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6977
- while (1) switch (_context68.prev = _context68.next) {
7069
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
7070
+ while (1) switch (_context69.prev = _context69.next) {
6978
7071
  case 0:
6979
7072
  if (this.store.order) {
6980
- _context68.next = 2;
7073
+ _context69.next = 2;
6981
7074
  break;
6982
7075
  }
6983
7076
  throw new Error('order 模块未初始化');
6984
7077
  case 2:
6985
7078
  amount = Number(params.amount || 0);
6986
7079
  if (!(!Number.isFinite(amount) || amount <= 0)) {
6987
- _context68.next = 5;
7080
+ _context69.next = 5;
6988
7081
  break;
6989
7082
  }
6990
7083
  throw new Error('支付金额必须大于 0');
@@ -7000,17 +7093,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7000
7093
  };
7001
7094
  paymentMethod = findPaymentMethod();
7002
7095
  if (paymentMethod) {
7003
- _context68.next = 13;
7096
+ _context69.next = 13;
7004
7097
  break;
7005
7098
  }
7006
- _context68.next = 11;
7099
+ _context69.next = 11;
7007
7100
  return this.getPaymentMethodsAsync();
7008
7101
  case 11:
7009
- paymentMethods = _context68.sent;
7102
+ paymentMethods = _context69.sent;
7010
7103
  paymentMethod = findPaymentMethod();
7011
7104
  case 13:
7012
7105
  if (paymentMethod) {
7013
- _context68.next = 15;
7106
+ _context69.next = 15;
7014
7107
  break;
7015
7108
  }
7016
7109
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
@@ -7019,13 +7112,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7019
7112
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
7020
7113
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
7021
7114
  if (!amountDue.lte(0)) {
7022
- _context68.next = 20;
7115
+ _context69.next = 20;
7023
7116
  break;
7024
7117
  }
7025
7118
  throw new Error('当前订单没有待支付金额');
7026
7119
  case 20:
7027
7120
  if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
7028
- _context68.next = 22;
7121
+ _context69.next = 22;
7029
7122
  break;
7030
7123
  }
7031
7124
  throw new Error('支付金额超过当前待支付金额');
@@ -7065,8 +7158,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7065
7158
  var _item$metadata3;
7066
7159
  return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
7067
7160
  });
7068
- _context68.prev = 31;
7069
- _context68.next = 34;
7161
+ _context69.prev = 31;
7162
+ _context69.next = 34;
7070
7163
  return this.syncPaymentsToOrder({
7071
7164
  payments: payments,
7072
7165
  submitWhenPaid: true,
@@ -7074,50 +7167,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7074
7167
  confirmPendingVoucherPayments: true
7075
7168
  });
7076
7169
  case 34:
7077
- syncResult = _context68.sent;
7170
+ syncResult = _context69.sent;
7078
7171
  if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
7079
- _context68.next = 37;
7172
+ _context69.next = 37;
7080
7173
  break;
7081
7174
  }
7082
7175
  throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
7083
7176
  case 37:
7084
7177
  if (!this.store.payment) {
7085
- _context68.next = 42;
7178
+ _context69.next = 42;
7086
7179
  break;
7087
7180
  }
7088
7181
  committed = this.getCommittedWalletAssets();
7089
7182
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
7090
- _context68.next = 42;
7183
+ _context69.next = 42;
7091
7184
  return this.publishWalletAssetsState(walletState, 'local');
7092
7185
  case 42:
7093
- return _context68.abrupt("return", {
7186
+ return _context69.abrupt("return", {
7094
7187
  payment: payment || {},
7095
7188
  payments: this.store.order.getOrderPayments(),
7096
7189
  syncResult: syncResult,
7097
7190
  isOrderFullyPaid: syncResult.isOrderFullyPaid
7098
7191
  });
7099
7192
  case 45:
7100
- _context68.prev = 45;
7101
- _context68.t0 = _context68["catch"](31);
7193
+ _context69.prev = 45;
7194
+ _context69.t0 = _context69["catch"](31);
7102
7195
  this.store.order.setOrderPayments(beforePayments);
7103
7196
  restoredTempOrder = this.store.order.getTempOrder();
7104
7197
  if (restoredTempOrder && beforePaymentStatus !== undefined) {
7105
7198
  restoredTempOrder.payment_status = beforePaymentStatus;
7106
7199
  this.store.order.persistTempOrder();
7107
7200
  }
7108
- _context68.next = 52;
7201
+ _context69.next = 52;
7109
7202
  return this.store.order.recalculateSummary({
7110
7203
  createIfMissing: true
7111
7204
  });
7112
7205
  case 52:
7113
- throw _context68.t0;
7206
+ throw _context69.t0;
7114
7207
  case 53:
7115
7208
  case "end":
7116
- return _context68.stop();
7209
+ return _context69.stop();
7117
7210
  }
7118
- }, _callee68, this, [[31, 45]]);
7211
+ }, _callee69, this, [[31, 45]]);
7119
7212
  }));
7120
- function commitPaymentMethodPayment(_x53) {
7213
+ function commitPaymentMethodPayment(_x55) {
7121
7214
  return _commitPaymentMethodPayment.apply(this, arguments);
7122
7215
  }
7123
7216
  return commitPaymentMethodPayment;
@@ -7132,40 +7225,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7132
7225
  }, {
7133
7226
  key: "roundAmount",
7134
7227
  value: (function () {
7135
- var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(params) {
7228
+ var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
7136
7229
  var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
7137
7230
  var amount, cashManualPayment;
7138
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
7139
- while (1) switch (_context69.prev = _context69.next) {
7231
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7232
+ while (1) switch (_context70.prev = _context70.next) {
7140
7233
  case 0:
7141
7234
  amount = params.amount;
7142
7235
  cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
7143
7236
  return paymentMethod.code === 'CASHMANUAL';
7144
7237
  });
7145
7238
  if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
7146
- _context69.next = 4;
7239
+ _context70.next = 4;
7147
7240
  break;
7148
7241
  }
7149
- return _context69.abrupt("return", {
7242
+ return _context70.abrupt("return", {
7150
7243
  originalAmount: amount.toString(),
7151
7244
  roundedAmount: amount.toString(),
7152
7245
  roundingDifference: '0.00'
7153
7246
  });
7154
7247
  case 4:
7155
7248
  if (this.payment) {
7156
- _context69.next = 6;
7249
+ _context70.next = 6;
7157
7250
  break;
7158
7251
  }
7159
7252
  throw new Error('payment 模块未初始化');
7160
7253
  case 6:
7161
- return _context69.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
7254
+ return _context70.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
7162
7255
  case 7:
7163
7256
  case "end":
7164
- return _context69.stop();
7257
+ return _context70.stop();
7165
7258
  }
7166
- }, _callee69, this);
7259
+ }, _callee70, this);
7167
7260
  }));
7168
- function roundAmount(_x54) {
7261
+ function roundAmount(_x56) {
7169
7262
  return _roundAmount.apply(this, arguments);
7170
7263
  }
7171
7264
  return roundAmount;
@@ -7180,49 +7273,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7180
7273
  }, {
7181
7274
  key: "sendCustomerPayLink",
7182
7275
  value: (function () {
7183
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
7276
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
7184
7277
  var orderIds, _ref56, _ref57, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
7185
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7186
- while (1) switch (_context70.prev = _context70.next) {
7278
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7279
+ while (1) switch (_context71.prev = _context71.next) {
7187
7280
  case 0:
7188
7281
  if (this.store.order) {
7189
- _context70.next = 2;
7282
+ _context71.next = 2;
7190
7283
  break;
7191
7284
  }
7192
7285
  throw new Error('order 模块未初始化');
7193
7286
  case 2:
7194
7287
  orderIds = params.order_ids || params.orderIds || [];
7195
7288
  if (!(!orderIds.length || params.submitBeforeSend)) {
7196
- _context70.next = 11;
7289
+ _context71.next = 11;
7197
7290
  break;
7198
7291
  }
7199
- _context70.next = 6;
7292
+ _context71.next = 6;
7200
7293
  return this.submitSalesOrder({
7201
7294
  smallTicketDataFlag: 1
7202
7295
  });
7203
7296
  case 6:
7204
- submitResult = _context70.sent;
7297
+ submitResult = _context71.sent;
7205
7298
  orderId = (_ref56 = (_ref57 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref57 !== void 0 ? _ref57 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref56 !== void 0 ? _ref56 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
7206
7299
  if (orderId) {
7207
- _context70.next = 10;
7300
+ _context71.next = 10;
7208
7301
  break;
7209
7302
  }
7210
7303
  throw new Error('本地订单提交云端失败,无法发送支付链接');
7211
7304
  case 10:
7212
7305
  orderIds = [orderId];
7213
7306
  case 11:
7214
- return _context70.abrupt("return", this.store.order.sendCustomerPayLink({
7307
+ return _context71.abrupt("return", this.store.order.sendCustomerPayLink({
7215
7308
  emails: params.emails,
7216
7309
  notify_action: params.notify_action,
7217
7310
  order_ids: orderIds
7218
7311
  }));
7219
7312
  case 12:
7220
7313
  case "end":
7221
- return _context70.stop();
7314
+ return _context71.stop();
7222
7315
  }
7223
- }, _callee70, this);
7316
+ }, _callee71, this);
7224
7317
  }));
7225
- function sendCustomerPayLink(_x55) {
7318
+ function sendCustomerPayLink(_x57) {
7226
7319
  return _sendCustomerPayLink.apply(this, arguments);
7227
7320
  }
7228
7321
  return sendCustomerPayLink;
@@ -7237,14 +7330,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7237
7330
  }, {
7238
7331
  key: "calculateVenueCatalogProductBookingPrice",
7239
7332
  value: (function () {
7240
- var _calculateVenueCatalogProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params, source) {
7333
+ var _calculateVenueCatalogProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params, source) {
7241
7334
  var _params$customer_id;
7242
7335
  var customerId, channel, queryPayload, authoritativeProduct;
7243
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7244
- while (1) switch (_context71.prev = _context71.next) {
7336
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7337
+ while (1) switch (_context72.prev = _context72.next) {
7245
7338
  case 0:
7246
7339
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
7247
- _context71.next = 3;
7340
+ _context72.next = 3;
7248
7341
  return this.prepareProductPriceQueryContext(customerId);
7249
7342
  case 3:
7250
7343
  channel = this.getPriceQueryChannel(params.channel);
@@ -7261,14 +7354,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7261
7354
  queryPayload: queryPayload
7262
7355
  });
7263
7356
  if (authoritativeProduct) {
7264
- _context71.next = 8;
7357
+ _context72.next = 8;
7265
7358
  break;
7266
7359
  }
7267
7360
  throw Object.assign(new Error('Complete product pricing rules are not ready. Please retry.'), {
7268
7361
  code: 'VENUE_LOCAL_PRICE_UNAVAILABLE'
7269
7362
  });
7270
7363
  case 8:
7271
- return _context71.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
7364
+ return _context72.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
7272
7365
  channel: channel,
7273
7366
  customer_id: customerId,
7274
7367
  product: this.mergeProductForPriceQuery(params.product, authoritativeProduct),
@@ -7277,11 +7370,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7277
7370
  })));
7278
7371
  case 9:
7279
7372
  case "end":
7280
- return _context71.stop();
7373
+ return _context72.stop();
7281
7374
  }
7282
- }, _callee71, this);
7375
+ }, _callee72, this);
7283
7376
  }));
7284
- function calculateVenueCatalogProductBookingPrice(_x56, _x57) {
7377
+ function calculateVenueCatalogProductBookingPrice(_x58, _x59) {
7285
7378
  return _calculateVenueCatalogProductBookingPrice.apply(this, arguments);
7286
7379
  }
7287
7380
  return calculateVenueCatalogProductBookingPrice;
@@ -7289,25 +7382,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7289
7382
  }, {
7290
7383
  key: "calculateProductBookingPrice",
7291
7384
  value: function () {
7292
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(params) {
7385
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(params) {
7293
7386
  var _yield$this$calculate, _yield$this$calculate2, result;
7294
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7295
- while (1) switch (_context72.prev = _context72.next) {
7387
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7388
+ while (1) switch (_context73.prev = _context73.next) {
7296
7389
  case 0:
7297
- _context72.next = 2;
7390
+ _context73.next = 2;
7298
7391
  return this.calculateProductBookingPrices([params]);
7299
7392
  case 2:
7300
- _yield$this$calculate = _context72.sent;
7393
+ _yield$this$calculate = _context73.sent;
7301
7394
  _yield$this$calculate2 = _slicedToArray(_yield$this$calculate, 1);
7302
7395
  result = _yield$this$calculate2[0];
7303
- return _context72.abrupt("return", result);
7396
+ return _context73.abrupt("return", result);
7304
7397
  case 6:
7305
7398
  case "end":
7306
- return _context72.stop();
7399
+ return _context73.stop();
7307
7400
  }
7308
- }, _callee72, this);
7401
+ }, _callee73, this);
7309
7402
  }));
7310
- function calculateProductBookingPrice(_x58) {
7403
+ function calculateProductBookingPrice(_x60) {
7311
7404
  return _calculateProductBookingPrice.apply(this, arguments);
7312
7405
  }
7313
7406
  return calculateProductBookingPrice;
@@ -7315,7 +7408,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7315
7408
  }, {
7316
7409
  key: "getQuotationCustomerScopeInfo",
7317
7410
  value: function getQuotationCustomerScopeInfo() {
7318
- var _this23 = this;
7411
+ var _this24 = this;
7319
7412
  var quotation = this.store.quotation;
7320
7413
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
7321
7414
  return quotation.getQuotationCustomerScopeInfo();
@@ -7327,7 +7420,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7327
7420
  }).map(function (item) {
7328
7421
  var localSeen = new Set();
7329
7422
  var customers = item.customer.filter(function (customer) {
7330
- var customerId = _this23.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
7423
+ var customerId = _this24.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
7331
7424
  if (!customerId || localSeen.has(customerId)) return false;
7332
7425
  localSeen.add(customerId);
7333
7426
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -7391,20 +7484,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7391
7484
  }, {
7392
7485
  key: "resolveProductBookingPriceGroups",
7393
7486
  value: function () {
7394
- var _resolveProductBookingPriceGroups = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(paramsList, currentOrderCustomerId) {
7395
- var _this24 = this,
7396
- _this$otherParams43;
7487
+ var _resolveProductBookingPriceGroups = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(paramsList, currentOrderCustomerId) {
7488
+ var _this25 = this,
7489
+ _this$otherParams44;
7397
7490
  var strictDurationPricing,
7398
7491
  resolvedChannels,
7399
7492
  authoritativeProducts,
7400
7493
  groups,
7401
- _args74 = arguments;
7402
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7403
- while (1) switch (_context74.prev = _context74.next) {
7494
+ _args75 = arguments;
7495
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7496
+ while (1) switch (_context75.prev = _context75.next) {
7404
7497
  case 0:
7405
- strictDurationPricing = _args74.length > 2 && _args74[2] !== undefined ? _args74[2] : false;
7498
+ strictDurationPricing = _args75.length > 2 && _args75[2] !== undefined ? _args75[2] : false;
7406
7499
  resolvedChannels = paramsList.map(function (params) {
7407
- return _this24.getPriceQueryChannel(params.channel);
7500
+ return _this25.getPriceQueryChannel(params.channel);
7408
7501
  });
7409
7502
  authoritativeProducts = paramsList.map(function () {
7410
7503
  return null;
@@ -7412,10 +7505,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7412
7505
  groups = new Map();
7413
7506
  paramsList.forEach(function (params, index) {
7414
7507
  var _params$customer_id2;
7415
- var schedule = _this24.getPriceQuerySchedule(params);
7508
+ var schedule = _this25.getPriceQuerySchedule(params);
7416
7509
  var channel = resolvedChannels[index];
7417
7510
  var customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : currentOrderCustomerId;
7418
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this24.normalizePriceContextCustomerId(customerId) || ''].join('|');
7511
+ var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this25.normalizePriceContextCustomerId(customerId) || ''].join('|');
7419
7512
  var group = groups.get(groupKey) || {
7420
7513
  indices: [],
7421
7514
  schedule: schedule,
@@ -7425,21 +7518,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7425
7518
  group.indices.push(index);
7426
7519
  groups.set(groupKey, group);
7427
7520
  });
7428
- _context74.next = 7;
7521
+ _context75.next = 7;
7429
7522
  return forEachPriceQueryGroup(Array.from(groups.values()), /*#__PURE__*/function () {
7430
- var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(group) {
7523
+ var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(group) {
7431
7524
  var priceQueries, resolvedProducts;
7432
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7433
- while (1) switch (_context73.prev = _context73.next) {
7525
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7526
+ while (1) switch (_context74.prev = _context74.next) {
7434
7527
  case 0:
7435
- _context73.next = 2;
7436
- return _this24.prepareProductPriceQueryContext(group.customerId);
7528
+ _context74.next = 2;
7529
+ return _this25.prepareProductPriceQueryContext(group.customerId);
7437
7530
  case 2:
7438
7531
  priceQueries = group.indices.map(function (index) {
7439
7532
  return paramsList[index];
7440
7533
  });
7441
- _context73.next = 5;
7442
- return _this24.resolveProductsForPriceQuery({
7534
+ _context74.next = 5;
7535
+ return _this25.resolveProductsForPriceQuery({
7443
7536
  priceQueries: priceQueries,
7444
7537
  schedule: group.schedule,
7445
7538
  customerId: group.customerId,
@@ -7447,29 +7540,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7447
7540
  strictDurationPricing: strictDurationPricing
7448
7541
  });
7449
7542
  case 5:
7450
- resolvedProducts = _context73.sent;
7543
+ resolvedProducts = _context74.sent;
7451
7544
  group.indices.forEach(function (originalIndex, groupIndex) {
7452
7545
  authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
7453
7546
  });
7454
7547
  case 7:
7455
7548
  case "end":
7456
- return _context73.stop();
7549
+ return _context74.stop();
7457
7550
  }
7458
- }, _callee73);
7551
+ }, _callee74);
7459
7552
  }));
7460
- return function (_x61) {
7553
+ return function (_x63) {
7461
7554
  return _ref58.apply(this, arguments);
7462
7555
  };
7463
- }(), normalizeRuntimePlatform((_this$otherParams43 = this.otherParams) === null || _this$otherParams43 === void 0 ? void 0 : _this$otherParams43.platform) === 'pos' ? 4 : groups.size);
7556
+ }(), normalizeRuntimePlatform((_this$otherParams44 = this.otherParams) === null || _this$otherParams44 === void 0 ? void 0 : _this$otherParams44.platform) === 'pos' ? 4 : groups.size);
7464
7557
  case 7:
7465
- return _context74.abrupt("return", authoritativeProducts);
7558
+ return _context75.abrupt("return", authoritativeProducts);
7466
7559
  case 8:
7467
7560
  case "end":
7468
- return _context74.stop();
7561
+ return _context75.stop();
7469
7562
  }
7470
- }, _callee74, this);
7563
+ }, _callee75, this);
7471
7564
  }));
7472
- function resolveProductBookingPriceGroups(_x59, _x60) {
7565
+ function resolveProductBookingPriceGroups(_x61, _x62) {
7473
7566
  return _resolveProductBookingPriceGroups.apply(this, arguments);
7474
7567
  }
7475
7568
  return resolveProductBookingPriceGroups;
@@ -7477,34 +7570,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7477
7570
  }, {
7478
7571
  key: "calculateProductBookingPrices",
7479
7572
  value: function () {
7480
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(paramsList) {
7481
- var _this$otherParams44,
7482
- _this25 = this;
7573
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(paramsList) {
7574
+ var _this$otherParams45,
7575
+ _this26 = this;
7483
7576
  var useCustomerUserPricing, isPos, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, plans, segmentQueries, segmentQueryIndices, segmentProducts, quotationContexts;
7484
- return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7485
- while (1) switch (_context75.prev = _context75.next) {
7577
+ return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7578
+ while (1) switch (_context76.prev = _context76.next) {
7486
7579
  case 0:
7487
7580
  if (paramsList.length) {
7488
- _context75.next = 2;
7581
+ _context76.next = 2;
7489
7582
  break;
7490
7583
  }
7491
- return _context75.abrupt("return", []);
7584
+ return _context76.abrupt("return", []);
7492
7585
  case 2:
7493
7586
  useCustomerUserPricing = this.isCustomerUserPriceQuery();
7494
- isPos = normalizeRuntimePlatform((_this$otherParams44 = this.otherParams) === null || _this$otherParams44 === void 0 ? void 0 : _this$otherParams44.platform) === 'pos';
7587
+ isPos = normalizeRuntimePlatform((_this$otherParams45 = this.otherParams) === null || _this$otherParams45 === void 0 ? void 0 : _this$otherParams45.platform) === 'pos';
7495
7588
  quotation = useCustomerUserPricing ? undefined : this.store.quotation;
7496
7589
  currentOrderCustomerId = this.getCurrentOrderCustomerId();
7497
7590
  resolvedChannels = paramsList.map(function (params) {
7498
- return _this25.getPriceQueryChannel(params.channel);
7591
+ return _this26.getPriceQueryChannel(params.channel);
7499
7592
  });
7500
- _context75.next = 9;
7593
+ _context76.next = 9;
7501
7594
  return this.resolveProductBookingPriceGroups(paramsList, currentOrderCustomerId);
7502
7595
  case 9:
7503
- authoritativeProducts = _context75.sent;
7596
+ authoritativeProducts = _context76.sent;
7504
7597
  if (!paramsList.some(function (params, index) {
7505
7598
  return params.requireAuthoritativePrice && !authoritativeProducts[index];
7506
7599
  })) {
7507
- _context75.next = 12;
7600
+ _context76.next = 12;
7508
7601
  break;
7509
7602
  }
7510
7603
  throw new Error('The current customer product price is unavailable. Please retry before paying.');
@@ -7538,20 +7631,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7538
7631
  return queryIndex;
7539
7632
  })) || [];
7540
7633
  });
7541
- _context75.next = 17;
7634
+ _context76.next = 17;
7542
7635
  return this.resolveProductBookingPriceGroups(segmentQueries, currentOrderCustomerId, true);
7543
7636
  case 17:
7544
- segmentProducts = _context75.sent;
7637
+ segmentProducts = _context76.sent;
7545
7638
  if (!segmentProducts.some(function (product) {
7546
7639
  return !product;
7547
7640
  })) {
7548
- _context75.next = 20;
7641
+ _context76.next = 20;
7549
7642
  break;
7550
7643
  }
7551
7644
  throw durationPricingUnavailable('An authoritative product is missing for a billing unit.');
7552
7645
  case 20:
7553
7646
  if (useCustomerUserPricing) {
7554
- _context75.next = 25;
7647
+ _context76.next = 25;
7555
7648
  break;
7556
7649
  }
7557
7650
  quotationContexts = new Map();
@@ -7566,18 +7659,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7566
7659
  customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
7567
7660
  });
7568
7661
  });
7569
- _context75.next = 25;
7662
+ _context76.next = 25;
7570
7663
  return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
7571
- return _this25.loadQuotationForPriceQuery(_objectSpread({
7664
+ return _this26.loadQuotationForPriceQuery(_objectSpread({
7572
7665
  quotation: quotation
7573
7666
  }, context));
7574
7667
  }));
7575
7668
  case 25:
7576
- return _context75.abrupt("return", paramsList.map(function (params, index) {
7669
+ return _context76.abrupt("return", paramsList.map(function (params, index) {
7577
7670
  var _params$customer_id4, _authoritativeProduct2, _params$duration;
7578
7671
  var productInput = params.product || {};
7579
7672
  var authoritativeProduct = authoritativeProducts[index];
7580
- var product = _this25.mergeProductForPriceQuery(productInput, authoritativeProduct);
7673
+ var product = _this26.mergeProductForPriceQuery(productInput, authoritativeProduct);
7581
7674
  var customerId = (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId;
7582
7675
  var channel = resolvedChannels[index];
7583
7676
  var plan = plans[index];
@@ -7588,7 +7681,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7588
7681
  var prices = unitProducts.map(function (unitProduct, unitIndex) {
7589
7682
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
7590
7683
  channel: channel,
7591
- product: _this25.mergeProductForPriceQuery(unitIndex === 0 ? productInput : _objectSpread(_objectSpread({}, productInput), {}, {
7684
+ product: _this26.mergeProductForPriceQuery(unitIndex === 0 ? productInput : _objectSpread(_objectSpread({}, productInput), {}, {
7592
7685
  product_bundle: undefined
7593
7686
  }), unitProduct),
7594
7687
  booking: _objectSpread(_objectSpread({}, params.booking), {}, {
@@ -7614,7 +7707,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7614
7707
  product: product,
7615
7708
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
7616
7709
  customer_id: customerId,
7617
- quotation: authoritativeProduct && _this25.preferAuthoritativeProductQueryPrice() ? undefined : quotation
7710
+ quotation: authoritativeProduct && _this26.preferAuthoritativeProductQueryPrice() ? undefined : quotation
7618
7711
  }));
7619
7712
  return changedToFixed ? _objectSpread(_objectSpread({}, result), {}, {
7620
7713
  pricing_method: {
@@ -7625,11 +7718,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7625
7718
  }));
7626
7719
  case 26:
7627
7720
  case "end":
7628
- return _context75.stop();
7721
+ return _context76.stop();
7629
7722
  }
7630
- }, _callee75, this);
7723
+ }, _callee76, this);
7631
7724
  }));
7632
- function calculateProductBookingPrices(_x62) {
7725
+ function calculateProductBookingPrices(_x64) {
7633
7726
  return _calculateProductBookingPrices.apply(this, arguments);
7634
7727
  }
7635
7728
  return calculateProductBookingPrices;
@@ -7649,47 +7742,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7649
7742
  }, {
7650
7743
  key: "addProductToOrder",
7651
7744
  value: function () {
7652
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(product, booking, options) {
7745
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(product, booking, options) {
7653
7746
  var products;
7654
- return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7655
- while (1) switch (_context76.prev = _context76.next) {
7747
+ return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7748
+ while (1) switch (_context77.prev = _context77.next) {
7656
7749
  case 0:
7657
- _context76.prev = 0;
7750
+ _context77.prev = 0;
7658
7751
  if (this.store.order) {
7659
- _context76.next = 3;
7752
+ _context77.next = 3;
7660
7753
  break;
7661
7754
  }
7662
7755
  throw new Error('order 模块未初始化');
7663
7756
  case 3:
7664
7757
  if (!(options === undefined)) {
7665
- _context76.next = 9;
7758
+ _context77.next = 9;
7666
7759
  break;
7667
7760
  }
7668
- _context76.next = 6;
7761
+ _context77.next = 6;
7669
7762
  return this.store.order.addProductToOrder(product, booking);
7670
7763
  case 6:
7671
- _context76.t0 = _context76.sent;
7672
- _context76.next = 12;
7764
+ _context77.t0 = _context77.sent;
7765
+ _context77.next = 12;
7673
7766
  break;
7674
7767
  case 9:
7675
- _context76.next = 11;
7768
+ _context77.next = 11;
7676
7769
  return this.store.order.addProductToOrder(product, booking, options);
7677
7770
  case 11:
7678
- _context76.t0 = _context76.sent;
7771
+ _context77.t0 = _context77.sent;
7679
7772
  case 12:
7680
- products = _context76.t0;
7681
- return _context76.abrupt("return", products);
7773
+ products = _context77.t0;
7774
+ return _context77.abrupt("return", products);
7682
7775
  case 16:
7683
- _context76.prev = 16;
7684
- _context76.t1 = _context76["catch"](0);
7685
- throw _context76.t1;
7776
+ _context77.prev = 16;
7777
+ _context77.t1 = _context77["catch"](0);
7778
+ throw _context77.t1;
7686
7779
  case 19:
7687
7780
  case "end":
7688
- return _context76.stop();
7781
+ return _context77.stop();
7689
7782
  }
7690
- }, _callee76, this, [[0, 16]]);
7783
+ }, _callee77, this, [[0, 16]]);
7691
7784
  }));
7692
- function addProductToOrder(_x63, _x64, _x65) {
7785
+ function addProductToOrder(_x65, _x66, _x67) {
7693
7786
  return _addProductToOrder.apply(this, arguments);
7694
7787
  }
7695
7788
  return addProductToOrder;
@@ -7697,34 +7790,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7697
7790
  }, {
7698
7791
  key: "updateOrderProduct",
7699
7792
  value: function () {
7700
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(params) {
7793
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(params) {
7701
7794
  var products;
7702
- return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7703
- while (1) switch (_context77.prev = _context77.next) {
7795
+ return _regeneratorRuntime().wrap(function _callee78$(_context78) {
7796
+ while (1) switch (_context78.prev = _context78.next) {
7704
7797
  case 0:
7705
- _context77.prev = 0;
7798
+ _context78.prev = 0;
7706
7799
  if (this.store.order) {
7707
- _context77.next = 3;
7800
+ _context78.next = 3;
7708
7801
  break;
7709
7802
  }
7710
7803
  throw new Error('order 模块未初始化');
7711
7804
  case 3:
7712
- _context77.next = 5;
7805
+ _context78.next = 5;
7713
7806
  return this.store.order.updateOrderProduct(params);
7714
7807
  case 5:
7715
- products = _context77.sent;
7716
- return _context77.abrupt("return", products);
7808
+ products = _context78.sent;
7809
+ return _context78.abrupt("return", products);
7717
7810
  case 9:
7718
- _context77.prev = 9;
7719
- _context77.t0 = _context77["catch"](0);
7720
- throw _context77.t0;
7811
+ _context78.prev = 9;
7812
+ _context78.t0 = _context78["catch"](0);
7813
+ throw _context78.t0;
7721
7814
  case 12:
7722
7815
  case "end":
7723
- return _context77.stop();
7816
+ return _context78.stop();
7724
7817
  }
7725
- }, _callee77, this, [[0, 9]]);
7818
+ }, _callee78, this, [[0, 9]]);
7726
7819
  }));
7727
- function updateOrderProduct(_x66) {
7820
+ function updateOrderProduct(_x68) {
7728
7821
  return _updateOrderProduct.apply(this, arguments);
7729
7822
  }
7730
7823
  return updateOrderProduct;
@@ -7732,34 +7825,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7732
7825
  }, {
7733
7826
  key: "updateOrderProducts",
7734
7827
  value: function () {
7735
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(paramsList, options) {
7828
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(paramsList, options) {
7736
7829
  var products;
7737
- return _regeneratorRuntime().wrap(function _callee78$(_context78) {
7738
- while (1) switch (_context78.prev = _context78.next) {
7830
+ return _regeneratorRuntime().wrap(function _callee79$(_context79) {
7831
+ while (1) switch (_context79.prev = _context79.next) {
7739
7832
  case 0:
7740
- _context78.prev = 0;
7833
+ _context79.prev = 0;
7741
7834
  if (this.store.order) {
7742
- _context78.next = 3;
7835
+ _context79.next = 3;
7743
7836
  break;
7744
7837
  }
7745
7838
  throw new Error('order 模块未初始化');
7746
7839
  case 3:
7747
- _context78.next = 5;
7840
+ _context79.next = 5;
7748
7841
  return this.store.order.updateOrderProducts(paramsList, options);
7749
7842
  case 5:
7750
- products = _context78.sent;
7751
- return _context78.abrupt("return", products);
7843
+ products = _context79.sent;
7844
+ return _context79.abrupt("return", products);
7752
7845
  case 9:
7753
- _context78.prev = 9;
7754
- _context78.t0 = _context78["catch"](0);
7755
- throw _context78.t0;
7846
+ _context79.prev = 9;
7847
+ _context79.t0 = _context79["catch"](0);
7848
+ throw _context79.t0;
7756
7849
  case 12:
7757
7850
  case "end":
7758
- return _context78.stop();
7851
+ return _context79.stop();
7759
7852
  }
7760
- }, _callee78, this, [[0, 9]]);
7853
+ }, _callee79, this, [[0, 9]]);
7761
7854
  }));
7762
- function updateOrderProducts(_x67, _x68) {
7855
+ function updateOrderProducts(_x69, _x70) {
7763
7856
  return _updateOrderProducts.apply(this, arguments);
7764
7857
  }
7765
7858
  return updateOrderProducts;
@@ -7767,34 +7860,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7767
7860
  }, {
7768
7861
  key: "updateOrderProductQuantity",
7769
7862
  value: function () {
7770
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(params) {
7863
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(params) {
7771
7864
  var products;
7772
- return _regeneratorRuntime().wrap(function _callee79$(_context79) {
7773
- while (1) switch (_context79.prev = _context79.next) {
7865
+ return _regeneratorRuntime().wrap(function _callee80$(_context80) {
7866
+ while (1) switch (_context80.prev = _context80.next) {
7774
7867
  case 0:
7775
- _context79.prev = 0;
7868
+ _context80.prev = 0;
7776
7869
  if (this.store.order) {
7777
- _context79.next = 3;
7870
+ _context80.next = 3;
7778
7871
  break;
7779
7872
  }
7780
7873
  throw new Error('order 模块未初始化');
7781
7874
  case 3:
7782
- _context79.next = 5;
7875
+ _context80.next = 5;
7783
7876
  return this.store.order.updateOrderProductQuantity(params);
7784
7877
  case 5:
7785
- products = _context79.sent;
7786
- return _context79.abrupt("return", products);
7878
+ products = _context80.sent;
7879
+ return _context80.abrupt("return", products);
7787
7880
  case 9:
7788
- _context79.prev = 9;
7789
- _context79.t0 = _context79["catch"](0);
7790
- throw _context79.t0;
7881
+ _context80.prev = 9;
7882
+ _context80.t0 = _context80["catch"](0);
7883
+ throw _context80.t0;
7791
7884
  case 12:
7792
7885
  case "end":
7793
- return _context79.stop();
7886
+ return _context80.stop();
7794
7887
  }
7795
- }, _callee79, this, [[0, 9]]);
7888
+ }, _callee80, this, [[0, 9]]);
7796
7889
  }));
7797
- function updateOrderProductQuantity(_x69) {
7890
+ function updateOrderProductQuantity(_x71) {
7798
7891
  return _updateOrderProductQuantity.apply(this, arguments);
7799
7892
  }
7800
7893
  return updateOrderProductQuantity;
@@ -7817,12 +7910,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7817
7910
  }, {
7818
7911
  key: "setOrderProductLineNote",
7819
7912
  value: (function () {
7820
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(identity, note) {
7913
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(identity, note) {
7821
7914
  var params, products;
7822
- return _regeneratorRuntime().wrap(function _callee80$(_context80) {
7823
- while (1) switch (_context80.prev = _context80.next) {
7915
+ return _regeneratorRuntime().wrap(function _callee81$(_context81) {
7916
+ while (1) switch (_context81.prev = _context81.next) {
7824
7917
  case 0:
7825
- _context80.prev = 0;
7918
+ _context81.prev = 0;
7826
7919
  params = {
7827
7920
  product_id: identity.product_id,
7828
7921
  product_variant_id: identity.product_variant_id,
@@ -7837,22 +7930,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7837
7930
  params.product_sku = identity.product_sku;
7838
7931
  }
7839
7932
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
7840
- _context80.next = 7;
7933
+ _context81.next = 7;
7841
7934
  return this.updateOrderProduct(params);
7842
7935
  case 7:
7843
- products = _context80.sent;
7844
- return _context80.abrupt("return", products);
7936
+ products = _context81.sent;
7937
+ return _context81.abrupt("return", products);
7845
7938
  case 11:
7846
- _context80.prev = 11;
7847
- _context80.t0 = _context80["catch"](0);
7848
- throw _context80.t0;
7939
+ _context81.prev = 11;
7940
+ _context81.t0 = _context81["catch"](0);
7941
+ throw _context81.t0;
7849
7942
  case 14:
7850
7943
  case "end":
7851
- return _context80.stop();
7944
+ return _context81.stop();
7852
7945
  }
7853
- }, _callee80, this, [[0, 11]]);
7946
+ }, _callee81, this, [[0, 11]]);
7854
7947
  }));
7855
- function setOrderProductLineNote(_x70, _x71) {
7948
+ function setOrderProductLineNote(_x72, _x73) {
7856
7949
  return _setOrderProductLineNote.apply(this, arguments);
7857
7950
  }
7858
7951
  return setOrderProductLineNote;
@@ -7867,45 +7960,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7867
7960
  }, {
7868
7961
  key: "removeProductsFromOrder",
7869
7962
  value: (function () {
7870
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(identities, options) {
7871
- return _regeneratorRuntime().wrap(function _callee81$(_context81) {
7872
- while (1) switch (_context81.prev = _context81.next) {
7963
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(identities, options) {
7964
+ return _regeneratorRuntime().wrap(function _callee82$(_context82) {
7965
+ while (1) switch (_context82.prev = _context82.next) {
7873
7966
  case 0:
7874
- _context81.prev = 0;
7967
+ _context82.prev = 0;
7875
7968
  if (this.store.order) {
7876
- _context81.next = 3;
7969
+ _context82.next = 3;
7877
7970
  break;
7878
7971
  }
7879
7972
  throw new Error('order 模块未初始化');
7880
7973
  case 3:
7881
7974
  if (!(options === undefined)) {
7882
- _context81.next = 9;
7975
+ _context82.next = 9;
7883
7976
  break;
7884
7977
  }
7885
- _context81.next = 6;
7978
+ _context82.next = 6;
7886
7979
  return this.store.order.removeProductsFromOrder(identities);
7887
7980
  case 6:
7888
- _context81.t0 = _context81.sent;
7889
- _context81.next = 12;
7981
+ _context82.t0 = _context82.sent;
7982
+ _context82.next = 12;
7890
7983
  break;
7891
7984
  case 9:
7892
- _context81.next = 11;
7985
+ _context82.next = 11;
7893
7986
  return this.store.order.removeProductsFromOrder(identities, options);
7894
7987
  case 11:
7895
- _context81.t0 = _context81.sent;
7988
+ _context82.t0 = _context82.sent;
7896
7989
  case 12:
7897
- return _context81.abrupt("return", _context81.t0);
7990
+ return _context82.abrupt("return", _context82.t0);
7898
7991
  case 15:
7899
- _context81.prev = 15;
7900
- _context81.t1 = _context81["catch"](0);
7901
- throw _context81.t1;
7992
+ _context82.prev = 15;
7993
+ _context82.t1 = _context82["catch"](0);
7994
+ throw _context82.t1;
7902
7995
  case 18:
7903
7996
  case "end":
7904
- return _context81.stop();
7997
+ return _context82.stop();
7905
7998
  }
7906
- }, _callee81, this, [[0, 15]]);
7999
+ }, _callee82, this, [[0, 15]]);
7907
8000
  }));
7908
- function removeProductsFromOrder(_x72, _x73) {
8001
+ function removeProductsFromOrder(_x74, _x75) {
7909
8002
  return _removeProductsFromOrder.apply(this, arguments);
7910
8003
  }
7911
8004
  return removeProductsFromOrder;
@@ -7913,18 +8006,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7913
8006
  }, {
7914
8007
  key: "removeProductFromOrder",
7915
8008
  value: function () {
7916
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(identity, options) {
7917
- return _regeneratorRuntime().wrap(function _callee82$(_context82) {
7918
- while (1) switch (_context82.prev = _context82.next) {
8009
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(identity, options) {
8010
+ return _regeneratorRuntime().wrap(function _callee83$(_context83) {
8011
+ while (1) switch (_context83.prev = _context83.next) {
7919
8012
  case 0:
7920
- return _context82.abrupt("return", this.removeProductsFromOrder([identity], options));
8013
+ return _context83.abrupt("return", this.removeProductsFromOrder([identity], options));
7921
8014
  case 1:
7922
8015
  case "end":
7923
- return _context82.stop();
8016
+ return _context83.stop();
7924
8017
  }
7925
- }, _callee82, this);
8018
+ }, _callee83, this);
7926
8019
  }));
7927
- function removeProductFromOrder(_x74, _x75) {
8020
+ function removeProductFromOrder(_x76, _x77) {
7928
8021
  return _removeProductFromOrder.apply(this, arguments);
7929
8022
  }
7930
8023
  return removeProductFromOrder;
@@ -7974,23 +8067,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
7974
8067
  }, {
7975
8068
  key: "applyPromotion",
7976
8069
  value: (function () {
7977
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83() {
7978
- return _regeneratorRuntime().wrap(function _callee83$(_context83) {
7979
- while (1) switch (_context83.prev = _context83.next) {
8070
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
8071
+ return _regeneratorRuntime().wrap(function _callee84$(_context84) {
8072
+ while (1) switch (_context84.prev = _context84.next) {
7980
8073
  case 0:
7981
8074
  if (this.store.order) {
7982
- _context83.next = 2;
8075
+ _context84.next = 2;
7983
8076
  break;
7984
8077
  }
7985
8078
  throw new Error('order 模块未初始化');
7986
8079
  case 2:
7987
- _context83.next = 4;
8080
+ _context84.next = 4;
7988
8081
  return this.store.order.applyPromotion();
7989
8082
  case 4:
7990
8083
  case "end":
7991
- return _context83.stop();
8084
+ return _context84.stop();
7992
8085
  }
7993
- }, _callee83, this);
8086
+ }, _callee84, this);
7994
8087
  }));
7995
8088
  function applyPromotion() {
7996
8089
  return _applyPromotion.apply(this, arguments);
@@ -8017,18 +8110,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
8017
8110
  }, {
8018
8111
  key: "getProductList",
8019
8112
  value: function () {
8020
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
8021
- var _this$otherParams45;
8113
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
8114
+ var _this$otherParams46;
8022
8115
  var menu_list_ids, _this$store$products, res;
8023
- return _regeneratorRuntime().wrap(function _callee84$(_context84) {
8024
- while (1) switch (_context84.prev = _context84.next) {
8116
+ return _regeneratorRuntime().wrap(function _callee85$(_context85) {
8117
+ while (1) switch (_context85.prev = _context85.next) {
8025
8118
  case 0:
8026
8119
  // 可以直接通过配置里的 menu 读取
8027
- menu_list_ids = ((_this$otherParams45 = this.otherParams) === null || _this$otherParams45 === void 0 || (_this$otherParams45 = _this$otherParams45.dineInConfig) === null || _this$otherParams45 === void 0 ? void 0 : _this$otherParams45['menu.associated_menus'].map(function (n) {
8120
+ menu_list_ids = ((_this$otherParams46 = this.otherParams) === null || _this$otherParams46 === void 0 || (_this$otherParams46 = _this$otherParams46.dineInConfig) === null || _this$otherParams46 === void 0 ? void 0 : _this$otherParams46['menu.associated_menus'].map(function (n) {
8028
8121
  return Number(n.value);
8029
8122
  })) || [];
8030
- _context84.prev = 1;
8031
- _context84.next = 4;
8123
+ _context85.prev = 1;
8124
+ _context85.next = 4;
8032
8125
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
8033
8126
  menu_list_ids: menu_list_ids,
8034
8127
  cacheId: this.cacheId,
@@ -8036,17 +8129,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
8036
8129
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
8037
8130
  });
8038
8131
  case 4:
8039
- res = _context84.sent;
8040
- return _context84.abrupt("return", res);
8132
+ res = _context85.sent;
8133
+ return _context85.abrupt("return", res);
8041
8134
  case 8:
8042
- _context84.prev = 8;
8043
- _context84.t0 = _context84["catch"](1);
8044
- throw _context84.t0;
8135
+ _context85.prev = 8;
8136
+ _context85.t0 = _context85["catch"](1);
8137
+ throw _context85.t0;
8045
8138
  case 11:
8046
8139
  case "end":
8047
- return _context84.stop();
8140
+ return _context85.stop();
8048
8141
  }
8049
- }, _callee84, this, [[1, 8]]);
8142
+ }, _callee85, this, [[1, 8]]);
8050
8143
  }));
8051
8144
  function getProductList() {
8052
8145
  return _getProductList.apply(this, arguments);
@@ -8061,36 +8154,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
8061
8154
  }, {
8062
8155
  key: "setOtherParams",
8063
8156
  value: function () {
8064
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(params) {
8065
- var _this$otherParams46;
8157
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(params) {
8158
+ var _this$otherParams47;
8066
8159
  var _ref59,
8067
8160
  _ref59$cover,
8068
8161
  cover,
8069
8162
  previousPickupTimingScope,
8070
- _args85 = arguments;
8071
- return _regeneratorRuntime().wrap(function _callee85$(_context85) {
8072
- while (1) switch (_context85.prev = _context85.next) {
8163
+ _args86 = arguments;
8164
+ return _regeneratorRuntime().wrap(function _callee86$(_context86) {
8165
+ while (1) switch (_context86.prev = _context86.next) {
8073
8166
  case 0:
8074
- _ref59 = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {}, _ref59$cover = _ref59.cover, cover = _ref59$cover === void 0 ? false : _ref59$cover;
8167
+ _ref59 = _args86.length > 1 && _args86[1] !== undefined ? _args86[1] : {}, _ref59$cover = _ref59.cover, cover = _ref59$cover === void 0 ? false : _ref59$cover;
8075
8168
  previousPickupTimingScope = this.getPickupTimingScope();
8076
8169
  if (cover) {
8077
8170
  this.otherParams = _objectSpread({}, params);
8078
8171
  } else {
8079
8172
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
8080
8173
  }
8081
- this.cacheId = (_this$otherParams46 = this.otherParams) === null || _this$otherParams46 === void 0 ? void 0 : _this$otherParams46.cacheId;
8174
+ this.cacheId = (_this$otherParams47 = this.otherParams) === null || _this$otherParams47 === void 0 ? void 0 : _this$otherParams47.cacheId;
8082
8175
  if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
8083
- _context85.next = 7;
8176
+ _context86.next = 7;
8084
8177
  return this.syncOtherParamsToSubModules(params, {
8085
8178
  cover: cover
8086
8179
  });
8087
8180
  case 7:
8088
8181
  case "end":
8089
- return _context85.stop();
8182
+ return _context86.stop();
8090
8183
  }
8091
- }, _callee85, this);
8184
+ }, _callee86, this);
8092
8185
  }));
8093
- function setOtherParams(_x76) {
8186
+ function setOtherParams(_x78) {
8094
8187
  return _setOtherParams.apply(this, arguments);
8095
8188
  }
8096
8189
  return setOtherParams;