@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.
- package/dist/modules/Payment/index.js +21 -15
- package/dist/solution/Checkout/index.d.ts +10 -0
- package/dist/solution/Checkout/index.js +647 -456
- package/dist/solution/Checkout/types.d.ts +6 -0
- package/lib/modules/Payment/index.js +5 -2
- package/lib/solution/Checkout/index.d.ts +10 -0
- package/lib/solution/Checkout/index.js +155 -10
- package/lib/solution/Checkout/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -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 =
|
|
680
|
+
_context7.next = 20;
|
|
675
681
|
break;
|
|
676
682
|
}
|
|
677
683
|
// 如果存在相同 order_id 的订单,更新该订单信息
|
|
678
|
-
|
|
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 =
|
|
696
|
+
_context7.next = 15;
|
|
691
697
|
return this.dbManager.update('order', existingOrder);
|
|
692
|
-
case
|
|
693
|
-
_context7.next =
|
|
698
|
+
case 15:
|
|
699
|
+
_context7.next = 17;
|
|
694
700
|
return this.core.effects.emit(PaymentHooks.OnOrderUpdated, existingOrder);
|
|
695
|
-
case
|
|
701
|
+
case 17:
|
|
696
702
|
return _context7.abrupt("return", existingOrder);
|
|
697
|
-
case
|
|
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 =
|
|
719
|
+
_context7.next = 23;
|
|
714
720
|
return this.dbManager.add('order', newOrder);
|
|
715
|
-
case
|
|
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
|
|
723
|
-
_context7.next =
|
|
728
|
+
case 26:
|
|
729
|
+
_context7.next = 33;
|
|
724
730
|
break;
|
|
725
|
-
case
|
|
726
|
-
_context7.prev =
|
|
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
|
|
739
|
+
case 33:
|
|
734
740
|
case "end":
|
|
735
741
|
return _context7.stop();
|
|
736
742
|
}
|
|
737
|
-
}, _callee7, this, [[1,
|
|
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
|
*
|