@pisell/pisellos 2.2.309 → 2.2.311
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/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +21 -12
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +733 -373
- package/dist/modules/Order/types.d.ts +17 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +19 -5
- package/dist/modules/Order/utils.js +306 -86
- package/dist/modules/Payment/index.d.ts +0 -5
- package/dist/modules/Payment/index.js +35 -85
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/ProductList/index.js +18 -5
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/index.js +8 -5
- package/dist/server/modules/floor-plan/index.js +34 -3
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +12 -0
- package/dist/server/modules/payment/index.d.ts +25 -6
- package/dist/server/modules/payment/index.js +660 -133
- package/dist/server/utils/small-ticket.d.ts +8 -5
- package/dist/server/utils/small-ticket.js +1269 -199
- package/dist/solution/BaseSales/index.d.ts +11 -2
- package/dist/solution/BaseSales/index.js +1463 -1173
- package/dist/solution/BaseSales/types.d.ts +7 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingTicket/index.d.ts +11 -2
- package/dist/solution/BookingTicket/index.js +663 -542
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +5 -5
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/os-private-payload.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +11 -2
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +341 -71
- package/lib/modules/Order/types.d.ts +17 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +19 -5
- package/lib/modules/Order/utils.js +215 -13
- package/lib/modules/Payment/index.d.ts +0 -5
- package/lib/modules/Payment/index.js +3 -28
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/ProductList/index.js +14 -1
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/index.js +8 -5
- package/lib/server/modules/floor-plan/index.js +29 -1
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +12 -0
- package/lib/server/modules/payment/index.d.ts +25 -6
- package/lib/server/modules/payment/index.js +350 -78
- package/lib/server/utils/small-ticket.d.ts +8 -5
- package/lib/server/utils/small-ticket.js +1009 -121
- package/lib/solution/BaseSales/index.d.ts +11 -2
- package/lib/solution/BaseSales/index.js +164 -30
- package/lib/solution/BaseSales/types.d.ts +7 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingTicket/index.d.ts +11 -2
- package/lib/solution/BookingTicket/index.js +103 -41
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +5 -5
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/os-private-payload.js +22 -0
- package/package.json +1 -1
|
@@ -29,6 +29,10 @@ export interface RulesCalcDiscountOptions {
|
|
|
29
29
|
discountId?: number;
|
|
30
30
|
selectedList?: SetDiscountSelectedParams[];
|
|
31
31
|
scan?: boolean;
|
|
32
|
+
/** 本次扫码优先使用的次卡实例;普通重算不传,继续保留商品行当前选择。 */
|
|
33
|
+
preferredEntitlementPassIds?: number[];
|
|
34
|
+
/** 普通重算保留商品行已应用的次卡;最优选择传 false 恢复自动排序。 */
|
|
35
|
+
preserveEntitlementSelection?: boolean;
|
|
32
36
|
/** Change time 重报价目标行:允许已选编辑态折扣卡重新应用到这些 booking 商品。 */
|
|
33
37
|
reapplyBookingDiscountProductUids?: string[];
|
|
34
38
|
/** Reweighed order lines only: reapply selected wallet discounts against their new amount. */
|
package/dist/server/index.js
CHANGED
|
@@ -45,6 +45,7 @@ import { BaseSalesImpl } from "../solution/BaseSales";
|
|
|
45
45
|
import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity } from "../modules/Order/payment-utils";
|
|
46
46
|
import { finalizeSalesNotesForCheckout } from "../modules/Order/salesNotes";
|
|
47
47
|
import { normalizeOrderCollections } from "../modules/Order/utils/orderCollectionIdentity";
|
|
48
|
+
import { stripOsPrivatePayloadFields } from "../utils/os-private-payload";
|
|
48
49
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales } from "../modules/OpenData";
|
|
49
50
|
var OS_FULFILLMENT_REF_MODE_FIELD = '_os_fulfillment_ref_mode';
|
|
50
51
|
var OS_INVOICE_LAYOUT_CONFIG_FIELD = '_os_invoice_layout_config';
|
|
@@ -2574,7 +2575,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2574
2575
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
2575
2576
|
case 6:
|
|
2576
2577
|
numberedData = _context32.sent;
|
|
2577
|
-
checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
|
|
2578
|
+
checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
|
|
2578
2579
|
remoteCheckoutData = this.buildRemoteCheckoutData(checkoutData, title);
|
|
2579
2580
|
_context32.next = 11;
|
|
2580
2581
|
return this.buildCheckoutDeviceHeaders(title);
|
|
@@ -2676,11 +2677,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2676
2677
|
}, {
|
|
2677
2678
|
key: "buildRemoteCheckoutData",
|
|
2678
2679
|
value: function buildRemoteCheckoutData(data, title) {
|
|
2679
|
-
var next =
|
|
2680
|
+
var next = stripOsPrivatePayloadFields(this.omitCheckoutSyncMode(data));
|
|
2680
2681
|
if (!next || _typeof(next) !== 'object') return next;
|
|
2681
2682
|
var record = next;
|
|
2682
|
-
delete record[OS_FULFILLMENT_REF_MODE_FIELD];
|
|
2683
|
-
delete record[OS_INVOICE_LAYOUT_CONFIG_FIELD];
|
|
2684
2683
|
this.applyKioskCheckoutOperator(record);
|
|
2685
2684
|
if (!Array.isArray(record.payments)) return next;
|
|
2686
2685
|
var originalPayments = record.payments;
|
|
@@ -3543,6 +3542,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3543
3542
|
method: 'get',
|
|
3544
3543
|
path: '/shop/pay/custom-payment/all',
|
|
3545
3544
|
handler: this.handlePaymentMethods.bind(this)
|
|
3545
|
+
}, {
|
|
3546
|
+
method: 'get',
|
|
3547
|
+
path: '/pay/custom-payment/all',
|
|
3548
|
+
handler: this.handlePaymentMethods.bind(this)
|
|
3546
3549
|
}, {
|
|
3547
3550
|
method: 'get',
|
|
3548
3551
|
path: '/shop/quotation/available',
|
|
@@ -6414,7 +6417,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6414
6417
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
6415
6418
|
case 14:
|
|
6416
6419
|
numberedData = _context62.sent;
|
|
6417
|
-
checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
|
|
6420
|
+
checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
|
|
6418
6421
|
_context62.next = 18;
|
|
6419
6422
|
return this.handlePendingSyncCheckoutOrder({
|
|
6420
6423
|
backendPath: backendPath,
|
|
@@ -31,6 +31,33 @@ import { FloorPlanHooks } from "./types";
|
|
|
31
31
|
var FLOOR_PLAN_SYNC_DEBOUNCE_MS = 3000;
|
|
32
32
|
var FLOOR_PLAN_STORE_NAME = 'floor_plans';
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Request failures can be plain response objects (rather than Error instances).
|
|
36
|
+
* Keep diagnostics useful without allowing the UI bridge to stringify them as
|
|
37
|
+
* "[object Object]".
|
|
38
|
+
*/
|
|
39
|
+
function getRequestErrorInfo(error) {
|
|
40
|
+
var _ref, _ref2, _value$resData$res, _value$resData, _value$response, _response$code, _response$status, _value$response2;
|
|
41
|
+
if (error instanceof Error && error.message) return {
|
|
42
|
+
message: error.message
|
|
43
|
+
};
|
|
44
|
+
if (typeof error === 'string' && error) return {
|
|
45
|
+
message: error
|
|
46
|
+
};
|
|
47
|
+
var value = error;
|
|
48
|
+
var response = (_ref = (_ref2 = (_value$resData$res = value === null || value === void 0 || (_value$resData = value.resData) === null || _value$resData === void 0 ? void 0 : _value$resData.res) !== null && _value$resData$res !== void 0 ? _value$resData$res : value === null || value === void 0 || (_value$response = value.response) === null || _value$response === void 0 ? void 0 : _value$response.data) !== null && _ref2 !== void 0 ? _ref2 : value === null || value === void 0 ? void 0 : value.data) !== null && _ref !== void 0 ? _ref : value;
|
|
49
|
+
var candidates = [value === null || value === void 0 ? void 0 : value.message, value === null || value === void 0 ? void 0 : value.error, response === null || response === void 0 ? void 0 : response.message, response === null || response === void 0 ? void 0 : response.error];
|
|
50
|
+
var message = candidates.find(function (candidate) {
|
|
51
|
+
return typeof candidate === 'string' && candidate.trim() !== '';
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
message: message || '平面图加载失败(未提供错误详情)',
|
|
55
|
+
code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : value === null || value === void 0 ? void 0 : value.code,
|
|
56
|
+
status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : value === null || value === void 0 ? void 0 : value.status,
|
|
57
|
+
httpStatus: value === null || value === void 0 || (_value$response2 = value.response) === null || _value$response2 === void 0 ? void 0 : _value$response2.status
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
/**
|
|
35
62
|
* 平面图模块:预加载列表、pubsub 同步、供 OS Server 路由读本地 store
|
|
36
63
|
*/
|
|
@@ -230,7 +257,7 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
230
257
|
key: "loadListFromServer",
|
|
231
258
|
value: function () {
|
|
232
259
|
var _loadListFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
233
|
-
var res, body, raw, list;
|
|
260
|
+
var res, body, raw, list, errorInfo;
|
|
234
261
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
235
262
|
while (1) switch (_context2.prev = _context2.next) {
|
|
236
263
|
case 0:
|
|
@@ -248,11 +275,15 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
248
275
|
case 10:
|
|
249
276
|
_context2.prev = 10;
|
|
250
277
|
_context2.t0 = _context2["catch"](0);
|
|
278
|
+
errorInfo = getRequestErrorInfo(_context2.t0);
|
|
251
279
|
this.logWarning('loadListFromServer 失败', {
|
|
252
|
-
error:
|
|
280
|
+
error: errorInfo.message,
|
|
281
|
+
code: errorInfo.code,
|
|
282
|
+
status: errorInfo.status,
|
|
283
|
+
httpStatus: errorInfo.httpStatus
|
|
253
284
|
});
|
|
254
285
|
return _context2.abrupt("return", []);
|
|
255
|
-
case
|
|
286
|
+
case 15:
|
|
256
287
|
case "end":
|
|
257
288
|
return _context2.stop();
|
|
258
289
|
}
|
|
@@ -3302,6 +3302,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3302
3302
|
mergedRecord[_field] = cloneDeep(incomingRecord[_field]);
|
|
3303
3303
|
}
|
|
3304
3304
|
|
|
3305
|
+
// order_meta_list 是一次性生成的完整业务快照。incoming 明确携带时
|
|
3306
|
+
// 必须整体覆盖(包括 null / 空对象 / 空数组);省略时才保留 existing。
|
|
3307
|
+
if (Object.prototype.hasOwnProperty.call(incomingRecord, 'order_meta_list')) {
|
|
3308
|
+
mergedRecord.order_meta_list = cloneDeep(incomingRecord.order_meta_list);
|
|
3309
|
+
}
|
|
3310
|
+
|
|
3305
3311
|
// 子项数组遵循完整快照语义:incoming 自有且为数组(包括 [])时权威替换;
|
|
3306
3312
|
// 字段缺席或不是数组时视为稀疏 patch,继续保留 existing。
|
|
3307
3313
|
for (var _i6 = 0, _ORDER_AUTHORITATIVE_2 = ORDER_AUTHORITATIVE_COLLECTION_FIELDS; _i6 < _ORDER_AUTHORITATIVE_2.length; _i6++) {
|
|
@@ -36,6 +36,8 @@ export type OrderSurchargeType = string;
|
|
|
36
36
|
export interface OrderProductDiscountMetadata {
|
|
37
37
|
/** 设备端本地唯一标识,用于与服务端记录对齐 */
|
|
38
38
|
unique_identification_number?: string;
|
|
39
|
+
/** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
|
|
40
|
+
balance?: number | null;
|
|
39
41
|
[key: string]: unknown;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
@@ -452,10 +454,20 @@ export interface OrderData {
|
|
|
452
454
|
id: number | string;
|
|
453
455
|
tag: 'point_card';
|
|
454
456
|
product_id?: number | string;
|
|
457
|
+
code?: string;
|
|
455
458
|
product_name: string;
|
|
456
459
|
par_value: string;
|
|
457
460
|
used_par_value: string;
|
|
458
461
|
}>;
|
|
462
|
+
virtual_currency_snapshot?: Array<{
|
|
463
|
+
id: number | string;
|
|
464
|
+
tag: 'virtual_currency';
|
|
465
|
+
product_id?: number | string;
|
|
466
|
+
product_name: string;
|
|
467
|
+
par_value: string;
|
|
468
|
+
used_par_value: string;
|
|
469
|
+
name: Record<string, string>;
|
|
470
|
+
}>;
|
|
459
471
|
};
|
|
460
472
|
/**
|
|
461
473
|
* 金额汇总(仅输出)。
|
|
@@ -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
|
}
|