@pisell/pisellos 0.0.202 → 0.0.207
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.
- package/dist/effects/index.d.ts +1 -1
- package/dist/modules/Order/index.js +4 -1
- package/dist/modules/Order/utils.d.ts +12 -0
- package/dist/modules/Order/utils.js +39 -0
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.js +27 -28
- package/lib/effects/index.d.ts +1 -1
- package/lib/effects/index.js +3 -7
- package/lib/modules/Account/index.js +9 -10
- package/lib/modules/AccountList/index.js +14 -11
- package/lib/modules/BaseModule.js +6 -3
- package/lib/modules/Cart/index.js +14 -9
- package/lib/modules/Cart/utils/cartProduct.js +3 -6
- package/lib/modules/Date/index.js +8 -4
- package/lib/modules/Date/types.js +1 -0
- package/lib/modules/Discount/index.js +11 -6
- package/lib/modules/Guests/index.js +10 -15
- package/lib/modules/Order/index.js +6 -2
- package/lib/modules/Order/utils.d.ts +12 -0
- package/lib/modules/Order/utils.js +19 -2
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +98 -86
- package/lib/modules/Payment/wallet.js +1 -1
- package/lib/modules/Product/index.js +6 -5
- package/lib/modules/ProductList/index.js +5 -4
- package/lib/modules/Resource/index.js +8 -12
- package/lib/modules/Rules/index.js +10 -13
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/index.js +8 -5
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +2 -4
- package/lib/modules/Step/index.js +7 -4
- package/lib/modules/Summary/index.js +9 -4
- package/lib/plugins/request.js +34 -33
- package/lib/plugins/window.js +101 -113
- package/lib/solution/BookingByStep/index.js +44 -69
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +4 -8
- package/lib/solution/BookingByStep/utils/timeslots.js +6 -12
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/ShopDiscount/index.js +15 -11
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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]
|
|
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
|
}
|
|
@@ -53,11 +53,23 @@ function generateRequestUniqueId() {
|
|
|
53
53
|
const randomDigits = Math.floor(Math.random() * 9e3) + 1e3;
|
|
54
54
|
return `${year}${month}${day}${hour}${minute}${second}${millisecond}${randomDigits}`;
|
|
55
55
|
}
|
|
56
|
-
var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
56
|
+
var PaymentModule = class _PaymentModule 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
|
+
// 支付方式实例
|
|
68
|
+
cash;
|
|
69
|
+
eftpos;
|
|
70
|
+
wallet;
|
|
57
71
|
constructor(name, version) {
|
|
58
72
|
super(name, version);
|
|
59
|
-
this.defaultName = "pay";
|
|
60
|
-
this.defaultVersion = "1.0.0";
|
|
61
73
|
this.cash = new import_cash.CashPaymentImpl(this);
|
|
62
74
|
this.eftpos = new import_eftpos.EftposPaymentImpl(this);
|
|
63
75
|
this.wallet = new import_wallet.WalletPaymentImpl(this);
|
|
@@ -68,10 +80,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
68
80
|
this.request = core.getPlugin("request");
|
|
69
81
|
const appPlugin = core.getPlugin("app");
|
|
70
82
|
if (!this.request) {
|
|
71
|
-
throw new Error("
|
|
83
|
+
throw new Error("\u652F\u4ED8\u6A21\u5757\u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
|
|
72
84
|
}
|
|
73
85
|
if (!appPlugin) {
|
|
74
|
-
throw new Error("
|
|
86
|
+
throw new Error("\u652F\u4ED8\u6A21\u5757\u9700\u8981 app \u63D2\u4EF6\u652F\u6301");
|
|
75
87
|
}
|
|
76
88
|
this.app = appPlugin.getApp();
|
|
77
89
|
this.dbManager = this.app.dbManager;
|
|
@@ -79,7 +91,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
79
91
|
await this.ensurePaymentTables();
|
|
80
92
|
this.registerTaskHandlers();
|
|
81
93
|
this.registerNetworkHandlers();
|
|
82
|
-
console.log("[PaymentModule]
|
|
94
|
+
console.log("[PaymentModule] \u521D\u59CB\u5316\u5B8C\u6210");
|
|
83
95
|
this.logInfo("PaymentModule initialized successfully");
|
|
84
96
|
}
|
|
85
97
|
/**
|
|
@@ -146,7 +158,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
146
158
|
const network = this.app.plugins.get("network");
|
|
147
159
|
this.logInfo("Registering network status listener");
|
|
148
160
|
network == null ? void 0 : network.addListener("networkStatusChange", async (status) => {
|
|
149
|
-
console.log("
|
|
161
|
+
console.log("\u7F51\u7EDC\u72B6\u6001:", status.connected);
|
|
150
162
|
this.logInfo("Network status changed", {
|
|
151
163
|
connected: status.connected,
|
|
152
164
|
previousStatus: status.previousStatus
|
|
@@ -170,7 +182,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
170
182
|
try {
|
|
171
183
|
cachedMethods = await this.dbManager.getAll("pay_method");
|
|
172
184
|
} catch (dbError) {
|
|
173
|
-
console.warn("[PaymentModule] pay_method
|
|
185
|
+
console.warn("[PaymentModule] pay_method \u8868\u4E0D\u5B58\u5728\uFF0C\u5C06\u4ECE\u670D\u52A1\u5668\u83B7\u53D6\u6570\u636E");
|
|
174
186
|
}
|
|
175
187
|
const hasCache = cachedMethods.length > 0;
|
|
176
188
|
if (hasCache) {
|
|
@@ -184,7 +196,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
184
196
|
await this.dbManager.update("pay_method", method);
|
|
185
197
|
}
|
|
186
198
|
} catch (dbError) {
|
|
187
|
-
console.warn("[PaymentModule]
|
|
199
|
+
console.warn("[PaymentModule] \u65E0\u6CD5\u7F13\u5B58\u652F\u4ED8\u65B9\u5F0F\uFF0Cpay_method \u8868\u4E0D\u5B58\u5728");
|
|
188
200
|
}
|
|
189
201
|
await this.core.effects.emit(
|
|
190
202
|
import_types.PaymentHooks.OnPaymentMethodsLoaded,
|
|
@@ -196,7 +208,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
196
208
|
});
|
|
197
209
|
return payMethods;
|
|
198
210
|
} catch (error) {
|
|
199
|
-
console.error("[PaymentModule]
|
|
211
|
+
console.error("[PaymentModule] \u83B7\u53D6\u652F\u4ED8\u65B9\u5F0F\u5217\u8868\u5931\u8D25", error);
|
|
200
212
|
this.logError("getPayMethodListAsync failed", error);
|
|
201
213
|
return [];
|
|
202
214
|
}
|
|
@@ -209,7 +221,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
209
221
|
cachedMethodsCount: cachedMethods.length
|
|
210
222
|
});
|
|
211
223
|
try {
|
|
212
|
-
console.log("[PaymentModule]
|
|
224
|
+
console.log("[PaymentModule] \u540E\u53F0\u5237\u65B0\u652F\u4ED8\u65B9\u5F0F\u5217\u8868...");
|
|
213
225
|
const response = await this.request.get("/pay/custom-payment/available");
|
|
214
226
|
const newPayMethods = response.data || [];
|
|
215
227
|
const hasChanges = this.hasPaymentMethodsChanged(
|
|
@@ -217,7 +229,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
217
229
|
newPayMethods
|
|
218
230
|
);
|
|
219
231
|
if (hasChanges) {
|
|
220
|
-
console.log("[PaymentModule]
|
|
232
|
+
console.log("[PaymentModule] \u652F\u4ED8\u65B9\u5F0F\u5217\u8868\u5DF2\u66F4\u65B0");
|
|
221
233
|
this.logInfo("Payment methods updated in background", {
|
|
222
234
|
oldCount: cachedMethods.length,
|
|
223
235
|
newCount: newPayMethods.length
|
|
@@ -230,7 +242,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
230
242
|
await this.dbManager.update("pay_method", method);
|
|
231
243
|
}
|
|
232
244
|
} catch (dbError) {
|
|
233
|
-
console.warn("[PaymentModule]
|
|
245
|
+
console.warn("[PaymentModule] \u65E0\u6CD5\u66F4\u65B0\u652F\u4ED8\u65B9\u5F0F\u7F13\u5B58", dbError);
|
|
234
246
|
}
|
|
235
247
|
const eventData = {
|
|
236
248
|
oldMethods: cachedMethods,
|
|
@@ -241,10 +253,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
241
253
|
eventData
|
|
242
254
|
);
|
|
243
255
|
} else {
|
|
244
|
-
console.log("[PaymentModule]
|
|
256
|
+
console.log("[PaymentModule] \u652F\u4ED8\u65B9\u5F0F\u5217\u8868\u65E0\u53D8\u5316");
|
|
245
257
|
}
|
|
246
258
|
} catch (error) {
|
|
247
|
-
console.error("[PaymentModule]
|
|
259
|
+
console.error("[PaymentModule] \u540E\u53F0\u5237\u65B0\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
|
|
248
260
|
}
|
|
249
261
|
}
|
|
250
262
|
/**
|
|
@@ -275,7 +287,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
275
287
|
try {
|
|
276
288
|
return await this.dbManager.getAll("order");
|
|
277
289
|
} catch (error) {
|
|
278
|
-
console.error("[PaymentModule]
|
|
290
|
+
console.error("[PaymentModule] \u83B7\u53D6\u8BA2\u5355\u5217\u8868\u5931\u8D25", error);
|
|
279
291
|
return [];
|
|
280
292
|
}
|
|
281
293
|
}
|
|
@@ -286,7 +298,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
286
298
|
try {
|
|
287
299
|
return await this.dbManager.get("order", orderUuid);
|
|
288
300
|
} catch (error) {
|
|
289
|
-
console.error("[PaymentModule]
|
|
301
|
+
console.error("[PaymentModule] \u83B7\u53D6\u8BA2\u5355\u5931\u8D25", error);
|
|
290
302
|
return null;
|
|
291
303
|
}
|
|
292
304
|
}
|
|
@@ -305,7 +317,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
305
317
|
);
|
|
306
318
|
if (existingOrder) {
|
|
307
319
|
console.log(
|
|
308
|
-
`[PaymentModule]
|
|
320
|
+
`[PaymentModule] \u53D1\u73B0\u91CD\u590D\u8BA2\u5355 ID: ${params.order_info.order_id}\uFF0C\u66F4\u65B0\u73B0\u6709\u8BA2\u5355`
|
|
309
321
|
);
|
|
310
322
|
const originalOrder = { ...existingOrder };
|
|
311
323
|
existingOrder.order_info = params.order_info;
|
|
@@ -347,7 +359,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
347
359
|
return newOrder;
|
|
348
360
|
}
|
|
349
361
|
} catch (error) {
|
|
350
|
-
console.error("[PaymentModule]
|
|
362
|
+
console.error("[PaymentModule] \u6DFB\u52A0\u8BA2\u5355\u5931\u8D25", error);
|
|
351
363
|
this.logError("pushOrderAsync failed", error, {
|
|
352
364
|
orderId: params.order_info.order_id
|
|
353
365
|
});
|
|
@@ -369,7 +381,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
369
381
|
});
|
|
370
382
|
}
|
|
371
383
|
} catch (error) {
|
|
372
|
-
console.error("[PaymentModule]
|
|
384
|
+
console.error("[PaymentModule] \u5220\u9664\u8BA2\u5355\u5931\u8D25", error);
|
|
373
385
|
throw error;
|
|
374
386
|
}
|
|
375
387
|
}
|
|
@@ -390,7 +402,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
390
402
|
});
|
|
391
403
|
}
|
|
392
404
|
} catch (error) {
|
|
393
|
-
console.error("[PaymentModule]
|
|
405
|
+
console.error("[PaymentModule] \u66F4\u65B0\u8BA2\u5355\u5931\u8D25", error);
|
|
394
406
|
throw error;
|
|
395
407
|
}
|
|
396
408
|
}
|
|
@@ -416,7 +428,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
416
428
|
try {
|
|
417
429
|
const order = await this.dbManager.get("order", orderUuid);
|
|
418
430
|
if (!order) {
|
|
419
|
-
throw new Error("
|
|
431
|
+
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
|
|
420
432
|
}
|
|
421
433
|
const newPaymentItem = {
|
|
422
434
|
...paymentItem,
|
|
@@ -443,7 +455,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
443
455
|
newExpectAmount: order.expect_amount
|
|
444
456
|
});
|
|
445
457
|
} catch (error) {
|
|
446
|
-
console.error("[PaymentModule]
|
|
458
|
+
console.error("[PaymentModule] \u6DFB\u52A0\u652F\u4ED8\u9879\u5931\u8D25", error);
|
|
447
459
|
this.logError("pushPaymentAsync failed", error, {
|
|
448
460
|
orderUuid,
|
|
449
461
|
paymentItem
|
|
@@ -459,7 +471,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
459
471
|
try {
|
|
460
472
|
const order = await this.dbManager.get("order", orderUuid);
|
|
461
473
|
if (!order) {
|
|
462
|
-
throw new Error("
|
|
474
|
+
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
|
|
463
475
|
}
|
|
464
476
|
const index = order.payment.findIndex(
|
|
465
477
|
(payment) => payment.uuid === paymentUuid
|
|
@@ -479,7 +491,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
479
491
|
});
|
|
480
492
|
}
|
|
481
493
|
} catch (error) {
|
|
482
|
-
console.error("[PaymentModule]
|
|
494
|
+
console.error("[PaymentModule] \u5220\u9664\u652F\u4ED8\u9879\u5931\u8D25", error);
|
|
483
495
|
throw error;
|
|
484
496
|
}
|
|
485
497
|
}
|
|
@@ -490,7 +502,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
490
502
|
try {
|
|
491
503
|
const order = await this.dbManager.get("order", orderUuid);
|
|
492
504
|
if (!order) {
|
|
493
|
-
throw new Error("
|
|
505
|
+
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
|
|
494
506
|
}
|
|
495
507
|
const paymentItem = order.payment.find(
|
|
496
508
|
(payment) => payment.uuid === paymentUuid
|
|
@@ -514,7 +526,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
514
526
|
});
|
|
515
527
|
}
|
|
516
528
|
} catch (error) {
|
|
517
|
-
console.error("[PaymentModule]
|
|
529
|
+
console.error("[PaymentModule] \u66F4\u65B0\u652F\u4ED8\u9879\u5931\u8D25", error);
|
|
518
530
|
throw error;
|
|
519
531
|
}
|
|
520
532
|
}
|
|
@@ -556,7 +568,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
556
568
|
return { status: "failed" };
|
|
557
569
|
}
|
|
558
570
|
} catch (error) {
|
|
559
|
-
console.error("[PaymentModule]
|
|
571
|
+
console.error("[PaymentModule] \u63D0\u4EA4\u652F\u4ED8\u5931\u8D25", error);
|
|
560
572
|
this.logError("submitPayAsync failed", error, { orderUuid });
|
|
561
573
|
return { status: "failed" };
|
|
562
574
|
}
|
|
@@ -578,18 +590,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
578
590
|
if (totalPaidAmount.gte(orderTotalAmount)) {
|
|
579
591
|
order.payment_status = import_types.PaymentStatus.Finished;
|
|
580
592
|
console.log(
|
|
581
|
-
`[PaymentModule]
|
|
593
|
+
`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u652F\u4ED8\u5B8C\u6210\uFF0C\u91D1\u989D: ${totalPaidAmount.toString()}/${orderTotalAmount.toString()}`
|
|
582
594
|
);
|
|
583
595
|
} else {
|
|
584
596
|
order.payment_status = import_types.PaymentStatus.PartiallyPaid;
|
|
585
597
|
console.log(
|
|
586
|
-
`[PaymentModule]
|
|
598
|
+
`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u90E8\u5206\u652F\u4ED8\uFF0C\u91D1\u989D: ${totalPaidAmount.toString()}/${orderTotalAmount.toString()}`
|
|
587
599
|
);
|
|
588
600
|
}
|
|
589
601
|
paymentData.payment_status = order.payment_status === import_types.PaymentStatus.Finished ? "paid" : "partially_paid";
|
|
590
602
|
await this.dbManager.update("order", order);
|
|
591
603
|
if (paymentData.payments.length === 0) {
|
|
592
|
-
console.log(`[PaymentModule]
|
|
604
|
+
console.log(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u652F\u4ED8\u5217\u8868\u4E3A\u7A7A\uFF0C\u8DF3\u8FC7\u961F\u5217\u63A8\u9001`);
|
|
593
605
|
this.logWarning("Empty payment queue submission", {
|
|
594
606
|
orderUuid: order.uuid,
|
|
595
607
|
orderId: order.order_info.order_id
|
|
@@ -603,7 +615,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
603
615
|
order
|
|
604
616
|
});
|
|
605
617
|
} catch (error) {
|
|
606
|
-
console.error(`[PaymentModule]
|
|
618
|
+
console.error(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u652F\u4ED8\u63D0\u4EA4\u5931\u8D25`, error);
|
|
607
619
|
throw error;
|
|
608
620
|
}
|
|
609
621
|
}
|
|
@@ -612,7 +624,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
612
624
|
*/
|
|
613
625
|
async addToSyncQueue(order, paymentData) {
|
|
614
626
|
try {
|
|
615
|
-
console.log(`[PaymentModule]
|
|
627
|
+
console.log(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u5DF2\u6DFB\u52A0\u5230\u540C\u6B65\u961F\u5217`);
|
|
616
628
|
if (this.app.tasksManager) {
|
|
617
629
|
this.app.tasksManager.addTask({
|
|
618
630
|
module: "payment",
|
|
@@ -632,12 +644,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
632
644
|
}
|
|
633
645
|
]
|
|
634
646
|
});
|
|
635
|
-
console.log(`[PaymentModule]
|
|
647
|
+
console.log(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u540C\u6B65\u4EFB\u52A1\u5DF2\u6DFB\u52A0\u5230\u961F\u5217`);
|
|
636
648
|
} else {
|
|
637
|
-
console.warn("[PaymentModule] TasksManager
|
|
649
|
+
console.warn("[PaymentModule] TasksManager \u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u6DFB\u52A0\u540C\u6B65\u4EFB\u52A1");
|
|
638
650
|
}
|
|
639
651
|
} catch (error) {
|
|
640
|
-
console.error("[PaymentModule]
|
|
652
|
+
console.error("[PaymentModule] \u6DFB\u52A0\u540C\u6B65\u4EFB\u52A1\u5931\u8D25", error);
|
|
641
653
|
}
|
|
642
654
|
}
|
|
643
655
|
/**
|
|
@@ -646,7 +658,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
646
658
|
async getRemainingOrderAmountAsync(orderUuid) {
|
|
647
659
|
const order = await this.getOrderByUuidAsync(orderUuid);
|
|
648
660
|
if (!order) {
|
|
649
|
-
throw new Error("
|
|
661
|
+
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
|
|
650
662
|
}
|
|
651
663
|
return new import_decimal.Decimal(order.expect_amount).toNumber();
|
|
652
664
|
}
|
|
@@ -656,7 +668,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
656
668
|
async getRemainingOrderAmountWithInputAsync(inputAmount, orderUuid) {
|
|
657
669
|
const order = await this.getOrderByUuidAsync(orderUuid);
|
|
658
670
|
if (!order) {
|
|
659
|
-
throw new Error("
|
|
671
|
+
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728");
|
|
660
672
|
}
|
|
661
673
|
if (inputAmount === null || inputAmount === void 0) {
|
|
662
674
|
return new import_decimal.Decimal(order.expect_amount).toNumber();
|
|
@@ -669,7 +681,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
669
681
|
if (typeof inputAmount === "number") {
|
|
670
682
|
if (isNaN(inputAmount) || !isFinite(inputAmount)) {
|
|
671
683
|
console.warn(
|
|
672
|
-
`[PaymentModule]
|
|
684
|
+
`[PaymentModule] \u8F93\u5165\u91D1\u989D\u4E0D\u662F\u6709\u6548\u6570\u5B57: ${inputAmount}\uFF0C\u8FD4\u56DE\u539F\u59CB\u5F85\u4ED8\u91D1\u989D`
|
|
673
685
|
);
|
|
674
686
|
return new import_decimal.Decimal(order.expect_amount).toNumber();
|
|
675
687
|
}
|
|
@@ -679,7 +691,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
679
691
|
return new import_decimal.Decimal(order.expect_amount).minus(inputDecimal).toNumber();
|
|
680
692
|
} catch (error) {
|
|
681
693
|
console.warn(
|
|
682
|
-
`[PaymentModule]
|
|
694
|
+
`[PaymentModule] \u8F93\u5165\u91D1\u989D\u683C\u5F0F\u65E0\u6548: ${inputAmount}\uFF0C\u8FD4\u56DE\u539F\u59CB\u5F85\u4ED8\u91D1\u989D`
|
|
683
695
|
);
|
|
684
696
|
return new import_decimal.Decimal(order.expect_amount).toNumber();
|
|
685
697
|
}
|
|
@@ -706,7 +718,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
706
718
|
(method) => method.code === import_types.PaymentMethodType.Cash
|
|
707
719
|
) || null;
|
|
708
720
|
} catch (error) {
|
|
709
|
-
console.error("[PaymentModule]
|
|
721
|
+
console.error("[PaymentModule] \u83B7\u53D6\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
|
|
710
722
|
return null;
|
|
711
723
|
}
|
|
712
724
|
}
|
|
@@ -720,7 +732,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
720
732
|
(method) => method.code === import_types.PaymentMethodType.Eftpos
|
|
721
733
|
) || null;
|
|
722
734
|
} catch (error) {
|
|
723
|
-
console.error("[PaymentModule]
|
|
735
|
+
console.error("[PaymentModule] \u83B7\u53D6Eftpos\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
|
|
724
736
|
return null;
|
|
725
737
|
}
|
|
726
738
|
}
|
|
@@ -734,7 +746,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
734
746
|
(method) => method.code === import_types.PaymentMethodType.Wallet
|
|
735
747
|
) || null;
|
|
736
748
|
} catch (error) {
|
|
737
|
-
console.error("[PaymentModule]
|
|
749
|
+
console.error("[PaymentModule] \u83B7\u53D6\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u5931\u8D25", error);
|
|
738
750
|
return null;
|
|
739
751
|
}
|
|
740
752
|
}
|
|
@@ -745,12 +757,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
745
757
|
if (this.app.tasksManager) {
|
|
746
758
|
this.app.tasksManager.addTaskFunction(
|
|
747
759
|
"syncPayment",
|
|
748
|
-
|
|
760
|
+
_PaymentModule.syncPaymentTask
|
|
749
761
|
);
|
|
750
|
-
console.log("[PaymentModule]
|
|
762
|
+
console.log("[PaymentModule] \u4EFB\u52A1\u5904\u7406\u51FD\u6570\u5DF2\u6CE8\u518C");
|
|
751
763
|
} else {
|
|
752
764
|
console.warn(
|
|
753
|
-
"[PaymentModule] TasksManager
|
|
765
|
+
"[PaymentModule] TasksManager \u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u6CE8\u518C\u4EFB\u52A1\u5904\u7406\u51FD\u6570"
|
|
754
766
|
);
|
|
755
767
|
}
|
|
756
768
|
}
|
|
@@ -761,7 +773,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
761
773
|
static async syncPaymentTask(payload) {
|
|
762
774
|
var _a, _b, _c, _d, _e, _f;
|
|
763
775
|
const { orderUuid, orderId, paymentData, core } = payload.task.payload;
|
|
764
|
-
console.log(`[PaymentModule]
|
|
776
|
+
console.log(`[PaymentModule] \u5F00\u59CB\u540E\u53F0\u540C\u6B65\u652F\u4ED8\uFF0C\u8BA2\u5355ID: ${orderId}`);
|
|
765
777
|
paymentData.request_unique = generateRequestUniqueId();
|
|
766
778
|
const app = window.app;
|
|
767
779
|
const logger = app == null ? void 0 : app.logger;
|
|
@@ -777,15 +789,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
777
789
|
});
|
|
778
790
|
}
|
|
779
791
|
if (!app) {
|
|
780
|
-
throw new Error("App
|
|
792
|
+
throw new Error("App \u5B9E\u4F8B\u672A\u627E\u5230");
|
|
781
793
|
}
|
|
782
794
|
const request = app.request;
|
|
783
795
|
if (!request) {
|
|
784
|
-
throw new Error("Request
|
|
796
|
+
throw new Error("Request \u63D2\u4EF6\u672A\u627E\u5230");
|
|
785
797
|
}
|
|
786
798
|
const dbManager = app.dbManager;
|
|
787
799
|
if (!dbManager) {
|
|
788
|
-
throw new Error("DBManager
|
|
800
|
+
throw new Error("DBManager \u672A\u627E\u5230");
|
|
789
801
|
}
|
|
790
802
|
try {
|
|
791
803
|
const requestRes = await request.post(
|
|
@@ -801,16 +813,16 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
801
813
|
delete payment.syncError;
|
|
802
814
|
});
|
|
803
815
|
await dbManager.update("order", order);
|
|
804
|
-
console.log(`[PaymentModule]
|
|
816
|
+
console.log(`[PaymentModule] \u8BA2\u5355 ${orderUuid} \u540C\u6B65\u72B6\u6001\u5DF2\u66F4\u65B0`);
|
|
805
817
|
}
|
|
806
|
-
console.log(`[PaymentModule]
|
|
818
|
+
console.log(`[PaymentModule] \u8BA2\u5355 ${orderUuid} \u540E\u53F0\u540C\u6B65\u6210\u529F`);
|
|
807
819
|
await core.effects.emit("payment:onPaymentSyncSuccess", {
|
|
808
820
|
orderUuid,
|
|
809
821
|
orderId,
|
|
810
822
|
timestamp: Date.now()
|
|
811
823
|
});
|
|
812
824
|
console.log(
|
|
813
|
-
`[PaymentModule]
|
|
825
|
+
`[PaymentModule] \u5DF2\u901A\u8FC7 effects \u901A\u77E5\u524D\u7AEF\u8BA2\u5355 ${orderUuid} \u540C\u6B65\u6210\u529F`
|
|
814
826
|
);
|
|
815
827
|
if (logger) {
|
|
816
828
|
logger.addLog({
|
|
@@ -821,18 +833,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
821
833
|
}
|
|
822
834
|
return { status: "success", orderUuid, orderId };
|
|
823
835
|
} else {
|
|
824
|
-
console.log(`[PaymentModule]
|
|
825
|
-
const businessError = new Error(requestRes.message || "
|
|
836
|
+
console.log(`[PaymentModule] \u63A5\u53E3\u8FD4\u56DE\u5931\u8D25\uFF0C\u8BA2\u5355 ${orderUuid} \u540C\u6B65\u5931\u8D25`);
|
|
837
|
+
const businessError = new Error(requestRes.message || "\u63A5\u53E3\u8FD4\u56DE\u5931\u8D25");
|
|
826
838
|
businessError.response = { status: 200 };
|
|
827
839
|
businessError.isBusinessError = true;
|
|
828
840
|
businessError.responseData = requestRes;
|
|
829
841
|
throw businessError;
|
|
830
842
|
}
|
|
831
843
|
} catch (error) {
|
|
832
|
-
console.error("[PaymentModule]
|
|
833
|
-
const isNetworkError = !error.response && !error.status && (error.code === "NETWORK_ERROR" || error.code === "ERR_NETWORK" || error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ETIMEDOUT" || ((_a = error.message) == null ? void 0 : _a.includes("
|
|
844
|
+
console.error("[PaymentModule] \u540E\u53F0\u540C\u6B65\u5931\u8D25:", error);
|
|
845
|
+
const isNetworkError = !error.response && !error.status && (error.code === "NETWORK_ERROR" || error.code === "ERR_NETWORK" || error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ETIMEDOUT" || ((_a = error.message) == null ? void 0 : _a.includes("\u7F51\u7EDC")) || ((_b = error.message) == null ? void 0 : _b.includes("network")) || ((_c = error.message) == null ? void 0 : _c.includes("fetch")));
|
|
834
846
|
if (isNetworkError) {
|
|
835
|
-
console.log(`[PaymentModule]
|
|
847
|
+
console.log(`[PaymentModule] \u7F51\u7EDC\u9519\u8BEF\uFF0C\u8BA2\u5355 ${orderUuid} \u5C06\u91CD\u8BD5\u540C\u6B65`);
|
|
836
848
|
if (logger) {
|
|
837
849
|
logger.addLog({
|
|
838
850
|
type: "warning",
|
|
@@ -848,29 +860,29 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
848
860
|
throw error;
|
|
849
861
|
} else {
|
|
850
862
|
console.log(
|
|
851
|
-
`[PaymentModule]
|
|
863
|
+
`[PaymentModule] \u4E1A\u52A1\u9519\u8BEF\uFF0C\u8BA2\u5355 ${orderUuid} \u540C\u6B65\u5931\u8D25\uFF0C\u901A\u77E5\u524D\u7AEF`
|
|
852
864
|
);
|
|
853
865
|
try {
|
|
854
866
|
if (core && core.effects) {
|
|
855
867
|
const errorData = {
|
|
856
868
|
orderUuid,
|
|
857
869
|
orderId,
|
|
858
|
-
error: error.message || "
|
|
870
|
+
error: error.message || "\u4E1A\u52A1\u9519\u8BEF",
|
|
859
871
|
errorCode: error.code,
|
|
860
872
|
statusCode: ((_d = error.response) == null ? void 0 : _d.status) || error.status,
|
|
861
873
|
timestamp: Date.now()
|
|
862
874
|
};
|
|
863
875
|
if (error.isBusinessError && error.responseData) {
|
|
864
|
-
errorData.error = error.responseData.message || error.message || "
|
|
876
|
+
errorData.error = error.responseData.message || error.message || "\u63A5\u53E3\u8FD4\u56DE\u5931\u8D25";
|
|
865
877
|
errorData.responseData = error.responseData;
|
|
866
878
|
}
|
|
867
879
|
await core.effects.emit("payment:onPaymentSyncError", errorData);
|
|
868
880
|
console.log(
|
|
869
|
-
`[PaymentModule]
|
|
881
|
+
`[PaymentModule] \u5DF2\u901A\u8FC7 effects \u901A\u77E5\u524D\u7AEF\u8BA2\u5355 ${orderUuid} \u540C\u6B65\u9519\u8BEF`
|
|
870
882
|
);
|
|
871
883
|
} else {
|
|
872
884
|
console.warn(
|
|
873
|
-
`[PaymentModule]
|
|
885
|
+
`[PaymentModule] \u65E0\u6CD5\u83B7\u53D6 core \u5B9E\u4F8B\uFF0C\u65E0\u6CD5\u901A\u77E5\u524D\u7AEF\u9519\u8BEF`
|
|
874
886
|
);
|
|
875
887
|
}
|
|
876
888
|
if (logger) {
|
|
@@ -888,7 +900,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
888
900
|
});
|
|
889
901
|
}
|
|
890
902
|
} catch (notifyError) {
|
|
891
|
-
console.error(`[PaymentModule]
|
|
903
|
+
console.error(`[PaymentModule] \u901A\u77E5\u524D\u7AEF\u540C\u6B65\u9519\u8BEF\u5931\u8D25:`, notifyError);
|
|
892
904
|
if (logger) {
|
|
893
905
|
logger.addLog({
|
|
894
906
|
type: "error",
|
|
@@ -908,14 +920,14 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
908
920
|
});
|
|
909
921
|
await dbManager.update("order", order);
|
|
910
922
|
console.log(
|
|
911
|
-
`[PaymentModule]
|
|
923
|
+
`[PaymentModule] \u8BA2\u5355 ${orderUuid} \u4E1A\u52A1\u9519\u8BEF\uFF0C\u5DF2\u6807\u8BB0\u4E3A\u5DF2\u540C\u6B65`
|
|
912
924
|
);
|
|
913
925
|
}
|
|
914
926
|
return {
|
|
915
927
|
status: "completed_with_error",
|
|
916
928
|
orderUuid,
|
|
917
929
|
orderId,
|
|
918
|
-
error: error.message || "
|
|
930
|
+
error: error.message || "\u4E1A\u52A1\u9519\u8BEF",
|
|
919
931
|
statusCode: ((_f = error.response) == null ? void 0 : _f.status) || error.status
|
|
920
932
|
};
|
|
921
933
|
}
|
|
@@ -929,7 +941,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
929
941
|
await this.dbManager.getAll("pay_method");
|
|
930
942
|
} catch (error) {
|
|
931
943
|
console.warn(
|
|
932
|
-
"[PaymentModule] pay_method
|
|
944
|
+
"[PaymentModule] pay_method \u8868\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5728\u6570\u636E\u5E93\u914D\u7F6E\u4E2D\u6DFB\u52A0\u4EE5\u4E0B\u914D\u7F6E\uFF1A"
|
|
933
945
|
);
|
|
934
946
|
console.warn('{ name: "pay_method", keyPath: "id" }');
|
|
935
947
|
}
|
|
@@ -937,7 +949,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
937
949
|
await this.dbManager.getAll("order");
|
|
938
950
|
} catch (error) {
|
|
939
951
|
console.warn(
|
|
940
|
-
"[PaymentModule] order
|
|
952
|
+
"[PaymentModule] order \u8868\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5728\u6570\u636E\u5E93\u914D\u7F6E\u4E2D\u6DFB\u52A0\u4EE5\u4E0B\u914D\u7F6E\uFF1A"
|
|
941
953
|
);
|
|
942
954
|
console.warn('{ name: "order", keyPath: "uuid" }');
|
|
943
955
|
}
|
|
@@ -952,7 +964,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
952
964
|
(order) => order.payment_status === import_types.PaymentStatus.PartiallyPaid
|
|
953
965
|
);
|
|
954
966
|
} catch (error) {
|
|
955
|
-
console.error("[PaymentModule]
|
|
967
|
+
console.error("[PaymentModule] \u83B7\u53D6\u90E8\u5206\u652F\u4ED8\u8BA2\u5355\u5931\u8D25", error);
|
|
956
968
|
return [];
|
|
957
969
|
}
|
|
958
970
|
}
|
|
@@ -966,7 +978,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
966
978
|
return (order.payment_status === import_types.PaymentStatus.Finished || order.payment_status === import_types.PaymentStatus.PartiallyPaid) && order.payment.some((payment) => !payment.isSynced);
|
|
967
979
|
});
|
|
968
980
|
} catch (error) {
|
|
969
|
-
console.error("[PaymentModule]
|
|
981
|
+
console.error("[PaymentModule] \u83B7\u53D6\u672A\u540C\u6B65\u8BA2\u5355\u5931\u8D25", error);
|
|
970
982
|
return [];
|
|
971
983
|
}
|
|
972
984
|
}
|
|
@@ -984,10 +996,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
984
996
|
await this.deleteOrderAsync(order.uuid);
|
|
985
997
|
}
|
|
986
998
|
console.log(
|
|
987
|
-
`[PaymentModule]
|
|
999
|
+
`[PaymentModule] \u6E05\u7406\u4E86 ${finishedAndSyncedOrders.length} \u4E2A\u5DF2\u5B8C\u6210\u4E14\u5DF2\u540C\u6B65\u7684\u8BA2\u5355`
|
|
988
1000
|
);
|
|
989
1001
|
} catch (error) {
|
|
990
|
-
console.error("[PaymentModule]
|
|
1002
|
+
console.error("[PaymentModule] \u6E05\u7406\u5DF2\u5B8C\u6210\u8BA2\u5355\u5931\u8D25", error);
|
|
991
1003
|
}
|
|
992
1004
|
}
|
|
993
1005
|
/**
|
|
@@ -1009,7 +1021,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1009
1021
|
try {
|
|
1010
1022
|
if (!this.app.tasksManager) {
|
|
1011
1023
|
console.warn(
|
|
1012
|
-
"[PaymentModule] TasksManager
|
|
1024
|
+
"[PaymentModule] TasksManager \u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u91CD\u65B0\u6392\u961F\u672A\u540C\u6B65\u8BA2\u5355"
|
|
1013
1025
|
);
|
|
1014
1026
|
this.logWarning(
|
|
1015
1027
|
"TasksManager not initialized, cannot requeue unsynced orders"
|
|
@@ -1018,12 +1030,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1018
1030
|
}
|
|
1019
1031
|
const unsyncedOrders = await this.getUnsyncedOrdersAsync();
|
|
1020
1032
|
if (unsyncedOrders.length === 0) {
|
|
1021
|
-
console.log("[PaymentModule]
|
|
1033
|
+
console.log("[PaymentModule] \u6CA1\u6709\u53D1\u73B0\u672A\u540C\u6B65\u7684\u8BA2\u5355");
|
|
1022
1034
|
this.logInfo("No unsynced orders found");
|
|
1023
1035
|
return 0;
|
|
1024
1036
|
}
|
|
1025
1037
|
console.log(
|
|
1026
|
-
`[PaymentModule]
|
|
1038
|
+
`[PaymentModule] \u53D1\u73B0 ${unsyncedOrders.length} \u4E2A\u672A\u540C\u6B65\u7684\u8BA2\u5355\uFF0C\u5F00\u59CB\u91CD\u65B0\u52A0\u5165\u4EFB\u52A1\u961F\u5217`
|
|
1027
1039
|
);
|
|
1028
1040
|
this.logInfo("Found unsynced orders, adding to sync queue", {
|
|
1029
1041
|
unsyncedCount: unsyncedOrders.length,
|
|
@@ -1037,7 +1049,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1037
1049
|
}
|
|
1038
1050
|
}
|
|
1039
1051
|
console.log(
|
|
1040
|
-
`[PaymentModule]
|
|
1052
|
+
`[PaymentModule] \u6210\u529F\u91CD\u65B0\u52A0\u5165 ${requeuedCount} \u4E2A\u8BA2\u5355\u5230\u4EFB\u52A1\u961F\u5217`
|
|
1041
1053
|
);
|
|
1042
1054
|
this.logInfo("Successfully requeued unsynced orders", {
|
|
1043
1055
|
requeuedCount,
|
|
@@ -1045,7 +1057,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1045
1057
|
});
|
|
1046
1058
|
return requeuedCount;
|
|
1047
1059
|
} catch (error) {
|
|
1048
|
-
console.error("[PaymentModule]
|
|
1060
|
+
console.error("[PaymentModule] \u91CD\u65B0\u6392\u961F\u672A\u540C\u6B65\u8BA2\u5355\u5931\u8D25", error);
|
|
1049
1061
|
this.logError("recheckAndRequeueUnsyncedOrders failed", error);
|
|
1050
1062
|
return 0;
|
|
1051
1063
|
}
|
|
@@ -1073,7 +1085,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1073
1085
|
this.logInfo("Starting runPaymentSyncQueue");
|
|
1074
1086
|
try {
|
|
1075
1087
|
if (!this.app.tasksManager) {
|
|
1076
|
-
console.warn("[PaymentModule] TasksManager
|
|
1088
|
+
console.warn("[PaymentModule] TasksManager \u672A\u521D\u59CB\u5316\uFF0C\u65E0\u6CD5\u6267\u884C\u540C\u6B65\u961F\u5217");
|
|
1077
1089
|
this.logWarning("TasksManager not initialized, cannot run sync queue");
|
|
1078
1090
|
return;
|
|
1079
1091
|
}
|
|
@@ -1082,15 +1094,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1082
1094
|
queueId: "payment_sync"
|
|
1083
1095
|
});
|
|
1084
1096
|
if (!(queue == null ? void 0 : queue.length)) {
|
|
1085
|
-
console.log("[PaymentModule]
|
|
1097
|
+
console.log("[PaymentModule] \u652F\u4ED8\u540C\u6B65\u961F\u5217\u65E0\u5185\u5BB9\uFF0C\u4E0D\u6267\u884C");
|
|
1086
1098
|
return;
|
|
1087
1099
|
}
|
|
1088
|
-
console.log("[PaymentModule]
|
|
1100
|
+
console.log("[PaymentModule] \u5F00\u59CB\u6267\u884C\u652F\u4ED8\u540C\u6B65\u961F\u5217");
|
|
1089
1101
|
await this.app.tasksManager.run({
|
|
1090
1102
|
module: "payment",
|
|
1091
1103
|
queueId: "payment_sync",
|
|
1092
1104
|
callback: () => {
|
|
1093
|
-
console.log("[PaymentModule]
|
|
1105
|
+
console.log("[PaymentModule] \u652F\u4ED8\u540C\u6B65\u961F\u5217\u6267\u884C\u5B8C\u6210");
|
|
1094
1106
|
if (this.logger) {
|
|
1095
1107
|
this.logger.addLog({
|
|
1096
1108
|
type: "info",
|
|
@@ -1102,7 +1114,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1102
1114
|
});
|
|
1103
1115
|
this.logInfo("runPaymentSyncQueue completed successfully");
|
|
1104
1116
|
} catch (error) {
|
|
1105
|
-
console.error("[PaymentModule]
|
|
1117
|
+
console.error("[PaymentModule] \u6267\u884C\u652F\u4ED8\u540C\u6B65\u961F\u5217\u5931\u8D25", error);
|
|
1106
1118
|
this.logError("runPaymentSyncQueue failed", error);
|
|
1107
1119
|
}
|
|
1108
1120
|
}
|
|
@@ -1127,12 +1139,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1127
1139
|
const taskExists = existingQueue == null ? void 0 : existingQueue.some((task) => task.id === taskId);
|
|
1128
1140
|
if (taskExists) {
|
|
1129
1141
|
console.log(
|
|
1130
|
-
`[PaymentModule]
|
|
1142
|
+
`[PaymentModule] \u4EFB\u52A1 ${taskId} \u5DF2\u5B58\u5728\u4E8E\u961F\u5217\u4E2D\uFF0C\u8DF3\u8FC7\u91CD\u590D\u6DFB\u52A0`
|
|
1131
1143
|
);
|
|
1132
1144
|
return false;
|
|
1133
1145
|
}
|
|
1134
1146
|
await this.addToSyncQueue(order, paymentData);
|
|
1135
|
-
console.log(`[PaymentModule]
|
|
1147
|
+
console.log(`[PaymentModule] \u8BA2\u5355 ${order.uuid} \u5DF2\u91CD\u65B0\u6DFB\u52A0\u5230\u540C\u6B65\u961F\u5217`);
|
|
1136
1148
|
this.logInfo("Order re-added to sync queue", {
|
|
1137
1149
|
orderUuid: order.uuid,
|
|
1138
1150
|
orderId: order.order_info.order_id,
|
|
@@ -1142,7 +1154,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1142
1154
|
return true;
|
|
1143
1155
|
} catch (error) {
|
|
1144
1156
|
console.error(
|
|
1145
|
-
`[PaymentModule]
|
|
1157
|
+
`[PaymentModule] \u91CD\u65B0\u6DFB\u52A0\u8BA2\u5355 ${order.uuid} \u5230\u540C\u6B65\u961F\u5217\u5931\u8D25`,
|
|
1146
1158
|
error
|
|
1147
1159
|
);
|
|
1148
1160
|
this.logError("Failed to re-add order to sync queue", error, {
|
|
@@ -29,7 +29,7 @@ var WalletPaymentImpl = class {
|
|
|
29
29
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
30
30
|
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
31
31
|
if (!walletMethod) {
|
|
32
|
-
throw new Error("
|
|
32
|
+
throw new Error("\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
|
|
33
33
|
}
|
|
34
34
|
const paymentItem = {
|
|
35
35
|
amount: amount.toString(),
|