@pisell/pisellos 0.0.261 → 0.0.263

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.
@@ -670,12 +670,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
670
670
  return this.dbManager.get('order', params.order_id);
671
671
  case 4:
672
672
  existingOrder = _context7.sent;
673
+ this.logInfo('createPaymentOrderAsync existingOrder', {
674
+ existingOrder: existingOrder
675
+ });
676
+ // const existingOrder = existingOrders.find(
677
+ // (order: PaymentOrder) => String(order.id) === String(params.order_id),
678
+ // );
673
679
  if (!existingOrder) {
674
- _context7.next = 19;
680
+ _context7.next = 20;
675
681
  break;
676
682
  }
677
683
  // 如果存在相同 order_id 的订单,更新该订单信息
678
- console.log("[PaymentModule] \u53D1\u73B0\u91CD\u590D\u8BA2\u5355 ID: ".concat(params.order_id, "\uFF0C\u66F4\u65B0\u73B0\u6709\u652F\u4ED8\u8BA2\u5355"));
684
+ this.logInfo("createPaymentOrderAsync found duplicate order ID: ".concat(params.order_id, ", updating existing payment order"));
679
685
 
680
686
  // const originalOrder = { ...existingOrder };
681
687
  existingOrder.order_info = params.order_info;
@@ -687,14 +693,14 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
687
693
  this.recalculateOrderAmount(existingOrder);
688
694
 
689
695
  // 更新到数据库
690
- _context7.next = 14;
696
+ _context7.next = 15;
691
697
  return this.dbManager.update('order', existingOrder);
692
- case 14:
693
- _context7.next = 16;
698
+ case 15:
699
+ _context7.next = 17;
694
700
  return this.core.effects.emit(PaymentHooks.OnOrderUpdated, existingOrder);
695
- case 16:
701
+ case 17:
696
702
  return _context7.abrupt("return", existingOrder);
697
- case 19:
703
+ case 20:
698
704
  // 创建新的支付订单
699
705
  newOrder = {
700
706
  uuid: getUniqueId('pay_order_'),
@@ -710,31 +716,31 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
710
716
  is_deposit: params.is_deposit || 0,
711
717
  deposit_amount: params.deposit_amount || '0.00'
712
718
  };
713
- _context7.next = 22;
719
+ _context7.next = 23;
714
720
  return this.dbManager.add('order', newOrder);
715
- case 22:
721
+ case 23:
716
722
  this.core.effects.emit(PaymentHooks.OnOrderAdded, newOrder);
717
723
  this.logInfo('createPaymentOrderAsync completed - new payment order created', {
718
724
  orderUuid: newOrder.uuid,
719
725
  orderId: newOrder.id
720
726
  });
721
727
  return _context7.abrupt("return", newOrder);
722
- case 25:
723
- _context7.next = 32;
728
+ case 26:
729
+ _context7.next = 33;
724
730
  break;
725
- case 27:
726
- _context7.prev = 27;
731
+ case 28:
732
+ _context7.prev = 28;
727
733
  _context7.t0 = _context7["catch"](1);
728
734
  console.error('[PaymentModule] 创建支付订单失败', _context7.t0);
729
735
  this.logError('createPaymentOrderAsync failed', _context7.t0, {
730
736
  orderId: params.order_id
731
737
  });
732
738
  throw _context7.t0;
733
- case 32:
739
+ case 33:
734
740
  case "end":
735
741
  return _context7.stop();
736
742
  }
737
- }, _callee7, this, [[1, 27]]);
743
+ }, _callee7, this, [[1, 28]]);
738
744
  }));
739
745
  function createPaymentOrderAsync(_x6) {
740
746
  return _createPaymentOrderAsync.apply(this, arguments);
@@ -182,6 +182,16 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
182
182
  * @throws 当前没有活跃订单时抛出错误
183
183
  */
184
184
  updateOrderDepositStatusAsync(isDeposit: number): Promise<void>;
185
+ /**
186
+ * 手动设置当前订单的定金金额
187
+ *
188
+ * 允许手动设置订单的定金金额,通常用于用户自定义定金支付场景
189
+ *
190
+ * @param depositAmount 定金金额,必须是有效的数字字符串,且不能超过订单总额
191
+ * @throws 当前没有活跃订单时抛出错误
192
+ * @throws 定金金额格式无效或超过订单总额时抛出错误
193
+ */
194
+ setDepositAmountAsync(depositAmount: string): Promise<void>;
185
195
  /**
186
196
  * 手动同步订单到后端
187
197
  *