@pisell/pisellos 2.3.112 → 2.3.114
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Payment/index.d.ts +0 -5
- package/dist/modules/Payment/index.js +35 -85
- package/dist/modules/ResourcePlanner/planner.js +9 -5
- package/dist/modules/ResourcePlanner/types.d.ts +2 -1
- package/dist/server/index.js +4 -0
- package/dist/server/modules/payment/index.d.ts +25 -6
- package/dist/server/modules/payment/index.js +660 -133
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +1081 -1042
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +3 -3
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Payment/index.d.ts +0 -5
- package/lib/modules/Payment/index.js +3 -28
- package/lib/modules/ResourcePlanner/planner.js +9 -5
- package/lib/modules/ResourcePlanner/types.d.ts +2 -1
- package/lib/server/index.js +4 -0
- package/lib/server/modules/payment/index.d.ts +25 -6
- package/lib/server/modules/payment/index.js +350 -78
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +14 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +3 -3
- package/package.json +1 -1
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 |
|
|
329
|
+
weekNum: 0 | 2 | 3 | 1 | 5 | 6 | 4;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -127,8 +127,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
127
127
|
*/
|
|
128
128
|
clearSessionStorageOrderSnapshot(): void;
|
|
129
129
|
/**
|
|
130
|
-
* H5/Kiosk
|
|
131
|
-
*
|
|
130
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
131
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
132
132
|
*/
|
|
133
133
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
134
134
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -1904,8 +1904,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1904
1904
|
}
|
|
1905
1905
|
|
|
1906
1906
|
/**
|
|
1907
|
-
* H5/Kiosk
|
|
1908
|
-
*
|
|
1907
|
+
* PC/H5/Kiosk 结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1908
|
+
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1909
1909
|
*/
|
|
1910
1910
|
}, {
|
|
1911
1911
|
key: "shouldUseCheckoutSyncTask",
|
|
@@ -1914,7 +1914,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1914
1914
|
var configured = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.checkoutSyncTaskEnabled;
|
|
1915
1915
|
if (configured === true) return true;
|
|
1916
1916
|
var platform = normalizeRuntimePlatform((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform);
|
|
1917
|
-
return platform
|
|
1917
|
+
return !isCustomerUserPlatform(platform) && platform !== 'kiosk';
|
|
1918
1918
|
}
|
|
1919
1919
|
|
|
1920
1920
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -171,9 +171,9 @@ function buildBookingConfigQueryKey(params = {}) {
|
|
|
171
171
|
return JSON.stringify(sorted);
|
|
172
172
|
}
|
|
173
173
|
function resolveBookingConfigRequest(platform, params = {}) {
|
|
174
|
-
const
|
|
175
|
-
const endpoint =
|
|
176
|
-
const query =
|
|
174
|
+
const isCustomerPlatform = (0, _platform.isCustomerUserPlatform)(platform);
|
|
175
|
+
const endpoint = isCustomerPlatform ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
|
|
176
|
+
const query = isCustomerPlatform ? {
|
|
177
177
|
item_type: params.item_type || DEFAULT_BOOKING_CONFIG_PARAMS.item_type
|
|
178
178
|
} : {
|
|
179
179
|
...DEFAULT_BOOKING_CONFIG_PARAMS,
|
|
@@ -557,7 +557,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
557
557
|
generateIdempotencyToken(): string;
|
|
558
558
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
559
559
|
createOrder(params: CommitOrderParams['query']): {
|
|
560
|
-
type: "
|
|
560
|
+
type: "appointment_booking" | "virtual";
|
|
561
561
|
platform: string;
|
|
562
562
|
sales_channel: string;
|
|
563
563
|
order_sales_channel: string;
|
|
@@ -171,11 +171,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
171
171
|
* 获取钱包支付方式
|
|
172
172
|
*/
|
|
173
173
|
getWalletPaymentMethod(): Promise<PaymentMethod | null>;
|
|
174
|
-
/**
|
|
175
|
-
* 确保支付模块所需的数据库表已创建
|
|
176
|
-
*/
|
|
177
|
-
/** @deprecated */
|
|
178
|
-
private ensurePaymentTables;
|
|
179
174
|
/**
|
|
180
175
|
* 获取部分支付的订单
|
|
181
176
|
*/
|
|
@@ -159,10 +159,6 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
159
159
|
this.app = this.appPlugin.getApp();
|
|
160
160
|
this.dbManager = this.app.dbManager;
|
|
161
161
|
this.logger = this.app.logger;
|
|
162
|
-
|
|
163
|
-
// 确保支付模块所需的对象存储已创建
|
|
164
|
-
// await this.ensurePaymentTables();
|
|
165
|
-
|
|
166
162
|
this.registerNetworkHandlers();
|
|
167
163
|
|
|
168
164
|
// // 预连接数据库
|
|
@@ -1111,7 +1107,7 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
1111
1107
|
*/
|
|
1112
1108
|
async getCashPaymentMethod() {
|
|
1113
1109
|
try {
|
|
1114
|
-
const payMethods = await this.
|
|
1110
|
+
const payMethods = await this.getPayMethodListAsync();
|
|
1115
1111
|
return payMethods.find(method => method.code === _types.PaymentMethodType.Cash) || null;
|
|
1116
1112
|
} catch (error) {
|
|
1117
1113
|
console.error('[PaymentModule] 获取现金支付方式失败', error);
|
|
@@ -1124,7 +1120,7 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
1124
1120
|
*/
|
|
1125
1121
|
async getEftposPaymentMethod() {
|
|
1126
1122
|
try {
|
|
1127
|
-
const payMethods = await this.
|
|
1123
|
+
const payMethods = await this.getPayMethodListAsync();
|
|
1128
1124
|
return payMethods.find(method => method.code === _types.PaymentMethodType.Eftpos) || null;
|
|
1129
1125
|
} catch (error) {
|
|
1130
1126
|
console.error('[PaymentModule] 获取Eftpos支付方式失败', error);
|
|
@@ -1137,7 +1133,7 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
1137
1133
|
*/
|
|
1138
1134
|
async getWalletPaymentMethod() {
|
|
1139
1135
|
try {
|
|
1140
|
-
const payMethods = await this.
|
|
1136
|
+
const payMethods = await this.getPayMethodListAsync();
|
|
1141
1137
|
return payMethods.find(method => method.code === _types.PaymentMethodType.Wallet) || null;
|
|
1142
1138
|
} catch (error) {
|
|
1143
1139
|
console.error('[PaymentModule] 获取钱包支付方式失败', error);
|
|
@@ -1145,27 +1141,6 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
1145
1141
|
}
|
|
1146
1142
|
}
|
|
1147
1143
|
|
|
1148
|
-
/**
|
|
1149
|
-
* 确保支付模块所需的数据库表已创建
|
|
1150
|
-
*/
|
|
1151
|
-
/** @deprecated */
|
|
1152
|
-
async ensurePaymentTables() {
|
|
1153
|
-
try {
|
|
1154
|
-
// 尝试访问 pay_method 表,如果不存在会抛出错误
|
|
1155
|
-
await this.dbManager.getAll('pay_method');
|
|
1156
|
-
} catch (error) {
|
|
1157
|
-
console.warn('[PaymentModule] pay_method 表不存在,请在数据库配置中添加以下配置:');
|
|
1158
|
-
console.warn('{ name: "pay_method", keyPath: "id" }');
|
|
1159
|
-
}
|
|
1160
|
-
try {
|
|
1161
|
-
// 尝试访问 order 表,如果不存在会抛出错误
|
|
1162
|
-
await this.dbManager.getAll('order');
|
|
1163
|
-
} catch (error) {
|
|
1164
|
-
console.warn('[PaymentModule] order 表不存在,请在数据库配置中添加以下配置:');
|
|
1165
|
-
console.warn('{ name: "order", keyPath: "uuid" }');
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
1144
|
/**
|
|
1170
1145
|
* 获取部分支付的订单
|
|
1171
1146
|
*/
|
|
@@ -281,12 +281,14 @@ function evaluateCandidateTimeGate(params) {
|
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
if (policy.type === 'before_start') {
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
//
|
|
284
|
+
// POS fixed-duration candidates use the context's stable opening-minute
|
|
285
|
+
// anchor. Keep that anchored range selectable while it is still active;
|
|
286
|
+
// otherwise a minute refresh turns it into 0 capacity and incorrectly
|
|
287
|
+
// advances a create flow to the next slot. The earlier `past` gate still
|
|
288
|
+
// rejects the anchor once its booking range has ended.
|
|
289
|
+
const isActivePosDurationAnchor = evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration' && !product.isFlexibleDuration && evaluationContext.durationCandidateAnchorAtMs === candidateRange.start;
|
|
288
290
|
const usesMinutePrecision = product.isFlexibleDuration || evaluationContext.useExactDurationCandidateMinute && product.kind === 'duration';
|
|
289
|
-
const hasNotReachedStart = usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start;
|
|
291
|
+
const hasNotReachedStart = isActivePosDurationAnchor || (usesMinutePrecision ? floorToMinute(now) <= candidateRange.start : now < candidateRange.start);
|
|
290
292
|
if (hasNotReachedStart) return null;
|
|
291
293
|
return {
|
|
292
294
|
status: 'unavailable',
|
|
@@ -1249,6 +1251,7 @@ function buildAvailabilityCellIndex(projection) {
|
|
|
1249
1251
|
}
|
|
1250
1252
|
function buildEvaluationContext(params) {
|
|
1251
1253
|
const evaluatedAt = toDateTime(params.evaluatedAt || params.projection.meta.now, params.projection.meta.timezone);
|
|
1254
|
+
const durationCandidateAnchorAt = toDateTime(params.projection.meta.durationCandidateAnchorAt, params.projection.meta.timezone);
|
|
1252
1255
|
const selectionsByGroupKey = new Map();
|
|
1253
1256
|
(params.requirementSelections || []).forEach(selection => {
|
|
1254
1257
|
const key = selection.requirementGroupId || String(selection.formId ?? '');
|
|
@@ -1260,6 +1263,7 @@ function buildEvaluationContext(params) {
|
|
|
1260
1263
|
resourceIdSet: params.resourceIds?.length ? new Set(params.resourceIds.map(String)) : null,
|
|
1261
1264
|
selectionsByGroupKey,
|
|
1262
1265
|
useExactDurationCandidateMinute: params.useExactDurationCandidateMinute === true,
|
|
1266
|
+
durationCandidateAnchorAtMs: Number.isFinite(durationCandidateAnchorAt) ? floorToMinute(durationCandidateAnchorAt) : null,
|
|
1263
1267
|
allowExcludedScheduleDateOverride: params.allowExcludedScheduleDateOverride === true
|
|
1264
1268
|
};
|
|
1265
1269
|
}
|
|
@@ -253,7 +253,8 @@ export interface GetProductTimeRangesRuntimeOptions {
|
|
|
253
253
|
/**
|
|
254
254
|
* Internal POS capability: fixed-duration candidates start from the stable
|
|
255
255
|
* context anchor's current minute instead of rounding up to ten minutes, and
|
|
256
|
-
* that
|
|
256
|
+
* that anchored range remains selectable while active during before-start
|
|
257
|
+
* cutoff evaluation.
|
|
257
258
|
* Other callers keep the legacy alignment and strict second-level cutoff.
|
|
258
259
|
*/
|
|
259
260
|
useExactDurationCandidateMinute?: boolean;
|
package/lib/server/index.js
CHANGED
|
@@ -1296,6 +1296,10 @@ class Server {
|
|
|
1296
1296
|
method: 'get',
|
|
1297
1297
|
path: '/shop/pay/custom-payment/all',
|
|
1298
1298
|
handler: this.handlePaymentMethods.bind(this)
|
|
1299
|
+
}, {
|
|
1300
|
+
method: 'get',
|
|
1301
|
+
path: '/pay/custom-payment/all',
|
|
1302
|
+
handler: this.handlePaymentMethods.bind(this)
|
|
1299
1303
|
}, {
|
|
1300
1304
|
method: 'get',
|
|
1301
1305
|
path: '/shop/quotation/available',
|
|
@@ -7,22 +7,41 @@ export declare class PaymentServerModule extends BaseModule implements Module {
|
|
|
7
7
|
private request;
|
|
8
8
|
private app;
|
|
9
9
|
private logger;
|
|
10
|
+
private dbManager;
|
|
10
11
|
private store;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
12
|
+
private paymentDataSource;
|
|
13
|
+
private initialLoadInFlight;
|
|
14
|
+
private refreshInFlight;
|
|
15
|
+
private hasLoadedPayMethods;
|
|
16
|
+
private hasEmittedLoaded;
|
|
17
|
+
private syncTimer;
|
|
18
|
+
private pendingMessageUuids;
|
|
19
|
+
private queuedTrailingRefresh;
|
|
20
|
+
private trailingMessageUuids;
|
|
13
21
|
constructor(name?: string, version?: string);
|
|
14
22
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
23
|
+
preload(): Promise<void>;
|
|
15
24
|
getPayMethodListAsync(options?: {
|
|
16
25
|
shouldFilter?: boolean;
|
|
17
26
|
}): Promise<PaymentMethod[]>;
|
|
18
|
-
|
|
19
|
-
private
|
|
27
|
+
private ensureInitialPayMethods;
|
|
28
|
+
private initPaymentDataSource;
|
|
29
|
+
private setupPaymentMethodSync;
|
|
30
|
+
private schedulePaymentMethodRefresh;
|
|
31
|
+
private refreshPayMethodsSingleFlight;
|
|
32
|
+
private performRemoteRefresh;
|
|
20
33
|
private fetchRemotePayMethods;
|
|
21
|
-
private
|
|
34
|
+
private loadPayMethodsFromSQLite;
|
|
35
|
+
private replacePayMethodsInSQLite;
|
|
36
|
+
private resolveCurrentShopScope;
|
|
37
|
+
private stripSnapshotFields;
|
|
38
|
+
private arePayMethodsEqual;
|
|
22
39
|
private resolvePayMethods;
|
|
23
40
|
private filterPayMethods;
|
|
24
|
-
private
|
|
41
|
+
private setPayMethodMirror;
|
|
42
|
+
private getErrorMessage;
|
|
25
43
|
private logInfo;
|
|
26
44
|
private logWarning;
|
|
27
45
|
private logError;
|
|
46
|
+
destroy(): void;
|
|
28
47
|
}
|