@pisell/pisellos 0.10.10 → 0.10.12

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.
@@ -60,6 +60,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
60
60
  * orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
61
61
  */
62
62
  updateOtherParams(params: Record<string, any>): void;
63
+ /** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
64
+ isOnlineStorePlatform(): boolean;
63
65
  /**
64
66
  * 记录信息日志
65
67
  */
@@ -524,7 +526,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
524
526
  generateIdempotencyToken(): string;
525
527
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
526
528
  createOrder(params: CommitOrderParams['query']): {
527
- type: "appointment_booking" | "virtual";
529
+ type: "virtual" | "appointment_booking";
528
530
  platform: string;
529
531
  sales_channel: string;
530
532
  order_sales_channel: string;
@@ -459,6 +459,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
459
459
  this.otherParams = otherParams;
460
460
  }
461
461
 
462
+ /** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
463
+ }, {
464
+ key: "isOnlineStorePlatform",
465
+ value: function isOnlineStorePlatform() {
466
+ var _this$otherParams;
467
+ var platform = String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
468
+ return platform === 'pc' || platform === 'h5';
469
+ }
470
+
462
471
  /**
463
472
  * 记录信息日志
464
473
  */
@@ -2892,7 +2901,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2892
2901
  }, {
2893
2902
  key: "buildTempOrderHolderFromBookings",
2894
2903
  value: function buildTempOrderHolderFromBookings(tempOrder) {
2895
- var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder2, _baseHolder3, _this$otherParams;
2904
+ var _baseHolder$customer_, _baseHolder, _ref45, _baseHolder$form_id, _baseHolder2, _tempOrder$holder2, _baseHolder3, _this$otherParams2;
2896
2905
  var holderRecords = [];
2897
2906
  var holderNames = [];
2898
2907
  var baseHolder = null;
@@ -2945,7 +2954,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2945
2954
  if (holderNames.length) {
2946
2955
  nextHolder.name = holderNames.join(',');
2947
2956
  }
2948
- if ((_baseHolder3 = baseHolder) !== null && _baseHolder3 !== void 0 && _baseHolder3.is_source_shop || (_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.isFranchisee) {
2957
+ if ((_baseHolder3 = baseHolder) !== null && _baseHolder3 !== void 0 && _baseHolder3.is_source_shop || (_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.isFranchisee) {
2949
2958
  nextHolder.is_source_shop = 1;
2950
2959
  }
2951
2960
  return nextHolder;
@@ -3044,7 +3053,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3044
3053
  key: "recalculateSummary",
3045
3054
  value: function () {
3046
3055
  var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(options) {
3047
- var _this$otherParams2, _ref46, _salesSummaryResult$e;
3056
+ var _this$otherParams3, _ref46, _salesSummaryResult$e;
3048
3057
  var tempOrder, originalSnapshot, hasShopDiscountChanged, shouldReuseOriginalSnapshot, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
3049
3058
  return _regeneratorRuntime().wrap(function _callee12$(_context14) {
3050
3059
  while (1) switch (_context14.prev = _context14.next) {
@@ -3111,7 +3120,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3111
3120
  isPriceIncludeTax: tempOrder.is_price_include_tax,
3112
3121
  shopDiscount: tempOrder.shop_discount,
3113
3122
  virtualSettlementMode: this.shouldUseVirtualSettlementSummary(tempOrder)
3114
- }, (_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.channel ? {
3123
+ }, (_this$otherParams3 = this.otherParams) !== null && _this$otherParams3 !== void 0 && _this$otherParams3.channel ? {
3115
3124
  channel: this.otherParams.channel
3116
3125
  } : {}));
3117
3126
  case 28:
@@ -3987,8 +3996,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3987
3996
  }, {
3988
3997
  key: "isMultiCurrencySettlementEnabled",
3989
3998
  value: function isMultiCurrencySettlementEnabled() {
3990
- var _this$otherParams3;
3991
- return ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.enableMultiCurrencySettlement) === true;
3999
+ var _this$otherParams4;
4000
+ return ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.enableMultiCurrencySettlement) === true;
3992
4001
  }
3993
4002
  }, {
3994
4003
  key: "isActiveVirtualSettlementOrder",
@@ -5249,14 +5258,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5249
5258
  }, {
5250
5259
  key: "buildCurrentSubmitPayloadForLocalPrint",
5251
5260
  value: function buildCurrentSubmitPayloadForLocalPrint(params) {
5252
- var _params$cacheId, _this$otherParams4, _ref71, _params$businessCode, _this$otherParams5, _this$otherParams6;
5261
+ var _params$cacheId, _this$otherParams5, _ref71, _params$businessCode, _this$otherParams6, _this$otherParams7;
5253
5262
  var tempOrder = this.ensureTempOrder();
5254
5263
  this.persistTempOrder();
5255
5264
  var payload = buildSubmitPayload({
5256
5265
  tempOrder: tempOrder,
5257
5266
  cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
5258
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform),
5259
- businessCode: (_ref71 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode) !== null && _ref71 !== void 0 ? _ref71 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.business_code,
5267
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform),
5268
+ businessCode: (_ref71 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_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,
5260
5269
  channel: params === null || params === void 0 ? void 0 : params.channel,
5261
5270
  type: params === null || params === void 0 ? void 0 : params.type,
5262
5271
  summary: this.store.summary || createEmptySummary(),
@@ -5316,7 +5325,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5316
5325
  key: "saveTempOrderAsDraft",
5317
5326
  value: function () {
5318
5327
  var _saveTempOrderAsDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
5319
- var _params$cacheId2, _this$otherParams7, _this$otherParams8, _this$otherParams9, _params$type, _this$otherParams10, _payload$products;
5328
+ var _params$cacheId2, _this$otherParams8, _this$otherParams9, _this$otherParams10, _params$type, _this$otherParams11, _payload$products;
5320
5329
  var tempOrder, latestSummary, payload;
5321
5330
  return _regeneratorRuntime().wrap(function _callee30$(_context33) {
5322
5331
  while (1) switch (_context33.prev = _context33.next) {
@@ -5347,10 +5356,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5347
5356
  payload = buildSubmitPayload({
5348
5357
  tempOrder: tempOrder,
5349
5358
  cacheId: (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId,
5350
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.platform),
5351
- businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.businessCode) || ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.business_code) || tempOrder.business_code,
5359
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform),
5360
+ businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.business_code) || tempOrder.business_code,
5352
5361
  channel: params === null || params === void 0 ? void 0 : params.channel,
5353
- type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.type,
5362
+ type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.type,
5354
5363
  summary: latestSummary,
5355
5364
  enhance: params === null || params === void 0 ? void 0 : params.enhancePayload
5356
5365
  });
@@ -5429,16 +5438,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5429
5438
  key: "runSubmitTempOrder",
5430
5439
  value: function () {
5431
5440
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
5432
- var _params$cacheId3, _this$otherParams11, _ref75, _ref76, _submitSnapshot$busin, _this$otherParams12, _this$otherParams13, _submitSnapshot$type;
5433
- var tempOrder, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
5441
+ var _params$cacheId3, _this$otherParams12, _ref75, _ref76, _submitSnapshot$busin, _this$otherParams13, _this$otherParams14, _submitSnapshot$type;
5442
+ var tempOrder, isOnlineStorePlatform, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
5434
5443
  return _regeneratorRuntime().wrap(function _callee33$(_context36) {
5435
5444
  while (1) switch (_context36.prev = _context36.next) {
5436
5445
  case 0:
5437
5446
  tempOrder = this.ensureTempOrder();
5438
5447
  this.prepareVirtualSettlementTempOrder(tempOrder);
5448
+ isOnlineStorePlatform = this.isOnlineStorePlatform();
5439
5449
  shouldConfirmPendingVoucherPayments = (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== false;
5440
5450
  hasPaymentOverride = (params === null || params === void 0 ? void 0 : params.payments) !== undefined;
5441
- preparedPaymentOverride = hasPaymentOverride ? this.prepareVoucherPaymentsForSubmit((params === null || params === void 0 ? void 0 : params.payments) || [], shouldConfirmPendingVoucherPayments) : undefined;
5451
+ if (hasPaymentOverride) {
5452
+ preparedPaymentOverride = isOnlineStorePlatform ? (params === null || params === void 0 ? void 0 : params.payments) || [] : this.prepareVoucherPaymentsForSubmit((params === null || params === void 0 ? void 0 : params.payments) || [], shouldConfirmPendingVoucherPayments);
5453
+ }
5442
5454
  if (!hasPaymentOverride) {
5443
5455
  if (shouldConfirmPendingVoucherPayments) {
5444
5456
  this.confirmPendingVoucherPayments({
@@ -5453,25 +5465,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5453
5465
  }
5454
5466
  }
5455
5467
  this.persistTempOrder();
5456
- _context36.next = 9;
5468
+ _context36.next = 10;
5457
5469
  return this.recalculateSummary({
5458
5470
  createIfMissing: true
5459
5471
  });
5460
- case 9:
5472
+ case 10:
5461
5473
  _context36.t1 = _context36.sent;
5462
5474
  if (_context36.t1) {
5463
- _context36.next = 12;
5475
+ _context36.next = 13;
5464
5476
  break;
5465
5477
  }
5466
5478
  _context36.t1 = this.store.summary;
5467
- case 12:
5479
+ case 13:
5468
5480
  _context36.t0 = _context36.t1;
5469
5481
  if (_context36.t0) {
5470
- _context36.next = 15;
5482
+ _context36.next = 16;
5471
5483
  break;
5472
5484
  }
5473
5485
  _context36.t0 = createEmptySummary();
5474
- case 15:
5486
+ case 16:
5475
5487
  latestSummary = _context36.t0;
5476
5488
  effectiveCacheId = (_params$cacheId3 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId3 !== void 0 ? _params$cacheId3 : this.cacheId;
5477
5489
  hasPaymentStatusOverride = (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined;
@@ -5479,7 +5491,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5479
5491
  enhancePayload = hasPaymentOverride || hasPaymentStatusOverride || hasSmallTicketDataFlagOverride || params !== null && params !== void 0 && params.enhancePayload ? function (payload, ctx) {
5480
5492
  var nextPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, payload), hasPaymentOverride ? {
5481
5493
  payments: preparedPaymentOverride || []
5482
- } : {}), hasPaymentStatusOverride && !shouldConfirmPendingVoucherPayments ? {
5494
+ } : {}), hasPaymentStatusOverride && !isOnlineStorePlatform && !shouldConfirmPendingVoucherPayments ? {
5483
5495
  payment_status: params === null || params === void 0 ? void 0 : params.paymentStatus
5484
5496
  } : {}), hasSmallTicketDataFlagOverride ? {
5485
5497
  small_ticket_data_flag: params === null || params === void 0 ? void 0 : params.smallTicketDataFlag
@@ -5491,12 +5503,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5491
5503
  payload = buildSubmitPayload({
5492
5504
  tempOrder: tempOrder,
5493
5505
  cacheId: effectiveCacheId,
5494
- platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform),
5495
- businessCode: (_ref75 = (_ref76 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref76 !== void 0 ? _ref76 : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode) !== null && _ref75 !== void 0 ? _ref75 : (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.business_code,
5506
+ platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.platform),
5507
+ businessCode: (_ref75 = (_ref76 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref76 !== void 0 ? _ref76 : (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.businessCode) !== null && _ref75 !== void 0 ? _ref75 : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.business_code,
5496
5508
  channel: params === null || params === void 0 ? void 0 : params.channel,
5497
5509
  type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
5498
5510
  summary: latestSummary,
5499
5511
  request_unique_idempotency_token: params === null || params === void 0 ? void 0 : params.request_unique_idempotency_token,
5512
+ includePaymentStatus: !isOnlineStorePlatform,
5500
5513
  enhance: enhancePayload
5501
5514
  });
5502
5515
  console.log('[Order.runSubmitTempOrder.payload]', payload);
@@ -5507,10 +5520,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5507
5520
  if (!payload.created_at) {
5508
5521
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
5509
5522
  }
5510
- _context36.next = 27;
5523
+ _context36.next = 28;
5511
5524
  return this.saveDraft();
5512
- case 27:
5513
- _context36.prev = 27;
5525
+ case 28:
5526
+ _context36.prev = 28;
5514
5527
  this.logInfo('submitTempOrder calling sales checkout', {
5515
5528
  orderId: payload.order_id,
5516
5529
  externalSaleNumber: payload.external_sale_number,
@@ -5520,26 +5533,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5520
5533
  smallTicketDataFlag: payload.small_ticket_data_flag,
5521
5534
  syncMode: payload.sync_mode
5522
5535
  });
5523
- _context36.next = 31;
5536
+ _context36.next = 32;
5524
5537
  return this.submitSalesOrder({
5525
5538
  query: payload
5526
5539
  });
5527
- case 31:
5540
+ case 32:
5528
5541
  result = _context36.sent;
5529
- _context36.next = 44;
5542
+ _context36.next = 45;
5530
5543
  break;
5531
- case 34:
5532
- _context36.prev = 34;
5533
- _context36.t2 = _context36["catch"](27);
5544
+ case 35:
5545
+ _context36.prev = 35;
5546
+ _context36.t2 = _context36["catch"](28);
5534
5547
  backendErrorResponse = this.extractSubmitErrorResponse(_context36.t2);
5535
5548
  if (!backendErrorResponse) {
5536
- _context36.next = 41;
5549
+ _context36.next = 42;
5537
5550
  break;
5538
5551
  }
5539
5552
  this.store.syncState = 'failed';
5540
5553
  this.logSubmitBackendRejected(backendErrorResponse, payload);
5541
5554
  return _context36.abrupt("return", backendErrorResponse);
5542
- case 41:
5555
+ case 42:
5543
5556
  this.store.syncState = 'failed';
5544
5557
  this.logError('submitTempOrder failed', {
5545
5558
  error: _context36.t2 instanceof Error ? _context36.t2.message : String(_context36.t2),
@@ -5549,15 +5562,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5549
5562
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
5550
5563
  });
5551
5564
  throw _context36.t2;
5552
- case 44:
5565
+ case 45:
5553
5566
  if (!this.isSubmitResponseRejected(result)) {
5554
- _context36.next = 48;
5567
+ _context36.next = 49;
5555
5568
  break;
5556
5569
  }
5557
5570
  this.store.syncState = 'failed';
5558
5571
  this.logSubmitBackendRejected(result, payload);
5559
5572
  return _context36.abrupt("return", result);
5560
- case 48:
5573
+ case 49:
5561
5574
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
5562
5575
  this.logInfo('runSubmitTempOrder: 提交成功', {
5563
5576
  submittedOrderId: submittedOrderId,
@@ -5567,29 +5580,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5567
5580
  })
5568
5581
  });
5569
5582
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
5570
- _context36.next = 57;
5583
+ _context36.next = 58;
5571
5584
  break;
5572
5585
  }
5573
5586
  tempOrder.order_id = submittedOrderId;
5574
5587
  resultRecord = result;
5575
- _context36.next = 55;
5588
+ _context36.next = 56;
5576
5589
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
5577
- case 55:
5578
- _context36.next = 58;
5590
+ case 56:
5591
+ _context36.next = 59;
5579
5592
  break;
5580
- case 57:
5593
+ case 58:
5581
5594
  if (this.isLocalPendingSubmitResult(result)) {
5582
5595
  this.store.syncState = 'local';
5583
5596
  } else {
5584
5597
  this.store.syncState = 'submitted';
5585
5598
  }
5586
- case 58:
5587
- return _context36.abrupt("return", result);
5588
5599
  case 59:
5600
+ return _context36.abrupt("return", result);
5601
+ case 60:
5589
5602
  case "end":
5590
5603
  return _context36.stop();
5591
5604
  }
5592
- }, _callee33, this, [[27, 34]]);
5605
+ }, _callee33, this, [[28, 35]]);
5593
5606
  }));
5594
5607
  function runSubmitTempOrder(_x39) {
5595
5608
  return _runSubmitTempOrder.apply(this, arguments);
@@ -295,8 +295,9 @@ export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identific
295
295
  payment_price: string;
296
296
  product_sku: OrderProductSku;
297
297
  }
298
- export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at'> {
298
+ export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at' | 'payment_status'> {
299
299
  platform: string;
300
+ payment_status?: string;
300
301
  created_at?: string | undefined;
301
302
  request_unique_idempotency_token?: string;
302
303
  form_record_ids?: Array<{
@@ -449,7 +450,7 @@ export interface SubmitSalesOrderParams {
449
450
  sales_channel: string;
450
451
  order_sales_channel: string;
451
452
  status: string;
452
- payment_status: string;
453
+ payment_status?: string;
453
454
  shipping_status: string;
454
455
  customer_id: number | null;
455
456
  customer_name: string;
@@ -776,6 +777,8 @@ export interface OrderModuleAPI {
776
777
  isTempOrderPersistEnabled: () => boolean;
777
778
  /** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
778
779
  notifyTempOrderChanged: () => void;
780
+ /** PC/H5 为在线店铺;其它或缺失平台统一按 POS 处理。 */
781
+ isOnlineStorePlatform: () => boolean;
779
782
  submitTempOrder: <T = any>(params?: {
780
783
  cacheId?: string;
781
784
  platform?: string;
@@ -220,6 +220,7 @@ export declare function buildSubmitPayload(params: {
220
220
  type?: string;
221
221
  summary?: OrderSummary | null;
222
222
  request_unique_idempotency_token?: string;
223
+ includePaymentStatus?: boolean;
223
224
  enhance?: SubmitPayloadEnhancer;
224
225
  }): OrderSubmitPayload;
225
226
  export declare function mapPaymentItemToOrderPayment(paymentItem: OrderPaymentSource): OrderPaymentData;
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["custom_product_bundle_map_id"],
2
2
  _excluded2 = ["unique_identification_number"],
3
3
  _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per"],
4
- _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id"],
4
+ _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id", "payment_status"],
5
5
  _excluded5 = ["collect_pax", "table_occupancy_duration", "cart_settlement_key", "cart_settlement_snapshot", "legal_currency_snapshot"];
6
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -1148,6 +1148,7 @@ export function buildSubmitPayload(params) {
1148
1148
  _totalRefundAmount = _ref30.total_refund_amount,
1149
1149
  _createDate = _ref30.create_date,
1150
1150
  _holderId = _ref30.holder_id,
1151
+ _paymentStatus = _ref30.payment_status,
1151
1152
  tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
1152
1153
  var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
1153
1154
  if (!submitType) {
@@ -1159,7 +1160,7 @@ export function buildSubmitPayload(params) {
1159
1160
  submitType = 'virtual';
1160
1161
  }
1161
1162
  }
1162
- var payload = _objectSpread(_objectSpread({}, tempOrderRest), {}, {
1163
+ var payload = _objectSpread(_objectSpread(_objectSpread({}, tempOrderRest), {}, {
1163
1164
  customer_id: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : 1,
1164
1165
  customer_name: tempOrder.customer_name || 'Walk-In',
1165
1166
  country_calling_code: String((_tempOrder$country_ca = tempOrder.country_calling_code) !== null && _tempOrder$country_ca !== void 0 ? _tempOrder$country_ca : ''),
@@ -1174,8 +1175,10 @@ export function buildSubmitPayload(params) {
1174
1175
  business_code: businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code,
1175
1176
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1176
1177
  order_sales_channel: (_ref31 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref31 !== void 0 ? _ref31 : 'online_store',
1177
- status: tempOrder.status || 'normal',
1178
- payment_status: tempOrder.payment_status || 'payment_processing',
1178
+ status: tempOrder.status || 'normal'
1179
+ }, params.includePaymentStatus !== false ? {
1180
+ payment_status: tempOrder.payment_status || 'payment_processing'
1181
+ } : {}), {}, {
1179
1182
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
1180
1183
  is_price_include_tax: (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : 1,
1181
1184
  currency_format: tempOrder.currency_format || 'symbol_first',
@@ -3012,8 +3012,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3012
3012
  key: "buildVirtualSettlementSubmitData",
3013
3013
  value: function () {
3014
3014
  var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3015
- var _tempOrder$metadata$c, _tempOrder$metadata2, _paymentMethod$custom;
3016
- var tempOrder, snapshot, currencyProductId, summary, amount, customerId, asset, currencyCode, currencySymbol, currencyFormat, balance, paymentMethods, paymentMethod, amountText, payment;
3015
+ var _tempOrder$metadata$c, _tempOrder$metadata2;
3016
+ var tempOrder, snapshot, currencyProductId, summary, amount, customerId, asset, currencyCode, currencySymbol, currencyFormat, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
3017
3017
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3018
3018
  while (1) switch (_context29.prev = _context29.next) {
3019
3019
  case 0:
@@ -3090,22 +3090,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3090
3090
  }
3091
3091
  throw new Error('Insufficient virtual currency balance.');
3092
3092
  case 28:
3093
- _context29.next = 30;
3093
+ amountText = amount.toFixed(2);
3094
+ paymentNumber = "LOCAL_".concat(createUuidV4());
3095
+ if (!this.store.order.isOnlineStorePlatform()) {
3096
+ _context29.next = 34;
3097
+ break;
3098
+ }
3099
+ payment = {
3100
+ payment_number: paymentNumber,
3101
+ amount: amount.toNumber(),
3102
+ metadata: {
3103
+ unique_payment_number: createUuidV4()
3104
+ },
3105
+ tag: asset.tag,
3106
+ voucher_id: asset.id,
3107
+ wallet_pass_usage_unit: {
3108
+ price: 1,
3109
+ points: 1
3110
+ },
3111
+ wallet_pass_use_value: amountText
3112
+ };
3113
+ _context29.next = 41;
3114
+ break;
3115
+ case 34:
3116
+ _context29.next = 36;
3094
3117
  return this.getPaymentMethodsAsync();
3095
- case 30:
3118
+ case 36:
3096
3119
  paymentMethods = _context29.sent;
3097
3120
  paymentMethod = paymentMethods.find(function (method) {
3098
3121
  return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
3099
3122
  });
3100
3123
  if (paymentMethod) {
3101
- _context29.next = 34;
3124
+ _context29.next = 40;
3102
3125
  break;
3103
3126
  }
3104
3127
  throw new Error('PRODUCTVOUCHER payment method is unavailable.');
3105
- case 34:
3106
- amountText = amount.toFixed(2);
3128
+ case 40:
3107
3129
  payment = {
3108
- payment_number: "LOCAL_".concat(createUuidV4()),
3130
+ payment_number: paymentNumber,
3109
3131
  amount: amountText,
3110
3132
  origin_amount: amountText,
3111
3133
  code: paymentMethod.code,
@@ -3122,6 +3144,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3122
3144
  wallet_pass_use_value: amountText,
3123
3145
  metadata: {}
3124
3146
  };
3147
+ case 41:
3125
3148
  return _context29.abrupt("return", {
3126
3149
  payments: [payment],
3127
3150
  snapshot: snapshot,
@@ -3130,7 +3153,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3130
3153
  currencySymbol: currencySymbol,
3131
3154
  currencyFormat: currencyFormat
3132
3155
  });
3133
- case 37:
3156
+ case 42:
3134
3157
  case "end":
3135
3158
  return _context29.stop();
3136
3159
  }
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
329
+ weekNum: 0 | 5 | 1 | 2 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
348
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -0,0 +1,51 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
34
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
35
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
36
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
37
+ default: () => import_adapter2.default
38
+ });
39
+ module.exports = __toCommonJS(promotion_exports);
40
+ var import_evaluator = require("./evaluator");
41
+ var import_adapter = require("./adapter");
42
+ var import_adapter2 = __toESM(require("./adapter"));
43
+ var import_examples = require("./examples");
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ BUY_X_GET_Y_FREE_STRATEGY,
47
+ ITEM_REWARD_STRATEGY,
48
+ PromotionAdapter,
49
+ PromotionEvaluator,
50
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
51
+ });
@@ -60,6 +60,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
60
60
  * orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
61
61
  */
62
62
  updateOtherParams(params: Record<string, any>): void;
63
+ /** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
64
+ isOnlineStorePlatform(): boolean;
63
65
  /**
64
66
  * 记录信息日志
65
67
  */
@@ -524,7 +526,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
524
526
  generateIdempotencyToken(): string;
525
527
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
526
528
  createOrder(params: CommitOrderParams['query']): {
527
- type: "appointment_booking" | "virtual";
529
+ type: "virtual" | "appointment_booking";
528
530
  platform: string;
529
531
  sales_channel: string;
530
532
  order_sales_channel: string;
@@ -425,6 +425,12 @@ var OrderModule = class extends import_BaseModule.BaseModule {
425
425
  this.orderHooks = this.moduleHooksOverride || ((_b = otherParams.order) == null ? void 0 : _b.hooks) || ((_c = otherParams.hooks) == null ? void 0 : _c.order);
426
426
  this.otherParams = otherParams;
427
427
  }
428
+ /** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
429
+ isOnlineStorePlatform() {
430
+ var _a;
431
+ const platform = String(((_a = this.otherParams) == null ? void 0 : _a.platform) || "").trim().toLowerCase();
432
+ return platform === "pc" || platform === "h5";
433
+ }
428
434
  /**
429
435
  * 记录信息日志
430
436
  */
@@ -4148,12 +4154,16 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4148
4154
  var _a, _b, _c, _d, _e;
4149
4155
  const tempOrder = this.ensureTempOrder();
4150
4156
  this.prepareVirtualSettlementTempOrder(tempOrder);
4157
+ const isOnlineStorePlatform = this.isOnlineStorePlatform();
4151
4158
  const shouldConfirmPendingVoucherPayments = (params == null ? void 0 : params.confirmPendingVoucherPayments) !== false;
4152
4159
  const hasPaymentOverride = (params == null ? void 0 : params.payments) !== void 0;
4153
- const preparedPaymentOverride = hasPaymentOverride ? this.prepareVoucherPaymentsForSubmit(
4154
- (params == null ? void 0 : params.payments) || [],
4155
- shouldConfirmPendingVoucherPayments
4156
- ) : void 0;
4160
+ let preparedPaymentOverride;
4161
+ if (hasPaymentOverride) {
4162
+ preparedPaymentOverride = isOnlineStorePlatform ? (params == null ? void 0 : params.payments) || [] : this.prepareVoucherPaymentsForSubmit(
4163
+ (params == null ? void 0 : params.payments) || [],
4164
+ shouldConfirmPendingVoucherPayments
4165
+ );
4166
+ }
4157
4167
  if (!hasPaymentOverride) {
4158
4168
  if (shouldConfirmPendingVoucherPayments) {
4159
4169
  this.confirmPendingVoucherPayments({
@@ -4178,7 +4188,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4178
4188
  ...hasPaymentOverride ? {
4179
4189
  payments: preparedPaymentOverride || []
4180
4190
  } : {},
4181
- ...hasPaymentStatusOverride && !shouldConfirmPendingVoucherPayments ? { payment_status: params == null ? void 0 : params.paymentStatus } : {},
4191
+ ...hasPaymentStatusOverride && !isOnlineStorePlatform && !shouldConfirmPendingVoucherPayments ? { payment_status: params == null ? void 0 : params.paymentStatus } : {},
4182
4192
  ...hasSmallTicketDataFlagOverride ? { small_ticket_data_flag: params == null ? void 0 : params.smallTicketDataFlag } : {}
4183
4193
  };
4184
4194
  const enhancedPayload = (params == null ? void 0 : params.enhancePayload) ? params.enhancePayload(nextPayload, ctx) : nextPayload;
@@ -4194,6 +4204,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4194
4204
  type: submitSnapshot.type ?? (params == null ? void 0 : params.type),
4195
4205
  summary: latestSummary,
4196
4206
  request_unique_idempotency_token: params == null ? void 0 : params.request_unique_idempotency_token,
4207
+ includePaymentStatus: !isOnlineStorePlatform,
4197
4208
  enhance: enhancePayload
4198
4209
  });
4199
4210
  console.log("[Order.runSubmitTempOrder.payload]", payload);
@@ -295,8 +295,9 @@ export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identific
295
295
  payment_price: string;
296
296
  product_sku: OrderProductSku;
297
297
  }
298
- export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at'> {
298
+ export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at' | 'payment_status'> {
299
299
  platform: string;
300
+ payment_status?: string;
300
301
  created_at?: string | undefined;
301
302
  request_unique_idempotency_token?: string;
302
303
  form_record_ids?: Array<{
@@ -449,7 +450,7 @@ export interface SubmitSalesOrderParams {
449
450
  sales_channel: string;
450
451
  order_sales_channel: string;
451
452
  status: string;
452
- payment_status: string;
453
+ payment_status?: string;
453
454
  shipping_status: string;
454
455
  customer_id: number | null;
455
456
  customer_name: string;
@@ -776,6 +777,8 @@ export interface OrderModuleAPI {
776
777
  isTempOrderPersistEnabled: () => boolean;
777
778
  /** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
778
779
  notifyTempOrderChanged: () => void;
780
+ /** PC/H5 为在线店铺;其它或缺失平台统一按 POS 处理。 */
781
+ isOnlineStorePlatform: () => boolean;
779
782
  submitTempOrder: <T = any>(params?: {
780
783
  cacheId?: string;
781
784
  platform?: string;
@@ -220,6 +220,7 @@ export declare function buildSubmitPayload(params: {
220
220
  type?: string;
221
221
  summary?: OrderSummary | null;
222
222
  request_unique_idempotency_token?: string;
223
+ includePaymentStatus?: boolean;
223
224
  enhance?: SubmitPayloadEnhancer;
224
225
  }): OrderSubmitPayload;
225
226
  export declare function mapPaymentItemToOrderPayment(paymentItem: OrderPaymentSource): OrderPaymentData;
@@ -1027,6 +1027,7 @@ function buildSubmitPayload(params) {
1027
1027
  total_refund_amount: _totalRefundAmount,
1028
1028
  create_date: _createDate,
1029
1029
  holder_id: _holderId,
1030
+ payment_status: _paymentStatus,
1030
1031
  ...tempOrderRest
1031
1032
  } = tempOrder;
1032
1033
  let submitType = type ?? tempOrder.type;
@@ -1054,7 +1055,7 @@ function buildSubmitPayload(params) {
1054
1055
  sales_channel: tempOrder.sales_channel || "my_pisel",
1055
1056
  order_sales_channel: channel ?? tempOrder.order_sales_channel ?? "online_store",
1056
1057
  status: tempOrder.status || "normal",
1057
- payment_status: tempOrder.payment_status || "payment_processing",
1058
+ ...params.includePaymentStatus !== false ? { payment_status: tempOrder.payment_status || "payment_processing" } : {},
1058
1059
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
1059
1060
  is_price_include_tax: tempOrder.is_price_include_tax ?? 1,
1060
1061
  currency_format: tempOrder.currency_format || "symbol_first",
@@ -2093,29 +2093,45 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2093
2093
  if (balance.lt(amount)) {
2094
2094
  throw new Error("Insufficient virtual currency balance.");
2095
2095
  }
2096
- const paymentMethods = await this.getPaymentMethodsAsync();
2097
- const paymentMethod = paymentMethods.find(
2098
- (method) => String(method.code || "").toUpperCase() === "PRODUCTVOUCHER"
2099
- );
2100
- if (!paymentMethod) {
2101
- throw new Error("PRODUCTVOUCHER payment method is unavailable.");
2102
- }
2103
2096
  const amountText = amount.toFixed(2);
2104
- const payment = {
2105
- payment_number: `LOCAL_${(0, import_utils.createUuidV4)()}`,
2106
- amount: amountText,
2107
- origin_amount: amountText,
2108
- code: paymentMethod.code,
2109
- custom_payment_id: paymentMethod.id,
2110
- custom_payment_type: paymentMethod.custom_payment_type ?? paymentMethod.type,
2111
- name: paymentMethod.name,
2112
- type: "normal",
2113
- voucher_id: asset.id,
2114
- order_payment_type: "normal",
2115
- wallet_pass_usage_unit: { price: 1, points: 1 },
2116
- wallet_pass_use_value: amountText,
2117
- metadata: {}
2118
- };
2097
+ const paymentNumber = `LOCAL_${(0, import_utils.createUuidV4)()}`;
2098
+ let payment;
2099
+ if (this.store.order.isOnlineStorePlatform()) {
2100
+ payment = {
2101
+ payment_number: paymentNumber,
2102
+ amount: amount.toNumber(),
2103
+ metadata: {
2104
+ unique_payment_number: (0, import_utils.createUuidV4)()
2105
+ },
2106
+ tag: asset.tag,
2107
+ voucher_id: asset.id,
2108
+ wallet_pass_usage_unit: { price: 1, points: 1 },
2109
+ wallet_pass_use_value: amountText
2110
+ };
2111
+ } else {
2112
+ const paymentMethods = await this.getPaymentMethodsAsync();
2113
+ const paymentMethod = paymentMethods.find(
2114
+ (method) => String(method.code || "").toUpperCase() === "PRODUCTVOUCHER"
2115
+ );
2116
+ if (!paymentMethod) {
2117
+ throw new Error("PRODUCTVOUCHER payment method is unavailable.");
2118
+ }
2119
+ payment = {
2120
+ payment_number: paymentNumber,
2121
+ amount: amountText,
2122
+ origin_amount: amountText,
2123
+ code: paymentMethod.code,
2124
+ custom_payment_id: paymentMethod.id,
2125
+ custom_payment_type: paymentMethod.custom_payment_type ?? paymentMethod.type,
2126
+ name: paymentMethod.name,
2127
+ type: "normal",
2128
+ voucher_id: asset.id,
2129
+ order_payment_type: "normal",
2130
+ wallet_pass_usage_unit: { price: 1, points: 1 },
2131
+ wallet_pass_use_value: amountText,
2132
+ metadata: {}
2133
+ };
2134
+ }
2119
2135
  return {
2120
2136
  payments: [payment],
2121
2137
  snapshot,
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
329
+ weekNum: 0 | 5 | 1 | 2 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
348
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.10",
4
+ "version": "0.10.12",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",