@pisell/pisellos 2.2.272 → 2.2.274

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 (113) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  12. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -12
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/OpenData/index.d.ts +0 -2
  16. package/dist/modules/OpenData/index.js +0 -8
  17. package/dist/modules/Order/index.d.ts +12 -31
  18. package/dist/modules/Order/index.js +562 -778
  19. package/dist/modules/Order/types.d.ts +22 -36
  20. package/dist/modules/Order/types.js +11 -0
  21. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  22. package/dist/modules/Order/utils.js +6 -10
  23. package/dist/modules/Payment/index.d.ts +0 -2
  24. package/dist/modules/Payment/index.js +50 -79
  25. package/dist/modules/Payment/types.d.ts +27 -29
  26. package/dist/modules/Payment/types.js +3 -5
  27. package/dist/modules/Rules/index.d.ts +0 -1
  28. package/dist/modules/Rules/index.js +39 -55
  29. package/dist/modules/SalesSummary/utils.js +7 -1
  30. package/dist/server/index.d.ts +0 -16
  31. package/dist/server/index.js +1036 -1933
  32. package/dist/server/modules/order/index.d.ts +4 -49
  33. package/dist/server/modules/order/index.js +695 -1574
  34. package/dist/server/modules/order/types.d.ts +3 -11
  35. package/dist/server/modules/order/types.js +1 -1
  36. package/dist/solution/BaseSales/index.d.ts +25 -59
  37. package/dist/solution/BaseSales/index.js +490 -767
  38. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  39. package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
  40. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  41. package/dist/solution/BookingByStep/index.d.ts +1 -1
  42. package/dist/solution/BookingTicket/index.d.ts +5 -21
  43. package/dist/solution/BookingTicket/index.js +49 -126
  44. package/dist/solution/BookingTicket/types.d.ts +3 -0
  45. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  46. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  47. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  48. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  49. package/dist/solution/Sales/index.d.ts +0 -1
  50. package/dist/solution/Sales/index.js +2 -10
  51. package/dist/solution/ScanOrder/index.js +20 -31
  52. package/dist/solution/VenueBooking/index.js +19 -30
  53. package/dist/types/index.d.ts +0 -1
  54. package/lib/core/index.d.ts +0 -2
  55. package/lib/core/index.js +0 -4
  56. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  57. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  58. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  59. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  60. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  61. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  62. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  63. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  64. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  65. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  66. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -2
  67. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  68. package/lib/modules/OpenData/index.d.ts +0 -2
  69. package/lib/modules/OpenData/index.js +0 -5
  70. package/lib/modules/Order/index.d.ts +12 -31
  71. package/lib/modules/Order/index.js +142 -201
  72. package/lib/modules/Order/types.d.ts +22 -36
  73. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  74. package/lib/modules/Order/utils.js +4 -11
  75. package/lib/modules/Payment/index.d.ts +0 -2
  76. package/lib/modules/Payment/index.js +13 -34
  77. package/lib/modules/Payment/types.d.ts +27 -29
  78. package/lib/modules/Payment/types.js +3 -3
  79. package/lib/modules/Rules/index.d.ts +0 -1
  80. package/lib/modules/Rules/index.js +22 -41
  81. package/lib/modules/SalesSummary/utils.js +5 -1
  82. package/lib/server/index.d.ts +0 -16
  83. package/lib/server/index.js +18 -670
  84. package/lib/server/modules/order/index.d.ts +4 -49
  85. package/lib/server/modules/order/index.js +66 -657
  86. package/lib/server/modules/order/types.d.ts +3 -11
  87. package/lib/solution/BaseSales/index.d.ts +25 -59
  88. package/lib/solution/BaseSales/index.js +79 -246
  89. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  90. package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
  91. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  92. package/lib/solution/BookingByStep/index.d.ts +1 -1
  93. package/lib/solution/BookingTicket/index.d.ts +5 -21
  94. package/lib/solution/BookingTicket/index.js +8 -59
  95. package/lib/solution/BookingTicket/types.d.ts +3 -0
  96. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  97. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  98. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  99. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  100. package/lib/solution/Sales/index.d.ts +0 -1
  101. package/lib/solution/Sales/index.js +3 -5
  102. package/lib/solution/ScanOrder/index.js +0 -8
  103. package/lib/solution/VenueBooking/index.js +0 -8
  104. package/lib/types/index.d.ts +0 -1
  105. package/package.json +1 -1
  106. package/dist/modules/Order/payment-utils.d.ts +0 -26
  107. package/dist/modules/Order/payment-utils.js +0 -225
  108. package/dist/utils/payment-number.d.ts +0 -9
  109. package/dist/utils/payment-number.js +0 -69
  110. package/lib/modules/Order/payment-utils.d.ts +0 -26
  111. package/lib/modules/Order/payment-utils.js +0 -224
  112. package/lib/utils/payment-number.d.ts +0 -9
  113. package/lib/utils/payment-number.js +0 -64
