@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
|
@@ -40,7 +40,7 @@ var WalletPassPaymentImpl = class {
|
|
|
40
40
|
try {
|
|
41
41
|
this.paymentModule.core.effects.emit(hook, data);
|
|
42
42
|
} catch (error) {
|
|
43
|
-
|
|
43
|
+
this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -48,6 +48,7 @@ var WalletPassPaymentImpl = class {
|
|
|
48
48
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
49
49
|
*/
|
|
50
50
|
generateWalletParams(businessData) {
|
|
51
|
+
var _a;
|
|
51
52
|
const { customer_id, amountInfo, products, order_wait_pay_amount } = businessData;
|
|
52
53
|
const totalAmount = Number(amountInfo.totalAmount);
|
|
53
54
|
const subTotal = Number(amountInfo.subTotal);
|
|
@@ -65,7 +66,13 @@ var WalletPassPaymentImpl = class {
|
|
|
65
66
|
prepare_payments: []
|
|
66
67
|
};
|
|
67
68
|
this.walletParams = walletParams;
|
|
68
|
-
|
|
69
|
+
this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
|
|
70
|
+
customer_id: walletParams.customer_id,
|
|
71
|
+
order_expect_amount: walletParams.order_expect_amount,
|
|
72
|
+
order_product_amount: walletParams.order_product_amount,
|
|
73
|
+
order_wait_pay_amount: walletParams.order_wait_pay_amount,
|
|
74
|
+
products_count: ((_a = walletParams.products) == null ? void 0 : _a.length) || 0
|
|
75
|
+
});
|
|
69
76
|
return walletParams;
|
|
70
77
|
}
|
|
71
78
|
/**
|
|
@@ -81,14 +88,14 @@ var WalletPassPaymentImpl = class {
|
|
|
81
88
|
*/
|
|
82
89
|
clearStoredWalletParams() {
|
|
83
90
|
this.walletParams = null;
|
|
84
|
-
|
|
91
|
+
this.paymentModule.logInfo("[WalletPass] 已存储的钱包参数已清理");
|
|
85
92
|
}
|
|
86
93
|
/**
|
|
87
94
|
* 从业务数据初始化钱包数据
|
|
88
95
|
* 内部生成参数,然后调用标准的初始化流程
|
|
89
96
|
*/
|
|
90
97
|
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
91
|
-
var _a, _b;
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
92
99
|
const startTime = Date.now();
|
|
93
100
|
const walletParams = this.generateWalletParams(businessData);
|
|
94
101
|
if (Number(((_a = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _a.totalAmount) || 0) < 0 || Number(((_b = businessData == null ? void 0 : businessData.amountInfo) == null ? void 0 : _b.subTotal) || 0) < 0) {
|
|
@@ -101,6 +108,13 @@ var WalletPassPaymentImpl = class {
|
|
|
101
108
|
businessData,
|
|
102
109
|
startTime
|
|
103
110
|
});
|
|
111
|
+
this.paymentModule.logInfo("[WalletPass] 开始从业务数据初始化钱包数据", {
|
|
112
|
+
customer_id: businessData.customer_id,
|
|
113
|
+
totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
|
|
114
|
+
subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
|
|
115
|
+
order_wait_pay_amount: businessData.order_wait_pay_amount,
|
|
116
|
+
products_count: ((_e = businessData.products) == null ? void 0 : _e.length) || 0
|
|
117
|
+
});
|
|
104
118
|
try {
|
|
105
119
|
const result = await this.initializeWalletDataAsync(walletParams);
|
|
106
120
|
const endTime = Date.now();
|
|
@@ -112,7 +126,11 @@ var WalletPassPaymentImpl = class {
|
|
|
112
126
|
endTime,
|
|
113
127
|
duration
|
|
114
128
|
});
|
|
115
|
-
|
|
129
|
+
this.paymentModule.logInfo(`[WalletPass] 从业务数据初始化钱包数据成功`, {
|
|
130
|
+
duration: `${duration}ms`,
|
|
131
|
+
walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
|
|
132
|
+
userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
|
|
133
|
+
});
|
|
116
134
|
return result;
|
|
117
135
|
} catch (error) {
|
|
118
136
|
const endTime = Date.now();
|
|
@@ -124,7 +142,11 @@ var WalletPassPaymentImpl = class {
|
|
|
124
142
|
endTime,
|
|
125
143
|
duration
|
|
126
144
|
});
|
|
127
|
-
|
|
145
|
+
this.paymentModule.logError(`[WalletPass] 从业务数据初始化钱包数据失败`, error, {
|
|
146
|
+
duration: `${duration}ms`,
|
|
147
|
+
customer_id: businessData.customer_id,
|
|
148
|
+
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
149
|
+
});
|
|
128
150
|
throw error;
|
|
129
151
|
}
|
|
130
152
|
}
|
|
@@ -148,12 +170,20 @@ var WalletPassPaymentImpl = class {
|
|
|
148
170
|
userIdentificationCodes
|
|
149
171
|
};
|
|
150
172
|
} catch (error) {
|
|
151
|
-
|
|
173
|
+
this.paymentModule.logError("[WalletPass] 初始化钱包数据失败", error, {
|
|
174
|
+
customer_id: baseParams.customer_id,
|
|
175
|
+
order_expect_amount: baseParams.order_expect_amount
|
|
176
|
+
});
|
|
152
177
|
throw error;
|
|
153
178
|
}
|
|
154
179
|
}
|
|
155
180
|
async getWalletPassRecommendListAsync(params) {
|
|
156
181
|
try {
|
|
182
|
+
this.paymentModule.logInfo("[WalletPass] 开始获取钱包推荐列表", {
|
|
183
|
+
customer_id: params.customer_id,
|
|
184
|
+
order_expect_amount: params.order_expect_amount,
|
|
185
|
+
sale_channel: params.sale_channel
|
|
186
|
+
});
|
|
157
187
|
const response = await this.paymentModule.request.post(
|
|
158
188
|
"/machinecode/prepare/deduction/recommend",
|
|
159
189
|
params
|
|
@@ -163,14 +193,22 @@ var WalletPassPaymentImpl = class {
|
|
|
163
193
|
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
164
194
|
walletRecommendList: this.walletRecommendList
|
|
165
195
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.walletRecommendList.
|
|
169
|
-
|
|
170
|
-
|
|
196
|
+
this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已更新", {
|
|
197
|
+
count: this.walletRecommendList.length,
|
|
198
|
+
items: this.walletRecommendList.map((item) => ({
|
|
199
|
+
voucher_id: item.voucher_id,
|
|
200
|
+
name: item.name,
|
|
201
|
+
amount: item.amount,
|
|
202
|
+
tag: item.tag
|
|
203
|
+
}))
|
|
204
|
+
});
|
|
171
205
|
return this.walletRecommendList;
|
|
172
206
|
} catch (error) {
|
|
173
|
-
|
|
207
|
+
this.paymentModule.logError("[WalletPass] 获取钱包推荐列表失败", error, {
|
|
208
|
+
customer_id: params.customer_id,
|
|
209
|
+
order_expect_amount: params.order_expect_amount,
|
|
210
|
+
sale_channel: params.sale_channel
|
|
211
|
+
});
|
|
174
212
|
return [];
|
|
175
213
|
}
|
|
176
214
|
}
|
|
@@ -178,11 +216,18 @@ var WalletPassPaymentImpl = class {
|
|
|
178
216
|
return (0, import_utils.formatWalletPassList2PreparePayments)(list);
|
|
179
217
|
}
|
|
180
218
|
async getUserIdentificationCodeListAsync(params) {
|
|
219
|
+
var _a;
|
|
181
220
|
try {
|
|
182
221
|
const newParams = {
|
|
183
222
|
...this.walletParams,
|
|
184
223
|
...params
|
|
185
224
|
};
|
|
225
|
+
this.paymentModule.logInfo("[WalletPass] 开始获取用户识别码列表", {
|
|
226
|
+
customer_id: newParams.customer_id,
|
|
227
|
+
available: newParams.available,
|
|
228
|
+
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
229
|
+
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass
|
|
230
|
+
});
|
|
186
231
|
const response = await this.paymentModule.request.post(
|
|
187
232
|
"/machinecode/prepare/deduction",
|
|
188
233
|
newParams
|
|
@@ -192,14 +237,20 @@ var WalletPassPaymentImpl = class {
|
|
|
192
237
|
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
193
238
|
userIdentificationCodes: this.userIdentificationCodes
|
|
194
239
|
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
this.userIdentificationCodes.
|
|
198
|
-
|
|
199
|
-
|
|
240
|
+
this.paymentModule.logInfo("[WalletPass] 用户识别码列表已更新", {
|
|
241
|
+
count: this.userIdentificationCodes.length,
|
|
242
|
+
sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
|
|
243
|
+
code: item.code,
|
|
244
|
+
error_code: item.error_code,
|
|
245
|
+
error_msg: item.error_msg
|
|
246
|
+
}))
|
|
247
|
+
});
|
|
200
248
|
return this.userIdentificationCodes;
|
|
201
249
|
} catch (error) {
|
|
202
|
-
|
|
250
|
+
this.paymentModule.logError("[WalletPass] 获取用户识别码列表失败", error, {
|
|
251
|
+
customer_id: params.customer_id,
|
|
252
|
+
available: params.available
|
|
253
|
+
});
|
|
203
254
|
return [];
|
|
204
255
|
}
|
|
205
256
|
}
|
|
@@ -212,6 +263,11 @@ var WalletPassPaymentImpl = class {
|
|
|
212
263
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
213
264
|
try {
|
|
214
265
|
const { code } = params;
|
|
266
|
+
this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
|
|
267
|
+
code,
|
|
268
|
+
code_length: code.length,
|
|
269
|
+
noCache: config.noCache || false
|
|
270
|
+
});
|
|
215
271
|
const isWalletCode = code.startsWith("WL");
|
|
216
272
|
if (isWalletCode) {
|
|
217
273
|
const walletDetailParams = {
|
|
@@ -219,11 +275,21 @@ var WalletPassPaymentImpl = class {
|
|
|
219
275
|
with_customer: 1,
|
|
220
276
|
with: ["wallet"]
|
|
221
277
|
};
|
|
278
|
+
this.paymentModule.logInfo("[WalletPass] 搜索钱包识别码", {
|
|
279
|
+
code,
|
|
280
|
+
with_customer: walletDetailParams.with_customer,
|
|
281
|
+
with: walletDetailParams.with
|
|
282
|
+
});
|
|
222
283
|
const response2 = await this.paymentModule.request.post(
|
|
223
284
|
"/wallet/detail/search",
|
|
224
285
|
walletDetailParams
|
|
225
286
|
);
|
|
226
287
|
const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
|
|
288
|
+
this.paymentModule.logInfo("[WalletPass] 钱包识别码搜索完成", {
|
|
289
|
+
code,
|
|
290
|
+
results_count: searchResults2.length,
|
|
291
|
+
type: "walletCode"
|
|
292
|
+
});
|
|
227
293
|
return {
|
|
228
294
|
type: "walletCode",
|
|
229
295
|
data: searchResults2
|
|
@@ -232,7 +298,7 @@ var WalletPassPaymentImpl = class {
|
|
|
232
298
|
const baseWalletParams = this.walletParams;
|
|
233
299
|
const searchParams = {
|
|
234
300
|
// 基础钱包参数
|
|
235
|
-
sale_channel: params.sale_channel || (baseWalletParams == null ? void 0 : baseWalletParams.sale_channel),
|
|
301
|
+
sale_channel: params.sale_channel || (baseWalletParams == null ? void 0 : baseWalletParams.sale_channel) || "pos",
|
|
236
302
|
customer_id: params.customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.customer_id),
|
|
237
303
|
order_expect_amount: params.order_expect_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_expect_amount),
|
|
238
304
|
order_product_amount: params.order_product_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_product_amount),
|
|
@@ -244,6 +310,12 @@ var WalletPassPaymentImpl = class {
|
|
|
244
310
|
// 搜索特有参数
|
|
245
311
|
code: params.code
|
|
246
312
|
};
|
|
313
|
+
this.paymentModule.logInfo("[WalletPass] 搜索普通识别码", {
|
|
314
|
+
code: searchParams.code,
|
|
315
|
+
customer_id: searchParams.customer_id,
|
|
316
|
+
order_expect_amount: searchParams.order_expect_amount,
|
|
317
|
+
multiple: searchParams.multiple
|
|
318
|
+
});
|
|
247
319
|
const response = await this.paymentModule.request.post(
|
|
248
320
|
"/machinecode/prepare/deduction/search",
|
|
249
321
|
searchParams
|
|
@@ -270,18 +342,38 @@ var WalletPassPaymentImpl = class {
|
|
|
270
342
|
cachedSearchResults: [...this.searchResults],
|
|
271
343
|
searchParams: params
|
|
272
344
|
});
|
|
345
|
+
this.paymentModule.logInfo("[WalletPass] 普通识别码搜索完成", {
|
|
346
|
+
code: params.code,
|
|
347
|
+
results_count: searchResults.length,
|
|
348
|
+
cached_results_count: this.searchResults.length,
|
|
349
|
+
type: "normalCode"
|
|
350
|
+
});
|
|
273
351
|
return {
|
|
274
352
|
type: "normalCode",
|
|
275
353
|
data: searchResults
|
|
276
354
|
};
|
|
277
355
|
} catch (error) {
|
|
278
|
-
|
|
356
|
+
this.paymentModule.logError("[WalletPass] 搜索识别码信息失败", error, {
|
|
357
|
+
code: params.code,
|
|
358
|
+
customer_id: params.customer_id,
|
|
359
|
+
order_expect_amount: params.order_expect_amount
|
|
360
|
+
});
|
|
279
361
|
throw error;
|
|
280
362
|
}
|
|
281
363
|
}
|
|
282
364
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
365
|
+
this.paymentModule.logInfo("[WalletPass] 开始处理钱包支付", {
|
|
366
|
+
amount,
|
|
367
|
+
orderUuid,
|
|
368
|
+
voucherId: voucherId || "none"
|
|
369
|
+
});
|
|
283
370
|
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
284
371
|
if (!walletMethod) {
|
|
372
|
+
this.paymentModule.logError("[WalletPass] 钱包支付方式未找到", null, {
|
|
373
|
+
amount,
|
|
374
|
+
orderUuid,
|
|
375
|
+
voucherId
|
|
376
|
+
});
|
|
285
377
|
throw new Error("钱包支付方式未找到");
|
|
286
378
|
}
|
|
287
379
|
const paymentItem = {
|
|
@@ -293,6 +385,12 @@ var WalletPassPaymentImpl = class {
|
|
|
293
385
|
voucher_id: voucherId || ""
|
|
294
386
|
};
|
|
295
387
|
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
388
|
+
this.paymentModule.logInfo("[WalletPass] 钱包支付处理完成", {
|
|
389
|
+
amount,
|
|
390
|
+
orderUuid,
|
|
391
|
+
voucherId: voucherId || "none",
|
|
392
|
+
payment_method: walletMethod.name
|
|
393
|
+
});
|
|
296
394
|
}
|
|
297
395
|
async getWalletBalance(voucherId) {
|
|
298
396
|
return 0;
|
|
@@ -317,7 +415,7 @@ var WalletPassPaymentImpl = class {
|
|
|
317
415
|
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
318
416
|
clearedTypes: ["walletRecommendList"]
|
|
319
417
|
});
|
|
320
|
-
|
|
418
|
+
this.paymentModule.logInfo("[WalletPass] 钱包推荐列表已清除");
|
|
321
419
|
}
|
|
322
420
|
/**
|
|
323
421
|
* 清除用户识别码列表
|
|
@@ -327,7 +425,7 @@ var WalletPassPaymentImpl = class {
|
|
|
327
425
|
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
328
426
|
clearedTypes: ["userIdentificationCodes"]
|
|
329
427
|
});
|
|
330
|
-
|
|
428
|
+
this.paymentModule.logInfo("[WalletPass] 用户识别码列表已清除");
|
|
331
429
|
}
|
|
332
430
|
/**
|
|
333
431
|
* 获取缓存的搜索结果列表
|
|
@@ -346,7 +444,7 @@ var WalletPassPaymentImpl = class {
|
|
|
346
444
|
*/
|
|
347
445
|
clearSearchResults() {
|
|
348
446
|
this.searchResults = [];
|
|
349
|
-
|
|
447
|
+
this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
|
|
350
448
|
}
|
|
351
449
|
/**
|
|
352
450
|
* 清除所有缓存数据
|
|
@@ -359,7 +457,9 @@ var WalletPassPaymentImpl = class {
|
|
|
359
457
|
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
360
458
|
clearedTypes: ["all"]
|
|
361
459
|
});
|
|
362
|
-
|
|
460
|
+
this.paymentModule.logInfo("[WalletPass] 所有缓存数据已清除", {
|
|
461
|
+
cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
|
|
462
|
+
});
|
|
363
463
|
}
|
|
364
464
|
};
|
|
365
465
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -169,6 +169,15 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
169
169
|
schedule
|
|
170
170
|
}) {
|
|
171
171
|
var _a, _b, _c, _d;
|
|
172
|
+
if (schedule.start_time && schedule.end_time) {
|
|
173
|
+
const isBeforeStartTime = (0, import_dayjs.default)(date).isBefore(
|
|
174
|
+
(0, import_dayjs.default)(schedule.start_time)
|
|
175
|
+
);
|
|
176
|
+
const isAfterEndTime = (0, import_dayjs.default)(date).isAfter((0, import_dayjs.default)(schedule.end_time));
|
|
177
|
+
if (isBeforeStartTime || isAfterEndTime) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
172
181
|
let _schedule = {
|
|
173
182
|
...schedule,
|
|
174
183
|
// 开始时间向前推一天
|
|
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
314
314
|
}[];
|
|
315
315
|
setOtherData(key: string, value: any): void;
|
|
316
316
|
getOtherData(key: string): any;
|
|
317
|
-
getProductTypeById(id: number): Promise<"
|
|
317
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
318
318
|
/**
|
|
319
319
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
320
320
|
*
|
|
@@ -2,7 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { OrderModule } from '../../modules/Order';
|
|
4
4
|
import { PaymentModule } from '../../modules/Payment';
|
|
5
|
-
import { CheckoutModuleAPI,
|
|
5
|
+
import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
|
|
6
6
|
import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
|
|
7
7
|
export * from './types';
|
|
8
8
|
/**
|
|
@@ -64,24 +64,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
64
64
|
* 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
|
|
65
65
|
*/
|
|
66
66
|
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
67
|
-
/**
|
|
68
|
-
* 手动下单 (根据虚拟订单生成实际订单)
|
|
69
|
-
*
|
|
70
|
-
* 使用当前存储的本地订单数据调用 Order 模块创建真实订单
|
|
71
|
-
*/
|
|
72
|
-
placeOrderAsync(params?: PlaceOrderParams): Promise<{
|
|
73
|
-
success: boolean;
|
|
74
|
-
orderId?: string;
|
|
75
|
-
error?: string;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* 创建订单
|
|
79
|
-
*/
|
|
80
|
-
createOrderAsync(params: CreateOrderParams): Promise<PaymentOrder>;
|
|
81
|
-
/**
|
|
82
|
-
* 处理支付
|
|
83
|
-
*/
|
|
84
|
-
processPaymentAsync(params: ProcessPaymentParams): Promise<void>;
|
|
85
67
|
/**
|
|
86
68
|
* 完成结账
|
|
87
69
|
*/
|
|
@@ -89,28 +71,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
89
71
|
success: boolean;
|
|
90
72
|
orderId?: string;
|
|
91
73
|
}>;
|
|
92
|
-
/**
|
|
93
|
-
* 取消结账
|
|
94
|
-
*/
|
|
95
|
-
cancelCheckoutAsync(): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* 获取结账状态
|
|
98
|
-
*/
|
|
99
|
-
getCheckoutStatus(): CheckoutStatusInfo;
|
|
100
|
-
/**
|
|
101
|
-
* 获取结账摘要
|
|
102
|
-
*/
|
|
103
|
-
getCheckoutSummaryAsync(): Promise<CheckoutSummary>;
|
|
104
|
-
/**
|
|
105
|
-
* 获取可用支付方式
|
|
106
|
-
*/
|
|
107
|
-
getAvailablePaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
108
|
-
/**
|
|
109
|
-
* 刷新支付方式缓存
|
|
110
|
-
*
|
|
111
|
-
* 强制重新从服务器获取支付方式列表,更新本地缓存
|
|
112
|
-
*/
|
|
113
|
-
refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
114
74
|
/**
|
|
115
75
|
* 获取订单原始数据
|
|
116
76
|
*/
|
|
@@ -127,21 +87,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
127
87
|
* 返回当前订单的所有支付项,包括活跃和已撤销的支付项
|
|
128
88
|
*/
|
|
129
89
|
getCurrentOrderPaymentItemsAsync(): Promise<PaymentItem[]>;
|
|
130
|
-
/**
|
|
131
|
-
* 验证结账前置条件
|
|
132
|
-
*/
|
|
133
|
-
validateCheckoutAsync(): Promise<{
|
|
134
|
-
valid: boolean;
|
|
135
|
-
errors: string[];
|
|
136
|
-
}>;
|
|
137
|
-
/**
|
|
138
|
-
* 重试失败的操作
|
|
139
|
-
*/
|
|
140
|
-
retryFailedOperationAsync(): Promise<void>;
|
|
141
|
-
/**
|
|
142
|
-
* 设置当前步骤
|
|
143
|
-
*/
|
|
144
|
-
setCurrentStep(step: CheckoutStep): void;
|
|
145
90
|
/**
|
|
146
91
|
* 获取订单模块
|
|
147
92
|
*/
|
|
@@ -181,12 +126,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
181
126
|
* @returns 当前系统计算的待付金额
|
|
182
127
|
*/
|
|
183
128
|
getBalanceDueAmount(): string;
|
|
184
|
-
/**
|
|
185
|
-
* 刷新 stateAmount 为当前剩余未支付金额
|
|
186
|
-
*
|
|
187
|
-
* UI 可以调用此方法来主动刷新支付金额状态
|
|
188
|
-
*/
|
|
189
|
-
refreshStateAmountAsync(): Promise<void>;
|
|
190
129
|
/**
|
|
191
130
|
* 获取购物车小计数据
|
|
192
131
|
*
|
|
@@ -195,14 +134,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
195
134
|
* @returns 购物车小计数据数组,如果没有则返回 null
|
|
196
135
|
*/
|
|
197
136
|
getCartSummary(): CartSummaryItem[] | null;
|
|
198
|
-
/**
|
|
199
|
-
* 获取提取的金额详细信息
|
|
200
|
-
*
|
|
201
|
-
* 从当前的购物车小计数据中提取结构化的金额信息
|
|
202
|
-
*
|
|
203
|
-
* @returns 提取的金额信息对象,如果没有小计数据则返回 null
|
|
204
|
-
*/
|
|
205
|
-
getExtractedAmountInfo(): ExtractedAmountInfo | null;
|
|
206
137
|
/**
|
|
207
138
|
* 获取支付方式列表
|
|
208
139
|
*
|
|
@@ -251,34 +182,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
251
182
|
* @throws 当前没有活跃订单时抛出错误
|
|
252
183
|
*/
|
|
253
184
|
updateOrderDepositStatusAsync(isDeposit: number): Promise<void>;
|
|
254
|
-
/**
|
|
255
|
-
* 更新当前订单的客户信息
|
|
256
|
-
*
|
|
257
|
-
* 更新当前订单关联的客户信息,用于标识订单的所属客户
|
|
258
|
-
*
|
|
259
|
-
* @param customer 客户信息 (customer_id 和/或 customer_name)
|
|
260
|
-
* @throws 当前没有活跃订单时抛出错误
|
|
261
|
-
*/
|
|
262
|
-
updateOrderCustomerAsync(customer: {
|
|
263
|
-
customer_id?: string;
|
|
264
|
-
customer_name?: string;
|
|
265
|
-
}): Promise<void>;
|
|
266
|
-
/**
|
|
267
|
-
* 获取当前订单的客户信息
|
|
268
|
-
*
|
|
269
|
-
* @returns 当前客户信息,如果没有则返回 null
|
|
270
|
-
*/
|
|
271
|
-
getCurrentCustomer(): {
|
|
272
|
-
customer_id?: string;
|
|
273
|
-
customer_name?: string;
|
|
274
|
-
} | null;
|
|
275
|
-
/**
|
|
276
|
-
* 检查订单是否需要手动同步(异步版本)
|
|
277
|
-
*
|
|
278
|
-
* 返回订单是否为纯代金券支付且待付金额<=0但未同步的状态
|
|
279
|
-
* 从 Payment 模块获取最新的支付项数据
|
|
280
|
-
*/
|
|
281
|
-
needsManualSyncAsync(): Promise<boolean>;
|
|
282
185
|
/**
|
|
283
186
|
* 手动同步订单到后端
|
|
284
187
|
*
|
|
@@ -335,34 +238,12 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
335
238
|
orderUuid?: string;
|
|
336
239
|
response?: any;
|
|
337
240
|
}>;
|
|
338
|
-
/**
|
|
339
|
-
* 获取当前商店折扣金额
|
|
340
|
-
*
|
|
341
|
-
* @returns 当前的商店折扣金额,如果没有则返回0
|
|
342
|
-
*/
|
|
343
|
-
getShopDiscount(): number;
|
|
344
|
-
/**
|
|
345
|
-
* 更新订单商店折扣
|
|
346
|
-
*
|
|
347
|
-
* 同时更新cartSummary和localOrderData中的shop_discount值
|
|
348
|
-
*
|
|
349
|
-
* @param discountAmount 商店折扣金额
|
|
350
|
-
*/
|
|
351
|
-
updateShopDiscountAsync(discountAmount: number): Promise<void>;
|
|
352
241
|
/**
|
|
353
242
|
* 更新订单备注
|
|
354
243
|
*
|
|
355
244
|
* @param note 订单备注内容
|
|
356
245
|
*/
|
|
357
246
|
updateOrderNoteAsync(note: string): Promise<void>;
|
|
358
|
-
/**
|
|
359
|
-
* 设置状态
|
|
360
|
-
*/
|
|
361
|
-
private setStatus;
|
|
362
|
-
/**
|
|
363
|
-
* 设置步骤
|
|
364
|
-
*/
|
|
365
|
-
private setStep;
|
|
366
247
|
/**
|
|
367
248
|
* 处理错误
|
|
368
249
|
*/
|
|
@@ -386,14 +267,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
386
267
|
* @returns 处理后的支付项(包含找零信息)
|
|
387
268
|
*/
|
|
388
269
|
private processCashPaymentItem;
|
|
389
|
-
/**
|
|
390
|
-
* 判断是否为现金支付
|
|
391
|
-
*
|
|
392
|
-
* @param paymentCode 支付代码
|
|
393
|
-
* @param paymentType 支付类型
|
|
394
|
-
* @returns 是否为现金支付
|
|
395
|
-
*/
|
|
396
|
-
private isCashPayment;
|
|
397
270
|
/**
|
|
398
271
|
* 预加载支付方式(在初始化时调用)
|
|
399
272
|
*/
|
|
@@ -426,11 +299,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
426
299
|
* 当剩余待付款金额 <= 0 时,触发订单支付完成事件
|
|
427
300
|
*/
|
|
428
301
|
private checkOrderPaymentCompletion;
|
|
429
|
-
/**
|
|
430
|
-
* 同步订单到后端
|
|
431
|
-
*
|
|
432
|
-
* 调用后端 /order/checkout 接口创建真实订单
|
|
433
|
-
*/
|
|
434
302
|
/**
|
|
435
303
|
* 同步订单到后端并返回真实订单ID
|
|
436
304
|
*
|
|
@@ -439,11 +307,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
439
307
|
* @returns 包含订单ID、UUID和完整后端响应的对象
|
|
440
308
|
*/
|
|
441
309
|
private syncOrderToBackendWithReturn;
|
|
442
|
-
private syncOrderToBackend;
|
|
443
|
-
/**
|
|
444
|
-
* 获取状态消息
|
|
445
|
-
*/
|
|
446
|
-
private getStatusMessage;
|
|
447
310
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
448
311
|
cover?: boolean;
|
|
449
312
|
}): Promise<void>;
|
|
@@ -491,19 +354,4 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
491
354
|
* 在创建新订单前调用,确保状态完全干净
|
|
492
355
|
*/
|
|
493
356
|
private resetStoreStateAsync;
|
|
494
|
-
/**
|
|
495
|
-
* 手动清理已完成的订单状态(公开方法)
|
|
496
|
-
*
|
|
497
|
-
* 供UI层调用的公开方法,用于手动清理订单状态
|
|
498
|
-
*
|
|
499
|
-
* @returns 清理结果
|
|
500
|
-
*/
|
|
501
|
-
clearCompletedOrderAsync(): Promise<{
|
|
502
|
-
success: boolean;
|
|
503
|
-
message?: string;
|
|
504
|
-
clearedOrder?: {
|
|
505
|
-
uuid: string;
|
|
506
|
-
orderId: string;
|
|
507
|
-
} | null;
|
|
508
|
-
}>;
|
|
509
357
|
}
|