@pisell/pisellos 0.0.255 → 0.0.257
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/Order/index.js +10 -4
- package/dist/modules/Payment/index.d.ts +5 -4
- package/dist/modules/Payment/index.js +38 -31
- package/dist/modules/Payment/walletpass.js +174 -58
- package/dist/modules/Schedule/index.d.ts +1 -1
- package/dist/modules/Schedule/index.js +9 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +1 -153
- package/dist/solution/Checkout/index.js +1040 -2504
- package/dist/solution/Checkout/types.d.ts +0 -221
- package/dist/solution/Checkout/types.js +0 -49
- package/dist/solution/Checkout/utils/index.d.ts +9 -5
- package/dist/solution/Checkout/utils/index.js +18 -56
- package/lib/modules/Order/index.js +6 -0
- package/lib/modules/Payment/index.d.ts +5 -4
- package/lib/modules/Payment/index.js +13 -6
- package/lib/modules/Payment/walletpass.js +125 -25
- package/lib/modules/Schedule/index.d.ts +1 -1
- package/lib/modules/Schedule/index.js +9 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +1 -153
- package/lib/solution/Checkout/index.js +219 -1148
- package/lib/solution/Checkout/types.d.ts +0 -221
- package/lib/solution/Checkout/types.js +2 -27
- package/lib/solution/Checkout/utils/index.d.ts +9 -5
- package/lib/solution/Checkout/utils/index.js +12 -53
- package/package.json +1 -1
|
@@ -354,21 +354,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
354
354
|
return this.request.post('/order/checkout', orderData);
|
|
355
355
|
case 11:
|
|
356
356
|
response = _context3.sent;
|
|
357
|
+
this.logInfo('Order API called successfully', {
|
|
358
|
+
response: response
|
|
359
|
+
});
|
|
357
360
|
console.log('[Order] 订单创建成功,后端响应:', {
|
|
358
361
|
success: !!response,
|
|
359
362
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
360
363
|
});
|
|
361
364
|
return _context3.abrupt("return", response);
|
|
362
|
-
case
|
|
363
|
-
_context3.prev =
|
|
365
|
+
case 17:
|
|
366
|
+
_context3.prev = 17;
|
|
364
367
|
_context3.t0 = _context3["catch"](2);
|
|
365
368
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
369
|
+
this.logInfo('Order API called failed', {
|
|
370
|
+
error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
371
|
+
});
|
|
366
372
|
throw _context3.t0;
|
|
367
|
-
case
|
|
373
|
+
case 22:
|
|
368
374
|
case "end":
|
|
369
375
|
return _context3.stop();
|
|
370
376
|
}
|
|
371
|
-
}, _callee3, this, [[2,
|
|
377
|
+
}, _callee3, this, [[2, 17]]);
|
|
372
378
|
}));
|
|
373
379
|
function createOrderByCheckout(_x4) {
|
|
374
380
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -23,6 +23,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
23
23
|
private store;
|
|
24
24
|
private dbManager;
|
|
25
25
|
private logger;
|
|
26
|
+
protected otherParams: any;
|
|
26
27
|
cash: CashPayment;
|
|
27
28
|
eftpos: EftposPayment;
|
|
28
29
|
wallet: WalletPassPayment;
|
|
@@ -31,19 +32,19 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
31
32
|
/**
|
|
32
33
|
* 记录信息日志
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
logInfo(title: string, metadata?: any): void;
|
|
35
36
|
/**
|
|
36
37
|
* 记录警告日志
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
|
+
logWarning(title: string, metadata?: any): void;
|
|
39
40
|
/**
|
|
40
41
|
* 记录错误日志
|
|
41
42
|
*/
|
|
42
|
-
|
|
43
|
+
logError(title: string, error?: any, metadata?: any): void;
|
|
43
44
|
/**
|
|
44
45
|
* 记录调试日志
|
|
45
46
|
*/
|
|
46
|
-
|
|
47
|
+
logDebug(title: string, metadata?: any): void;
|
|
47
48
|
/**
|
|
48
49
|
* 网络恢复以后,尝试执行队列
|
|
49
50
|
*
|
|
@@ -85,6 +85,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
85
85
|
// IndexDBManager 实例
|
|
86
86
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
87
87
|
// LoggerManager 实例
|
|
88
|
+
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
88
89
|
// 支付方式实例
|
|
89
90
|
_defineProperty(_assertThisInitialized(_this), "cash", void 0);
|
|
90
91
|
_defineProperty(_assertThisInitialized(_this), "eftpos", void 0);
|
|
@@ -104,34 +105,35 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
104
105
|
case 0:
|
|
105
106
|
this.core = core;
|
|
106
107
|
this.store = options.store;
|
|
108
|
+
this.otherParams = options.otherParams || {};
|
|
107
109
|
|
|
108
110
|
// 获取依赖的插件
|
|
109
111
|
this.request = core.getPlugin('request');
|
|
110
112
|
appPlugin = core.getPlugin('app');
|
|
111
113
|
if (this.request) {
|
|
112
|
-
_context.next =
|
|
114
|
+
_context.next = 7;
|
|
113
115
|
break;
|
|
114
116
|
}
|
|
115
117
|
throw new Error('支付模块需要 request 插件支持');
|
|
116
|
-
case
|
|
118
|
+
case 7:
|
|
117
119
|
if (appPlugin) {
|
|
118
|
-
_context.next =
|
|
120
|
+
_context.next = 9;
|
|
119
121
|
break;
|
|
120
122
|
}
|
|
121
123
|
throw new Error('支付模块需要 app 插件支持');
|
|
122
|
-
case
|
|
124
|
+
case 9:
|
|
123
125
|
this.app = appPlugin.getApp();
|
|
124
126
|
this.dbManager = this.app.dbManager;
|
|
125
127
|
this.logger = this.app.logger;
|
|
126
128
|
|
|
127
129
|
// 确保支付模块所需的对象存储已创建
|
|
128
|
-
_context.next =
|
|
130
|
+
_context.next = 14;
|
|
129
131
|
return this.ensurePaymentTables();
|
|
130
|
-
case
|
|
132
|
+
case 14:
|
|
131
133
|
this.registerNetworkHandlers();
|
|
132
134
|
console.log('[PaymentModule] 初始化完成');
|
|
133
135
|
this.logInfo('PaymentModule initialized successfully');
|
|
134
|
-
case
|
|
136
|
+
case 17:
|
|
135
137
|
case "end":
|
|
136
138
|
return _context.stop();
|
|
137
139
|
}
|
|
@@ -148,6 +150,15 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
148
150
|
}, {
|
|
149
151
|
key: "logInfo",
|
|
150
152
|
value: function logInfo(title, metadata) {
|
|
153
|
+
var _this$otherParams;
|
|
154
|
+
if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.fatherModule) {
|
|
155
|
+
var _this$otherParams2;
|
|
156
|
+
var fatherModule = this.core.getModule((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule);
|
|
157
|
+
if (fatherModule) {
|
|
158
|
+
fatherModule.logInfo("".concat(title), metadata);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
151
162
|
if (this.logger) {
|
|
152
163
|
this.logger.addLog({
|
|
153
164
|
type: 'info',
|
|
@@ -646,7 +657,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
646
657
|
key: "createPaymentOrderAsync",
|
|
647
658
|
value: (function () {
|
|
648
659
|
var _createPaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
649
|
-
var
|
|
660
|
+
var existingOrder, newOrder;
|
|
650
661
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
651
662
|
while (1) switch (_context7.prev = _context7.next) {
|
|
652
663
|
case 0:
|
|
@@ -656,19 +667,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
656
667
|
});
|
|
657
668
|
_context7.prev = 1;
|
|
658
669
|
_context7.next = 4;
|
|
659
|
-
return this.dbManager.
|
|
670
|
+
return this.dbManager.get('order', params.order_id);
|
|
660
671
|
case 4:
|
|
661
|
-
|
|
662
|
-
existingOrder = existingOrders.find(function (order) {
|
|
663
|
-
return String(order.id) === String(params.order_id);
|
|
664
|
-
});
|
|
672
|
+
existingOrder = _context7.sent;
|
|
665
673
|
if (!existingOrder) {
|
|
666
|
-
_context7.next =
|
|
674
|
+
_context7.next = 19;
|
|
667
675
|
break;
|
|
668
676
|
}
|
|
669
677
|
// 如果存在相同 order_id 的订单,更新该订单信息
|
|
670
678
|
console.log("[PaymentModule] \u53D1\u73B0\u91CD\u590D\u8BA2\u5355 ID: ".concat(params.order_id, "\uFF0C\u66F4\u65B0\u73B0\u6709\u652F\u4ED8\u8BA2\u5355"));
|
|
671
|
-
|
|
679
|
+
|
|
680
|
+
// const originalOrder = { ...existingOrder };
|
|
672
681
|
existingOrder.order_info = params.order_info;
|
|
673
682
|
existingOrder.total_amount = params.total_amount;
|
|
674
683
|
existingOrder.is_deposit = params.is_deposit || 0;
|
|
@@ -678,14 +687,14 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
678
687
|
this.recalculateOrderAmount(existingOrder);
|
|
679
688
|
|
|
680
689
|
// 更新到数据库
|
|
681
|
-
_context7.next =
|
|
690
|
+
_context7.next = 14;
|
|
682
691
|
return this.dbManager.update('order', existingOrder);
|
|
683
|
-
case
|
|
684
|
-
_context7.next =
|
|
692
|
+
case 14:
|
|
693
|
+
_context7.next = 16;
|
|
685
694
|
return this.core.effects.emit(PaymentHooks.OnOrderUpdated, existingOrder);
|
|
686
|
-
case
|
|
695
|
+
case 16:
|
|
687
696
|
return _context7.abrupt("return", existingOrder);
|
|
688
|
-
case
|
|
697
|
+
case 19:
|
|
689
698
|
// 创建新的支付订单
|
|
690
699
|
newOrder = {
|
|
691
700
|
uuid: getUniqueId('pay_order_'),
|
|
@@ -701,33 +710,31 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
701
710
|
is_deposit: params.is_deposit || 0,
|
|
702
711
|
deposit_amount: params.deposit_amount || '0.00'
|
|
703
712
|
};
|
|
704
|
-
_context7.next =
|
|
713
|
+
_context7.next = 22;
|
|
705
714
|
return this.dbManager.add('order', newOrder);
|
|
706
|
-
case
|
|
707
|
-
|
|
708
|
-
return this.core.effects.emit(PaymentHooks.OnOrderAdded, newOrder);
|
|
709
|
-
case 26:
|
|
715
|
+
case 22:
|
|
716
|
+
this.core.effects.emit(PaymentHooks.OnOrderAdded, newOrder);
|
|
710
717
|
this.logInfo('createPaymentOrderAsync completed - new payment order created', {
|
|
711
718
|
orderUuid: newOrder.uuid,
|
|
712
719
|
orderId: newOrder.id
|
|
713
720
|
});
|
|
714
721
|
return _context7.abrupt("return", newOrder);
|
|
715
|
-
case
|
|
716
|
-
_context7.next =
|
|
722
|
+
case 25:
|
|
723
|
+
_context7.next = 32;
|
|
717
724
|
break;
|
|
718
|
-
case
|
|
719
|
-
_context7.prev =
|
|
725
|
+
case 27:
|
|
726
|
+
_context7.prev = 27;
|
|
720
727
|
_context7.t0 = _context7["catch"](1);
|
|
721
728
|
console.error('[PaymentModule] 创建支付订单失败', _context7.t0);
|
|
722
729
|
this.logError('createPaymentOrderAsync failed', _context7.t0, {
|
|
723
730
|
orderId: params.order_id
|
|
724
731
|
});
|
|
725
732
|
throw _context7.t0;
|
|
726
|
-
case
|
|
733
|
+
case 32:
|
|
727
734
|
case "end":
|
|
728
735
|
return _context7.stop();
|
|
729
736
|
}
|
|
730
|
-
}, _callee7, this, [[1,
|
|
737
|
+
}, _callee7, this, [[1, 27]]);
|
|
731
738
|
}));
|
|
732
739
|
function createPaymentOrderAsync(_x6) {
|
|
733
740
|
return _createPaymentOrderAsync.apply(this, arguments);
|