@pisell/pisellos 2.1.98 → 2.1.100

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 (82) hide show
  1. package/dist/effects/index.d.ts +2 -2
  2. package/dist/modules/Customer/types.d.ts +1 -1
  3. package/dist/modules/Payment/types.d.ts +7 -7
  4. package/dist/modules/Product/index.d.ts +1 -1
  5. package/dist/modules/Rules/types.d.ts +1 -1
  6. package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  7. package/dist/modules/Schedule/type.d.ts +7 -7
  8. package/dist/modules/Schedule/types.d.ts +9 -9
  9. package/dist/solution/BookingByStep/index.d.ts +1 -1
  10. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  11. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  12. package/dist/solution/ShopDiscount/utils.d.ts +2 -2
  13. package/dist/types/index.d.ts +1 -1
  14. package/dist/utils/task.d.ts +2 -2
  15. package/dist/utils/watch.d.ts +2 -2
  16. package/lib/core/index.js +27 -28
  17. package/lib/effects/index.d.ts +2 -2
  18. package/lib/effects/index.js +3 -7
  19. package/lib/modules/Account/index.js +9 -10
  20. package/lib/modules/AccountList/index.js +14 -11
  21. package/lib/modules/BaseModule.js +6 -3
  22. package/lib/modules/Cart/index.js +14 -9
  23. package/lib/modules/Cart/utils/cartProduct.js +3 -6
  24. package/lib/modules/Customer/constants.js +1 -1
  25. package/lib/modules/Customer/index.js +18 -15
  26. package/lib/modules/Customer/types.d.ts +1 -1
  27. package/lib/modules/Date/index.js +10 -6
  28. package/lib/modules/Date/types.js +1 -0
  29. package/lib/modules/Discount/index.js +11 -6
  30. package/lib/modules/Guests/index.js +10 -15
  31. package/lib/modules/Order/index.js +10 -7
  32. package/lib/modules/Payment/cash.js +1 -1
  33. package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
  34. package/lib/modules/Payment/eftpos.js +1 -1
  35. package/lib/modules/Payment/index.js +84 -73
  36. package/lib/modules/Payment/types.d.ts +7 -7
  37. package/lib/modules/Payment/utils.js +3 -6
  38. package/lib/modules/Payment/walletpass.js +31 -31
  39. package/lib/modules/Product/index.d.ts +1 -1
  40. package/lib/modules/Product/index.js +6 -5
  41. package/lib/modules/ProductList/index.js +5 -3
  42. package/lib/modules/Resource/index.js +8 -12
  43. package/lib/modules/Rules/index.js +21 -35
  44. package/lib/modules/Rules/types.d.ts +1 -1
  45. package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
  46. package/lib/modules/Schedule/index.js +8 -5
  47. package/lib/modules/Schedule/type.d.ts +7 -7
  48. package/lib/modules/Schedule/types.d.ts +9 -9
  49. package/lib/modules/Schedule/utils.js +2 -4
  50. package/lib/modules/Step/index.js +7 -4
  51. package/lib/modules/Summary/index.js +9 -4
  52. package/lib/modules/Summary/utils.js +8 -16
  53. package/lib/plugins/request.js +34 -33
  54. package/lib/plugins/window.js +101 -113
  55. package/lib/solution/BookingByStep/index.d.ts +1 -1
  56. package/lib/solution/BookingByStep/index.js +110 -177
  57. package/lib/solution/BookingByStep/utils/capacity.js +11 -16
  58. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  59. package/lib/solution/BookingByStep/utils/resources.js +4 -8
  60. package/lib/solution/BookingByStep/utils/stock.js +3 -6
  61. package/lib/solution/BookingByStep/utils/timeslots.js +24 -27
  62. package/lib/solution/BookingTicket/index.js +19 -14
  63. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
  64. package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
  65. package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
  66. package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
  67. package/lib/solution/BuyTickets/index.js +15 -15
  68. package/lib/solution/Checkout/index.js +216 -211
  69. package/lib/solution/Checkout/utils/index.js +18 -22
  70. package/lib/solution/RegisterAndLogin/config.js +2 -2
  71. package/lib/solution/RegisterAndLogin/index.js +114 -110
  72. package/lib/solution/RegisterAndLogin/utils.js +9 -9
  73. package/lib/solution/ShopDiscount/index.js +16 -13
  74. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  75. package/lib/solution/ShopDiscount/utils.d.ts +2 -2
  76. package/lib/solution/ShopDiscount/utils.js +1 -2
  77. package/lib/types/index.d.ts +1 -1
  78. package/lib/utils/task.d.ts +2 -2
  79. package/lib/utils/task.js +3 -3
  80. package/lib/utils/watch.d.ts +2 -2
  81. package/lib/utils/watch.js +5 -7
  82. package/package.json +16 -17
@@ -37,7 +37,7 @@ function formatAmount(amount) {
37
37
  const decimal = new import_decimal.Decimal(amount);
38
38
  return decimal.toFixed(2);
39
39
  } catch (error) {
40
- console.warn(`[PaymentModule] 金额格式化失败: ${amount},使用默认值 0.00`);
40
+ console.warn(`[PaymentModule] \u91D1\u989D\u683C\u5F0F\u5316\u5931\u8D25: ${amount}\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u503C 0.00`);
41
41
  return "0.00";
42
42
  }
