@pisell/pisellos 1.0.147 → 1.0.148

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