@pisell/pisellos 2.2.248 → 2.2.250

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -1224,9 +1224,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1224
1224
  }, {
1225
1225
  key: "calculatePaymentEffectiveAmount",
1226
1226
  value: function calculatePaymentEffectiveAmount(payment) {
1227
- var amount = new Decimal(payment.amount || 0).minus(new Decimal(payment.service_fee || 0));
1227
+ var _ref17, _payment$origin_amoun;
1228
+ var amount = new Decimal(payment.amount || 0);
1229
+ var originAmount = new Decimal((_ref17 = (_payment$origin_amoun = payment.origin_amount) !== null && _payment$origin_amoun !== void 0 ? _payment$origin_amoun : payment.amount) !== null && _ref17 !== void 0 ? _ref17 : 0);
1230
+ var serviceFee = new Decimal(payment.service_fee || 0);
1231
+ // TODO: 后端允许 amount 表示顾客实际支付总额后,移除这个兼容分支。
1232
+ var effectiveAmount = serviceFee.gt(0) && amount.eq(originAmount) ? amount.plus(serviceFee) : amount;
1228
1233
  var rounding = new Decimal(payment.rounding_amount || 0);
1229
- return amount.minus(rounding);
1234
+ return effectiveAmount.minus(rounding);
1230
1235
  }
1231
1236
  }, {
1232
1237
  key: "calculatePaymentTotal",
@@ -1312,7 +1317,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1312
1317
  }, {
1313
1318
  key: "normalizePaymentSource",
1314
1319
  value: function normalizePaymentSource(payment, options) {
1315
- var _ref17, _paymentRecord$origin;
1320
+ var _ref18, _paymentRecord$origin;
1316
1321
  var paymentRecord = payment;
1317
1322
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
1318
1323
  if (!metadata.unique_payment_number) {
@@ -1320,7 +1325,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1320
1325
  }
1321
1326
  var normalized = _objectSpread(_objectSpread({}, paymentRecord), {}, {
1322
1327
  metadata: metadata,
1323
- origin_amount: (_ref17 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref17 !== void 0 ? _ref17 : '0.00'
1328
+ origin_amount: (_ref18 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref18 !== void 0 ? _ref18 : '0.00'
1324
1329
  });
1325
1330
  if (paymentRecord.status !== undefined) {
1326
1331
  normalized.status = paymentRecord.status;
@@ -1654,7 +1659,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1654
1659
  _product$payment_pric,
1655
1660
  _sku$code,
1656
1661
  _sku$barcode,
1657
- _ref18,
1662
+ _ref19,
1658
1663
  _sku$variant_id,
1659
1664
  _this8 = this;
1660
1665
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
@@ -1681,24 +1686,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1681
1686
  product_sku: this.normalizeFingerprintValue({
1682
1687
  code: (_sku$code = sku.code) !== null && _sku$code !== void 0 ? _sku$code : '',
1683
1688
  barcode: (_sku$barcode = sku.barcode) !== null && _sku$barcode !== void 0 ? _sku$barcode : '',
1684
- variant_id: (_ref18 = (_sku$variant_id = sku.variant_id) !== null && _sku$variant_id !== void 0 ? _sku$variant_id : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref18 !== void 0 ? _ref18 : 0,
1689
+ variant_id: (_ref19 = (_sku$variant_id = sku.variant_id) !== null && _sku$variant_id !== void 0 ? _sku$variant_id : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref19 !== void 0 ? _ref19 : 0,
1685
1690
  variant: sku.variant || [],
1686
1691
  option: getProductSkuOptions(product || {}).map(function (option) {
1687
- var _ref19, _option$id, _option$option_group_, _ref20, _option$option_group_2, _option$num, _option$add_price;
1692
+ var _ref20, _option$id, _option$option_group_, _ref21, _option$option_group_2, _option$num, _option$add_price;
1688
1693
  return {
1689
- id: (_ref19 = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref19 !== void 0 ? _ref19 : null,
1694
+ id: (_ref20 = (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref20 !== void 0 ? _ref20 : null,
1690
1695
  option_group_id: (_option$option_group_ = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : null,
1691
- option_group_item_id: (_ref20 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref20 !== void 0 ? _ref20 : null,
1696
+ option_group_item_id: (_ref21 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref21 !== void 0 ? _ref21 : null,
1692
1697
  num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
1693
1698
  add_price: _this8.normalizeFingerprintMoney((_option$add_price = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option === null || option === void 0 ? void 0 : option.price)
1694
1699
  };
1695
1700
  })
1696
1701
  }),
1697
1702
  product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
1698
- var _ref21, _ref22, _bundle$bundle_produc, _ref23, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
1703
+ var _ref22, _ref23, _bundle$bundle_produc, _ref24, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
1699
1704
  return {
1700
- bundle_product_id: (_ref21 = (_ref22 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref22 !== void 0 ? _ref22 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref21 !== void 0 ? _ref21 : null,
1701
- bundle_variant_id: (_ref23 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref23 !== void 0 ? _ref23 : 0,
1705
+ bundle_product_id: (_ref22 = (_ref23 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref23 !== void 0 ? _ref23 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref22 !== void 0 ? _ref22 : null,
1706
+ bundle_variant_id: (_ref24 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0,
1702
1707
  num: getSafeProductNum((_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
1703
1708
  price: _this8.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
1704
1709
  bundle_selling_price: _this8.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
@@ -1707,10 +1712,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1707
1712
  };
1708
1713
  })),
1709
1714
  discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
1710
- var _ref24, _discount$type2, _ref25, _ref26, _discount$discount_id, _discount$discount;
1715
+ var _ref25, _discount$type2, _ref26, _ref27, _discount$discount_id, _discount$discount;
1711
1716
  return {
1712
- type: (_ref24 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref24 !== void 0 ? _ref24 : '',
1713
- discount_id: (_ref25 = (_ref26 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref26 !== void 0 ? _ref26 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref25 !== void 0 ? _ref25 : null,
1717
+ type: (_ref25 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref25 !== void 0 ? _ref25 : '',
1718
+ discount_id: (_ref26 = (_ref27 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref27 !== void 0 ? _ref27 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref26 !== void 0 ? _ref26 : null,
1714
1719
  amount: _this8.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
1715
1720
  };
1716
1721
  }))
@@ -1734,14 +1739,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1734
1739
  var _product$product_id3,
1735
1740
  _product$product_vari2,
1736
1741
  _product$num2,
1737
- _ref27,
1742
+ _ref28,
1738
1743
  _metadata$unique_iden,
1739
1744
  _metadata$price_overr,
1740
1745
  _metadata$is_manual_d,
1741
1746
  _metadata$product_dis,
1742
1747
  _sku$code2,
1743
1748
  _sku$barcode2,
1744
- _ref28,
1749
+ _ref29,
1745
1750
  _sku$variant_id2,
1746
1751
  _this10 = this;
1747
1752
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
@@ -1757,7 +1762,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1757
1762
  extension_type: extensionType,
1758
1763
  num: getSafeProductNum((_product$num2 = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product === null || product === void 0 ? void 0 : product.product_quantity),
1759
1764
  metadata: {
1760
- unique_identification_number: (_ref27 = (_metadata$unique_iden = metadata.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref27 !== void 0 ? _ref27 : '',
1765
+ unique_identification_number: (_ref28 = (_metadata$unique_iden = metadata.unique_identification_number) !== null && _metadata$unique_iden !== void 0 ? _metadata$unique_iden : product === null || product === void 0 ? void 0 : product.unique_identification_number) !== null && _ref28 !== void 0 ? _ref28 : '',
1761
1766
  price_override: (_metadata$price_overr = metadata.price_override) !== null && _metadata$price_overr !== void 0 ? _metadata$price_overr : '',
1762
1767
  is_manual_discount: (_metadata$is_manual_d = metadata.is_manual_discount) !== null && _metadata$is_manual_d !== void 0 ? _metadata$is_manual_d : '',
1763
1768
  product_discount_reason: (_metadata$product_dis = metadata.product_discount_reason) !== null && _metadata$product_dis !== void 0 ? _metadata$product_dis : ''
@@ -1765,35 +1770,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1765
1770
  product_sku: this.normalizeFingerprintValue({
1766
1771
  code: (_sku$code2 = sku.code) !== null && _sku$code2 !== void 0 ? _sku$code2 : '',
1767
1772
  barcode: (_sku$barcode2 = sku.barcode) !== null && _sku$barcode2 !== void 0 ? _sku$barcode2 : '',
1768
- variant_id: (_ref28 = (_sku$variant_id2 = sku.variant_id) !== null && _sku$variant_id2 !== void 0 ? _sku$variant_id2 : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref28 !== void 0 ? _ref28 : 0,
1773
+ variant_id: (_ref29 = (_sku$variant_id2 = sku.variant_id) !== null && _sku$variant_id2 !== void 0 ? _sku$variant_id2 : product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _ref29 !== void 0 ? _ref29 : 0,
1769
1774
  variant: sku.variant || [],
1770
1775
  option: getProductSkuOptions(product || {}).map(function (option) {
1771
- var _ref29, _option$id2, _option$option_group_3, _ref30, _option$option_group_4, _option$num2, _option$add_price2;
1776
+ var _ref30, _option$id2, _option$option_group_3, _ref31, _option$option_group_4, _option$num2, _option$add_price2;
1772
1777
  return {
1773
- id: (_ref29 = (_option$id2 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id2 !== void 0 ? _option$id2 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref29 !== void 0 ? _ref29 : null,
1778
+ id: (_ref30 = (_option$id2 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id2 !== void 0 ? _option$id2 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref30 !== void 0 ? _ref30 : null,
1774
1779
  option_group_id: (_option$option_group_3 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_3 !== void 0 ? _option$option_group_3 : null,
1775
- option_group_item_id: (_ref30 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref30 !== void 0 ? _ref30 : null,
1780
+ option_group_item_id: (_ref31 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref31 !== void 0 ? _ref31 : null,
1776
1781
  num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
1777
1782
  add_price: _this10.normalizeFingerprintMoney((_option$add_price2 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price2 !== void 0 ? _option$add_price2 : option === null || option === void 0 ? void 0 : option.price)
1778
1783
  };
1779
1784
  })
1780
1785
  }),
1781
1786
  product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
1782
- var _ref31, _bundle$bundle_id, _ref32, _bundle$bundle_group_, _ref33, _ref34, _bundle$bundle_produc2, _ref35, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
1787
+ var _ref32, _bundle$bundle_id, _ref33, _bundle$bundle_group_, _ref34, _ref35, _bundle$bundle_produc2, _ref36, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
1783
1788
  return {
1784
- bundle_id: (_ref31 = (_bundle$bundle_id = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle === null || bundle === void 0 ? void 0 : bundle.id) !== null && _ref31 !== void 0 ? _ref31 : null,
1785
- bundle_group_id: (_ref32 = (_bundle$bundle_group_ = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle === null || bundle === void 0 ? void 0 : bundle.group_id) !== null && _ref32 !== void 0 ? _ref32 : null,
1786
- bundle_product_id: (_ref33 = (_ref34 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref34 !== void 0 ? _ref34 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref33 !== void 0 ? _ref33 : null,
1787
- bundle_variant_id: (_ref35 = (_bundle$bundle_varian2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian2 !== void 0 ? _bundle$bundle_varian2 : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref35 !== void 0 ? _ref35 : 0,
1789
+ bundle_id: (_ref32 = (_bundle$bundle_id = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle === null || bundle === void 0 ? void 0 : bundle.id) !== null && _ref32 !== void 0 ? _ref32 : null,
1790
+ bundle_group_id: (_ref33 = (_bundle$bundle_group_ = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle === null || bundle === void 0 ? void 0 : bundle.group_id) !== null && _ref33 !== void 0 ? _ref33 : null,
1791
+ bundle_product_id: (_ref34 = (_ref35 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref35 !== void 0 ? _ref35 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref34 !== void 0 ? _ref34 : null,
1792
+ bundle_variant_id: (_ref36 = (_bundle$bundle_varian2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian2 !== void 0 ? _bundle$bundle_varian2 : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref36 !== void 0 ? _ref36 : 0,
1788
1793
  num: getSafeProductNum((_bundle$num2 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num2 !== void 0 ? _bundle$num2 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
1789
1794
  price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
1790
1795
  price_type_ext: (_bundle$price_type_ex2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : '',
1791
1796
  option: _this10.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
1792
- var _ref36, _option$id3, _option$option_group_5, _ref37, _option$option_group_6, _option$num3, _option$add_price3;
1797
+ var _ref37, _option$id3, _option$option_group_5, _ref38, _option$option_group_6, _option$num3, _option$add_price3;
1793
1798
  return {
1794
- id: (_ref36 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref36 !== void 0 ? _ref36 : null,
1799
+ id: (_ref37 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref37 !== void 0 ? _ref37 : null,
1795
1800
  option_group_id: (_option$option_group_5 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_5 !== void 0 ? _option$option_group_5 : null,
1796
- option_group_item_id: (_ref37 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref37 !== void 0 ? _ref37 : null,
1801
+ option_group_item_id: (_ref38 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref38 !== void 0 ? _ref38 : null,
1797
1802
  num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
1798
1803
  add_price: _this10.normalizeFingerprintMoney((_option$add_price3 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price3 !== void 0 ? _option$add_price3 : option === null || option === void 0 ? void 0 : option.price)
1799
1804
  };
@@ -1801,10 +1806,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1801
1806
  };
1802
1807
  })),
1803
1808
  discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
1804
- var _ref38, _discount$type4, _ref39, _ref40, _discount$discount_id2, _discount$discount2;
1809
+ var _ref39, _discount$type4, _ref40, _ref41, _discount$discount_id2, _discount$discount2;
1805
1810
  return {
1806
- type: (_ref38 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref38 !== void 0 ? _ref38 : '',
1807
- discount_id: (_ref39 = (_ref40 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref40 !== void 0 ? _ref40 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref39 !== void 0 ? _ref39 : null,
1811
+ type: (_ref39 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref39 !== void 0 ? _ref39 : '',
1812
+ discount_id: (_ref40 = (_ref41 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref41 !== void 0 ? _ref41 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref40 !== void 0 ? _ref40 : null,
1808
1813
  amount: _this10.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
1809
1814
  };
1810
1815
  }))
@@ -2084,11 +2089,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2084
2089
  }, {
2085
2090
  key: "getOrderIdentity",
2086
2091
  value: function getOrderIdentity() {
2087
- var _ref41, _ref42, _tempOrder$order_id, _tempOrder$_extend6;
2092
+ var _ref42, _ref43, _tempOrder$order_id, _tempOrder$_extend6;
2088
2093
  var tempOrder = this.store.tempOrder;
2089
2094
  if (!tempOrder) return null;
2090
2095
  var lastOrderInfo = this.store.lastOrderInfo || {};
2091
- var orderId = (_ref41 = (_ref42 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref42 !== void 0 ? _ref42 : lastOrderInfo.id) !== null && _ref41 !== void 0 ? _ref41 : null;
2096
+ var orderId = (_ref42 = (_ref43 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref43 !== void 0 ? _ref43 : lastOrderInfo.id) !== null && _ref42 !== void 0 ? _ref42 : null;
2092
2097
  return {
2093
2098
  localId: this.cacheId || ((_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.localId),
2094
2099
  orderId: orderId,
@@ -2241,11 +2246,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2241
2246
  }, {
2242
2247
  key: "captureProductRuntime",
2243
2248
  value: function captureProductRuntime(tempOrder, rawProduct, normalizedProduct, existedUid) {
2244
- var _extend$productsByUid, _ref43, _rawProduct$_origin;
2249
+ var _extend$productsByUid, _ref44, _rawProduct$_origin;
2245
2250
  var uid = existedUid || this.getProductUid(normalizedProduct);
2246
2251
  var extend = this.ensureExtend(tempOrder);
2247
2252
  var existed = ((_extend$productsByUid = extend.productsByUid) === null || _extend$productsByUid === void 0 ? void 0 : _extend$productsByUid[uid]) || {};
2248
- var origin = (_ref43 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref43 !== void 0 ? _ref43 : existed.origin;
2253
+ var origin = (_ref44 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref44 !== void 0 ? _ref44 : existed.origin;
2249
2254
  extend.productsByUid[uid] = _objectSpread(_objectSpread({}, existed), origin !== undefined ? {
2250
2255
  origin: origin
2251
2256
  } : {});
@@ -2346,7 +2351,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2346
2351
  }, {
2347
2352
  key: "buildTempOrderHolderFromBookings",
2348
2353
  value: function buildTempOrderHolderFromBookings(tempOrder) {
2349
- var _baseHolder$customer_, _baseHolder, _ref44, _baseHolder$form_id, _baseHolder2, _tempOrder$holder5, _baseHolder3, _this$otherParams;
2354
+ var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder5, _baseHolder3, _this$otherParams;
2350
2355
  var holderRecords = [];
2351
2356
  var holderNames = [];
2352
2357
  var baseHolder = null;
@@ -2393,7 +2398,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2393
2398
  }
2394
2399
  var nextHolder = {
2395
2400
  customer_id: (_baseHolder$customer_ = (_baseHolder = baseHolder) === null || _baseHolder === void 0 ? void 0 : _baseHolder.customer_id) !== null && _baseHolder$customer_ !== void 0 ? _baseHolder$customer_ : tempOrder.customer_id,
2396
- form_id: (_ref44 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder5 = tempOrder.holder) === null || _tempOrder$holder5 === void 0 ? void 0 : _tempOrder$holder5.form_id) !== null && _ref44 !== void 0 ? _ref44 : 0,
2401
+ form_id: (_ref45 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder5 = tempOrder.holder) === null || _tempOrder$holder5 === void 0 ? void 0 : _tempOrder$holder5.form_id) !== null && _ref45 !== void 0 ? _ref45 : 0,
2397
2402
  form_record: holderRecords
2398
2403
  };
2399
2404
  if (holderNames.length) {
@@ -2496,7 +2501,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2496
2501
  key: "recalculateSummary",
2497
2502
  value: function () {
2498
2503
  var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(options) {
2499
- var _ref45, _salesSummaryResult$e;
2504
+ var _ref46, _salesSummaryResult$e;
2500
2505
  var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
2501
2506
  return _regeneratorRuntime().wrap(function _callee11$(_context13) {
2502
2507
  while (1) switch (_context13.prev = _context13.next) {
@@ -2569,7 +2574,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2569
2574
  roundingAmount = paidPaymentSummary.roundingAmount;
2570
2575
  payServiceChargeAmount = paidPaymentSummary.payServiceChargeAmount;
2571
2576
  hasSalesSummaryAmount = salesSummaryResult.expect_amount !== undefined || salesSummaryResult.total_amount !== undefined;
2572
- expectAmount = hasSalesSummaryAmount ? new Decimal((_ref45 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref45 !== void 0 ? _ref45 : 0) : null;
2577
+ expectAmount = hasSalesSummaryAmount ? new Decimal((_ref46 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref46 !== void 0 ? _ref46 : 0) : null;
2573
2578
  amountPaymentPatch = hasSalesSummaryAmount || !roundingAmount.eq(0) || !payServiceChargeAmount.eq(0) ? _objectSpread({
2574
2579
  rounding_amount: roundingAmount.toFixed(2)
2575
2580
  }, expectAmount ? {
@@ -2747,17 +2752,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2747
2752
  }, {
2748
2753
  key: "buildTempOrderCustomer",
2749
2754
  value: function buildTempOrderCustomer(params) {
2750
- var _ref46, _ref47, _ref48, _source$name, _ref49, _ref50, _ref51, _source$customer_name, _source$id, _source$customer_id, _ref52, _source$country_calli, _source$phone, _source$email;
2755
+ var _ref47, _ref48, _ref49, _source$name, _ref50, _ref51, _ref52, _source$customer_name, _source$id, _source$customer_id, _ref53, _source$country_calli, _source$phone, _source$email;
2751
2756
  if (!params.customerId) return null;
2752
2757
  var source = params.source ? cloneDeep(params.source) : {};
2753
- var name = (_ref46 = (_ref47 = (_ref48 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref48 !== void 0 ? _ref48 : source.customerName) !== null && _ref47 !== void 0 ? _ref47 : source.customer_name) !== null && _ref46 !== void 0 ? _ref46 : params.customerName;
2754
- var customerName = (_ref49 = (_ref50 = (_ref51 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref51 !== void 0 ? _ref51 : source.display_name) !== null && _ref50 !== void 0 ? _ref50 : source.name) !== null && _ref49 !== void 0 ? _ref49 : params.customerName;
2758
+ var name = (_ref47 = (_ref48 = (_ref49 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref49 !== void 0 ? _ref49 : source.customerName) !== null && _ref48 !== void 0 ? _ref48 : source.customer_name) !== null && _ref47 !== void 0 ? _ref47 : params.customerName;
2759
+ var customerName = (_ref50 = (_ref51 = (_ref52 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref52 !== void 0 ? _ref52 : source.display_name) !== null && _ref51 !== void 0 ? _ref51 : source.name) !== null && _ref50 !== void 0 ? _ref50 : params.customerName;
2755
2760
  return _objectSpread(_objectSpread({}, source), {}, {
2756
2761
  id: (_source$id = source.id) !== null && _source$id !== void 0 ? _source$id : params.customerId,
2757
2762
  customer_id: (_source$customer_id = source.customer_id) !== null && _source$customer_id !== void 0 ? _source$customer_id : params.customerId,
2758
2763
  name: String(name || ''),
2759
2764
  customer_name: String(customerName || ''),
2760
- country_calling_code: String((_ref52 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref52 !== void 0 ? _ref52 : params.countryCallingCode),
2765
+ country_calling_code: String((_ref53 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref53 !== void 0 ? _ref53 : params.countryCallingCode),
2761
2766
  phone: String((_source$phone = source.phone) !== null && _source$phone !== void 0 ? _source$phone : params.phone),
2762
2767
  email: String((_source$email = source.email) !== null && _source$email !== void 0 ? _source$email : params.email)
2763
2768
  });
@@ -2856,14 +2861,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2856
2861
  }, {
2857
2862
  key: "updateTempOrderCustomer",
2858
2863
  value: function updateTempOrderCustomer(customer) {
2859
- var _tempOrder$customer_i2, _ref53, _ref54, _customer$customer_id, _ref55, _ref56, _ref57, _customer$customer_na, _ref58, _customer$country_cal, _tempOrder$customer_i3;
2864
+ var _tempOrder$customer_i2, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i3;
2860
2865
  var tempOrder = this.ensureTempOrder();
2861
2866
  var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
2862
- var customerId = (_ref53 = (_ref54 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref54 !== void 0 ? _ref54 : customer.id) !== null && _ref53 !== void 0 ? _ref53 : null;
2863
- var customerName = (_ref55 = (_ref56 = (_ref57 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref57 !== void 0 ? _ref57 : customer.display_name) !== null && _ref56 !== void 0 ? _ref56 : customer.name) !== null && _ref55 !== void 0 ? _ref55 : '';
2867
+ var customerId = (_ref54 = (_ref55 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref55 !== void 0 ? _ref55 : customer.id) !== null && _ref54 !== void 0 ? _ref54 : null;
2868
+ var customerName = (_ref56 = (_ref57 = (_ref58 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref58 !== void 0 ? _ref58 : customer.display_name) !== null && _ref57 !== void 0 ? _ref57 : customer.name) !== null && _ref56 !== void 0 ? _ref56 : '';
2864
2869
  tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
2865
2870
  tempOrder.customer_name = String(customerName || '');
2866
- tempOrder.country_calling_code = String((_ref58 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref58 !== void 0 ? _ref58 : '');
2871
+ tempOrder.country_calling_code = String((_ref59 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref59 !== void 0 ? _ref59 : '');
2867
2872
  tempOrder.phone = String(customer.phone || '');
2868
2873
  tempOrder.email = String(customer.email || '');
2869
2874
  tempOrder.customer = this.buildTempOrderCustomer({
@@ -3408,7 +3413,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3408
3413
  key: "addProductToOrder",
3409
3414
  value: (function () {
3410
3415
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(product, booking) {
3411
- var tempOrder, _ref59, _productRecord$num, productRecord, splitCount, i, singleLine;
3416
+ var tempOrder, _ref60, _productRecord$num, productRecord, splitCount, i, singleLine;
3412
3417
  return _regeneratorRuntime().wrap(function _callee17$(_context19) {
3413
3418
  while (1) switch (_context19.prev = _context19.next) {
3414
3419
  case 0:
@@ -3418,7 +3423,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3418
3423
  break;
3419
3424
  }
3420
3425
  productRecord = product;
3421
- splitCount = getSafeProductNum((_ref59 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref59 !== void 0 ? _ref59 : 1);
3426
+ splitCount = getSafeProductNum((_ref60 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref60 !== void 0 ? _ref60 : 1);
3422
3427
  if (!(splitCount > 1)) {
3423
3428
  _context19.next = 18;
3424
3429
  break;
@@ -3476,7 +3481,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3476
3481
  key: "addProductsToOrder",
3477
3482
  value: (function () {
3478
3483
  var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(items, options) {
3479
- var tempOrder, _iterator20, _step20, item, product, booking, _ref60, _productRecord$num2, productRecord, splitCount, i, singleLine;
3484
+ var tempOrder, _iterator20, _step20, item, product, booking, _ref61, _productRecord$num2, productRecord, splitCount, i, singleLine;
3480
3485
  return _regeneratorRuntime().wrap(function _callee18$(_context20) {
3481
3486
  while (1) switch (_context20.prev = _context20.next) {
3482
3487
  case 0:
@@ -3508,7 +3513,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3508
3513
  break;
3509
3514
  }
3510
3515
  productRecord = product;
3511
- splitCount = getSafeProductNum((_ref60 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref60 !== void 0 ? _ref60 : 1);
3516
+ splitCount = getSafeProductNum((_ref61 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
3512
3517
  if (!(splitCount > 1)) {
3513
3518
  _context20.next = 26;
3514
3519
  break;
@@ -3585,9 +3590,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3585
3590
  }, {
3586
3591
  key: "getBundleRuntimeIdentity",
3587
3592
  value: function getBundleRuntimeIdentity(bundle) {
3588
- var _ref61, _bundle$bundle_id2, _ref62, _bundle$bundle_group_2, _ref63, _ref64, _bundle$bundle_produc3, _ref65, _bundle$bundle_varian3;
3593
+ var _ref62, _bundle$bundle_id2, _ref63, _bundle$bundle_group_2, _ref64, _ref65, _bundle$bundle_produc3, _ref66, _bundle$bundle_varian3;
3589
3594
  if (!bundle || _typeof(bundle) !== 'object') return '';
3590
- return [(_ref61 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref61 !== void 0 ? _ref61 : '', (_ref62 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref62 !== void 0 ? _ref62 : '', (_ref63 = (_ref64 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref64 !== void 0 ? _ref64 : bundle.product_id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref65 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref65 !== void 0 ? _ref65 : 0].join('|');
3595
+ return [(_ref62 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref62 !== void 0 ? _ref62 : '', (_ref63 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref64 = (_ref65 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref65 !== void 0 ? _ref65 : bundle.product_id) !== null && _ref64 !== void 0 ? _ref64 : '', (_ref66 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref66 !== void 0 ? _ref66 : 0].join('|');
3591
3596
  }
3592
3597
  }, {
3593
3598
  key: "preservePersistedBundlePriceFields",
@@ -4104,23 +4109,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4104
4109
  }, {
4105
4110
  key: "buildCurrentSubmitPayloadForLocalPrint",
4106
4111
  value: function buildCurrentSubmitPayloadForLocalPrint(params) {
4107
- var _params$cacheId, _this$otherParams2, _ref66, _params$businessCode, _this$otherParams3, _this$otherParams4;
4112
+ var _params$cacheId, _this$otherParams2, _ref67, _params$businessCode, _this$otherParams3, _this$otherParams4;
4108
4113
  var tempOrder = this.ensureTempOrder();
4109
4114
  this.persistTempOrder();
4110
4115
  var payload = buildSubmitPayload({
4111
4116
  tempOrder: tempOrder,
4112
4117
  cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
4113
4118
  platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform),
4114
- businessCode: (_ref66 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode) !== null && _ref66 !== void 0 ? _ref66 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
4119
+ businessCode: (_ref67 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode) !== null && _ref67 !== void 0 ? _ref67 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
4115
4120
  channel: params === null || params === void 0 ? void 0 : params.channel,
4116
4121
  type: params === null || params === void 0 ? void 0 : params.type,
4117
4122
  summary: this.store.summary || createEmptySummary(),
4118
4123
  enhance: function enhance(nextPayload) {
4119
- var _ref67, _tempOrder$order_numb, _ref68, _tempOrder$shop_order, _ref69, _tempOrder$shop_full_;
4124
+ var _ref68, _tempOrder$order_numb, _ref69, _tempOrder$shop_order, _ref70, _tempOrder$shop_full_;
4120
4125
  return _objectSpread(_objectSpread({}, nextPayload), {}, {
4121
- order_number: (_ref67 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref67 !== void 0 ? _ref67 : null,
4122
- shop_order_number: (_ref68 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref68 !== void 0 ? _ref68 : null,
4123
- shop_full_order_number: (_ref69 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref69 !== void 0 ? _ref69 : null,
4126
+ order_number: (_ref68 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref68 !== void 0 ? _ref68 : null,
4127
+ shop_order_number: (_ref69 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref69 !== void 0 ? _ref69 : null,
4128
+ shop_full_order_number: (_ref70 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref70 !== void 0 ? _ref70 : null,
4124
4129
  small_ticket_data_flag: 1
4125
4130
  });
4126
4131
  }
@@ -4217,7 +4222,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4217
4222
  key: "runSubmitTempOrder",
4218
4223
  value: function () {
4219
4224
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
4220
- var _params$cacheId2, _this$otherParams5, _ref70, _params$businessCode2, _this$otherParams6, _this$otherParams7;
4225
+ var _params$cacheId2, _this$otherParams5, _ref71, _params$businessCode2, _this$otherParams6, _this$otherParams7;
4221
4226
  var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
4222
4227
  return _regeneratorRuntime().wrap(function _callee28$(_context31) {
4223
4228
  while (1) switch (_context31.prev = _context31.next) {
@@ -4263,7 +4268,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4263
4268
  tempOrder: tempOrder,
4264
4269
  cacheId: effectiveCacheId,
4265
4270
  platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform),
4266
- businessCode: (_ref70 = (_params$businessCode2 = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode2 !== void 0 ? _params$businessCode2 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref70 !== void 0 ? _ref70 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code,
4271
+ businessCode: (_ref71 = (_params$businessCode2 = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode2 !== void 0 ? _params$businessCode2 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref71 !== void 0 ? _ref71 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code,
4267
4272
  channel: params === null || params === void 0 ? void 0 : params.channel,
4268
4273
  type: params === null || params === void 0 ? void 0 : params.type,
4269
4274
  summary: latestSummary,
@@ -5112,7 +5117,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5112
5117
  _step22;
5113
5118
  try {
5114
5119
  for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
5115
- var _product$metadata8, _ref71, _ref72, _existed$origin, _rawProduct$metadata;
5120
+ var _product$metadata8, _ref72, _ref73, _existed$origin, _rawProduct$metadata;
5116
5121
  var _step22$value = _slicedToArray(_step22.value, 2),
5117
5122
  index = _step22$value[0],
5118
5123
  product = _step22$value[1];
@@ -5120,7 +5125,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5120
5125
  if (!uid) continue;
5121
5126
  var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
5122
5127
  var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
5123
- var origin = (_ref71 = (_ref72 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref72 !== void 0 ? _ref72 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref71 !== void 0 ? _ref71 : rawProduct;
5128
+ var origin = (_ref72 = (_ref73 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref73 !== void 0 ? _ref73 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref72 !== void 0 ? _ref72 : rawProduct;
5124
5129
  var originSnapshot = cloneDeep(origin);
5125
5130
  var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
5126
5131
  if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
@@ -5230,10 +5235,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5230
5235
  }, {
5231
5236
  key: "normalizeHydratedProductOptionItem",
5232
5237
  value: function normalizeHydratedProductOptionItem(optionItem) {
5233
- var _ref73, _optionItem$num, _ref74, _optionItem$add_price;
5234
- var rawNum = (_ref73 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref73 !== void 0 ? _ref73 : 1;
5238
+ var _ref74, _optionItem$num, _ref75, _optionItem$add_price;
5239
+ var rawNum = (_ref74 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref74 !== void 0 ? _ref74 : 1;
5235
5240
  var parsedNum = Number(rawNum);
5236
- var rawPrice = (_ref74 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref74 !== void 0 ? _ref74 : 0;
5241
+ var rawPrice = (_ref75 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref75 !== void 0 ? _ref75 : 0;
5237
5242
  var parsedPrice = Number(rawPrice);
5238
5243
  var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
5239
5244
  option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
@@ -5360,10 +5365,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5360
5365
  _step27;
5361
5366
  try {
5362
5367
  for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) {
5363
- var _ref75, _bundle$num3;
5368
+ var _ref76, _bundle$num3;
5364
5369
  var bundle = _step27.value;
5365
5370
  var isPersistedBundleProduct = isPersistedProduct || Boolean((bundle === null || bundle === void 0 ? void 0 : bundle.order_detail_id) || (bundle === null || bundle === void 0 ? void 0 : bundle.orderDetailId) || (bundle === null || bundle === void 0 ? void 0 : bundle.booking_id));
5366
- var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref75 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref75 !== void 0 ? _ref75 : 1) || 1).toNumber();
5371
+ var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref76 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref76 !== void 0 ? _ref76 : 1) || 1).toNumber();
5367
5372
  var _iterator28 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
5368
5373
  _step28;
5369
5374
  try {
@@ -422,6 +422,10 @@ declare class Server {
422
422
  private canAssignStringProductTitleToLocale;
423
423
  private hasCjkText;
424
424
  private resolveFirstProductTitleValue;
425
+ private getPaymentCodeKey;
426
+ private isBlankPaymentName;
427
+ private shouldLookupPaymentMethodNameByCode;
428
+ private enrichPaymentNamesByCode;
425
429
  private withLocalSmallTicketData;
426
430
  private handleOrderSalesDetail;
427
431
  /**