43
43
  }
@@ -54,12 +54,23 @@ function generateRequestUniqueId() {
54
54
  return `${year}${month}${day}${hour}${minute}${second}${millisecond}${randomDigits}`;
55
55
  }
56
56
  var PaymentModule = class extends import_BaseModule.BaseModule {
57
+ defaultName = "pay";
58
+ defaultVersion = "1.0.0";
59
+ request;
60
+ app;
61
+ // App instance
62
+ store;
63
+ dbManager;
64
+ // IndexDBManager 实例
65
+ logger;
66
+ // LoggerManager 实例
67
+ otherParams = {};
68
+ // 支付方式实例
69
+ cash;
70
+ eftpos;
71
+ wallet;
57
72
  constructor(name, version) {
58
73
  super(name || "payment", version);
59
- this.defaultName = "pay";
60
- this.defaultVersion = "1.0.0";
61
- // LoggerManager 实例
62
- this.otherParams = {};
63
74
  this.cash = new import_cash.CashPaymentImpl(this);
64
75
  this.eftpos = new import_eftpos.EftposPaymentImpl(this);
65
76
  this.wallet = new import_walletpass.WalletPassPaymentImpl(this);
@@ -71,17 +82,17 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
71
82
  this.request = core.getPlugin("request");
72
83
  const appPlugin = core.getPlugin("app");
73
84
  if (!this.request) {
74
- throw new Error("支付模块需要 request 插件支持");
85
+ throw new Error("\u652F\u4ED8\u6A21\u5757\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
75
86
  }
76
87
  if (!appPlugin) {
77
- throw new Error("支付模块需要 app 插件支持");
88
+ throw new Error("\u652F\u4ED8\u6A21\u5757\u9700\u8981 app \u63D2\u4EF6\u652F\u6301");
78
89
  }
79
90
  this.app = appPlugin.getApp();
80
91
  this.dbManager = this.app.dbManager;
81
92
  this.logger = this.app.logger;
82
93
  await this.ensurePaymentTables();
83
94
  this.registerNetworkHandlers();
84
- console.log("[PaymentModule] 初始化完成");
95
+ console.log("[PaymentModule] \u521D\u59CB\u5316\u5B8C\u6210");
85
96
  this.logInfo("PaymentModule initialized successfully");
86
97
  }
87
98
  /**
@@ -156,7 +167,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
156
167
  const network = this.app.plugins.get("network");
157
168
  this.logInfo("Registering network status listener");
158
169
  network == null ? void 0 : network.addListener("networkStatusChange", async (status) => {
159
- console.log("网络状态:", status.connected);
170
+ console.log("\u7F51\u7EDC\u72B6\u6001:", status.connected);
160
171
  this.logInfo("Network status changed", {
161
172
  connected: status.connected,
162
173
  previousStatus: status.previousStatus
@@ -176,7 +187,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
176
187
  try {
177
188
  cachedMethods = await this.dbManager.getAll("pay_method");
178
189
  } catch (dbError) {
179
- console.warn("[PaymentModule] pay_method 表不存在,将从服务器获取数据");
190
+ console.warn("[PaymentModule] pay_method \u8868\u4E0D\u5B58\u5728\uFF0C\u5C06\u4ECE\u670D\u52A1\u5668\u83B7\u53D6\u6570\u636E");
180
191
  }
181
192
  const hasCache = cachedMethods.length > 0;
182
193
  if (hasCache) {
@@ -190,7 +201,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
190
201
  await this.dbManager.update("pay_method", method);
191
202
  }
192
203
  } catch (dbError) {
193
- console.warn("[PaymentModule] 无法缓存支付方式,pay_method 表不存在");
204
+ console.warn("[PaymentModule] \u65E0\u6CD5\u7F13\u5B58\u652F\u4ED8\u65B9\u5F0F\uFF0Cpay_method \u8868\u4E0D\u5B58\u5728");
194
205
  }
195
206
  await this.core.effects.emit(
196
207
  `${this.name}:onPaymentMethodsLoaded`,
@@ -202,7 +213,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
202
213
  });
203
214
  return payMethods;
204
215
  } catch (error) {
205
- console.error("[PaymentModule] 获取支付方式列表失败", error);
216
+ console.error("[PaymentModule] \u83B7\u53D6\u652F\u4ED8\u65B9\u5F0F\u5217\u8868\u5931\u8D25", error);
206
217
  this.logError("getPayMethodListAsync failed", error);
207
218
  return [];
208
219
  }
@@ -215,7 +226,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
215
226
  cachedMethodsCount: cachedMethods.length
216
227
  });
217
228
  try {
218
- console.log("[PaymentModule] 后台刷新支付方式列表...");
229
+ console.log("[PaymentModule] \u540E\u53F0\u5237\u65B0\u652F\u4ED8\u65B9\u5F0F\u5217\u8868...");
219
230
  const response = await this.request.get("/pay/custom-payment/available", { channel: "pos" });
220
231
  const newPayMethods = response.data || [];
221
232
  const hasChanges = this.hasPaymentMethodsChanged(
@@ -223,7 +234,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
223
234
  newPayMethods
224
235
  );
225
236
  if (hasChanges) {
226
- console.log("[PaymentModule] 支付方式列表已更新");
237
+ console.log("[PaymentModule] \u652F\u4ED8\u65B9\u5F0F\u5217\u8868\u5DF2\u66F4\u65B0");
227
238
  this.logInfo("Payment methods updated in background", {
228
239
  oldCount: cachedMethods.length,
229
240
  newCount: newPayMethods.length
@@ -236,7 +247,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
236
247
  await this.dbManager.update("pay_method", method);
237
248
  }
238
249
  } catch (dbError) {
239
- console.warn("[PaymentModule] 无法更新支付方式缓存", dbError);
250
+ console.warn("[PaymentModule] \u65E0\u6CD5\u66F4\u65B0\u652F\u4ED8\u65B9\u5F0F\u7F13\u5B58", dbError);
240
251
  }
241
252
  const eventData = {
242
253
  oldMethods: cachedMethods,
@@ -247,10 +258,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
247
258
  eventData
248
259
  );
249
260
  } else {
250
- console.log("[PaymentModule] 支付方式列表无变化");
261
+ console.log("[PaymentModule] \u652F\u4ED8\u65B9\u5F0F\u5217\u8868\u65E0\u53D8\u5316");
251
262
  }
252
263
  } catch (error) {
253
- console.error("[PaymentModule] 后台刷新支付方式失败", error);
264
+ console.error("[PaymentModule] \u540E\u53F0\u5237\u65B0\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
254
265
  }
255
266
  }
256
267
  /**
@@ -269,7 +280,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
269
280
  return true;
270
281
  }
271
282
  if (oldMethod.code !== newMethod.code || oldMethod.name !== newMethod.name || oldMethod.type !== newMethod.type || oldMethod.description !== newMethod.description || oldMethod.status !== newMethod.status || oldMethod.disable !== newMethod.disable || oldMethod.is_surcharge !== newMethod.is_surcharge || oldMethod.fixed !== newMethod.fixed || oldMethod.percentage !== newMethod.percentage || oldMethod.enabled !== newMethod.enabled || JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) || JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) || JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {})) {
272
- console.log(`[PaymentModule] 支付方式 ${newMethod.id} (${newMethod.code}) 发生变化:`, {
283
+ console.log(`[PaymentModule] \u652F\u4ED8\u65B9\u5F0F ${newMethod.id} (${newMethod.code}) \u53D1\u751F\u53D8\u5316:`, {
273
284
  id: newMethod.id,
274
285
  changes: {
275
286
  code: oldMethod.code !== newMethod.code ? { old: oldMethod.code, new: newMethod.code } : void 0,
@@ -299,7 +310,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
299
310
  try {
300
311
  return await this.dbManager.getAll("order");
301
312
  } catch (error) {
302
- console.error("[PaymentModule] 获取订单列表失败", error);
313
+ console.error("[PaymentModule] \u83B7\u53D6\u8BA2\u5355\u5217\u8868\u5931\u8D25", error);
303
314
  return [];
304
315
  }
305
316
  }
@@ -310,7 +321,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
310
321
  try {
311
322
  return await this.dbManager.get("order", orderUuid, true);
312
323
  } catch (error) {
313
- console.error("[PaymentModule] 获取支付订单失败", error);
324
+ console.error("[PaymentModule] \u83B7\u53D6\u652F\u4ED8\u8BA2\u5355\u5931\u8D25", error);
314
325
  return null;
315
326
  }
316
327
  }
@@ -353,7 +364,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
353
364
  }, 0);
354
365
  return newOrder;
355
366
  } catch (error) {
356
- console.error("[PaymentModule] 创建支付订单失败", error);
367
+ console.error("[PaymentModule] \u521B\u5EFA\u652F\u4ED8\u8BA2\u5355\u5931\u8D25", error);
357
368
  this.logError("createPaymentOrderAsync failed", error, {
358
369
  orderId: params.order_id
359
370
  });
@@ -369,10 +380,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
369
380
  if (order) {
370
381
  await this.dbManager.delete("order", orderUuid);
371
382
  await this.core.effects.emit(`${this.name}:onOrderDeleted`, order);
372
- console.log("[PaymentModule] 支付订单删除成功:", orderUuid);
383
+ console.log("[PaymentModule] \u652F\u4ED8\u8BA2\u5355\u5220\u9664\u6210\u529F:", orderUuid);
373
384
  }
374
385
  } catch (error) {
375
- console.error("[PaymentModule] 删除支付订单失败", error);
386
+ console.error("[PaymentModule] \u5220\u9664\u652F\u4ED8\u8BA2\u5355\u5931\u8D25", error);
376
387
  throw error;
377
388
  }
378
389
  }
@@ -394,7 +405,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
394
405
  });
395
406
  }
396
407
  } catch (error) {
397
- console.error("[PaymentModule] 更新订单失败", error);
408
+ console.error("[PaymentModule] \u66F4\u65B0\u8BA2\u5355\u5931\u8D25", error);
398
409
  throw error;
399
410
  }
400
411
  }
@@ -428,7 +439,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
428
439
  newOrderId,
429
440
  existingOrderUuid: duplicateOrder.uuid
430
441
  });
431
- throw new Error(`订单ID ${newOrderId} 已存在`);
442
+ throw new Error(`\u8BA2\u5355ID ${newOrderId} \u5DF2\u5B58\u5728`);
432
443
  }
433
444
  const originalOrderId = existingOrder.id;
434
445
  const updatedOrder = {
@@ -460,10 +471,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
460
471
  originalOrderId,
461
472
  newOrderId
462
473
  });
463
- console.log(`[PaymentModule] 订单ID替换成功: ${originalOrderId} ${newOrderId}`);
474
+ console.log(`[PaymentModule] \u8BA2\u5355ID\u66FF\u6362\u6210\u529F: ${originalOrderId} \u2192 ${newOrderId}`);
464
475
  return updatedOrder;
465
476
  } catch (error) {
466
- console.error("[PaymentModule] 替换订单ID失败", error);
477
+ console.error("[PaymentModule] \u66FF\u6362\u8BA2\u5355ID\u5931\u8D25", error);
467
478
  this.logError("replaceOrderIdByUuidAsync failed", error, {
468
479
  orderUuid,
469
480
  newOrderId
@@ -510,11 +521,11 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
510
521
  orderPaymentType: paymentItem.order_payment_type
511
522
  });
512
523
  try {
513
- this.logInfo("准备获取订单", {
524
+ this.logInfo("\u51C6\u5907\u83B7\u53D6\u8BA2\u5355", {
514
525
  orderUuid
515
526
  });
516
527
  const order = await this.getPaymentOrderByUuidAsync(orderUuid);
517
- this.logInfo("获取订单信息成功", {
528
+ this.logInfo("\u83B7\u53D6\u8BA2\u5355\u4FE1\u606F\u6210\u529F", {
518
529
  orderUuid,
519
530
  order
520
531
  });
@@ -530,7 +541,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
530
541
  }, new import_decimal.Decimal(0));
531
542
  const expectedDepositAmount = new import_decimal.Decimal(order.deposit_amount || "0").sub(paidDepositAmount);
532
543
  if (expectAmount.lte(0) && expectedDepositAmount.eq(0)) {
533
- const warningMessage = `订单 ${orderUuid} 待付金额已为0,不允许添加新的支付项`;
544
+ const warningMessage = `\u8BA2\u5355 ${orderUuid} \u5F85\u4ED8\u91D1\u989D\u5DF2\u4E3A0\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u65B0\u7684\u652F\u4ED8\u9879`;
534
545
  console.warn("[PaymentModule] Payment lock triggered:", {
535
546
  orderUuid,
536
547
  expectAmount: order.expect_amount,
@@ -574,12 +585,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
574
585
  };
575
586
  order.payment.push(newPaymentItem);
576
587
  this.recalculateOrderAmount(order);
577
- this.logInfo("开始更新订单支付项", {
588
+ this.logInfo("\u5F00\u59CB\u66F4\u65B0\u8BA2\u5355\u652F\u4ED8\u9879", {
578
589
  orderUuid,
579
590
  order
580
591
  });
581
592
  await this.dbManager.update("order", order, true);
582
- this.logInfo("更新订单支付项完成", {
593
+ this.logInfo("\u66F4\u65B0\u8BA2\u5355\u652F\u4ED8\u9879\u5B8C\u6210", {
583
594
  orderUuid
584
595
  });
585
596
  this.core.effects.emit(`${this.name}:onPaymentAdded`, {
@@ -600,7 +611,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
600
611
  changeGivenAmount: (_d = newPaymentItem.metadata) == null ? void 0 : _d.change_given_amount
601
612
  });
602
613
  } catch (error) {
603
- console.error("[PaymentModule] 添加支付项失败", error);
614
+ console.error("[PaymentModule] \u6DFB\u52A0\u652F\u4ED8\u9879\u5931\u8D25", error);
604
615
  this.logError("addPaymentItemAsync failed", error, {
605
616
  orderUuid,
606
617
  paymentItem
@@ -616,22 +627,22 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
616
627
  try {
617
628
  const order = await this.dbManager.get("order", orderUuid);
618
629
  if (!order) {
619
- throw new Error("订单不存在");
630
+ throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
620
631
  }
621
632
  const paymentItem = order.payment.find(
622
633
  (payment) => payment.uuid === paymentUuid
623
634
  );
624
635
  if (!paymentItem) {
625
- throw new Error(`支付项不存在: ${paymentUuid}`);
636
+ throw new Error(`\u652F\u4ED8\u9879\u4E0D\u5B58\u5728: ${paymentUuid}`);
626
637
  }
627
638
  if (paymentItem.status === "voided") {
628
- console.warn(`[PaymentModule] 支付项 ${paymentUuid} 已经被删除,跳过操作`);
639
+ console.warn(`[PaymentModule] \u652F\u4ED8\u9879 ${paymentUuid} \u5DF2\u7ECF\u88AB\u5220\u9664\uFF0C\u8DF3\u8FC7\u64CD\u4F5C`);
629
640
  return;
630
641
  }
631
642
  paymentItem.status = "voided";
632
643
  paymentItem.origin_amount = paymentItem.amount;
633
644
  paymentItem.amount = "0.00";
634
- console.log(`[PaymentModule] 支付项标记为删除:`, {
645
+ console.log(`[PaymentModule] \u652F\u4ED8\u9879\u6807\u8BB0\u4E3A\u5220\u9664:`, {
635
646
  uuid: paymentItem.uuid,
636
647
  originalAmount: paymentItem.origin_amount,
637
648
  status: paymentItem.status
@@ -654,7 +665,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
654
665
  newExpectAmount: order.expect_amount
655
666
  });
656
667
  } catch (error) {
657
- console.error("[PaymentModule] 删除支付项失败", error);
668
+ console.error("[PaymentModule] \u5220\u9664\u652F\u4ED8\u9879\u5931\u8D25", error);
658
669
  this.logError("deletePaymentAsync failed", error, {
659
670
  orderUuid,
660
671
  paymentUuid
@@ -682,12 +693,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
682
693
  try {
683
694
  const order = await this.getPaymentOrderByUuidAsync(orderUuid);
684
695
  if (!order) {
685
- throw new Error(`订单不存在: ${orderUuid}`);
696
+ throw new Error(`\u8BA2\u5355\u4E0D\u5B58\u5728: ${orderUuid}`);
686
697
  }
687
698
  const existingVoucherItems = order.payment.filter(
688
699
  (payment) => payment.voucher_id && payment.status !== "voided" && !payment.isSynced
689
700
  );
690
- console.log("[PaymentModule] 发现现有代金券支付项:", {
701
+ console.log("[PaymentModule] \u53D1\u73B0\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", {
691
702
  orderUuid,
692
703
  existingVoucherCount: existingVoucherItems.length,
693
704
  existingItems: existingVoucherItems.map((item) => ({
@@ -699,18 +710,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
699
710
  }))
700
711
  });
701
712
  for (const voucherItem of existingVoucherItems) {
702
- console.log(`[PaymentModule] 删除现有代金券支付项: ${voucherItem.uuid}`);
713
+ console.log(`[PaymentModule] \u5220\u9664\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879: ${voucherItem.uuid}`);
703
714
  await this.deletePaymentAsync(orderUuid, voucherItem.uuid);
704
715
  }
705
- console.log("[PaymentModule] 添加新的代金券支付项:", {
716
+ console.log("[PaymentModule] \u6DFB\u52A0\u65B0\u7684\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", {
706
717
  orderUuid,
707
718
  newItemCount: voucherPaymentItems.length
708
719
  });
709
720
  for (const voucherItem of voucherPaymentItems) {
710
721
  if (!voucherItem.voucher_id) {
711
- throw new Error(`代金券支付项缺少 voucher_id: ${JSON.stringify(voucherItem)}`);
722
+ throw new Error(`\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u7F3A\u5C11 voucher_id: ${JSON.stringify(voucherItem)}`);
712
723
  }
713
- console.log(`[PaymentModule] 添加代金券支付项:`, {
724
+ console.log(`[PaymentModule] \u6DFB\u52A0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:`, {
714
725
  code: voucherItem.code,
715
726
  amount: voucherItem.amount,
716
727
  voucher_id: voucherItem.voucher_id,
@@ -732,7 +743,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
732
743
  finalExpectAmount: updatedOrder == null ? void 0 : updatedOrder.expect_amount
733
744
  });
734
745
  } catch (error) {
735
- console.error("[PaymentModule] 批量更新代金券支付项失败:", error);
746
+ console.error("[PaymentModule] \u6279\u91CF\u66F4\u65B0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u5931\u8D25:", error);
736
747
  this.logError("updateVoucherPaymentItemsAsync failed", error, {
737
748
  orderUuid,
738
749
  voucherPaymentItems
@@ -747,7 +758,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
747
758
  try {
748
759
  const order = await this.dbManager.get("order", orderUuid);
749
760
  if (!order) {
750
- throw new Error("订单不存在");
761
+ throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
751
762
  }
752
763
  const paymentItem = order.payment.find(
753
764
  (payment) => payment.uuid === paymentUuid
@@ -771,7 +782,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
771
782
  });
772
783
  }
773
784
  } catch (error) {
774
- console.error("[PaymentModule] 更新支付项失败", error);
785
+ console.error("[PaymentModule] \u66F4\u65B0\u652F\u4ED8\u9879\u5931\u8D25", error);
775
786
  throw error;
776
787
  }
777
788
  }
@@ -801,7 +812,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
801
812
  });
802
813
  return result;
803
814
  } catch (error) {
804
- console.error("[PaymentModule] 提交支付失败", error);
815
+ console.error("[PaymentModule] \u63D0\u4EA4\u652F\u4ED8\u5931\u8D25", error);
805
816
  this.logError("submitPayAsync failed", error, { orderUuid });
806
817
  return { status: "failed" };
807
818
  }
@@ -834,18 +845,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
834
845
  if (totalPaidAmount.gte(orderTotalAmount)) {
835
846
  order.payment_status = import_types.PaymentStatus.Finished;
836
847
  console.log(
837
- `[PaymentModule] 订单 ${order.uuid} 支付完成,金额: ${totalPaidAmount.toString()}/${orderTotalAmount.toString()}`
848
+ `[PaymentModule] \u8BA2\u5355 ${order.uuid} \u652F\u4ED8\u5B8C\u6210\uFF0C\u91D1\u989D: ${totalPaidAmount.toString()}/${orderTotalAmount.toString()}`
838
849
  );
839
850
  } else {
840
851
  order.payment_status = import_types.PaymentStatus.PartiallyPaid;
841
852
  console.log(
842
- `[PaymentModule] 订单 ${order.uuid} 部分支付,金额: ${totalPaidAmount.toString()}/${orderTotalAmount.toString()}`
853
+ `[PaymentModule] \u8BA2\u5355 ${order.uuid} \u90E8\u5206\u652F\u4ED8\uFF0C\u91D1\u989D: ${totalPaidAmount.toString()}/${orderTotalAmount.toString()}`
843
854
  );
844
855
  }
845
856
  paymentData.payment_status = order.payment_status === import_types.PaymentStatus.Finished ? "paid" : "partially_paid";
846
857
  await this.dbManager.update("order", order);
847
858
  if (paymentData.payments.length === 0) {
848
- console.log(`[PaymentModule] 订单 ${order.uuid} 支付列表为空,跳过支付处理`);
859
+ console.log(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u652F\u4ED8\u5217\u8868\u4E3A\u7A7A\uFF0C\u8DF3\u8FC7\u652F\u4ED8\u5904\u7406`);
849
860
  this.logWarning("Empty payment list", {
850
861
  orderUuid: order.uuid,
851
862
  orderId: order.order_id
@@ -858,7 +869,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
858
869
  order
859
870
  });
860
871
  } catch (error) {
861
- console.error(`[PaymentModule] 订单 ${order.uuid} 支付提交失败`, error);
872
+ console.error(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u652F\u4ED8\u63D0\u4EA4\u5931\u8D25`, error);
862
873
  throw error;
863
874
  }
864
875
  }
@@ -868,7 +879,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
868
879
  async getRemainingOrderAmountAsync(orderUuid) {
869
880
  const order = await this.getPaymentOrderByUuidAsync(orderUuid);
870
881
  if (!order) {
871
- throw new Error("订单不存在");
882
+ throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
872
883
  }
873
884
  return new import_decimal.Decimal(order.expect_amount).toNumber();
874
885
  }
@@ -878,7 +889,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
878
889
  async getRemainingOrderAmountWithInputAsync(inputAmount, orderUuid) {
879
890
  const order = await this.getPaymentOrderByUuidAsync(orderUuid);
880
891
  if (!order) {
881
- throw new Error("订单不存在");
892
+ throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
882
893
  }
883
894
  if (inputAmount === null || inputAmount === void 0) {
884
895
  return new import_decimal.Decimal(order.expect_amount).toNumber();
@@ -891,7 +902,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
891
902
  if (typeof inputAmount === "number") {
892
903
  if (isNaN(inputAmount) || !isFinite(inputAmount)) {
893
904
  console.warn(
894
- `[PaymentModule] 输入金额不是有效数字: ${inputAmount},返回原始待付金额`
905
+ `[PaymentModule] \u8F93\u5165\u91D1\u989D\u4E0D\u662F\u6709\u6548\u6570\u5B57: ${inputAmount}\uFF0C\u8FD4\u56DE\u539F\u59CB\u5F85\u4ED8\u91D1\u989D`
895
906
  );
896
907
  return new import_decimal.Decimal(order.expect_amount).toNumber();
897
908
  }
@@ -901,7 +912,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
901
912
  return new import_decimal.Decimal(order.expect_amount).minus(inputDecimal).toNumber();
902
913
  } catch (error) {
903
914
  console.warn(
904
- `[PaymentModule] 输入金额格式无效: ${inputAmount},返回原始待付金额`
915
+ `[PaymentModule] \u8F93\u5165\u91D1\u989D\u683C\u5F0F\u65E0\u6548: ${inputAmount}\uFF0C\u8FD4\u56DE\u539F\u59CB\u5F85\u4ED8\u91D1\u989D`
905
916
  );
906
917
  return new import_decimal.Decimal(order.expect_amount).toNumber();
907
918
  }
@@ -922,7 +933,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
922
933
  const effectiveAmount = paymentAmount.plus(roundingAmount.isNegative() ? roundingAmount.abs() : 0);
923
934
  return sum.plus(effectiveAmount);
924
935
  } catch (error) {
925
- console.warn(`[PaymentModule] 无效的支付金额: amount=${payment.amount}, rounding_amount=${payment.rounding_amount},跳过计算`);
936
+ console.warn(`[PaymentModule] \u65E0\u6548\u7684\u652F\u4ED8\u91D1\u989D: amount=${payment.amount}, rounding_amount=${payment.rounding_amount}\uFF0C\u8DF3\u8FC7\u8BA1\u7B97`);
926
937
  return sum;
927
938
  }
928
939
  },
@@ -930,7 +941,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
930
941
  );
931
942
  const remainingAmount = order.is_deposit === 1 ? new import_decimal.Decimal(order.deposit_amount).minus(paidAmount) : totalAmount.minus(paidAmount);
932
943
  order.expect_amount = import_decimal.Decimal.max(0, remainingAmount).toFixed(2);
933
- console.log(`[PaymentModule] 重新计算订单金额:`, {
944
+ console.log(`[PaymentModule] \u91CD\u65B0\u8BA1\u7B97\u8BA2\u5355\u91D1\u989D:`, {
934
945
  orderUuid: order.uuid,
935
946
  totalAmount: order.total_amount,
936
947
  effectivePaidAmount: paidAmount.toFixed(2),
@@ -943,7 +954,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
943
954
  rounding_amount: p.rounding_amount || "0.00",
944
955
  effective_amount: new import_decimal.Decimal(p.amount || 0).plus(new import_decimal.Decimal(Number(p.rounding_amount) > 0 ? 0 : p.rounding_amount || 0).abs()).toFixed(2)
945
956
  })),
946
- 说明: "有效支付金额包含抹零计算(amount + |rounding_amount|)"
957
+ \u8BF4\u660E: "\u6709\u6548\u652F\u4ED8\u91D1\u989D\u5305\u542B\u62B9\u96F6\u8BA1\u7B97\uFF08amount + |rounding_amount|\uFF09"
947
958
  });
948
959
  }
949
960
  /**
@@ -956,7 +967,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
956
967
  (method) => method.code === import_types.PaymentMethodType.Cash
957
968
  ) || null;
958
969
  } catch (error) {
959
- console.error("[PaymentModule] 获取现金支付方式失败", error);
970
+ console.error("[PaymentModule] \u83B7\u53D6\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
960
971
  return null;
961
972
  }
962
973
  }
@@ -970,7 +981,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
970
981
  (method) => method.code === import_types.PaymentMethodType.Eftpos
971
982
  ) || null;
972
983
  } catch (error) {
973
- console.error("[PaymentModule] 获取Eftpos支付方式失败", error);
984
+ console.error("[PaymentModule] \u83B7\u53D6Eftpos\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
974
985
  return null;
975
986
  }
976
987
  }
@@ -984,7 +995,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
984
995
  (method) => method.code === import_types.PaymentMethodType.Wallet
985
996
  ) || null;
986
997
  } catch (error) {
987
- console.error("[PaymentModule] 获取钱包支付方式失败", error);
998
+ console.error("[PaymentModule] \u83B7\u53D6\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
988
999
  return null;
989
1000
  }
990
1001
  }
@@ -996,7 +1007,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
996
1007
  await this.dbManager.getAll("pay_method");
997
1008
  } catch (error) {
998
1009
  console.warn(
999
- "[PaymentModule] pay_method 表不存在,请在数据库配置中添加以下配置:"
1010
+ "[PaymentModule] pay_method \u8868\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5728\u6570\u636E\u5E93\u914D\u7F6E\u4E2D\u6DFB\u52A0\u4EE5\u4E0B\u914D\u7F6E\uFF1A"
1000
1011
  );
1001
1012
  console.warn('{ name: "pay_method", keyPath: "id" }');
1002
1013
  }
@@ -1004,7 +1015,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1004
1015
  await this.dbManager.getAll("order");
1005
1016
  } catch (error) {
1006
1017
  console.warn(
1007
- "[PaymentModule] order 表不存在,请在数据库配置中添加以下配置:"
1018
+ "[PaymentModule] order \u8868\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5728\u6570\u636E\u5E93\u914D\u7F6E\u4E2D\u6DFB\u52A0\u4EE5\u4E0B\u914D\u7F6E\uFF1A"
1008
1019
  );
1009
1020
  console.warn('{ name: "order", keyPath: "uuid" }');
1010
1021
  }
@@ -1019,7 +1030,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1019
1030
  (order) => order.payment_status === import_types.PaymentStatus.PartiallyPaid
1020
1031
  );
1021
1032
  } catch (error) {
1022
- console.error("[PaymentModule] 获取部分支付订单失败", error);
1033
+ console.error("[PaymentModule] \u83B7\u53D6\u90E8\u5206\u652F\u4ED8\u8BA2\u5355\u5931\u8D25", error);
1023
1034
  return [];
1024
1035
  }
1025
1036
  }
@@ -1039,15 +1050,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1039
1050
  const amount = new import_decimal.Decimal(originalAmount);
1040
1051
  const roundingInterval = new import_decimal.Decimal(interval);
1041
1052
  if (roundingInterval.lte(0)) {
1042
- throw new Error("舍入间隔必须大于 0");
1053
+ throw new Error("\u820D\u5165\u95F4\u9694\u5FC5\u987B\u5927\u4E8E 0");
1043
1054
  }
1044
1055
  const supportedIntervals = [0.05, 0.1, 0.5, 1];
1045
1056
  const intervalValue = roundingInterval.toNumber();
1046
1057
  if (!supportedIntervals.includes(intervalValue)) {
1047
- console.warn(`[PaymentModule] 不支持的舍入间隔: ${intervalValue}, 支持的间隔: ${supportedIntervals.join(", ")}`);
1058
+ console.warn(`[PaymentModule] \u4E0D\u652F\u6301\u7684\u820D\u5165\u95F4\u9694: ${intervalValue}, \u652F\u6301\u7684\u95F4\u9694: ${supportedIntervals.join(", ")}`);
1048
1059
  }
1049
1060
  const baseValue = amount.div(roundingInterval);
1050
- console.log(`[PaymentModule] 舍入计算 - 原始金额: ${amount.toString()}, 间隔: ${intervalValue}, 基础值: ${baseValue.toString()}, 规则: ${rule}`);
1061
+ console.log(`[PaymentModule] \u820D\u5165\u8BA1\u7B97 - \u539F\u59CB\u91D1\u989D: ${amount.toString()}, \u95F4\u9694: ${intervalValue}, \u57FA\u7840\u503C: ${baseValue.toString()}, \u89C4\u5219: ${rule}`);
1051
1062
  let roundedValue;
1052
1063
  switch (rule) {
1053
1064
  case import_types.RoundingRule.Standard:
@@ -1067,12 +1078,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1067
1078
  roundedValue = baseValue.floor();
1068
1079
  break;
1069
1080
  default:
1070
- throw new Error(`不支持的舍入规则: ${rule}`);
1081
+ throw new Error(`\u4E0D\u652F\u6301\u7684\u820D\u5165\u89C4\u5219: ${rule}`);
1071
1082
  }
1072
1083
  const finalAmount = roundedValue.mul(roundingInterval);
1073
1084
  const originalAmountStr = amount.toFixed(2);
1074
1085
  if (finalAmount.eq(0)) {
1075
- console.log(`[PaymentModule] 最终金额为0,返回原始金额: ${originalAmountStr}`);
1086
+ console.log(`[PaymentModule] \u6700\u7EC8\u91D1\u989D\u4E3A0\uFF0C\u8FD4\u56DE\u539F\u59CB\u91D1\u989D: ${originalAmountStr}`);
1076
1087
  return {
1077
1088
  originalAmount: originalAmountStr,
1078
1089
  roundedAmount: originalAmountStr,
@@ -1082,15 +1093,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
1082
1093
  const roundedAmountStr = finalAmount.toFixed(2);
1083
1094
  const roundingDifference = finalAmount.sub(amount);
1084
1095
  const roundingDifferenceStr = roundingDifference.toFixed(2);
1085
- console.log(`[PaymentModule] 舍入结果 - 原始金额: ${originalAmountStr}, 舍入后金额: ${roundedAmountStr}, 舍入差额: ${roundingDifferenceStr}`);
1096
+ console.log(`[PaymentModule] \u820D\u5165\u7ED3\u679C - \u539F\u59CB\u91D1\u989D: ${originalAmountStr}, \u820D\u5165\u540E\u91D1\u989D: ${roundedAmountStr}, \u820D\u5165\u5DEE\u989D: ${roundingDifferenceStr}`);
1086
1097
  return {
1087
1098
  originalAmount: originalAmountStr,
1088
1099
  roundedAmount: roundedAmountStr,
1089
1100
  roundingDifference: roundingDifferenceStr
1090
1101
  };
1091
1102
  } catch (error) {
1092
- console.error("[PaymentModule] 金额舍入失败:", error);
1093
- throw new Error(`金额舍入失败: ${error instanceof Error ? error.message : String(error)}`);
1103
+ console.error("[PaymentModule] \u91D1\u989D\u820D\u5165\u5931\u8D25:", error);
1104
+ throw new Error(`\u91D1\u989D\u820D\u5165\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`);
1094
1105
  }
1095
1106
  }
1096
1107
  /**
@@ -581,12 +581,12 @@ export declare enum PaymentHooks {
581
581
  OnOrderAmountChanged = "payment:onOrderAmountChanged",
582
582
  OnPaymentSyncError = "payment:onPaymentSyncError",
583
583
  OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess",
584
- OnWalletRecommendListUpdated = "wallet:onWalletRecommendListUpdated",
585
- OnWalletRecommendListCleared = "wallet:onWalletRecommendListCleared",
586
- OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
587
- OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
588
- OnWalletCacheCleared = "wallet:onWalletCacheCleared",
589
- OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
584
+ OnWalletRecommendListUpdated = 0,
585
+ OnWalletRecommendListCleared = 0,
586
+ OnUserIdentificationCodesUpdated = 0,
587
+ OnUserIdentificationCodesCleared = 0,
588
+ OnWalletCacheCleared = 0,
589
+ OnSearchIdentificationCodeCompleted = 0
590
590
  }
591
591
  /**
592
592
  * 钱包推荐扣款请求参数
@@ -740,7 +740,7 @@ export interface SearchIdentificationCodeResponse {
740
740
  /**
741
741
  * 搜索识别码结果类型
742
742
  */
743
- export type SearchIdentificationCodeResult = {
743
+ export declare type SearchIdentificationCodeResult = {
744
744
  type: 'walletCode';
745
745
  data: SearchIdentificationCodeItem[];
746
746
  } | {
@@ -46,12 +46,9 @@ var sortUserIdentificationCodeList = (list) => {
46
46
  var _a;
47
47
  const errorCode = (_a = item.unified_error_code) == null ? void 0 : _a.toString();
48
48
  const availableStatus = item.unified_available_status;
49
- if (errorCode && middlePriorityErrorCodes.includes(errorCode))
50
- return 2;
51
- if (availableStatus === 0)
52
- return 3;
53
- if (availableStatus === 1)
54
- return 1;
49
+ if (errorCode && middlePriorityErrorCodes.includes(errorCode)) return 2;
50
+ if (availableStatus === 0) return 3;
51
+ if (availableStatus === 1) return 1;
55
52
  return 0;
56
53
  };
57
54
  const aPriority = getPriority(a);