@pisell/pisellos 2.3.5 → 2.3.7

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 (40) hide show
  1. package/dist/core/index.js +1 -1
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
  4. package/dist/modules/Order/index.d.ts +12 -1
  5. package/dist/modules/Order/index.js +260 -160
  6. package/dist/modules/Order/types.d.ts +5 -0
  7. package/dist/modules/Order/utils.d.ts +4 -0
  8. package/dist/modules/Order/utils.js +31 -0
  9. package/dist/modules/Product/index.d.ts +1 -1
  10. package/dist/modules/Rules/index.d.ts +3 -3
  11. package/dist/modules/Rules/index.js +8 -3
  12. package/dist/modules/Rules/types.d.ts +2 -1
  13. package/dist/server/index.js +4 -3
  14. package/dist/server/modules/order/index.d.ts +4 -4
  15. package/dist/server/modules/order/index.js +4 -4
  16. package/dist/solution/BaseSales/index.js +93 -68
  17. package/dist/solution/BaseSales/types.d.ts +1 -0
  18. package/dist/solution/BaseSales/types.js +2 -1
  19. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -2
  20. package/dist/solution/BookingByStep/index.d.ts +1 -1
  21. package/lib/core/index.js +1 -1
  22. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
  23. package/lib/modules/Order/index.d.ts +12 -1
  24. package/lib/modules/Order/index.js +135 -26
  25. package/lib/modules/Order/types.d.ts +5 -0
  26. package/lib/modules/Order/utils.d.ts +4 -0
  27. package/lib/modules/Order/utils.js +39 -0
  28. package/lib/modules/Product/index.d.ts +1 -1
  29. package/lib/modules/Rules/index.d.ts +3 -3
  30. package/lib/modules/Rules/index.js +4 -3
  31. package/lib/modules/Rules/types.d.ts +2 -1
  32. package/lib/server/index.js +1 -4
  33. package/lib/server/modules/order/index.d.ts +4 -4
  34. package/lib/server/modules/order/index.js +4 -4
  35. package/lib/solution/BaseSales/index.js +40 -19
  36. package/lib/solution/BaseSales/types.d.ts +1 -0
  37. package/lib/solution/BaseSales/types.js +2 -1
  38. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -5
  39. package/lib/solution/BookingByStep/index.d.ts +1 -1
  40. package/package.json +1 -1
@@ -32,7 +32,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
32
32
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
33
33
  import { BaseModule } from "../BaseModule";
34
34
  import { OrderHooks } from "./types";
35
- import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields } from "./utils";
35
+ import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, mergeOrderProductDisplayFields, resolveIsFormSubject } from "./utils";
36
36
  import { isNormalProduct } from "../Product/utils";
37
37
  import dayjs from 'dayjs';
38
38
  import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
@@ -224,6 +224,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
224
224
  product.metadata.main_product_selling_price = newMainSellingPrice;
225
225
  product.metadata.price_schema_version = 2;
226
226
  }
