@pisell/pisellos 2.3.29 → 2.3.30
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/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Discount/index.d.ts +2 -5
- package/dist/modules/Discount/index.js +7 -30
- package/dist/modules/Discount/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +28 -10
- package/dist/modules/Order/index.js +747 -498
- package/dist/modules/Order/payment-utils.d.ts +23 -0
- package/dist/modules/Order/payment-utils.js +203 -0
- package/dist/modules/Order/types.d.ts +33 -3
- package/dist/modules/Order/utils.js +4 -4
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +78 -49
- package/dist/modules/Payment/types.d.ts +26 -24
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +0 -22
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -4
- package/dist/modules/ProductList/types.d.ts +0 -2
- package/dist/server/index.d.ts +14 -50
- package/dist/server/index.js +1975 -1395
- package/dist/server/modules/order/index.d.ts +40 -3
- package/dist/server/modules/order/index.js +1200 -501
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/server/modules/products/index.d.ts +7 -26
- package/dist/server/modules/products/index.js +76 -167
- package/dist/server/modules/products/types.d.ts +0 -14
- package/dist/solution/BaseSales/index.d.ts +33 -5
- package/dist/solution/BaseSales/index.js +622 -345
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -1
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/modules/Discount/index.d.ts +2 -5
- package/lib/modules/Discount/index.js +3 -23
- package/lib/modules/Discount/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +28 -10
- package/lib/modules/Order/index.js +181 -73
- package/lib/modules/Order/payment-utils.d.ts +23 -0
- package/lib/modules/Order/payment-utils.js +193 -0
- package/lib/modules/Order/types.d.ts +33 -3
- package/lib/modules/Order/utils.js +2 -3
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +33 -12
- package/lib/modules/Payment/types.d.ts +26 -24
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +0 -22
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -4
- package/lib/modules/ProductList/types.d.ts +0 -2
- package/lib/server/index.d.ts +14 -50
- package/lib/server/index.js +633 -214
- package/lib/server/modules/order/index.d.ts +40 -3
- package/lib/server/modules/order/index.js +434 -31
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/server/modules/products/index.d.ts +7 -26
- package/lib/server/modules/products/index.js +35 -114
- package/lib/server/modules/products/types.d.ts +0 -14
- package/lib/solution/BaseSales/index.d.ts +33 -5
- package/lib/solution/BaseSales/index.js +170 -19
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
|
@@ -309,7 +309,6 @@ export interface OrderState {
|
|
|
309
309
|
lastOrderInfo?: Record<string, any>;
|
|
310
310
|
syncState?: OrderSyncState;
|
|
311
311
|
discountList: any[];
|
|
312
|
-
availableWalletIds?: number[];
|
|
313
312
|
discount: DiscountModule | null;
|
|
314
313
|
rules: RulesModule | null;
|
|
315
314
|
}
|
|
@@ -468,6 +467,8 @@ export interface SubmitSalesOrderParams {
|
|
|
468
467
|
export interface PaymentItemData {
|
|
469
468
|
/** 当前支付项的唯一 ID */
|
|
470
469
|
uuid: string;
|
|
470
|
+
/** 支付项稳定唯一号 */
|
|
471
|
+
payment_number?: string;
|
|
471
472
|
/** 当前支付方式付出去多少钱 */
|
|
472
473
|
amount: string;
|
|
473
474
|
/** 支付类型代码 */
|
|
@@ -490,13 +491,22 @@ export interface PaymentItemData {
|
|
|
490
491
|
export interface OrderPaymentMetadata {
|
|
491
492
|
rounding_rule?: Record<string, any>;
|
|
492
493
|
unique_payment_number?: string;
|
|
494
|
+
/** 刷卡机设备快照;OS 不解析内部字段,仅透传并持久化 */
|
|
495
|
+
card_reader_snapshot?: Record<string, unknown>;
|
|
493
496
|
shop_wallet_pass_id?: number | string;
|
|
494
497
|
actual_paid_amount?: number | string;
|
|
495
498
|
change_given_amount?: number | string;
|
|
499
|
+
transactions?: OrderPaymentTransaction[];
|
|
496
500
|
[key: string]: any;
|
|
497
501
|
}
|
|
502
|
+
export interface OrderPaymentTransaction {
|
|
503
|
+
number: string;
|
|
504
|
+
status: 'success' | 'fail';
|
|
505
|
+
}
|
|
498
506
|
export interface OrderPaymentData {
|
|
499
507
|
order_payment_id?: number | string;
|
|
508
|
+
/** 支付项稳定唯一号;历史支付项允许缺失 */
|
|
509
|
+
payment_number?: string;
|
|
500
510
|
amount: string;
|
|
501
511
|
code: string;
|
|
502
512
|
custom_payment_id: number;
|
|
@@ -523,6 +533,15 @@ export interface OrderPaymentData {
|
|
|
523
533
|
created_at?: string;
|
|
524
534
|
updated_at?: string;
|
|
525
535
|
}
|
|
536
|
+
export interface OrderPaymentUpdateOptions {
|
|
537
|
+
matchBy?: 'payment_number' | 'compat' | 'legacy';
|
|
538
|
+
}
|
|
539
|
+
export interface OrderPaymentUpdateResult {
|
|
540
|
+
updated: boolean;
|
|
541
|
+
payment: OrderPaymentData | null;
|
|
542
|
+
payments: OrderPaymentData[];
|
|
543
|
+
summary: OrderSummary | null;
|
|
544
|
+
}
|
|
526
545
|
export type OrderPaymentSource = PaymentItem | OrderPaymentData | Record<string, any>;
|
|
527
546
|
export interface MapOrderPaymentsOptions {
|
|
528
547
|
includeVoided?: boolean;
|
|
@@ -673,6 +692,14 @@ export interface OrderModuleAPI {
|
|
|
673
692
|
channel?: string;
|
|
674
693
|
type?: string;
|
|
675
694
|
}) => OrderSubmitPayload;
|
|
695
|
+
saveTempOrderAsDraft: <T = any>(params?: {
|
|
696
|
+
cacheId?: string;
|
|
697
|
+
platform?: string;
|
|
698
|
+
businessCode?: string;
|
|
699
|
+
channel?: string;
|
|
700
|
+
type?: string;
|
|
701
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
702
|
+
}) => Promise<T>;
|
|
676
703
|
applyLocalPrintOrderNumbers: (order?: Record<string, any> | null) => Promise<OrderTempOrder>;
|
|
677
704
|
getTempOrderNote: () => string;
|
|
678
705
|
updateTempOrderNote: {
|
|
@@ -730,11 +757,15 @@ export interface OrderModuleAPI {
|
|
|
730
757
|
getOrderPayments: () => OrderPaymentData[];
|
|
731
758
|
setOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
732
759
|
addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
|
|
733
|
-
|
|
760
|
+
addOrderPaymentAsync: (payment: OrderPaymentSource) => Promise<OrderPaymentData[]>;
|
|
761
|
+
updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions) => Promise<OrderPaymentUpdateResult>;
|
|
734
762
|
deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
|
|
735
763
|
updateVoucherOrderPayments: (payments: OrderPaymentSource[], options?: {
|
|
736
764
|
status?: 'paid' | 'payment_pending';
|
|
737
765
|
}) => OrderPaymentData[];
|
|
766
|
+
updateVoucherOrderPaymentsAsync: (payments: OrderPaymentSource[], options?: {
|
|
767
|
+
status?: 'paid' | 'payment_pending';
|
|
768
|
+
}) => Promise<OrderPaymentData[]>;
|
|
738
769
|
confirmPendingVoucherPayments: (options?: {
|
|
739
770
|
persist?: boolean;
|
|
740
771
|
recalculateSummary?: boolean;
|
|
@@ -776,7 +807,6 @@ export interface OrderModuleAPI {
|
|
|
776
807
|
apply?: boolean;
|
|
777
808
|
}) => Promise<Discount[]>;
|
|
778
809
|
getDiscountList: () => Discount[];
|
|
779
|
-
getAvailableWalletIds: () => number[];
|
|
780
810
|
applyDiscount: () => void;
|
|
781
811
|
/**
|
|
782
812
|
* 注入促销评估器。
|
|
@@ -1020,9 +1020,7 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1020
1020
|
const item = paymentItem;
|
|
1021
1021
|
const customPaymentId = item.custom_payment_id ?? item.id;
|
|
1022
1022
|
const metadata = item.metadata && typeof item.metadata === "object" ? { ...item.metadata } : {};
|
|
1023
|
-
|
|
1024
|
-
metadata.unique_payment_number = String(item.uuid);
|
|
1025
|
-
}
|
|
1023
|
+
const paymentNumber = item.payment_number;
|
|
1026
1024
|
const paymentMetadataKeys = [
|
|
1027
1025
|
"rounding_rule",
|
|
1028
1026
|
"shop_wallet_pass_id",
|
|
@@ -1039,6 +1037,7 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1039
1037
|
const createdAt = item.created_at ?? timestamp;
|
|
1040
1038
|
return {
|
|
1041
1039
|
...item.order_payment_id !== void 0 ? { order_payment_id: item.order_payment_id } : {},
|
|
1040
|
+
...paymentNumber !== void 0 && paymentNumber !== null && paymentNumber !== "" ? { payment_number: String(paymentNumber) } : {},
|
|
1042
1041
|
amount: String(item.amount ?? "0.00"),
|
|
1043
1042
|
code: String(item.code || ""),
|
|
1044
1043
|
custom_payment_id: Number(customPaymentId ?? 0),
|
|
@@ -20,6 +20,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
20
20
|
protected defaultVersion: string;
|
|
21
21
|
request: RequestPlugin;
|
|
22
22
|
private app;
|
|
23
|
+
private appPlugin;
|
|
23
24
|
private store;
|
|
24
25
|
window: WindowPlugin;
|
|
25
26
|
private dbManager;
|
|
@@ -40,6 +41,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
40
41
|
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
41
42
|
*/
|
|
42
43
|
updateOtherParams(params: Record<string, any>): void;
|
|
44
|
+
private getPaymentNumberAppData;
|
|
43
45
|
/**
|
|
44
46
|
* 记录信息日志
|
|
45
47
|
*/
|
|
@@ -31,6 +31,9 @@ var import_cash = require("./cash");
|
|
|
31
31
|
var import_eftpos = require("./eftpos");
|
|
32
32
|
var import_walletpass = require("./walletpass");
|
|
33
33
|
var import_decimal = require("decimal.js");
|
|
34
|
+
var import_payment_utils = require("../Order/payment-utils");
|
|
35
|
+
var import_utils2 = require("../Order/utils");
|
|
36
|
+
var import_payment_number = require("../../utils/payment-number");
|
|
34
37
|
__reExport(Payment_exports, require("./types"), module.exports);
|
|
35
38
|
function formatAmount(amount) {
|
|
36
39
|
try {
|
|
@@ -112,15 +115,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
112
115
|
this.store = options.store;
|
|
113
116
|
this.otherParams = options.otherParams || {};
|
|
114
117
|
this.request = core.getPlugin("request");
|
|
115
|
-
|
|
118
|
+
this.appPlugin = core.getPlugin("app");
|
|
116
119
|
this.window = core.getPlugin("window");
|
|
117
120
|
if (!this.request) {
|
|
118
121
|
throw new Error("支付模块需要 request 插件支持");
|
|
119
122
|
}
|
|
120
|
-
if (!appPlugin) {
|
|
123
|
+
if (!this.appPlugin) {
|
|
121
124
|
throw new Error("支付模块需要 app 插件支持");
|
|
122
125
|
}
|
|
123
|
-
this.app = appPlugin.getApp();
|
|
126
|
+
this.app = this.appPlugin.getApp();
|
|
124
127
|
this.dbManager = this.app.dbManager;
|
|
125
128
|
this.logger = this.app.logger;
|
|
126
129
|
this.registerNetworkHandlers();
|
|
@@ -136,6 +139,14 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
136
139
|
updateOtherParams(params) {
|
|
137
140
|
this.otherParams = params || {};
|
|
138
141
|
}
|
|
142
|
+
getPaymentNumberAppData(key) {
|
|
143
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
+
const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
|
|
145
|
+
if (typeof getData === "function")
|
|
146
|
+
return getData(key);
|
|
147
|
+
const coreData = (_g = (_e = (_d = (_c = this.app) == null ? void 0 : _c.models) == null ? void 0 : _d.getStore) == null ? void 0 : (_f = _e.call(_d)).getDataByModel) == null ? void 0 : _g.call(_f, "core", "core");
|
|
148
|
+
return coreData == null ? void 0 : coreData[key];
|
|
149
|
+
}
|
|
139
150
|
/**
|
|
140
151
|
* 记录信息日志
|
|
141
152
|
*/
|
|
@@ -521,15 +532,20 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
521
532
|
});
|
|
522
533
|
throw new Error(warningMessage);
|
|
523
534
|
}
|
|
524
|
-
|
|
525
|
-
if ((_a = paymentItem.metadata) == null ? void 0 : _a.unique_payment_number) {
|
|
526
|
-
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
527
|
-
} else {
|
|
528
|
-
paymentUuid = (0, import_utils.getUniqueId)("payment_");
|
|
529
|
-
}
|
|
535
|
+
const paymentUuid = paymentItem.uuid || ((_a = paymentItem.metadata) == null ? void 0 : _a.unique_payment_number) || (0, import_utils.getUniqueId)("payment_");
|
|
530
536
|
const currentTime = formatDateTime(/* @__PURE__ */ new Date());
|
|
537
|
+
const hasPaymentNumber = String(paymentItem.payment_number || "").trim() !== "";
|
|
538
|
+
const paymentNumberDevicePrefix = hasPaymentNumber ? "LOCAL" : await (0, import_payment_number.resolvePaymentNumberDevicePrefix)(
|
|
539
|
+
(key) => this.getPaymentNumberAppData(key)
|
|
540
|
+
);
|
|
541
|
+
const paymentNumber = (0, import_payment_utils.ensureOrderPaymentNumber)(
|
|
542
|
+
paymentItem,
|
|
543
|
+
paymentNumberDevicePrefix,
|
|
544
|
+
import_utils2.createUuidV4
|
|
545
|
+
).payment_number;
|
|
531
546
|
const newPaymentItem = {
|
|
532
547
|
uuid: paymentUuid,
|
|
548
|
+
payment_number: paymentNumber,
|
|
533
549
|
custom_payment_id: normalizeCustomPaymentId(paymentItem),
|
|
534
550
|
name: paymentItem.name,
|
|
535
551
|
code: paymentItem.code,
|
|
@@ -549,10 +565,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
549
565
|
updated_at: currentTime,
|
|
550
566
|
// 更新时间
|
|
551
567
|
metadata: {
|
|
552
|
-
...paymentItem.metadata
|
|
568
|
+
...paymentItem.metadata
|
|
553
569
|
// 保留传入的所有 metadata 字段
|
|
554
|
-
unique_payment_number: paymentUuid
|
|
555
|
-
// 设置唯一支付号为支付项的 uuid
|
|
556
570
|
}
|
|
557
571
|
};
|
|
558
572
|
order.payment.push(newPaymentItem);
|
|
@@ -767,6 +781,12 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
767
781
|
if ("amount" in formattedParams && formattedParams.amount !== void 0) {
|
|
768
782
|
formattedParams.amount = formatAmount(formattedParams.amount);
|
|
769
783
|
}
|
|
784
|
+
if (formattedParams.metadata && typeof formattedParams.metadata === "object") {
|
|
785
|
+
formattedParams.metadata = {
|
|
786
|
+
...paymentItem.metadata || {},
|
|
787
|
+
...formattedParams.metadata
|
|
788
|
+
};
|
|
789
|
+
}
|
|
770
790
|
Object.assign(paymentItem, formattedParams);
|
|
771
791
|
this.recalculateOrderAmount(order);
|
|
772
792
|
await this.dbManager.update("order", order);
|
|
@@ -824,6 +844,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
824
844
|
const paymentData = {
|
|
825
845
|
payments: order.payment.map((payment) => ({
|
|
826
846
|
uuid: payment.uuid,
|
|
847
|
+
payment_number: payment.payment_number,
|
|
827
848
|
amount: payment.amount,
|
|
828
849
|
code: payment.code,
|
|
829
850
|
custom_payment_id: payment.custom_payment_id,
|
|
@@ -87,12 +87,30 @@ export interface PaymentMethod {
|
|
|
87
87
|
/** 其他配置信息 */
|
|
88
88
|
[key: string]: any;
|
|
89
89
|
}
|
|
90
|
+
/** 支付项扩展元数据 */
|
|
91
|
+
export interface PaymentItemMetadata {
|
|
92
|
+
/** 钱箱 ID */
|
|
93
|
+
shop_wallet_pass_id?: string;
|
|
94
|
+
/** 三方支付交易流水号 */
|
|
95
|
+
unique_payment_number?: string;
|
|
96
|
+
/** 刷卡机设备快照;PaymentModule 不解析内部字段 */
|
|
97
|
+
card_reader_snapshot?: Record<string, unknown>;
|
|
98
|
+
/** rounding 规则 */
|
|
99
|
+
rounding_rule?: any;
|
|
100
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
101
|
+
actual_paid_amount?: number;
|
|
102
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
103
|
+
change_given_amount?: number;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
90
106
|
/**
|
|
91
107
|
* 支付项
|
|
92
108
|
*/
|
|
93
109
|
export interface PaymentItem {
|
|
94
110
|
/** 当前支付项的唯一 ID */
|
|
95
111
|
uuid: string;
|
|
112
|
+
/** 支付项稳定唯一号 */
|
|
113
|
+
payment_number?: string;
|
|
96
114
|
/** 当前支付方式付出去多少钱 */
|
|
97
115
|
amount: string;
|
|
98
116
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -110,18 +128,7 @@ export interface PaymentItem {
|
|
|
110
128
|
/** Wallet Pass 本次使用值 */
|
|
111
129
|
wallet_pass_use_value?: string | number | null;
|
|
112
130
|
/** 拓展参数字段 */
|
|
113
|
-
metadata?:
|
|
114
|
-
/** 钱箱 ID */
|
|
115
|
-
shop_wallet_pass_id?: string;
|
|
116
|
-
/** 唯一支付号 */
|
|
117
|
-
unique_payment_number?: string;
|
|
118
|
-
/** rouding规则 */
|
|
119
|
-
rounding_rule?: any;
|
|
120
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
121
|
-
actual_paid_amount?: number;
|
|
122
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
123
|
-
change_given_amount?: number;
|
|
124
|
-
};
|
|
131
|
+
metadata?: PaymentItemMetadata;
|
|
125
132
|
/** rouding金额 */
|
|
126
133
|
rounding_amount?: string;
|
|
127
134
|
/** 三方支付手续费 */
|
|
@@ -228,6 +235,10 @@ export interface UpdateOrderParams {
|
|
|
228
235
|
* 支付项输入类型(允许 amount 为数字)
|
|
229
236
|
*/
|
|
230
237
|
export interface PaymentItemInput {
|
|
238
|
+
/** 调用方已有的支付项运行态 UUID;存在时复用为 payment_number 的唯一号段 */
|
|
239
|
+
uuid?: string;
|
|
240
|
+
/** 支付项稳定唯一号 */
|
|
241
|
+
payment_number?: string;
|
|
231
242
|
/** 当前支付方式付出去多少钱 */
|
|
232
243
|
amount: string | number;
|
|
233
244
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -256,18 +267,7 @@ export interface PaymentItemInput {
|
|
|
256
267
|
/** 订单支付类型 */
|
|
257
268
|
order_payment_type?: 'normal' | 'deposit';
|
|
258
269
|
/** 扩展参数字段 */
|
|
259
|
-
metadata?:
|
|
260
|
-
/** 钱箱 ID */
|
|
261
|
-
shop_wallet_pass_id?: string;
|
|
262
|
-
/** 唯一支付号 */
|
|
263
|
-
unique_payment_number?: string;
|
|
264
|
-
/** rounding规则 */
|
|
265
|
-
rounding_rule?: any;
|
|
266
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
267
|
-
actual_paid_amount?: number;
|
|
268
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
269
|
-
change_given_amount?: number;
|
|
270
|
-
};
|
|
270
|
+
metadata?: PaymentItemMetadata;
|
|
271
271
|
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
272
272
|
created_at?: string;
|
|
273
273
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
@@ -302,6 +302,8 @@ export interface PaymentUpdateFields {
|
|
|
302
302
|
voucher_id?: string;
|
|
303
303
|
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
304
304
|
isSynced?: boolean;
|
|
305
|
+
/** 支付项扩展元数据;更新时与原 metadata 浅合并 */
|
|
306
|
+
metadata?: PaymentItemMetadata;
|
|
305
307
|
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
306
308
|
syncError?: {
|
|
307
309
|
error: string;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -9,26 +9,6 @@ export interface ProductCollection {
|
|
|
9
9
|
/** 商品集合封面 */
|
|
10
10
|
cover: string;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
|
|
14
|
-
*/
|
|
15
|
-
export interface ProductDataVariant {
|
|
16
|
-
/** 变体记录 id */
|
|
17
|
-
id: number;
|
|
18
|
-
/** 店铺 id */
|
|
19
|
-
shop_id: number;
|
|
20
|
-
/** 所属模块,商品场景固定为 product */
|
|
21
|
-
module: string;
|
|
22
|
-
/** 模块数据 id,商品场景对应 product.id */
|
|
23
|
-
module_data_id: number;
|
|
24
|
-
/** 关联 data_variant_rule.id */
|
|
25
|
-
data_variant_rule_id: number;
|
|
26
|
-
/** 命中策略后覆盖到商品上的字段 */
|
|
27
|
-
data: Record<string, any>;
|
|
28
|
-
created_at: string | null;
|
|
29
|
-
updated_at: string | null;
|
|
30
|
-
deleted_at: string | null;
|
|
31
|
-
}
|
|
32
12
|
/**
|
|
33
13
|
* 商品基本信息接口
|
|
34
14
|
*/
|
|
@@ -234,8 +214,6 @@ export interface ProductData {
|
|
|
234
214
|
bundle_group_count: number;
|
|
235
215
|
/** 选项组数量 */
|
|
236
216
|
option_group_count: number;
|
|
237
|
-
/** 智能定价变体列表,/product/query with dataVariants 返回 */
|
|
238
|
-
data_variants?: ProductDataVariant[];
|
|
239
217
|
/** 服务时长 */
|
|
240
218
|
service_times?: any;
|
|
241
219
|
}
|
|
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
26
26
|
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
27
27
|
*/
|
|
28
28
|
getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
|
|
29
|
-
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status,
|
|
29
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, }?: ProductListLoadProductsParams, options?: {
|
|
30
30
|
callback?: (result: any) => void;
|
|
31
31
|
subscriberId?: string;
|
|
32
32
|
}): Promise<any>;
|
|
@@ -95,8 +95,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
95
95
|
cacheId,
|
|
96
96
|
with_schedule,
|
|
97
97
|
extension_type,
|
|
98
|
-
status = "published"
|
|
99
|
-
strategy_context
|
|
98
|
+
status = "published"
|
|
100
99
|
} = {}, options) {
|
|
101
100
|
var _a, _b;
|
|
102
101
|
let userPlugin = this.core.getPlugin("user");
|
|
@@ -136,8 +135,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
136
135
|
is_eject: 1,
|
|
137
136
|
with_schedule,
|
|
138
137
|
schedule_datetime,
|
|
139
|
-
extension_type
|
|
140
|
-
strategy_context
|
|
138
|
+
extension_type
|
|
141
139
|
},
|
|
142
140
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
143
141
|
} }
|
|
@@ -12,8 +12,6 @@ export interface ProductListLoadProductsParams {
|
|
|
12
12
|
with_schedule?: number;
|
|
13
13
|
extension_type?: string[];
|
|
14
14
|
status?: string;
|
|
15
|
-
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
-
strategy_context?: Record<string, any>;
|
|
17
15
|
}
|
|
18
16
|
export interface ProductListData {
|
|
19
17
|
list: ProductData[];
|
package/lib/server/index.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
-
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
-
private productQueryScheduleTimers;
|
|
52
50
|
private orderQuerySubscribers;
|
|
53
51
|
private bookingQuerySubscribers;
|
|
54
52
|
private bookingRemoteQuerySubscribers;
|
|
@@ -57,6 +55,7 @@ declare class Server {
|
|
|
57
55
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
58
56
|
private salesSearchSubscribers;
|
|
59
57
|
private deviceTaskActionsRegistered;
|
|
58
|
+
private localPaymentUpdateQueues;
|
|
60
59
|
private floorPlanQuerySubscribers;
|
|
61
60
|
private moduleRegistry;
|
|
62
61
|
constructor(core: PisellCore);
|
|
@@ -212,48 +211,6 @@ declare class Server {
|
|
|
212
211
|
* 根据 subscriberId 移除商品查询订阅者
|
|
213
212
|
*/
|
|
214
213
|
removeProductQuerySubscriber(subscriberId?: string): void;
|
|
215
|
-
/**
|
|
216
|
-
* 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
|
|
217
|
-
*/
|
|
218
|
-
private buildProductQueryResultPayload;
|
|
219
|
-
/**
|
|
220
|
-
* 是否启用商品 query 订阅的 schedule 时间点定时重算。
|
|
221
|
-
* strategy_context.enable_schedule_reload === false 时关闭。
|
|
222
|
-
*/
|
|
223
|
-
private shouldScheduleProductQueryReload;
|
|
224
|
-
/**
|
|
225
|
-
* 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
|
|
226
|
-
*/
|
|
227
|
-
private clearSubscriberScheduleTimers;
|
|
228
|
-
/**
|
|
229
|
-
* 从 productQueryScheduleTimers 移除已触发的 timer 引用。
|
|
230
|
-
*/
|
|
231
|
-
private removeScheduleTimerRef;
|
|
232
|
-
/**
|
|
233
|
-
* 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
|
|
234
|
-
*/
|
|
235
|
-
private computeScheduleTimePointDelayMs;
|
|
236
|
-
/**
|
|
237
|
-
* 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
|
|
238
|
-
*/
|
|
239
|
-
private refreshSubscriberScheduleAtExecution;
|
|
240
|
-
/**
|
|
241
|
-
* 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
|
|
242
|
-
* 必须先 clearSubscriberScheduleTimers,再调用本方法。
|
|
243
|
-
*/
|
|
244
|
-
private scheduleSubscriberTimePointReloads;
|
|
245
|
-
/**
|
|
246
|
-
* schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
|
|
247
|
-
*/
|
|
248
|
-
private onScheduleTimePointTimerFire;
|
|
249
|
-
/**
|
|
250
|
-
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
251
|
-
*/
|
|
252
|
-
private recomputeAndNotifySubscriber;
|
|
253
|
-
/**
|
|
254
|
-
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
255
|
-
*/
|
|
256
|
-
private syncProductQueryScheduleTimers;
|
|
257
214
|
/**
|
|
258
215
|
* 处理商品查询请求
|
|
259
216
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -453,6 +410,18 @@ declare class Server {
|
|
|
453
410
|
*/
|
|
454
411
|
private handleUpdateLocalOrder;
|
|
455
412
|
private handleOrderSalesCheckout;
|
|
413
|
+
private handleOrderSalesDraft;
|
|
414
|
+
private createLocalPaymentOperationId;
|
|
415
|
+
private buildLocalPaymentOrderLogContext;
|
|
416
|
+
private isValidLocalPaymentDecimal;
|
|
417
|
+
private getInvalidLocalPaymentSurchargeFields;
|
|
418
|
+
private buildLocalPaymentSurchargeUpdate;
|
|
419
|
+
private handleGetLocalPayment;
|
|
420
|
+
private handleUpdateLocalPayment;
|
|
421
|
+
private runLocalPaymentUpdateInQueue;
|
|
422
|
+
private processLocalPaymentUpdate;
|
|
423
|
+
private processSuccessfulLocalPayment;
|
|
424
|
+
private sanitizeLocalRecoveryOrder;
|
|
456
425
|
private handleOrderCheckout;
|
|
457
426
|
private getDeviceTaskPlugin;
|
|
458
427
|
private getIdGeneratorPlugin;
|
|
@@ -480,6 +449,7 @@ declare class Server {
|
|
|
480
449
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
481
450
|
private handleOrderCheckoutSubmit;
|
|
482
451
|
private handleSyncCheckoutSubmit;
|
|
452
|
+
private handleOrderDraftSubmit;
|
|
483
453
|
private handlePendingSyncCheckoutOrder;
|
|
484
454
|
private buildPendingSyncCheckoutOrder;
|
|
485
455
|
private shouldBuildSmallTicketData;
|
|
@@ -614,12 +584,6 @@ declare class Server {
|
|
|
614
584
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
615
585
|
*/
|
|
616
586
|
private computeProductQueryResult;
|
|
617
|
-
/**
|
|
618
|
-
* 构建商品格式化上下文。
|
|
619
|
-
*
|
|
620
|
-
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
621
|
-
*/
|
|
622
|
-
private buildProductFormatterContext;
|
|
623
587
|
/**
|
|
624
588
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
625
589
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|