@pisell/pisellos 0.0.229 → 0.0.230
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/modules/Payment/index.d.ts +59 -6
- package/dist/modules/Payment/index.js +823 -504
- package/dist/modules/Payment/types.d.ts +62 -32
- package/dist/modules/Payment/types.js +2 -2
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +181 -0
- package/dist/solution/Checkout/index.js +1596 -0
- package/dist/solution/Checkout/types.d.ts +550 -0
- package/dist/solution/Checkout/types.js +132 -0
- package/dist/solution/Checkout/utils/index.d.ts +73 -0
- package/dist/solution/Checkout/utils/index.js +371 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/modules/Payment/index.d.ts +59 -6
- package/lib/modules/Payment/index.js +203 -64
- package/lib/modules/Payment/types.d.ts +62 -32
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +181 -0
- package/lib/solution/Checkout/index.js +864 -0
- package/lib/solution/Checkout/types.d.ts +550 -0
- package/lib/solution/Checkout/types.js +75 -0
- package/lib/solution/Checkout/utils/index.d.ts +73 -0
- package/lib/solution/Checkout/utils/index.js +266 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/package.json +1 -1
|
@@ -280,99 +280,108 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
|
-
*
|
|
283
|
+
* 根据订单UUID获取支付订单(新方法)
|
|
284
284
|
*/
|
|
285
|
-
async
|
|
285
|
+
async getPaymentOrderByUuidAsync(orderUuid) {
|
|
286
286
|
try {
|
|
287
287
|
return await this.dbManager.get("order", orderUuid);
|
|
288
288
|
} catch (error) {
|
|
289
|
-
console.error("[PaymentModule]
|
|
289
|
+
console.error("[PaymentModule] 获取支付订单失败", error);
|
|
290
290
|
return null;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
294
|
-
*
|
|
294
|
+
* 创建支付订单(新方法,专注支付数据)
|
|
295
295
|
*/
|
|
296
|
-
async
|
|
297
|
-
this.logInfo("Starting
|
|
298
|
-
orderId: params.
|
|
299
|
-
totalAmount: params.
|
|
296
|
+
async createPaymentOrderAsync(params) {
|
|
297
|
+
this.logInfo("Starting createPaymentOrderAsync", {
|
|
298
|
+
orderId: params.order_id,
|
|
299
|
+
totalAmount: params.total_amount
|
|
300
300
|
});
|
|
301
301
|
try {
|
|
302
302
|
const existingOrders = await this.dbManager.getAll("order");
|
|
303
303
|
const existingOrder = existingOrders.find(
|
|
304
|
-
(order) => order.id === params.
|
|
304
|
+
(order) => String(order.id) === String(params.order_id)
|
|
305
305
|
);
|
|
306
306
|
if (existingOrder) {
|
|
307
307
|
console.log(
|
|
308
|
-
`[PaymentModule] 发现重复订单 ID: ${params.
|
|
308
|
+
`[PaymentModule] 发现重复订单 ID: ${params.order_id},更新现有支付订单`
|
|
309
309
|
);
|
|
310
310
|
const originalOrder = { ...existingOrder };
|
|
311
311
|
existingOrder.order_info = params.order_info;
|
|
312
|
-
existingOrder.total_amount = params.
|
|
312
|
+
existingOrder.total_amount = params.total_amount;
|
|
313
|
+
existingOrder.is_deposit = params.is_deposit || 0;
|
|
314
|
+
existingOrder.deposit_amount = params.deposit_amount || "0.00";
|
|
313
315
|
this.recalculateOrderAmount(existingOrder);
|
|
314
316
|
await this.dbManager.update("order", existingOrder);
|
|
315
317
|
await this.core.effects.emit(
|
|
316
318
|
import_types.PaymentHooks.OnOrderUpdated,
|
|
317
319
|
existingOrder
|
|
318
320
|
);
|
|
319
|
-
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
320
|
-
action: "update",
|
|
321
|
-
order: existingOrder,
|
|
322
|
-
originalOrder
|
|
323
|
-
});
|
|
324
321
|
return existingOrder;
|
|
325
322
|
} else {
|
|
326
323
|
const newOrder = {
|
|
327
324
|
uuid: (0, import_utils.getUniqueId)("pay_order_"),
|
|
328
|
-
id: params.
|
|
325
|
+
id: params.order_id,
|
|
326
|
+
order_id: params.order_id,
|
|
329
327
|
order_info: params.order_info,
|
|
330
328
|
payment_status: import_types.PaymentStatus.Processing,
|
|
331
329
|
payment: [],
|
|
332
330
|
adjust_offline_payments: [],
|
|
333
|
-
total_amount: params.
|
|
334
|
-
expect_amount: params.
|
|
335
|
-
tax_fee: "0.00"
|
|
331
|
+
total_amount: params.total_amount,
|
|
332
|
+
expect_amount: params.total_amount,
|
|
333
|
+
tax_fee: "0.00",
|
|
334
|
+
is_deposit: params.is_deposit || 0,
|
|
335
|
+
deposit_amount: params.deposit_amount || "0.00"
|
|
336
336
|
};
|
|
337
337
|
await this.dbManager.add("order", newOrder);
|
|
338
338
|
await this.core.effects.emit(import_types.PaymentHooks.OnOrderAdded, newOrder);
|
|
339
|
-
|
|
340
|
-
action: "add",
|
|
341
|
-
order: newOrder
|
|
342
|
-
});
|
|
343
|
-
this.logInfo("pushOrderAsync completed - new order created", {
|
|
339
|
+
this.logInfo("createPaymentOrderAsync completed - new payment order created", {
|
|
344
340
|
orderUuid: newOrder.uuid,
|
|
345
341
|
orderId: newOrder.id
|
|
346
342
|
});
|
|
347
343
|
return newOrder;
|
|
348
344
|
}
|
|
349
345
|
} catch (error) {
|
|
350
|
-
console.error("[PaymentModule]
|
|
351
|
-
this.logError("
|
|
352
|
-
orderId: params.
|
|
346
|
+
console.error("[PaymentModule] 创建支付订单失败", error);
|
|
347
|
+
this.logError("createPaymentOrderAsync failed", error, {
|
|
348
|
+
orderId: params.order_id
|
|
353
349
|
});
|
|
354
350
|
throw error;
|
|
355
351
|
}
|
|
356
352
|
}
|
|
357
353
|
/**
|
|
358
|
-
*
|
|
354
|
+
* 往交易组中添加订单(兼容性方法)
|
|
355
|
+
* @deprecated 使用 createPaymentOrderAsync 替代
|
|
359
356
|
*/
|
|
360
|
-
async
|
|
357
|
+
async pushOrderAsync(params) {
|
|
358
|
+
console.warn("[PaymentModule] pushOrderAsync 已废弃,请使用 createPaymentOrderAsync 替代");
|
|
359
|
+
return this.createPaymentOrderAsync(params);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* 删除支付订单(新方法)
|
|
363
|
+
*/
|
|
364
|
+
async deletePaymentOrderAsync(orderUuid) {
|
|
361
365
|
try {
|
|
362
366
|
const order = await this.dbManager.get("order", orderUuid);
|
|
363
367
|
if (order) {
|
|
364
368
|
await this.dbManager.delete("order", orderUuid);
|
|
365
369
|
await this.core.effects.emit(import_types.PaymentHooks.OnOrderDeleted, order);
|
|
366
|
-
|
|
367
|
-
action: "delete",
|
|
368
|
-
order
|
|
369
|
-
});
|
|
370
|
+
console.log("[PaymentModule] 支付订单删除成功:", orderUuid);
|
|
370
371
|
}
|
|
371
372
|
} catch (error) {
|
|
372
|
-
console.error("[PaymentModule]
|
|
373
|
+
console.error("[PaymentModule] 删除支付订单失败", error);
|
|
373
374
|
throw error;
|
|
374
375
|
}
|
|
375
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* 删除订单(兼容性方法)
|
|
379
|
+
* @deprecated 使用 deletePaymentOrderAsync 替代
|
|
380
|
+
*/
|
|
381
|
+
async deleteOrderAsync(orderUuid) {
|
|
382
|
+
console.warn("[PaymentModule] deleteOrderAsync 已废弃,请使用 deletePaymentOrderAsync 替代");
|
|
383
|
+
return this.deletePaymentOrderAsync(orderUuid);
|
|
384
|
+
}
|
|
376
385
|
/**
|
|
377
386
|
* 更新订单
|
|
378
387
|
*/
|
|
@@ -395,62 +404,149 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
395
404
|
}
|
|
396
405
|
}
|
|
397
406
|
/**
|
|
398
|
-
*
|
|
407
|
+
* 基于UUID替换订单ID
|
|
408
|
+
*
|
|
409
|
+
* 此方法用于将本地虚拟订单ID替换为真实的订单ID。
|
|
410
|
+
* 当前端模拟下单流程完成后,后端返回真实订单ID时调用此方法。
|
|
411
|
+
*
|
|
412
|
+
* @param orderUuid 订单的UUID
|
|
413
|
+
* @param newOrderId 新的订单ID (来自后端)
|
|
414
|
+
* @returns 更新后的订单对象,如果订单不存在则返回null
|
|
399
415
|
*/
|
|
400
|
-
async
|
|
416
|
+
async replaceOrderIdByUuidAsync(orderUuid, newOrderId) {
|
|
417
|
+
this.logInfo("Starting replaceOrderIdByUuidAsync", {
|
|
418
|
+
orderUuid,
|
|
419
|
+
newOrderId
|
|
420
|
+
});
|
|
421
|
+
try {
|
|
422
|
+
const existingOrder = await this.dbManager.get("order", orderUuid);
|
|
423
|
+
if (!existingOrder) {
|
|
424
|
+
this.logWarning("Order not found for UUID replacement", { orderUuid });
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
const allOrders = await this.dbManager.getAll("order");
|
|
428
|
+
const duplicateOrder = allOrders.find(
|
|
429
|
+
(order) => String(order.order_id) === String(newOrderId) && order.uuid !== orderUuid
|
|
430
|
+
);
|
|
431
|
+
if (duplicateOrder) {
|
|
432
|
+
this.logWarning("New order ID already exists", {
|
|
433
|
+
newOrderId,
|
|
434
|
+
existingOrderUuid: duplicateOrder.uuid
|
|
435
|
+
});
|
|
436
|
+
throw new Error(`订单ID ${newOrderId} 已存在`);
|
|
437
|
+
}
|
|
438
|
+
const originalOrderId = existingOrder.id;
|
|
439
|
+
const updatedOrder = {
|
|
440
|
+
...existingOrder,
|
|
441
|
+
id: newOrderId,
|
|
442
|
+
order_info: {
|
|
443
|
+
...existingOrder.order_info,
|
|
444
|
+
order_id: newOrderId,
|
|
445
|
+
// 保留原始本地订单ID作为参考
|
|
446
|
+
original_local_order_id: originalOrderId,
|
|
447
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
await this.dbManager.update("order", updatedOrder);
|
|
451
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
452
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
453
|
+
action: "order_id_replaced",
|
|
454
|
+
order: updatedOrder,
|
|
455
|
+
originalOrder: existingOrder,
|
|
456
|
+
metadata: {
|
|
457
|
+
originalOrderId,
|
|
458
|
+
newOrderId
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
this.logInfo("Order ID replacement completed successfully", {
|
|
462
|
+
orderUuid,
|
|
463
|
+
originalOrderId,
|
|
464
|
+
newOrderId
|
|
465
|
+
});
|
|
466
|
+
console.log(`[PaymentModule] 订单ID替换成功: ${originalOrderId} → ${newOrderId}`);
|
|
467
|
+
return updatedOrder;
|
|
468
|
+
} catch (error) {
|
|
469
|
+
console.error("[PaymentModule] 替换订单ID失败", error);
|
|
470
|
+
this.logError("replaceOrderIdByUuidAsync failed", error, {
|
|
471
|
+
orderUuid,
|
|
472
|
+
newOrderId
|
|
473
|
+
});
|
|
474
|
+
throw error;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* 获取支付项(新方法)
|
|
479
|
+
*/
|
|
480
|
+
async getPaymentItemsAsync(orderUuid) {
|
|
401
481
|
if (!orderUuid) {
|
|
402
482
|
throw new Error("orderUuid is required");
|
|
403
483
|
}
|
|
404
|
-
const order = await this.
|
|
484
|
+
const order = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
405
485
|
return (order == null ? void 0 : order.payment) || [];
|
|
406
486
|
}
|
|
407
487
|
/**
|
|
408
|
-
*
|
|
488
|
+
* 获取支付项(兼容性方法)
|
|
489
|
+
* @deprecated 使用 getPaymentItemsAsync 替代
|
|
409
490
|
*/
|
|
410
|
-
async
|
|
411
|
-
|
|
491
|
+
async getPaymentAsync(orderUuid) {
|
|
492
|
+
console.warn("[PaymentModule] getPaymentAsync 已废弃,请使用 getPaymentItemsAsync 替代");
|
|
493
|
+
return this.getPaymentItemsAsync(orderUuid);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* 为某个订单添加支付项(新方法)
|
|
497
|
+
*/
|
|
498
|
+
async addPaymentItemAsync(orderUuid, paymentItem) {
|
|
499
|
+
this.logInfo("Starting addPaymentItemAsync", {
|
|
412
500
|
orderUuid,
|
|
413
501
|
paymentAmount: paymentItem.amount,
|
|
414
502
|
paymentCode: paymentItem.code
|
|
415
503
|
});
|
|
416
504
|
try {
|
|
417
|
-
const order = await this.
|
|
505
|
+
const order = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
418
506
|
if (!order) {
|
|
419
|
-
throw new Error(
|
|
507
|
+
throw new Error(`Order not found: ${orderUuid}`);
|
|
420
508
|
}
|
|
421
509
|
const newPaymentItem = {
|
|
422
|
-
|
|
510
|
+
uuid: (0, import_utils.getUniqueId)("payment_"),
|
|
511
|
+
id: paymentItem.id || 0,
|
|
512
|
+
name: paymentItem.name,
|
|
513
|
+
code: paymentItem.code,
|
|
514
|
+
type: paymentItem.type,
|
|
423
515
|
amount: formatAmount(paymentItem.amount),
|
|
424
|
-
|
|
425
|
-
|
|
516
|
+
voucher_id: paymentItem.voucher_id || "",
|
|
517
|
+
rounding_amount: "0.00",
|
|
518
|
+
service_charge: { percentage: "0.00", amount: "0.00" },
|
|
426
519
|
isSynced: false
|
|
427
520
|
};
|
|
428
521
|
order.payment.push(newPaymentItem);
|
|
429
522
|
this.recalculateOrderAmount(order);
|
|
430
523
|
await this.dbManager.update("order", order);
|
|
431
524
|
await this.core.effects.emit(import_types.PaymentHooks.OnPaymentAdded, {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
});
|
|
435
|
-
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
436
|
-
action: "payment_add",
|
|
437
|
-
order,
|
|
438
|
-
paymentItem: newPaymentItem
|
|
525
|
+
orderUuid,
|
|
526
|
+
payment: newPaymentItem
|
|
439
527
|
});
|
|
440
|
-
this.logInfo("
|
|
528
|
+
this.logInfo("addPaymentItemAsync completed successfully", {
|
|
441
529
|
orderUuid,
|
|
442
530
|
paymentUuid: newPaymentItem.uuid,
|
|
443
531
|
newExpectAmount: order.expect_amount
|
|
444
532
|
});
|
|
445
533
|
} catch (error) {
|
|
446
534
|
console.error("[PaymentModule] 添加支付项失败", error);
|
|
447
|
-
this.logError("
|
|
535
|
+
this.logError("addPaymentItemAsync failed", error, {
|
|
448
536
|
orderUuid,
|
|
449
537
|
paymentItem
|
|
450
538
|
});
|
|
451
539
|
throw error;
|
|
452
540
|
}
|
|
453
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* 为某个订单设置一个支付项(兼容性方法)
|
|
544
|
+
* @deprecated 使用 addPaymentItemAsync 替代
|
|
545
|
+
*/
|
|
546
|
+
async pushPaymentAsync(orderUuid, paymentItem) {
|
|
547
|
+
console.warn("[PaymentModule] pushPaymentAsync 已废弃,请使用 addPaymentItemAsync 替代");
|
|
548
|
+
return this.addPaymentItemAsync(orderUuid, paymentItem);
|
|
549
|
+
}
|
|
454
550
|
/**
|
|
455
551
|
* 删除一个支付项
|
|
456
552
|
*/
|
|
@@ -585,7 +681,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
585
681
|
(sum, payment) => sum.plus(payment.amount),
|
|
586
682
|
new import_decimal.Decimal(0)
|
|
587
683
|
);
|
|
588
|
-
const orderTotalAmount = new import_decimal.Decimal(order.
|
|
684
|
+
const orderTotalAmount = new import_decimal.Decimal(order.total_amount);
|
|
589
685
|
if (totalPaidAmount.gte(orderTotalAmount)) {
|
|
590
686
|
order.payment_status = import_types.PaymentStatus.Finished;
|
|
591
687
|
console.log(
|
|
@@ -603,7 +699,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
603
699
|
console.log(`[PaymentModule] 订单 ${order.uuid} 支付列表为空,跳过队列推送`);
|
|
604
700
|
this.logWarning("Empty payment queue submission", {
|
|
605
701
|
orderUuid: order.uuid,
|
|
606
|
-
orderId: order.
|
|
702
|
+
orderId: order.order_id
|
|
607
703
|
});
|
|
608
704
|
return;
|
|
609
705
|
}
|
|
@@ -634,7 +730,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
634
730
|
action: "syncPayment",
|
|
635
731
|
payload: {
|
|
636
732
|
orderUuid: order.uuid,
|
|
637
|
-
orderId: order.
|
|
733
|
+
orderId: order.order_id,
|
|
638
734
|
paymentData,
|
|
639
735
|
core: this.core
|
|
640
736
|
},
|
|
@@ -655,7 +751,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
655
751
|
* 获取订单剩余待付金额
|
|
656
752
|
*/
|
|
657
753
|
async getRemainingOrderAmountAsync(orderUuid) {
|
|
658
|
-
const order = await this.
|
|
754
|
+
const order = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
659
755
|
if (!order) {
|
|
660
756
|
throw new Error("订单不存在");
|
|
661
757
|
}
|
|
@@ -665,7 +761,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
665
761
|
* 在比如现金支付界面的地方,用户输入了一个金额,在下方显示剩余多少金额,通过此方法获取
|
|
666
762
|
*/
|
|
667
763
|
async getRemainingOrderAmountWithInputAsync(inputAmount, orderUuid) {
|
|
668
|
-
const order = await this.
|
|
764
|
+
const order = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
669
765
|
if (!order) {
|
|
670
766
|
throw new Error("订单不存在");
|
|
671
767
|
}
|
|
@@ -699,9 +795,16 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
699
795
|
* 重新计算订单金额
|
|
700
796
|
*/
|
|
701
797
|
recalculateOrderAmount(order) {
|
|
702
|
-
const totalAmount = new import_decimal.Decimal(order.
|
|
798
|
+
const totalAmount = new import_decimal.Decimal(order.total_amount);
|
|
703
799
|
const paidAmount = order.payment.reduce(
|
|
704
|
-
(sum, payment) =>
|
|
800
|
+
(sum, payment) => {
|
|
801
|
+
try {
|
|
802
|
+
return sum.plus(payment.amount);
|
|
803
|
+
} catch (error) {
|
|
804
|
+
console.warn(`[PaymentModule] 无效的支付金额: ${payment.amount},跳过计算`);
|
|
805
|
+
return sum;
|
|
806
|
+
}
|
|
807
|
+
},
|
|
705
808
|
new import_decimal.Decimal(0)
|
|
706
809
|
);
|
|
707
810
|
const remainingAmount = totalAmount.minus(paidAmount);
|
|
@@ -1157,7 +1260,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1157
1260
|
console.log(`[PaymentModule] 订单 ${order.uuid} 已重新添加到同步队列`);
|
|
1158
1261
|
this.logInfo("Order re-added to sync queue", {
|
|
1159
1262
|
orderUuid: order.uuid,
|
|
1160
|
-
orderId: order.
|
|
1263
|
+
orderId: order.order_id,
|
|
1161
1264
|
paymentStatus: order.payment_status,
|
|
1162
1265
|
unsyncedPayments: order.payment.filter((p) => !p.isSynced).length
|
|
1163
1266
|
});
|
|
@@ -1169,11 +1272,47 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1169
1272
|
);
|
|
1170
1273
|
this.logError("Failed to re-add order to sync queue", error, {
|
|
1171
1274
|
orderUuid: order.uuid,
|
|
1172
|
-
orderId: order.
|
|
1275
|
+
orderId: order.order_id
|
|
1173
1276
|
});
|
|
1174
1277
|
return false;
|
|
1175
1278
|
}
|
|
1176
1279
|
}
|
|
1280
|
+
// === 新的 API 方法实现 ===
|
|
1281
|
+
/**
|
|
1282
|
+
* 删除支付项(新方法)
|
|
1283
|
+
*/
|
|
1284
|
+
async deletePaymentItemAsync(orderUuid, paymentUuid) {
|
|
1285
|
+
console.warn("[PaymentModule] deletePaymentItemAsync 暂时使用 deletePaymentAsync 实现");
|
|
1286
|
+
return this.deletePaymentAsync(orderUuid, paymentUuid);
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* 更新支付项(新方法)
|
|
1290
|
+
*/
|
|
1291
|
+
async updatePaymentItemAsync(orderUuid, paymentUuid, params) {
|
|
1292
|
+
console.warn("[PaymentModule] updatePaymentItemAsync 暂时使用 updatePaymentAsync 实现");
|
|
1293
|
+
return this.updatePaymentAsync(orderUuid, paymentUuid, params);
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* 获取订单剩余待付金额(新方法)
|
|
1297
|
+
*/
|
|
1298
|
+
async getRemainingAmountAsync(orderUuid) {
|
|
1299
|
+
console.warn("[PaymentModule] getRemainingAmountAsync 暂时使用 getRemainingOrderAmountAsync 实现");
|
|
1300
|
+
return this.getRemainingOrderAmountAsync(orderUuid);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* 获取订单剩余待付金额(基于用户输入的金额)(新方法)
|
|
1304
|
+
*/
|
|
1305
|
+
async getRemainingAmountWithInputAsync(inputAmount, orderUuid) {
|
|
1306
|
+
console.warn("[PaymentModule] getRemainingAmountWithInputAsync 暂时使用 getRemainingOrderAmountWithInputAsync 实现");
|
|
1307
|
+
return this.getRemainingOrderAmountWithInputAsync(inputAmount, orderUuid);
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* 提交支付(新方法)
|
|
1311
|
+
*/
|
|
1312
|
+
async submitPaymentAsync(orderUuid) {
|
|
1313
|
+
console.warn("[PaymentModule] submitPaymentAsync 暂时使用 submitPayAsync 实现");
|
|
1314
|
+
return this.submitPayAsync(orderUuid);
|
|
1315
|
+
}
|
|
1177
1316
|
};
|
|
1178
1317
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1179
1318
|
0 && (module.exports = {
|
|
@@ -106,17 +106,15 @@ export interface OrderInfo {
|
|
|
106
106
|
deposit_amount: string;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
109
|
+
* 支付订单(简化版,仅保留支付相关信息)
|
|
110
110
|
*/
|
|
111
111
|
export interface PaymentOrder {
|
|
112
112
|
/** 当前订单的唯一 ID */
|
|
113
113
|
uuid: string;
|
|
114
|
-
/** 订单ID */
|
|
115
|
-
id:
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
/** 支付状态 */
|
|
119
|
-
payment_status: PaymentStatus;
|
|
114
|
+
/** 订单ID(字符串类型,支持本地虚拟ID) */
|
|
115
|
+
id: string;
|
|
116
|
+
/** 订单ID(数字类型,兼容旧版本) */
|
|
117
|
+
order_id: string;
|
|
120
118
|
/** 支付项列表 */
|
|
121
119
|
payment: PaymentItem[];
|
|
122
120
|
/** 修改的支付项列表 */
|
|
@@ -125,8 +123,16 @@ export interface PaymentOrder {
|
|
|
125
123
|
total_amount: string;
|
|
126
124
|
/** 待付金额 */
|
|
127
125
|
expect_amount: string;
|
|
126
|
+
/** 支付状态 */
|
|
127
|
+
payment_status: PaymentStatus;
|
|
128
|
+
/** 是否是定金订单 */
|
|
129
|
+
is_deposit: number;
|
|
130
|
+
/** 定金金额 */
|
|
131
|
+
deposit_amount: string;
|
|
128
132
|
/** 总税费 */
|
|
129
133
|
tax_fee: string;
|
|
134
|
+
/** 原始订单数据(由 Checkout 模块传入) */
|
|
135
|
+
order_info?: any;
|
|
130
136
|
}
|
|
131
137
|
/**
|
|
132
138
|
* 支付状态
|
|
@@ -134,11 +140,19 @@ export interface PaymentOrder {
|
|
|
134
140
|
export interface PaymentState {
|
|
135
141
|
}
|
|
136
142
|
/**
|
|
137
|
-
*
|
|
143
|
+
* 推送订单参数(简化版)
|
|
138
144
|
*/
|
|
139
145
|
export interface PushOrderParams {
|
|
140
|
-
/**
|
|
141
|
-
|
|
146
|
+
/** 订单ID */
|
|
147
|
+
order_id: string;
|
|
148
|
+
/** 总金额 */
|
|
149
|
+
total_amount: string;
|
|
150
|
+
/** 是否是定金订单 */
|
|
151
|
+
is_deposit?: number;
|
|
152
|
+
/** 定金金额 */
|
|
153
|
+
deposit_amount?: string;
|
|
154
|
+
/** 原始订单数据(可选,由 Checkout 模块传入) */
|
|
155
|
+
order_info?: any;
|
|
142
156
|
}
|
|
143
157
|
/**
|
|
144
158
|
* 更新订单参数
|
|
@@ -262,32 +276,30 @@ export interface PaymentModuleAPI {
|
|
|
262
276
|
wallet: WalletPayment;
|
|
263
277
|
/** 获取支付方式列表 */
|
|
264
278
|
getPayMethodListAsync: () => Promise<PaymentMethod[]>;
|
|
265
|
-
/**
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
|
|
273
|
-
/** 更新订单 */
|
|
274
|
-
updateOrderAsync: (orderUuid: string, params: Partial<PaymentOrder>) => Promise<void>;
|
|
279
|
+
/** 创建支付订单(仅保存支付相关信息) */
|
|
280
|
+
createPaymentOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
|
|
281
|
+
/** 根据订单UUID获取支付订单 */
|
|
282
|
+
getPaymentOrderByUuidAsync: (orderUuid: string) => Promise<PaymentOrder | null>;
|
|
283
|
+
/** 基于UUID替换订单ID */
|
|
284
|
+
replaceOrderIdByUuidAsync: (orderUuid: string, newOrderId: string) => Promise<PaymentOrder | null>;
|
|
285
|
+
/** 删除支付订单 */
|
|
286
|
+
deletePaymentOrderAsync: (orderUuid: string) => Promise<void>;
|
|
275
287
|
/** 获取支付项 */
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
|
|
288
|
+
getPaymentItemsAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
289
|
+
/** 为某个订单添加支付项 */
|
|
290
|
+
addPaymentItemAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
|
|
291
|
+
/** 删除支付项 */
|
|
292
|
+
deletePaymentItemAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
|
|
293
|
+
/** 更新支付项 */
|
|
294
|
+
updatePaymentItemAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
|
|
295
|
+
/** 获取订单剩余待付金额 */
|
|
296
|
+
getRemainingAmountAsync: (orderUuid: string) => Promise<number>;
|
|
297
|
+
/** 获取订单剩余待付金额(基于用户输入的金额) */
|
|
298
|
+
getRemainingAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
283
299
|
/** 提交支付 */
|
|
284
|
-
|
|
300
|
+
submitPaymentAsync: (orderUuid: string) => Promise<{
|
|
285
301
|
status: 'success' | 'failed';
|
|
286
302
|
}>;
|
|
287
|
-
/** 获取订单剩余待付金额 */
|
|
288
|
-
getRemainingOrderAmountAsync: (orderUuid: string) => Promise<number>;
|
|
289
|
-
/** 获取订单剩余待付金额(基于用户输入的金额) */
|
|
290
|
-
getRemainingOrderAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
291
303
|
/** 获取部分支付的订单 */
|
|
292
304
|
getPartiallyPaidOrdersAsync: () => Promise<PaymentOrder[]>;
|
|
293
305
|
/** 获取未同步到服务器的订单 */
|
|
@@ -296,6 +308,24 @@ export interface PaymentModuleAPI {
|
|
|
296
308
|
recheckAndRequeueUnsyncedOrders: () => Promise<number>;
|
|
297
309
|
/** 手动执行支付同步队列 */
|
|
298
310
|
runPaymentSyncQueue: () => Promise<void>;
|
|
311
|
+
/** @deprecated 使用 createPaymentOrderAsync 替代 */
|
|
312
|
+
pushOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
|
|
313
|
+
/** @deprecated 使用 getPaymentItemsAsync 替代 */
|
|
314
|
+
getPaymentAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
315
|
+
/** @deprecated 使用 addPaymentItemAsync 替代 */
|
|
316
|
+
pushPaymentAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
|
|
317
|
+
/** @deprecated 使用 deletePaymentItemAsync 替代 */
|
|
318
|
+
deletePaymentAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
|
|
319
|
+
/** @deprecated 使用 updatePaymentItemAsync 替代 */
|
|
320
|
+
updatePaymentAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
|
|
321
|
+
/** @deprecated 使用 submitPaymentAsync 替代 */
|
|
322
|
+
submitPayAsync: (orderUuid?: string) => Promise<{
|
|
323
|
+
status: 'success' | 'failed';
|
|
324
|
+
}>;
|
|
325
|
+
/** @deprecated 使用 getRemainingAmountAsync 替代 */
|
|
326
|
+
getRemainingOrderAmountAsync: (orderUuid: string) => Promise<number>;
|
|
327
|
+
/** @deprecated 使用 getRemainingAmountWithInputAsync 替代 */
|
|
328
|
+
getRemainingOrderAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
299
329
|
}
|
|
300
330
|
/**
|
|
301
331
|
* 订单变化事件数据
|
|
File without changes
|
|
File without changes
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"appointment_booking","platform":"PC","sales_channel":"my_pisel","order_sales_channel":"online_store","bookings":[{"id":0,"number":1,"registration_type":"all","relation_products":[],"is_all":false,"product":{"num":1,"product_id":61170,"product_variant_id":0,"product_bundle":[],"product_option_item":[],"discount_list":[{"amount":100,"type":"good_pass","discount":{"resource_id":64523,"title":{"auto":"玄-商品券","original":"玄-商品券","en":null,"zh-CN":null,"zh-HK":null},"original_amount":100,"product_id":61170,"percent":"1.00"}}]},"sub_type":"minutes","duration":480,"like_status":"common","resources":[{"relation_type":"form","like_status":"common","form_id":35,"relation_id":40357,"capacity":1,"metadata":{"combined_resource":{"status":1,"resource_ids":[40262,40263]},"form_name":"桌台","resource_name":"组合资源测试table-0422-01"},"children":[{"relation_type":"form","like_status":"common","id":40262,"main_field":"A01(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40262,"capacity":1,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A01(组合资源-小桌-4 人)"}},{"relation_type":"form","like_status":"common","id":40263,"main_field":"A02(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40263,"capacity":0,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A02(组合资源-小桌-4 人)"}}]},{"relation_type":"form","like_status":"common","form_id":214,"relation_id":38350,"capacity":1,"metadata":{"combined_resource":null,"form_name":"校区2","resource_name":"West Campus"}}],"schedule_id":0,"start_date":"2025-08-22","start_time":"09:00","select_date":"2025-08-22","end_time":"17:00","end_date":"2025-08-22","metadata":{"account":{"id":13433,"username":"a a"},"capacity":[{"id":0,"value":1,"name":""}]},"holder":null,"relation_forms":[]}],"shop_note":"","schedule_date":"2025-08-22 09:00:00","is_deposit":0,"relation_products":[],"relation_forms":[]}
|