@@ -213,12 +213,10 @@ export interface OrderBookingItem {
213
213
  [key: string]: unknown;
214
214
  }[];
215
215
  }
216
- /** 支付记录 metadata */
216
+ /** 支付记录 metadata,常含 unique_payment_number */
217
217
  export interface OrderPaymentMetadata {
218
- /** 三方支付交易流水号 */
218
+ /** 设备端本地支付唯一标识 */
219
219
  unique_payment_number?: string;
220
- /** 刷卡机设备快照;server 不解析内部字段,仅透传并持久化 */
221
- card_reader_snapshot?: Record<string, unknown>;
222
220
  [key: string]: unknown;
223
221
  }
224
222
  /**
@@ -227,8 +225,6 @@ export interface OrderPaymentMetadata {
227
225
  export interface OrderPaymentItem {
228
226
  /** 支付记录 ID;存量/更新时传。来源:OrderPayment.id */
229
227
  order_payment_id?: number | null;
230
- /** 支付项稳定唯一号;历史支付项允许缺失 */
231
- payment_number?: string;
232
228
  /** 支付方式 ID(设备端从本地支付方式配置取详情)。来源:OrderPayment.custom_payment_id */
233
229
  custom_payment_id?: number;
234
230
  /** 支付方式编码。来源:OrderPayment.payment_method */
@@ -253,13 +249,11 @@ export interface OrderPaymentItem {
253
249
  created_at?: string | null;
254
250
  /** 手续费配置。来源:OrderPayment.service_charge */
255
251
  service_charge?: Record<string, unknown> | null;
256
- /** 已计算的支付手续费。来源:OrderPayment.service_fee */
257
- service_fee?: OrderMoneyString;
258
252
  /** Wallet Pass 使用单位 */
259
253
  wallet_pass_usage_unit?: unknown[] | null;
260
254
  /** Wallet Pass 使用值 */
261
255
  wallet_pass_use_value?: number | null;
262
- /** 元数据;三方支付成功后可含 unique_payment_number */
256
+ /** 元数据;含 unique_payment_number。来源:OrderPayment.metadata */
263
257
  metadata?: OrderPaymentMetadata | null;
264
258
  }
265
259
  /**
@@ -419,8 +413,6 @@ export interface OrderData {
419
413
  create_date?: string;
420
414
  /** 本地待同步标记:1 表示需要后续同步到云端 */
421
415
  need_sync?: 0 | 1 | number;
422
- /** 本地草稿标记:1 表示仅为 POS 可恢复草稿,不代表已提交云端 */
423
- is_draft_order?: 0 | 1 | number;
424
416
  /** 兼容:部分场景仍使用顶层 total_amount */
425
417
  total_amount?: OrderMoneyString | number;
426
418
  /** 扩展字段(物流、标签等);使用 any 以便筛选与数据源扩展 */
@@ -72,7 +72,7 @@
72
72
  // 3.5 payments
73
73
  // ─────────────────────────────────────────────────────────────────
74
74
 
75
- /** 支付记录 metadata */
75
+ /** 支付记录 metadata,常含 unique_payment_number */
76
76
 