227
+ if (Array.isArray(product.product_bundle)) {
228
+ product.product_bundle = product.product_bundle.map(function (bundle) {
229
+ var _ref12, _bundle$original_pric;
230
+ var hasBundleDiscount = Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) && bundle.discount_list.length > 0;
231
+ if (hasBundleDiscount) return bundle;
232
+ var restoredPrice = (_ref12 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref12 !== void 0 ? _ref12 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
233
+ if (restoredPrice === undefined || restoredPrice === null || restoredPrice === '') return bundle;
234
+ return _objectSpread(_objectSpread({}, bundle), {}, {
235
+ price: restoredPrice,
236
+ bundle_selling_price: restoredPrice
237
+ });
238
+ });
239
+ }
227
240
  product.selling_price = composeLinePrice({
228
241
  mainPrice: newMainSellingPrice,
229
242
  bundle: product.product_bundle
@@ -553,8 +566,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
553
566
  key: "scanCode",
554
567
  value: function () {
555
568
  var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
556
- var _this$store$discount7, _tempOrder$holder, _this$store$summary, _tempOrder$holder2;
557
- var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref12, isAvailable, newDiscountList, unavailableReason, _this$store$discount8;
569
+ var _this$store$discount7, _tempOrder$holder, _this$store$summary;
570
+ var resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelected, tempOrder, holders, _ref13, isAvailable, newDiscountList, unavailableReason, _this$store$discount8;
558
571
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
559
572
  while (1) switch (_context5.prev = _context5.next) {
560
573
  case 0:
@@ -624,20 +637,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
624
637
  });
625
638
  case 16:
626
639
  tempOrder = this.store.tempOrder;
627
- holders = tempOrder !== null && tempOrder !== void 0 && (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
628
- form_record_id: tempOrder.holder.form_record_id
629
- }] : [];
630
- _ref12 = rulesModule.isDiscountListAvailable({
640
+ holders = (tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
641
+ _ref13 = rulesModule.isDiscountListAvailable({
631
642
  productList: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
632
643
  oldDiscountList: this.getDiscountList(),
633
644
  newDiscountList: withScanList,
634
645
  orderTotalAmount: Number(((_this$store$summary = this.store.summary) === null || _this$store$summary === void 0 ? void 0 : _this$store$summary.total_amount) || 0),
635
646
  holders: holders,
636
- isFormSubject: !!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
647
+ isFormSubject: function isFormSubject(product) {
648
+ return resolveIsFormSubject(tempOrder, product);
649
+ }
637
650
  }) || {
638
651
  isAvailable: false,
639
652
  discountList: this.getDiscountList()
640
- }, isAvailable = _ref12.isAvailable, newDiscountList = _ref12.discountList, unavailableReason = _ref12.unavailableReason;
653
+ }, isAvailable = _ref13.isAvailable, newDiscountList = _ref13.discountList, unavailableReason = _ref13.unavailableReason;
641
654
  if (isAvailable && newDiscountList) {
642
655
  (_this$store$discount8 = this.store.discount) === null || _this$store$discount8 === void 0 || _this$store$discount8.setDiscountList(newDiscountList);
643
656
  this.applyDiscount();
@@ -664,8 +677,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
664
677
  key: "applyDiscount",
665
678
  value: function applyDiscount() {
666
679
  var _this$store$discount9,
667
- _tempOrder$holder3,
668
- _tempOrder$holder4,
680
+ _tempOrder$holder2,
669
681
  _this$store$summary2,
670
682
  _this2 = this;
671
683
  var tempOrder = this.store.tempOrder;
@@ -674,26 +686,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
674
686
  // appliedProductDetails / savedAmount 复位。
675
687
  if (!tempOrder) return;
676
688
  delete tempOrder.discount_list;
677
- if (this.shouldSkipDiscountCalculation(tempOrder)) return;
689
+ var discountList = ((_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.getDiscountList()) || [];
690
+ var shouldSkipDiscountCalculation = this.shouldSkipDiscountCalculation(tempOrder);
691
+ if (shouldSkipDiscountCalculation) return;
678
692
  var rulesModule = this.store.rules;
679
693
  if (!rulesModule) return;
680
- var discountList = ((_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.getDiscountList()) || [];
681
- var holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
682
- form_record_id: tempOrder.holder.form_record_id
683
- }] : [];
694
+ var holders = ((_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_record) || [];
684
695
  var result = rulesModule.calcDiscount({
685
696
  productList: tempOrder.products,
686
697
  discountList: discountList,
687
698
  holders: holders,
688
- isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
699
+ isFormSubject: function isFormSubject(product) {
700
+ return resolveIsFormSubject(tempOrder, product);
701
+ },
689
702
  orderTotalAmount: Number(((_this$store$summary2 = this.store.summary) === null || _this$store$summary2 === void 0 ? void 0 : _this$store$summary2.total_amount) || 0)
690
703
  });
691
704
  if (result !== null && result !== void 0 && result.productList) {
692
705
  var previousProductsByUid = indexOrderProductsByUid(tempOrder.products);
693
706
  tempOrder.products = this.applyProductDiscountPrices((result.productList || []).map(function (product, index) {
694
- var _ref13;
707
+ var _ref14;
695
708
  var uid = getOrderProductLineUid(product);
696
- var previous = (_ref13 = uid ? previousProductsByUid.get(uid) : undefined) !== null && _ref13 !== void 0 ? _ref13 : previousProductsByUid.get("__index__:".concat(index));
709
+ var previous = (_ref14 = uid ? previousProductsByUid.get(uid) : undefined) !== null && _ref14 !== void 0 ? _ref14 : previousProductsByUid.get("__index__:".concat(index));
697
710
  if (isManualProductDiscountProduct(previous)) {
698
711
  return previous;
699
712
  }
@@ -1218,15 +1231,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1218
1231
  }, {
1219
1232
  key: "extractOrderIdFromSubmitResult",
1220
1233
  value: function extractOrderIdFromSubmitResult(result) {
1221
- var _ref14, _ref15, _ref16, _result$data$order_id, _result$data, _result$data2;
1222
- return (_ref14 = (_ref15 = (_ref16 = (_result$data$order_id = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.order_id) !== null && _result$data$order_id !== void 0 ? _result$data$order_id : result === null || result === void 0 ? void 0 : result.order_id) !== null && _ref16 !== void 0 ? _ref16 : result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.id) !== null && _ref15 !== void 0 ? _ref15 : result === null || result === void 0 ? void 0 : result.id) !== null && _ref14 !== void 0 ? _ref14 : null;
1234
+ var _ref15, _ref16, _ref17, _result$data$order_id, _result$data, _result$data2;
1235
+ return (_ref15 = (_ref16 = (_ref17 = (_result$data$order_id = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.order_id) !== null && _result$data$order_id !== void 0 ? _result$data$order_id : result === null || result === void 0 ? void 0 : result.order_id) !== null && _ref17 !== void 0 ? _ref17 : result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.id) !== null && _ref16 !== void 0 ? _ref16 : result === null || result === void 0 ? void 0 : result.id) !== null && _ref15 !== void 0 ? _ref15 : null;
1223
1236
  }
1224
1237
  }, {
1225
1238
  key: "calculatePaymentEffectiveAmount",
1226
1239
  value: function calculatePaymentEffectiveAmount(payment) {
1227
- var _ref17, _payment$origin_amoun;
1240
+ var _ref18, _payment$origin_amoun;
1228
1241
  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);
1242
+ var originAmount = new Decimal((_ref18 = (_payment$origin_amoun = payment.origin_amount) !== null && _payment$origin_amoun !== void 0 ? _payment$origin_amoun : payment.amount) !== null && _ref18 !== void 0 ? _ref18 : 0);
1230
1243
  var serviceFee = new Decimal(payment.service_fee || 0);
1231
1244
  // TODO: 后端允许 amount 表示顾客实际支付总额后,移除这个兼容分支。
1232
1245
  var effectiveAmount = serviceFee.gt(0) && amount.eq(originAmount) ? amount.plus(serviceFee) : amount;
@@ -1253,6 +1266,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1253
1266
  value: function normalizeDepositAmount(amount) {
1254
1267
  return Decimal.max(new Decimal(Number(amount) || 0), 0).toDecimalPlaces(2).toFixed(2);
1255
1268
  }
1269
+ }, {
1270
+ key: "getLastOrderDepositSnapshot",
1271
+ value: function getLastOrderDepositSnapshot() {
1272
+ var _lastOrderInfo$deposi, _lastOrderInfo$summar;
1273
+ var lastOrderInfo = this.store.lastOrderInfo;
1274
+ if (!lastOrderInfo || _typeof(lastOrderInfo) !== 'object') return null;
1275
+ var rawDepositAmount = (_lastOrderInfo$deposi = lastOrderInfo.deposit_amount) !== null && _lastOrderInfo$deposi !== void 0 ? _lastOrderInfo$deposi : (_lastOrderInfo$summar = lastOrderInfo.summary) === null || _lastOrderInfo$summar === void 0 ? void 0 : _lastOrderInfo$summar.deposit_amount;
1276
+ var depositAmount = this.normalizeDepositAmount(rawDepositAmount !== null && rawDepositAmount !== void 0 ? rawDepositAmount : 0);
1277
+ var hasDepositAmount = new Decimal(depositAmount).gt(0);
1278
+ var isDeposit = Number(lastOrderInfo.is_deposit) === 1 || hasDepositAmount;
1279
+ if (!isDeposit || !hasDepositAmount) return null;
1280
+ return {
1281
+ isDeposit: 1,
1282
+ depositAmount: depositAmount
1283
+ };
1284
+ }
1285
+ }, {
1286
+ key: "getLastOrderSubmitSnapshot",
1287
+ value: function getLastOrderSubmitSnapshot() {
1288
+ var lastOrderInfo = this.store.lastOrderInfo;
1289
+ if (!lastOrderInfo || _typeof(lastOrderInfo) !== 'object') return {};
1290
+ var businessCode = lastOrderInfo.business_code;
1291
+ var type = lastOrderInfo.type;
1292
+ return _objectSpread(_objectSpread({}, typeof businessCode === 'string' && businessCode ? {
1293
+ businessCode: businessCode
1294
+ } : {}), typeof type === 'string' && type ? {
1295
+ type: type
1296
+ } : {});
1297
+ }
1256
1298
  }, {
1257
1299
  key: "applyDepositAmountToSummary",
1258
1300
  value: function applyDepositAmountToSummary(tempOrder, summary, amount) {
@@ -1271,10 +1313,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1271
1313
  tempOrder.is_deposit = hasDepositAmount ? 1 : 0;
1272
1314
  return nextSummary;
1273
1315
  }
1316
+ }, {
1317
+ key: "applyLastOrderDepositSnapshot",
1318
+ value: function applyLastOrderDepositSnapshot(tempOrder, summary) {
1319
+ var snapshot = this.getLastOrderDepositSnapshot();
1320
+ if (!snapshot) return summary;
1321
+ var existedDeposit = summary.deposit && _typeof(summary.deposit) === 'object' ? summary.deposit : undefined;
1322
+ var nextSummary = _objectSpread(_objectSpread({}, summary), {}, {
1323
+ deposit_amount: snapshot.depositAmount,
1324
+ deposit: _objectSpread(_objectSpread({}, existedDeposit || {}), {}, {
1325
+ total: snapshot.depositAmount,
1326
+ deposit_policy_ids: (existedDeposit === null || existedDeposit === void 0 ? void 0 : existedDeposit.deposit_policy_ids) || [],
1327
+ hasDeposit: true
1328
+ })
1329
+ });
1330
+ tempOrder.deposit_amount = snapshot.depositAmount;
1331
+ tempOrder.is_deposit = tempOrder.is_deposit === 0 && new Decimal(tempOrder.deposit_amount || 0).gt(0) ? 0 : snapshot.isDeposit;
1332
+ return nextSummary;
1333
+ }
1274
1334
  }, {
1275
1335
  key: "isDepositOrder",
1276
1336
  value: function isDepositOrder(tempOrder, depositAmount) {
1277
- return tempOrder.is_deposit === 1 || depositAmount.gt(0);
1337
+ return tempOrder.is_deposit === 1 && depositAmount.gt(0);
1278
1338
  }
1279
1339
  }, {
1280
1340
  key: "getOrderExpectedAmount",
@@ -1289,6 +1349,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1289
1349
  if (depositAmount.lte(0)) return false;
1290
1350
  return params.paidAmount.gte(depositAmount);
1291
1351
  }
1352
+ }, {
1353
+ key: "getPaymentCompletion",
1354
+ value: function getPaymentCompletion(payments) {
1355
+ var tempOrder = this.ensureTempOrder();
1356
+ var summary = this.store.summary || createEmptySummary();
1357
+ var paymentList = payments || tempOrder.payments || [];
1358
+ var refundAmount = this.getSummaryRefundAmount(summary);
1359
+ var netPaidAmount = Decimal.max(this.calculatePaymentTotal(paymentList).minus(refundAmount), 0);
1360
+ var depositAmount = this.getDepositAmount(tempOrder, summary);
1361
+ var orderExpectedAmount = this.getOrderExpectedAmount(summary);
1362
+ var isDepositFullyPaid = this.isDepositCovered({
1363
+ tempOrder: tempOrder,
1364
+ summary: summary,
1365
+ paidAmount: netPaidAmount
1366
+ });
1367
+ var isOrderFullyPaid = orderExpectedAmount.lte(0) ? true : netPaidAmount.gte(orderExpectedAmount);
1368
+ var paymentStage = this.isDepositOrder(tempOrder, depositAmount) && !isDepositFullyPaid ? 'deposit' : 'normal';
1369
+ return {
1370
+ isFullyPaid: isOrderFullyPaid,
1371
+ isOrderFullyPaid: isOrderFullyPaid,
1372
+ isDepositFullyPaid: isDepositFullyPaid,
1373
+ paymentStage: paymentStage,
1374
+ depositAmount: depositAmount.toFixed(2),
1375
+ orderExpectedAmount: orderExpectedAmount.toFixed(2)
1376
+ };
1377
+ }
1292
1378
  }, {
1293
1379
  key: "calculateDepositPaidAmount",
1294
1380
  value: function calculateDepositPaidAmount(payments) {
@@ -1317,7 +1403,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1317
1403
  }, {
1318
1404
  key: "normalizePaymentSource",
1319
1405
  value: function normalizePaymentSource(payment, options) {
1320
- var _ref18, _paymentRecord$origin;
1406
+ var _ref19, _paymentRecord$origin;
1321
1407
  var paymentRecord = payment;
1322
1408
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
1323
1409
  if (!metadata.unique_payment_number) {
@@ -1325,7 +1411,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1325
1411
  }
1326
1412
  var normalized = _objectSpread(_objectSpread({}, paymentRecord), {}, {
1327
1413
  metadata: metadata,
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'
1414
+ origin_amount: (_ref19 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref19 !== void 0 ? _ref19 : '0.00'
1329
1415
  });
1330
1416
  if (paymentRecord.status !== undefined) {
1331
1417
  normalized.status = paymentRecord.status;
@@ -1658,7 +1744,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1658
1744
  _product$payment_pric,
1659
1745
  _sku$code,
1660
1746
  _sku$barcode,
1661
- _ref19,
1747
+ _ref20,
1662
1748
  _sku$variant_id,
1663
1749
  _this8 = this;
1664
1750
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
@@ -1685,24 +1771,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1685
1771
  product_sku: this.normalizeFingerprintValue({
1686
1772
  code: (_sku$code = sku.code) !== null && _sku$code !== void 0 ? _sku$code : '',
1687
1773
  barcode: (_sku$barcode = sku.barcode) !== null && _sku$barcode !== void 0 ? _sku$barcode : '',
1688
- 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,
1774
+ variant_id: (_ref20 = (_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 && _ref20 !== void 0 ? _ref20 : 0,
1689
1775
  variant: sku.variant || [],
1690
1776
  option: getProductSkuOptions(product || {}).map(function (option) {
1691
- var _ref20, _option$id, _option$option_group_, _ref21, _option$option_group_2, _option$num, _option$add_price;
1777
+ var _ref21, _option$id, _option$option_group_, _ref22, _option$option_group_2, _option$num, _option$add_price;
1692
1778
  return {
1693
- 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,
1779
+ id: (_ref21 = (_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 && _ref21 !== void 0 ? _ref21 : null,
1694
1780
  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,
1695
- 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,
1781
+ option_group_item_id: (_ref22 = (_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 && _ref22 !== void 0 ? _ref22 : null,
1696
1782
  num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
1697
1783
  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)
1698
1784
  };
1699
1785
  })
1700
1786
  }),
1701
1787
  product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
1702
- var _ref22, _ref23, _bundle$bundle_produc, _ref24, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
1788
+ var _ref23, _ref24, _bundle$bundle_produc, _ref25, _bundle$bundle_varian, _bundle$num, _bundle$price_type, _bundle$price_type_ex;
1703
1789
  return {
1704
- 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,
1705
- 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,
1790
+ bundle_product_id: (_ref23 = (_ref24 = (_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 && _ref24 !== void 0 ? _ref24 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref23 !== void 0 ? _ref23 : null,
1791
+ bundle_variant_id: (_ref25 = (_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 && _ref25 !== void 0 ? _ref25 : 0,
1706
1792
  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),
1707
1793
  price: _this8.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
1708
1794
  bundle_selling_price: _this8.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
@@ -1711,10 +1797,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1711
1797
  };
1712
1798
  })),
1713
1799
  discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
1714
- var _ref25, _discount$type2, _ref26, _ref27, _discount$discount_id, _discount$discount;
1800
+ var _ref26, _discount$type2, _ref27, _ref28, _discount$discount_id, _discount$discount;
1715
1801
  return {
1716
- 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 : '',
1717
- 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,
1802
+ type: (_ref26 = (_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 && _ref26 !== void 0 ? _ref26 : '',
1803
+ discount_id: (_ref27 = (_ref28 = (_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 && _ref28 !== void 0 ? _ref28 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref27 !== void 0 ? _ref27 : null,
1718
1804
  amount: _this8.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
1719
1805
  };
1720
1806
  }))
@@ -1738,14 +1824,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1738
1824
  var _product$product_id3,
1739
1825
  _product$product_vari2,
1740
1826
  _product$num2,
1741
- _ref28,
1827
+ _ref29,
1742
1828
  _metadata$unique_iden,
1743
1829
  _metadata$price_overr,
1744
1830
  _metadata$is_manual_d,
1745
1831
  _metadata$product_dis,
1746
1832
  _sku$code2,
1747
1833
  _sku$barcode2,
1748
- _ref29,
1834
+ _ref30,
1749
1835
  _sku$variant_id2,
1750
1836
  _this10 = this;
1751
1837
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
@@ -1761,7 +1847,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1761
1847
  extension_type: extensionType,
1762
1848
  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),
1763
1849
  metadata: {
1764
- 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 : '',
1850
+ unique_identification_number: (_ref29 = (_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 && _ref29 !== void 0 ? _ref29 : '',
1765
1851
  price_override: (_metadata$price_overr = metadata.price_override) !== null && _metadata$price_overr !== void 0 ? _metadata$price_overr : '',
1766
1852
  is_manual_discount: (_metadata$is_manual_d = metadata.is_manual_discount) !== null && _metadata$is_manual_d !== void 0 ? _metadata$is_manual_d : '',
1767
1853
  product_discount_reason: (_metadata$product_dis = metadata.product_discount_reason) !== null && _metadata$product_dis !== void 0 ? _metadata$product_dis : ''
@@ -1769,35 +1855,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1769
1855
  product_sku: this.normalizeFingerprintValue({
1770
1856
  code: (_sku$code2 = sku.code) !== null && _sku$code2 !== void 0 ? _sku$code2 : '',
1771
1857
  barcode: (_sku$barcode2 = sku.barcode) !== null && _sku$barcode2 !== void 0 ? _sku$barcode2 : '',
1772
- 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,
1858
+ variant_id: (_ref30 = (_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 && _ref30 !== void 0 ? _ref30 : 0,
1773
1859
  variant: sku.variant || [],
1774
1860
  option: getProductSkuOptions(product || {}).map(function (option) {
1775
- var _ref30, _option$id2, _option$option_group_3, _ref31, _option$option_group_4, _option$num2, _option$add_price2;
1861
+ var _ref31, _option$id2, _option$option_group_3, _ref32, _option$option_group_4, _option$num2, _option$add_price2;
1776
1862
  return {
1777
- 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,
1863
+ id: (_ref31 = (_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 && _ref31 !== void 0 ? _ref31 : null,
1778
1864
  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,
1779
- 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,
1865
+ option_group_item_id: (_ref32 = (_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 && _ref32 !== void 0 ? _ref32 : null,
1780
1866
  num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
1781
1867
  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)
1782
1868
  };
1783
1869
  })
1784
1870
  }),
1785
1871
  product_bundle: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.product_bundle) || []).map(function (bundle) {
1786
- 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;
1872
+ var _ref33, _bundle$bundle_id, _ref34, _bundle$bundle_group_, _ref35, _ref36, _bundle$bundle_produc2, _ref37, _bundle$bundle_varian2, _bundle$num2, _bundle$price_type2, _bundle$price_type_ex2;
1787
1873
  return {
1788
- 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,
1789
- 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,
1790
- 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,
1791
- 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,
1874
+ bundle_id: (_ref33 = (_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 && _ref33 !== void 0 ? _ref33 : null,
1875
+ bundle_group_id: (_ref34 = (_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 && _ref34 !== void 0 ? _ref34 : null,
1876
+ bundle_product_id: (_ref35 = (_ref36 = (_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 && _ref36 !== void 0 ? _ref36 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref35 !== void 0 ? _ref35 : null,
1877
+ bundle_variant_id: (_ref37 = (_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 && _ref37 !== void 0 ? _ref37 : 0,
1792
1878
  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),
1793
1879
  price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
1794
1880
  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 : '',
1795
1881
  option: _this10.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
1796
- var _ref37, _option$id3, _option$option_group_5, _ref38, _option$option_group_6, _option$num3, _option$add_price3;
1882
+ var _ref38, _option$id3, _option$option_group_5, _ref39, _option$option_group_6, _option$num3, _option$add_price3;
1797
1883
  return {
1798
- 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,
1884
+ id: (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : null,
1799
1885
  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,
1800
- 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,
1886
+ option_group_item_id: (_ref39 = (_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 && _ref39 !== void 0 ? _ref39 : null,
1801
1887
  num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
1802
1888
  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)
1803
1889
  };
@@ -1805,10 +1891,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1805
1891
  };
1806
1892
  })),
1807
1893
  discount_list: this.normalizeFingerprintValue(((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
1808
- var _ref39, _discount$type4, _ref40, _ref41, _discount$discount_id2, _discount$discount2;
1894
+ var _ref40, _discount$type4, _ref41, _ref42, _discount$discount_id2, _discount$discount2;
1809
1895
  return {
1810
- 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 : '',
1811
- 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,
1896
+ type: (_ref40 = (_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 && _ref40 !== void 0 ? _ref40 : '',
1897
+ discount_id: (_ref41 = (_ref42 = (_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 && _ref42 !== void 0 ? _ref42 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref41 !== void 0 ? _ref41 : null,
1812
1898
  amount: _this10.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
1813
1899
  };
1814
1900
  }))
@@ -2088,11 +2174,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2088
2174
  }, {
2089
2175
  key: "getOrderIdentity",
2090
2176
  value: function getOrderIdentity() {
2091
- var _ref42, _ref43, _tempOrder$order_id, _tempOrder$_extend6;
2177
+ var _ref43, _ref44, _tempOrder$order_id, _tempOrder$_extend6;
2092
2178
  var tempOrder = this.store.tempOrder;
2093
2179
  if (!tempOrder) return null;
2094
2180
  var lastOrderInfo = this.store.lastOrderInfo || {};
2095
- 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;
2181
+ var orderId = (_ref43 = (_ref44 = (_tempOrder$order_id = tempOrder.order_id) !== null && _tempOrder$order_id !== void 0 ? _tempOrder$order_id : lastOrderInfo.order_id) !== null && _ref44 !== void 0 ? _ref44 : lastOrderInfo.id) !== null && _ref43 !== void 0 ? _ref43 : null;
2096
2182
  return {
2097
2183
  localId: this.cacheId || ((_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.localId),
2098
2184
  orderId: orderId,
@@ -2127,7 +2213,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2127
2213
  orderPaidAmount: paidPaymentSummary.gapPaidAmount
2128
2214
  });
2129
2215
  return {
2130
- isDeposit: tempOrder.is_deposit === 1 || depositAmount !== '0.00',
2216
+ isDeposit: tempOrder.is_deposit === 1,
2131
2217
  depositAmount: depositAmount,
2132
2218
  expectAmount: summary.expect_amount || '0.00',
2133
2219
  totalAmount: summary.total_amount || '0.00',
@@ -2245,11 +2331,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2245
2331
  }, {
2246
2332
  key: "captureProductRuntime",
2247
2333
  value: function captureProductRuntime(tempOrder, rawProduct, normalizedProduct, existedUid) {
2248
- var _extend$productsByUid, _ref44, _rawProduct$_origin;
2334
+ var _extend$productsByUid, _ref45, _rawProduct$_origin;
2249
2335
  var uid = existedUid || this.getProductUid(normalizedProduct);
2250
2336
  var extend = this.ensureExtend(tempOrder);
2251
2337
  var existed = ((_extend$productsByUid = extend.productsByUid) === null || _extend$productsByUid === void 0 ? void 0 : _extend$productsByUid[uid]) || {};
2252
- var origin = (_ref44 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref44 !== void 0 ? _ref44 : existed.origin;
2338
+ var origin = (_ref45 = (_rawProduct$_origin = rawProduct._origin) !== null && _rawProduct$_origin !== void 0 ? _rawProduct$_origin : normalizedProduct._origin) !== null && _ref45 !== void 0 ? _ref45 : existed.origin;
2253
2339
  extend.productsByUid[uid] = _objectSpread(_objectSpread({}, existed), origin !== undefined ? {
2254
2340
  origin: origin
2255
2341
  } : {});
@@ -2350,7 +2436,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2350
2436
  }, {
2351
2437
  key: "buildTempOrderHolderFromBookings",
2352
2438
  value: function buildTempOrderHolderFromBookings(tempOrder) {
2353
- var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder5, _baseHolder3, _this$otherParams;
2439
+ var _baseHolder$customer_, _baseHolder, _ref46, _baseHolder$form_id, _baseHolder2, _tempOrder$holder3, _baseHolder3, _this$otherParams;
2354
2440
  var holderRecords = [];
2355
2441
  var holderNames = [];
2356
2442
  var baseHolder = null;
@@ -2397,7 +2483,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2397
2483
  }
2398
2484
  var nextHolder = {
2399
2485
  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,
2400
- 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,
2486
+ form_id: (_ref46 = (_baseHolder$form_id = (_baseHolder2 = baseHolder) === null || _baseHolder2 === void 0 ? void 0 : _baseHolder2.form_id) !== null && _baseHolder$form_id !== void 0 ? _baseHolder$form_id : (_tempOrder$holder3 = tempOrder.holder) === null || _tempOrder$holder3 === void 0 ? void 0 : _tempOrder$holder3.form_id) !== null && _ref46 !== void 0 ? _ref46 : 0,
2401
2487
  form_record: holderRecords
2402
2488
  };
2403
2489
  if (holderNames.length) {
@@ -2492,15 +2578,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2492
2578
  hasDeposit: true
2493
2579
  } : undefined
2494
2580
  });
2581
+ var isExistingDepositDisabled = tempOrder.is_deposit === 0 && new Decimal(tempOrder.deposit_amount || 0).gt(0);
2495
2582
  tempOrder.deposit_amount = depositAmount;
2496
- tempOrder.is_deposit = hasDepositAmount ? 1 : 0;
2497
- return nextSummary;
2583
+ tempOrder.is_deposit = hasDepositAmount && !isExistingDepositDisabled ? 1 : 0;
2584
+ return this.applyLastOrderDepositSnapshot(tempOrder, nextSummary);
2498
2585
  }
2499
2586
  }, {
2500
2587
  key: "recalculateSummary",
2501
2588
  value: function () {
2502
2589
  var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(options) {
2503
- var _ref46, _salesSummaryResult$e;
2590
+ var _ref47, _salesSummaryResult$e;
2504
2591
  var tempOrder, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
2505
2592
  return _regeneratorRuntime().wrap(function _callee11$(_context13) {
2506
2593
  while (1) switch (_context13.prev = _context13.next) {
@@ -2573,7 +2660,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2573
2660
  roundingAmount = paidPaymentSummary.roundingAmount;
2574
2661
  payServiceChargeAmount = paidPaymentSummary.payServiceChargeAmount;
2575
2662
  hasSalesSummaryAmount = salesSummaryResult.expect_amount !== undefined || salesSummaryResult.total_amount !== undefined;
2576
- 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;
2663
+ expectAmount = hasSalesSummaryAmount ? new Decimal((_ref47 = (_salesSummaryResult$e = salesSummaryResult.expect_amount) !== null && _salesSummaryResult$e !== void 0 ? _salesSummaryResult$e : salesSummaryResult.total_amount) !== null && _ref47 !== void 0 ? _ref47 : 0) : null;
2577
2664
  amountPaymentPatch = hasSalesSummaryAmount || !roundingAmount.eq(0) || !payServiceChargeAmount.eq(0) ? _objectSpread({
2578
2665
  rounding_amount: roundingAmount.toFixed(2)
2579
2666
  }, expectAmount ? {
@@ -2751,17 +2838,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2751
2838
  }, {
2752
2839
  key: "buildTempOrderCustomer",
2753
2840
  value: function buildTempOrderCustomer(params) {
2754
- 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;
2841
+ var _ref48, _ref49, _ref50, _source$name, _ref51, _ref52, _ref53, _source$customer_name, _source$id, _source$customer_id, _ref54, _source$country_calli, _source$phone, _source$email;
2755
2842
  if (!params.customerId) return null;
2756
2843
  var source = params.source ? cloneDeep(params.source) : {};
2757
- 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;
2758
- 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;
2844
+ var name = (_ref48 = (_ref49 = (_ref50 = (_source$name = source.name) !== null && _source$name !== void 0 ? _source$name : source.display_name) !== null && _ref50 !== void 0 ? _ref50 : source.customerName) !== null && _ref49 !== void 0 ? _ref49 : source.customer_name) !== null && _ref48 !== void 0 ? _ref48 : params.customerName;
2845
+ var customerName = (_ref51 = (_ref52 = (_ref53 = (_source$customer_name = source.customer_name) !== null && _source$customer_name !== void 0 ? _source$customer_name : source.customerName) !== null && _ref53 !== void 0 ? _ref53 : source.display_name) !== null && _ref52 !== void 0 ? _ref52 : source.name) !== null && _ref51 !== void 0 ? _ref51 : params.customerName;
2759
2846
  return _objectSpread(_objectSpread({}, source), {}, {
2760
2847
  id: (_source$id = source.id) !== null && _source$id !== void 0 ? _source$id : params.customerId,
2761
2848
  customer_id: (_source$customer_id = source.customer_id) !== null && _source$customer_id !== void 0 ? _source$customer_id : params.customerId,
2762
2849
  name: String(name || ''),
2763
2850
  customer_name: String(customerName || ''),
2764
- 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),
2851
+ country_calling_code: String((_ref54 = (_source$country_calli = source.country_calling_code) !== null && _source$country_calli !== void 0 ? _source$country_calli : source.countryCallingCode) !== null && _ref54 !== void 0 ? _ref54 : params.countryCallingCode),
2765
2852
  phone: String((_source$phone = source.phone) !== null && _source$phone !== void 0 ? _source$phone : params.phone),
2766
2853
  email: String((_source$email = source.email) !== null && _source$email !== void 0 ? _source$email : params.email)
2767
2854
  });
@@ -2860,14 +2947,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2860
2947
  }, {
2861
2948
  key: "updateTempOrderCustomer",
2862
2949
  value: function updateTempOrderCustomer(customer) {
2863
- var _tempOrder$customer_i2, _ref54, _ref55, _customer$customer_id, _ref56, _ref57, _ref58, _customer$customer_na, _ref59, _customer$country_cal, _tempOrder$customer_i3;
2950
+ var _tempOrder$customer_i2, _ref55, _ref56, _customer$customer_id, _ref57, _ref58, _ref59, _customer$customer_na, _ref60, _customer$country_cal, _tempOrder$customer_i3;
2864
2951
  var tempOrder = this.ensureTempOrder();
2865
2952
  var previousCustomerId = (_tempOrder$customer_i2 = tempOrder.customer_id) !== null && _tempOrder$customer_i2 !== void 0 ? _tempOrder$customer_i2 : null;
2866
- 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;
2867
- 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 : '';
2953
+ var customerId = (_ref55 = (_ref56 = (_customer$customer_id = customer.customer_id) !== null && _customer$customer_id !== void 0 ? _customer$customer_id : customer.customerId) !== null && _ref56 !== void 0 ? _ref56 : customer.id) !== null && _ref55 !== void 0 ? _ref55 : null;
2954
+ var customerName = (_ref57 = (_ref58 = (_ref59 = (_customer$customer_na = customer.customer_name) !== null && _customer$customer_na !== void 0 ? _customer$customer_na : customer.customerName) !== null && _ref59 !== void 0 ? _ref59 : customer.display_name) !== null && _ref58 !== void 0 ? _ref58 : customer.name) !== null && _ref57 !== void 0 ? _ref57 : '';
2868
2955
  tempOrder.customer_id = customerId === null || customerId === undefined || customerId === '' ? null : Number(customerId);
2869
2956
  tempOrder.customer_name = String(customerName || '');
2870
- 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 : '');
2957
+ tempOrder.country_calling_code = String((_ref60 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : customer.countryCallingCode) !== null && _ref60 !== void 0 ? _ref60 : '');
2871
2958
  tempOrder.phone = String(customer.phone || '');
2872
2959
  tempOrder.email = String(customer.email || '');
2873
2960
  tempOrder.customer = this.buildTempOrderCustomer({
@@ -2918,6 +3005,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2918
3005
  if (String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '')) {
2919
3006
  clearTempOrderHolderAssignments(tempOrder);
2920
3007
  this.clearCustomerBoundDiscounts(tempOrder);
3008
+ this.applyDiscount();
2921
3009
  }
2922
3010
  this.persistTempOrder();
2923
3011
  this.saveDraftInBackground();
@@ -3102,6 +3190,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3102
3190
  var hasSyncedOrderPayment = function hasSyncedOrderPayment(payment) {
3103
3191
  return payment.order_payment_id !== undefined && payment.order_payment_id !== null;
3104
3192
  };
3193
+ var isOrderPaymentType = function isOrderPaymentType(value) {
3194
+ return value === 'normal' || value === 'deposit';
3195
+ };
3196
+ var voucherOrderPaymentType = this.resolveNextOrderPaymentType(tempOrder);
3197
+ var withVoucherPaymentType = function withVoucherPaymentType(payment) {
3198
+ var paymentRecord = payment;
3199
+ if (!isVoucherPayment(paymentRecord)) return payment;
3200
+ var explicitPaymentType = isOrderPaymentType(paymentRecord.order_payment_type) ? paymentRecord.order_payment_type : isOrderPaymentType(paymentRecord.type) ? paymentRecord.type : undefined;
3201
+ var nextPaymentType = explicitPaymentType || voucherOrderPaymentType;
3202
+ var shouldPreserveCustomPaymentType = paymentRecord.custom_payment_type === undefined && paymentRecord.type !== undefined && !isOrderPaymentType(paymentRecord.type);
3203
+ return _objectSpread(_objectSpread(_objectSpread({}, paymentRecord), shouldPreserveCustomPaymentType ? {
3204
+ custom_payment_type: paymentRecord.type
3205
+ } : {}), {}, {
3206
+ type: nextPaymentType,
3207
+ order_payment_type: nextPaymentType
3208
+ });
3209
+ };
3105
3210
  // const normalizeVoucherPaymentStatus = (payment: OrderPaymentSource): OrderPaymentSource => {
3106
3211
  // const paymentRecord = payment as Record<string, any>;
3107
3212
  // // if (paymentRecord.status !== 'active') return payment;
@@ -3115,7 +3220,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3115
3220
  // return paymentRecord
3116
3221
  // };
3117
3222
  var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
3118
- return _this19.normalizePaymentSource(payment, {
3223
+ return _this19.normalizePaymentSource(withVoucherPaymentType(payment), {
3119
3224
  defaultPaid: true
3120
3225
  });
3121
3226
  })).filter(function (payment) {
@@ -3412,51 +3517,50 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3412
3517
  key: "addProductToOrder",
3413
3518
  value: (function () {
3414
3519
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(product, booking) {
3415
- var tempOrder, _ref60, _productRecord$num, productRecord, splitCount, i, singleLine;
3520
+ var tempOrder, _ref61, _productRecord$num, productRecord, splitCount, i, singleLine;
3416
3521
  return _regeneratorRuntime().wrap(function _callee17$(_context19) {
3417
3522
  while (1) switch (_context19.prev = _context19.next) {
3418
3523
  case 0:
3419
3524
  tempOrder = this.ensureTempOrder();
3420
- debugger;
3421
3525
  if (!booking) {
3422
- _context19.next = 19;
3526
+ _context19.next = 18;
3423
3527
  break;
3424
3528
  }
3425
3529
  productRecord = product;
3426
- splitCount = getSafeProductNum((_ref60 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref60 !== void 0 ? _ref60 : 1);
3530
+ splitCount = getSafeProductNum((_ref61 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
3427
3531
  if (!(splitCount > 1)) {
3428
- _context19.next = 19;
3532
+ _context19.next = 18;
3429
3533
  break;
3430
3534
  }
3431
3535
  i = 0;
3432
- case 7:
3536
+ case 6:
3433
3537
  if (!(i < splitCount)) {
3434
- _context19.next = 16;
3538
+ _context19.next = 15;
3435
3539
  break;
3436
3540
  }
3437
3541
  singleLine = cloneDeep(productRecord);
3438
3542
  singleLine.num = 1;
3439
3543
  delete singleLine.product_quantity;
3440
- _context19.next = 13;
3544
+ _context19.next = 12;
3441
3545
  return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking));
3442
- case 13:
3546
+ case 12:
3443
3547
  i += 1;
3444
- _context19.next = 7;
3548
+ _context19.next = 6;
3445
3549
  break;
3446
- case 16:
3447
- _context19.next = 18;
3550
+ case 15:
3551
+ _context19.next = 17;
3448
3552
  return this.finalizeProductOrderMutation(tempOrder);
3449
- case 18:
3553
+ case 17:
3450
3554
  return _context19.abrupt("return", tempOrder.products);
3451
- case 19:
3452
- _context19.next = 21;
3555
+ case 18:
3556
+ _context19.next = 20;
3453
3557
  return this.appendProductLineToTempOrder(tempOrder, product, booking);
3454
- case 21:
3455
- _context19.next = 23;
3558
+ case 20:
3559
+ _context19.next = 22;
3456
3560
  return this.finalizeProductOrderMutation(tempOrder);
3457
- case 23:
3561
+ case 22:
3458
3562
  return _context19.abrupt("return", tempOrder.products);
3459
- case 24:
3563
+ case 23:
3460
3564
  case "end":
3461
3565
  return _context19.stop();
3462
3566
  }
@@ -3481,7 +3585,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3481
3585
  key: "addProductsToOrder",
3482
3586
  value: (function () {
3483
3587
  var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(items, options) {
3484
- var tempOrder, _iterator20, _step20, item, product, booking, _ref61, _productRecord$num2, productRecord, splitCount, i, singleLine;
3588
+ var tempOrder, _iterator20, _step20, item, product, booking, _ref62, _productRecord$num2, productRecord, splitCount, i, singleLine;
3485
3589
  return _regeneratorRuntime().wrap(function _callee18$(_context20) {
3486
3590
  while (1) switch (_context20.prev = _context20.next) {
3487
3591
  case 0:
@@ -3513,7 +3617,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3513
3617
  break;
3514
3618
  }
3515
3619
  productRecord = product;
3516
- splitCount = getSafeProductNum((_ref61 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref61 !== void 0 ? _ref61 : 1);
3620
+ splitCount = getSafeProductNum((_ref62 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref62 !== void 0 ? _ref62 : 1);
3517
3621
  if (!(splitCount > 1)) {
3518
3622
  _context20.next = 26;
3519
3623
  break;
@@ -3590,9 +3694,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3590
3694
  }, {
3591
3695
  key: "getBundleRuntimeIdentity",
3592
3696
  value: function getBundleRuntimeIdentity(bundle) {
3593
- var _ref62, _bundle$bundle_id2, _ref63, _bundle$bundle_group_2, _ref64, _ref65, _bundle$bundle_produc3, _ref66, _bundle$bundle_varian3;
3697
+ var _ref63, _bundle$bundle_id2, _ref64, _bundle$bundle_group_2, _ref65, _ref66, _bundle$bundle_produc3, _ref67, _bundle$bundle_varian3;
3594
3698
  if (!bundle || _typeof(bundle) !== 'object') return '';
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('|');
3699
+ return [(_ref63 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref63 !== void 0 ? _ref63 : '', (_ref64 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref64 !== void 0 ? _ref64 : '', (_ref65 = (_ref66 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref66 !== void 0 ? _ref66 : bundle.product_id) !== null && _ref65 !== void 0 ? _ref65 : '', (_ref67 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref67 !== void 0 ? _ref67 : 0].join('|');
3596
3700
  }
3597
3701
  }, {
3598
3702
  key: "preservePersistedBundlePriceFields",
@@ -4154,23 +4258,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4154
4258
  }, {
4155
4259
  key: "buildCurrentSubmitPayloadForLocalPrint",
4156
4260
  value: function buildCurrentSubmitPayloadForLocalPrint(params) {
4157
- var _params$cacheId, _this$otherParams2, _ref67, _params$businessCode, _this$otherParams3, _this$otherParams4;
4261
+ var _params$cacheId, _this$otherParams2, _ref68, _params$businessCode, _this$otherParams3, _this$otherParams4;
4158
4262
  var tempOrder = this.ensureTempOrder();
4159
4263
  this.persistTempOrder();
4160
4264
  var payload = buildSubmitPayload({
4161
4265
  tempOrder: tempOrder,
4162
4266
  cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
4163
4267
  platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform),
4164
- 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,
4268
+ businessCode: (_ref68 = (_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 && _ref68 !== void 0 ? _ref68 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code,
4165
4269
  channel: params === null || params === void 0 ? void 0 : params.channel,
4166
4270
  type: params === null || params === void 0 ? void 0 : params.type,
4167
4271
  summary: this.store.summary || createEmptySummary(),
4168
4272
  enhance: function enhance(nextPayload) {
4169
- var _ref68, _tempOrder$order_numb, _ref69, _tempOrder$shop_order, _ref70, _tempOrder$shop_full_;
4273
+ var _ref69, _tempOrder$order_numb, _ref70, _tempOrder$shop_order, _ref71, _tempOrder$shop_full_;
4170
4274
  return _objectSpread(_objectSpread({}, nextPayload), {}, {
4171
- 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,
4172
- 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,
4173
- 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,
4275
+ order_number: (_ref69 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref69 !== void 0 ? _ref69 : null,
4276
+ shop_order_number: (_ref70 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref70 !== void 0 ? _ref70 : null,
4277
+ shop_full_order_number: (_ref71 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref71 !== void 0 ? _ref71 : null,
4174
4278
  small_ticket_data_flag: 1
4175
4279
  });
4176
4280
  }
@@ -4267,8 +4371,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4267
4371
  key: "runSubmitTempOrder",
4268
4372
  value: function () {
4269
4373
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
4270
- var _params$cacheId2, _this$otherParams5, _ref71, _params$businessCode2, _this$otherParams6, _this$otherParams7;
4271
- var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
4374
+ var _params$cacheId2, _this$otherParams5, _ref72, _ref73, _submitSnapshot$busin, _this$otherParams6, _this$otherParams7, _submitSnapshot$type;
4375
+ var tempOrder, latestSummary, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
4272
4376
  return _regeneratorRuntime().wrap(function _callee29$(_context32) {
4273
4377
  while (1) switch (_context32.prev = _context32.next) {
4274
4378
  case 0:
@@ -4309,13 +4413,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4309
4413
  var enhancedPayload = params !== null && params !== void 0 && params.enhancePayload ? params.enhancePayload(nextPayload, ctx) : nextPayload;
4310
4414
  return enhancedPayload;
4311
4415
  } : undefined;
4416
+ submitSnapshot = this.getLastOrderSubmitSnapshot();
4312
4417
  payload = buildSubmitPayload({
4313
4418
  tempOrder: tempOrder,
4314
4419
  cacheId: effectiveCacheId,
4315
4420
  platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform),
4316
- 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,
4421
+ businessCode: (_ref72 = (_ref73 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref73 !== void 0 ? _ref73 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref72 !== void 0 ? _ref72 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code,
4317
4422
  channel: params === null || params === void 0 ? void 0 : params.channel,
4318
- type: params === null || params === void 0 ? void 0 : params.type,
4423
+ type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
4319
4424
  summary: latestSummary,
4320
4425
  request_unique_idempotency_token: params === null || params === void 0 ? void 0 : params.request_unique_idempotency_token,
4321
4426
  enhance: enhancePayload
@@ -4327,10 +4432,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4327
4432
  if (!payload.created_at) {
4328
4433
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
4329
4434
  }
4330
- _context32.next = 21;
4435
+ _context32.next = 22;
4331
4436
  return this.saveDraft();
4332
- case 21:
4333
- _context32.prev = 21;
4437
+ case 22:
4438
+ _context32.prev = 22;
4334
4439
  this.logInfo('submitTempOrder calling sales checkout', {
4335
4440
  orderId: payload.order_id,
4336
4441
  externalSaleNumber: payload.external_sale_number,
@@ -4340,26 +4445,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4340
4445
  smallTicketDataFlag: payload.small_ticket_data_flag,
4341
4446
  syncMode: payload.sync_mode
4342
4447
  });
4343
- _context32.next = 25;
4448
+ _context32.next = 26;
4344
4449
  return this.submitSalesOrder({
4345
4450
  query: payload
4346
4451
  });
4347
- case 25:
4452
+ case 26:
4348
4453
  result = _context32.sent;
4349
- _context32.next = 38;
4454
+ _context32.next = 39;
4350
4455
  break;
4351
- case 28:
4352
- _context32.prev = 28;
4353
- _context32.t2 = _context32["catch"](21);
4456
+ case 29:
4457
+ _context32.prev = 29;
4458
+ _context32.t2 = _context32["catch"](22);
4354
4459
  backendErrorResponse = this.extractSubmitErrorResponse(_context32.t2);
4355
4460
  if (!backendErrorResponse) {
4356
- _context32.next = 35;
4461
+ _context32.next = 36;
4357
4462
  break;
4358
4463
  }
4359
4464
  this.store.syncState = 'failed';
4360
4465
  this.logSubmitBackendRejected(backendErrorResponse, payload);
4361
4466
  return _context32.abrupt("return", backendErrorResponse);
4362
- case 35:
4467
+ case 36:
4363
4468
  this.store.syncState = 'failed';
4364
4469
  this.logError('submitTempOrder failed', {
4365
4470
  error: _context32.t2 instanceof Error ? _context32.t2.message : String(_context32.t2),
@@ -4369,15 +4474,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4369
4474
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
4370
4475
  });
4371
4476
  throw _context32.t2;
4372
- case 38:
4477
+ case 39:
4373
4478
  if (!this.isSubmitResponseRejected(result)) {
4374
- _context32.next = 42;
4479
+ _context32.next = 43;
4375
4480
  break;
4376
4481
  }
4377
4482
  this.store.syncState = 'failed';
4378
4483
  this.logSubmitBackendRejected(result, payload);
4379
4484
  return _context32.abrupt("return", result);
4380
- case 42:
4485
+ case 43:
4381
4486
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
4382
4487
  this.logInfo('runSubmitTempOrder: 提交成功', {
4383
4488
  submittedOrderId: submittedOrderId,
@@ -4385,29 +4490,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4385
4490
  tempOrder: tempOrder
4386
4491
  });
4387
4492
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
4388
- _context32.next = 51;
4493
+ _context32.next = 52;
4389
4494
  break;
4390
4495
  }
4391
4496
  tempOrder.order_id = submittedOrderId;
4392
4497
  resultRecord = result;
4393
- _context32.next = 49;
4498
+ _context32.next = 50;
4394
4499
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
4395
- case 49:
4396
- _context32.next = 52;
4500
+ case 50:
4501
+ _context32.next = 53;
4397
4502
  break;
4398
- case 51:
4503
+ case 52:
4399
4504
  if (this.isLocalPendingSubmitResult(result)) {
4400
4505
  this.store.syncState = 'local';
4401
4506
  } else {
4402
4507
  this.store.syncState = 'submitted';
4403
4508
  }
4404
- case 52:
4405
- return _context32.abrupt("return", result);
4406
4509
  case 53:
4510
+ return _context32.abrupt("return", result);
4511
+ case 54:
4407
4512
  case "end":
4408
4513
  return _context32.stop();
4409
4514
  }
4410
- }, _callee29, this, [[21, 28]]);
4515
+ }, _callee29, this, [[22, 29]]);
4411
4516
  }));
4412
4517
  function runSubmitTempOrder(_x32) {
4413
4518
  return _runSubmitTempOrder.apply(this, arguments);
@@ -4510,41 +4615,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4510
4615
  key: "syncPaymentsToOrder",
4511
4616
  value: function () {
4512
4617
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
4513
- var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, paymentStatus, paymentSyncIdempotencyToken, submitResult;
4618
+ var tempOrder, mappedPayments, completion, paymentStatus, paymentSyncIdempotencyToken, submitResult;
4514
4619
  return _regeneratorRuntime().wrap(function _callee31$(_context34) {
4515
4620
  while (1) switch (_context34.prev = _context34.next) {
4516
4621
  case 0:
4517
4622
  tempOrder = this.ensureTempOrder();
4518
4623
  mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
4519
- paymentTotal = this.calculatePaymentTotal(mappedPayments);
4520
- targetAmount = this.getPaymentTargetAmount();
4521
- isFullyPaid = targetAmount.lte(0) ? true : paymentTotal.gte(targetAmount);
4522
- paymentStatus = isFullyPaid ? params.paymentStatus || 'paid' : 'partially_paid';
4624
+ completion = this.getPaymentCompletion(mappedPayments);
4625
+ paymentStatus = completion.isOrderFullyPaid ? params.paymentStatus || 'paid' : 'partially_paid';
4523
4626
  tempOrder.payments = mappedPayments;
4524
4627
  tempOrder.payment_status = paymentStatus;
4525
4628
  this.persistTempOrder();
4526
- _context34.next = 11;
4629
+ _context34.next = 9;
4527
4630
  return this.saveDraft();
4528
- case 11:
4631
+ case 9:
4529
4632
  if (params.submitWhenPaid) {
4530
- _context34.next = 13;
4633
+ _context34.next = 11;
4531
4634
  break;
4532
4635
  }
4533
- return _context34.abrupt("return", {
4534
- isFullyPaid: isFullyPaid
4535
- });
4536
- case 13:
4636
+ return _context34.abrupt("return", completion);
4637
+ case 11:
4537
4638
  if (!(this.store.syncState === 'submitting')) {
4538
- _context34.next = 15;
4639
+ _context34.next = 13;
4539
4640
  break;
4540
4641
  }
4541
- return _context34.abrupt("return", {
4542
- isFullyPaid: isFullyPaid
4543
- });
4544
- case 15:
4642
+ return _context34.abrupt("return", completion);
4643
+ case 13:
4545
4644
  this.store.syncState = 'submitting';
4546
4645
  paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, mappedPayments);
4547
- _context34.next = 19;
4646
+ _context34.next = 17;
4548
4647
  return this.submitTempOrder({
4549
4648
  payments: mappedPayments,
4550
4649
  paymentStatus: paymentStatus,
@@ -4558,13 +4657,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4558
4657
  return nextPayload;
4559
4658
  }
4560
4659
  });
4561
- case 19:
4660
+ case 17:
4562
4661
  submitResult = _context34.sent;
4563
- return _context34.abrupt("return", {
4564
- isFullyPaid: isFullyPaid,
4662
+ return _context34.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
4565
4663
  submitResult: submitResult
4566
- });
4567
- case 21:
4664
+ }));
4665
+ case 19:
4568
4666
  case "end":
4569
4667
  return _context34.stop();
4570
4668
  }
@@ -5200,7 +5298,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5200
5298
  _step22;
5201
5299
  try {
5202
5300
  for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
5203
- var _product$metadata8, _ref72, _ref73, _existed$origin, _rawProduct$metadata;
5301
+ var _product$metadata8, _ref74, _ref75, _existed$origin, _rawProduct$metadata;
5204
5302
  var _step22$value = _slicedToArray(_step22.value, 2),
5205
5303
  index = _step22$value[0],
5206
5304
  product = _step22$value[1];
@@ -5208,7 +5306,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5208
5306
  if (!uid) continue;
5209
5307
  var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
5210
5308
  var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
5211
- 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;
5309
+ var origin = (_ref74 = (_ref75 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref75 !== void 0 ? _ref75 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref74 !== void 0 ? _ref74 : rawProduct;
5212
5310
  var originSnapshot = cloneDeep(origin);
5213
5311
  var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
5214
5312
  if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
@@ -5318,10 +5416,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5318
5416
  }, {
5319
5417
  key: "normalizeHydratedProductOptionItem",
5320
5418
  value: function normalizeHydratedProductOptionItem(optionItem) {
5321
- var _ref74, _optionItem$num, _ref75, _optionItem$add_price;
5322
- 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;
5419
+ var _ref76, _optionItem$num, _ref77, _optionItem$add_price;
5420
+ var rawNum = (_ref76 = (_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 && _ref76 !== void 0 ? _ref76 : 1;
5323
5421
  var parsedNum = Number(rawNum);
5324
- 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;
5422
+ var rawPrice = (_ref77 = (_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 && _ref77 !== void 0 ? _ref77 : 0;
5325
5423
  var parsedPrice = Number(rawPrice);
5326
5424
  var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
5327
5425
  option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
@@ -5385,6 +5483,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5385
5483
  _context43.next = 2;
5386
5484
  return this.request.get("/order/sales/".concat(order_id), {
5387
5485
  with: ['products', 'bookings']
5486
+ }, {
5487
+ osServer: true
5388
5488
  });
5389
5489
  case 2:
5390
5490
  res = _context43.sent;
@@ -5448,10 +5548,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5448
5548
  _step27;
5449
5549
  try {
5450
5550
  for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) {
5451
- var _ref76, _bundle$num3;
5551
+ var _ref78, _bundle$num3;
5452
5552
  var bundle = _step27.value;
5453
5553
  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));
5454
- 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();
5554
+ var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref78 = (_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 && _ref78 !== void 0 ? _ref78 : 1) || 1).toNumber();
5455
5555
  var _iterator28 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
5456
5556
  _step28;
5457
5557
  try {