@pisell/pisellos 0.0.234 → 0.0.236

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 (33) hide show
  1. package/dist/modules/Order/index.d.ts +1 -1
  2. package/dist/modules/Payment/index.d.ts +3 -3
  3. package/dist/modules/Payment/index.js +74 -10
  4. package/dist/modules/Payment/types.d.ts +24 -3
  5. package/dist/modules/Payment/types.js +9 -1
  6. package/dist/modules/Payment/utils.js +1 -1
  7. package/dist/modules/Payment/walletpass.d.ts +5 -2
  8. package/dist/modules/Payment/walletpass.js +63 -11
  9. package/dist/solution/BookingTicket/index.d.ts +8 -0
  10. package/dist/solution/BookingTicket/index.js +27 -3
  11. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +6 -0
  12. package/dist/solution/BookingTicket/utils/scan/handleScan.js +43 -28
  13. package/dist/solution/Checkout/index.d.ts +73 -8
  14. package/dist/solution/Checkout/index.js +1540 -926
  15. package/dist/solution/Checkout/types.d.ts +79 -3
  16. package/dist/solution/Checkout/types.js +6 -0
  17. package/lib/modules/Order/index.d.ts +1 -1
  18. package/lib/modules/Payment/index.d.ts +3 -3
  19. package/lib/modules/Payment/index.js +30 -5
  20. package/lib/modules/Payment/types.d.ts +24 -3
  21. package/lib/modules/Payment/types.js +1 -1
  22. package/lib/modules/Payment/utils.js +1 -1
  23. package/lib/modules/Payment/walletpass.d.ts +5 -2
  24. package/lib/modules/Payment/walletpass.js +30 -2
  25. package/lib/solution/BookingTicket/index.d.ts +8 -0
  26. package/lib/solution/BookingTicket/index.js +23 -2
  27. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +6 -0
  28. package/lib/solution/BookingTicket/utils/scan/handleScan.js +21 -14
  29. package/lib/solution/Checkout/index.d.ts +73 -8
  30. package/lib/solution/Checkout/index.js +582 -200
  31. package/lib/solution/Checkout/types.d.ts +79 -3
  32. package/lib/solution/Checkout/types.js +2 -0
  33. package/package.json +1 -1
@@ -2,7 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
3
  import { OrderModule } from '../../modules/Order';
4
4
  import { PaymentModule } from '../../modules/Payment';
5
- import { CheckoutModuleAPI, CheckoutStep, CheckoutInitParams, CreateLocalOrderParams, PlaceOrderParams, CreateOrderParams, ProcessPaymentParams, CheckoutStatusInfo, CheckoutSummary, CurrentOrderInfo, CartSummaryItem, ExtractedAmountInfo } from './types';
5
+ import { CheckoutModuleAPI, CheckoutStep, CheckoutInitParams, CreateLocalOrderParams, PlaceOrderParams, CreateOrderParams, ProcessPaymentParams, CheckoutStatusInfo, CheckoutSummary, CurrentOrderInfo, CartSummaryItem, ExtractedAmountInfo, SendCustomerPayLinkParams } from './types';
6
6
  import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
7
7
  export * from './types';
8
8
  /**
@@ -185,7 +185,8 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
185
185
  /**
186
186
  * 获取支付方式列表
187
187
  *
188
- * 直接调用 Payment 模块的 getPayMethodListAsync 方法
188
+ * 优先使用 store 中的缓存数据,避免重复接口调用。
189
+ * 如果 store 中没有数据,则调用 Payment 模块的方法获取。
189
190
  *
190
191
  * @returns 支付方式列表
191
192
  */
@@ -251,11 +252,12 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
251
252
  customer_name?: string;
252
253
  } | null;
253
254
  /**
254
- * 检查订单是否需要手动同步
255
+ * 检查订单是否需要手动同步(异步版本)
255
256
  *
256
257
  * 返回订单是否为纯代金券支付且待付金额<=0但未同步的状态
258
+ * 从 Payment 模块获取最新的支付项数据
257
259
  */
258
- needsManualSync(): boolean;
260
+ needsManualSyncAsync(): Promise<boolean>;
259
261
  /**
260
262
  * 手动同步订单到后端
261
263
  *
@@ -279,6 +281,25 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
279
281
  * @returns 当前订单的ID,如果没有订单则返回null
280
282
  */
281
283
  getCurrentOrderId(): string | null;
284
+ /**
285
+ * 获取当前订单是否已同步到后端
286
+ *
287
+ * @returns 当前订单是否已同步状态,如果没有订单则返回false
288
+ */
289
+ isCurrentOrderSynced(): boolean;
290
+ /**
291
+ * 取消当前本地订单
292
+ *
293
+ * 只能取消未同步到后端的本地订单,如果订单已同步则不能取消
294
+ *
295
+ * @param cancelReason 取消原因(可选)
296
+ * @returns 取消结果
297
+ */
298
+ cancelCurrentOrderAsync(cancelReason?: string): Promise<{
299
+ success: boolean;
300
+ message?: string;
301
+ orderId?: string;
302
+ }>;
282
303
  /**
283
304
  * 保存订单并稍后支付
284
305
  *
@@ -363,13 +384,13 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
363
384
  */
364
385
  private calculateTotalAmount;
365
386
  /**
366
- * 计算已支付金额
387
+ * 计算已支付金额(从 Payment 模块获取最新数据)
367
388
  */
368
- private calculatePaidAmount;
389
+ private calculatePaidAmountAsync;
369
390
  /**
370
- * 计算剩余未支付金额
391
+ * 计算剩余未支付金额(从 Payment 模块获取最新数据)
371
392
  */
372
- private calculateRemainingAmount;
393
+ private calculateRemainingAmountAsync;
373
394
  /**
374
395
  * 更新 stateAmount 为当前剩余未支付金额
375
396
  */
@@ -432,5 +453,49 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
432
453
  message?: string;
433
454
  orderId?: string | number;
434
455
  }>;
456
+ /**
457
+ * 发送客户支付链接邮件
458
+ *
459
+ * 向指定邮箱发送订单支付提醒邮件
460
+ *
461
+ * @param params 发送参数
462
+ * @returns 发送结果
463
+ */
464
+ sendCustomerPayLinkAsync(params: SendCustomerPayLinkParams): Promise<{
465
+ success: boolean;
466
+ message?: string;
467
+ }>;
468
+ /**
469
+ * 金额舍入
470
+ *
471
+ * @param amount 原始金额
472
+ * @returns 舍入结果详情,包含原始金额、舍入后金额和舍入差额
473
+ */
474
+ roundAmountAsync(amount: number): Promise<{
475
+ originalAmount: string;
476
+ roundedAmount: string;
477
+ roundingDifference: string;
478
+ }>;
435
479
  destroy(): Promise<void>;
480
+ /**
481
+ * 重置 store 状态
482
+ *
483
+ * 在创建新订单前调用,确保状态完全干净
484
+ */
485
+ private resetStoreStateAsync;
486
+ /**
487
+ * 手动清理已完成的订单状态(公开方法)
488
+ *
489
+ * 供UI层调用的公开方法,用于手动清理订单状态
490
+ *
491
+ * @returns 清理结果
492
+ */
493
+ clearCompletedOrderAsync(): Promise<{
494
+ success: boolean;
495
+ message?: string;
496
+ clearedOrder?: {
497
+ uuid: string;
498
+ orderId: string;
499
+ } | null;
500
+ }>;
436
501
  }