77
77
  /**
78
78
  * 支付记录(3.5 payments)
@@ -2,14 +2,14 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
3
  import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult } from './types';
4
4
  import { OrderModule } from '../../modules/Order';
5
- import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
5
+ import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions } from '../../modules/Order/types';
6
6
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
7
7
  import type { Discount } from '../../modules/Discount/types';
8
8
  import { RequestPlugin, WindowPlugin } from '../../plugins';
9
9
  export * from './types';
10
10
  import { ProductList } from '../../modules/ProductList';
11
11
  import { PaymentModule } from '../../modules/Payment';
12
- import type { PaymentMethod } from '../../modules/Payment/types';
12
+ import type { PaymentMethod, RoundingResult } from '../../modules/Payment/types';
13
13
  import type { SalesSummaryModule } from '../../modules/SalesSummary';
14
14
  import type { ScheduleModule } from '../../modules/Schedule';
15
15
  import { QuotationModule } from '../../modules/Quotation';
@@ -24,19 +24,6 @@ export interface BaseSalesState {
24
24
  schedule?: ScheduleModule;
25
25
  quotation?: QuotationModule;
26
26
  }
27
- export interface BaseSalesUpdateOrderPaymentOptions extends OrderPaymentUpdateOptions {
28
- persistDraft?: boolean;
29
- submitWhenPaid?: boolean;
30
- forceSubmitIfPaid?: boolean;
31
- /** 草稿恢复时,允许将新回调字段合并进已 paid 的支付项。 */
32
- applyUpdatesWhenPaid?: boolean;
33
- smallTicketDataFlag?: number;
34
- }
35
- export interface BaseSalesUpdateOrderPaymentResult extends OrderPaymentUpdateResult {
36
- draftResult?: unknown;
37
- draftError?: unknown;
38
- syncResult?: SyncPaymentsToOrderResult<any>;
39
- }
40
27
  export type BaseSalesPrintLocalOrderReceiptParams = string | number;
41
28
  export declare class BaseSalesImpl extends BaseModule implements Module {
42
29
  protected defaultName: string;
@@ -48,11 +35,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
48
35
  protected store: BaseSalesState;
49
36
  protected otherParams: Record<string, any>;
50
37
  protected cacheId: string | undefined;
51
- /**
52
- * 由已在初始化阶段解析过设备短号的业务解决方案写入。
53
- * 未设置时,支付编号仍按原逻辑实时读取设备信息。
54
- */
55
- protected paymentNumberDevicePrefix: string | null;
56
38
  /**
57
39
  * window / request 暴露为 public:现存外部工具(如 BookingTicket Scan)通过
58
40
  * `solution.window` / `solution.request` 直接访问插件,保持原有契约不破坏。
@@ -108,6 +90,16 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
108
90
  private applyQuotationScheduleResolver;
109
91
  private loadQuotationForPriceQuery;
110
92
  private getPriceQueryProductId;
93
+ /**
94
+ * Change Time / customer reprice 必须沿用商品列表的渠道口径。
95
+ * SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
96
+ */
97
+ private getPriceQueryChannel;
98
+ /**
99
+ * /product/query 的智能定价评估只读取 strategy_context;
100
+ * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
101
+ */
102
+ private getPriceQueryStrategyContext;
111
103
  private getPriceQuerySchedule;
112
104
  private loadProductsForPriceQuery;
113
105
  private loadProductForPriceQuery;
@@ -146,13 +138,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
146
138
  */
147
139
  protected readSessionCacheData(): Record<string, any>;
148
140
  protected getAppData<T>(key: string): T | undefined;
149
- /**
150
- * 复用业务解决方案初始化时已解析的支付设备短号。
151
- * 空值会清除缓存,使后续支付恢复实时读取设备信息的兼容路径。
152
- */
153
- protected setPaymentNumberDevicePrefix(prefix: unknown): void;
154
- private getPaymentNumberDevicePrefixSync;
155
- private getPaymentNumberDevicePrefixAsync;
156
141
  private syncAppDataToTempOrder;
157
142
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
158
143
  destroy(): Promise<void>;
@@ -179,7 +164,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
179
164
  /** 获取附加费用(运费/服务费/税费等)。 */
180
165
  getSurcharges(): ISalesSurcharge[];
181
166
  getTempOrder(): OrderTempOrder | null;
182
- replaceTempOrder(tempOrder: OrderTempOrder): Promise<OrderTempOrder>;
167
+ replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
183
168
  getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
184
169
  getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
185
170
  getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
@@ -265,13 +250,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
265
250
  confirmPendingVoucherPayments?: boolean;
266
251
  enhancePayload?: SubmitPayloadEnhancer;
267
252
  }): Promise<T>;
268
- saveSalesOrderDraft<T = any>(params?: {
269
- platform?: string;
270
- businessCode?: string;
271
- channel?: string;
272
- type?: string;
273
- enhancePayload?: SubmitPayloadEnhancer;
274
- }): Promise<T>;
275
253
  submitTempOrderAsync<T = any>(params?: {
276
254
  payments?: OrderPaymentSource[];
277
255
  paymentStatus?: BaseSalesPaymentStatus;
@@ -290,27 +268,16 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
290
268
  private queueLatestAutoPaymentSync;
291
269
  private scheduleQueuedAutoPaymentSyncFlush;
292
270
  private flushQueuedAutoPaymentSync;
293
- /**
294
- * 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
295
- */
271
+ /** 追加单个支付项到当前订单。 */
296
272
  addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
297
- /**
298
- * 创建新支付项时优先使用业务解决方案初始化阶段缓存的设备短号;
299
- * 未缓存的通用 BaseSales 保持实时读取设备信息的兼容语义。
300
- */
301
- addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
302
- private addOrderPaymentWithDevicePrefix;
303
273
  /** 更新当前订单中的指定支付项。 */
304
- updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: BaseSalesUpdateOrderPaymentOptions): Promise<BaseSalesUpdateOrderPaymentResult>;
274
+ updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
305
275
  /** 删除当前订单中的指定支付项。 */
306
276
  deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
307
277
  /** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
308
278
  updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
309
279
  status?: 'paid' | 'payment_pending';
310
280
  }): OrderPaymentData[];
311
- updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
312
- status?: 'paid' | 'payment_pending';
313
- }): Promise<OrderPaymentData[]>;
314
281
  confirmPendingVoucherPayments(): OrderPaymentData[];
315
282
  discardPendingVoucherPayments(): OrderPaymentData[];
316
283
  private getWalletProductList;
@@ -333,16 +300,15 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
333
300
  getPaymentMethodsAsync(): Promise<PaymentMethod[]>;
334
301
  /** 同步读取初始化时缓存的支付方式列表。 */
335
302
  getPaymentMethods(): PaymentMethod[];
336
- /** 轻量舍入能力,供现金支付 UI 计算 rounding_amount。 */
303
+ /**
304
+ * 按当前店铺的现金舍入配置计算金额,供现金支付 UI 使用。
305
+ *
306
+ * 舍入开关取自 CASHMANUAL 支付方式;舍入规则取自
307
+ * otherParams.order_rounding_setting,金额算法统一由 PaymentModule 维护。
308
+ */
337
309
  roundAmount(params: {
338
310
  amount: string | number;
339
- interval?: string | number;
340
- rule?: 'standard_rounding' | 'standard_down' | 'always_up' | 'always_down' | string;
341
- }): {
342
- originalAmount: string;
343
- roundedAmount: string;
344
- roundingDifference: string;
345
- };
311
+ }): Promise<RoundingResult>;
346
312
  /**
347
313
  * 发送支付链接。
348
314
  *
@@ -359,7 +325,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
359
325
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
360
326
  shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
361
327
  calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
362
- addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
328
+ addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
363
329
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
364
330
  updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
365
331
  updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -375,8 +341,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
375
341
  * @example
376
342
  * await baseSales.removeProductsFromOrder([identityA, identityB]);
377
343
  */
378
- removeProductsFromOrder(identities: BaseSalesOrderProductIdentity[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
379
- removeProductFromOrder(identity: BaseSalesOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
344
+ removeProductsFromOrder(identities: BaseSalesOrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
345
+ removeProductFromOrder(identity: BaseSalesOrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
380
346
  /**
381
347
  * 注入促销评估器到底层 OrderModule。
382
348
  *