@pisell/pisellos 2.2.204 → 2.2.206
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/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +21 -16
- package/dist/modules/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +237 -146
- package/dist/modules/Order/types.d.ts +10 -0
- package/dist/modules/Order/utils.js +7 -5
- package/dist/modules/Payment/index.d.ts +0 -13
- package/dist/modules/Payment/index.js +449 -833
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +142 -0
- package/dist/server/index.js +2208 -824
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +7 -0
- package/dist/server/modules/order/index.js +375 -337
- package/dist/server/modules/order/types.d.ts +15 -0
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/utils/small-ticket.d.ts +69 -0
- package/dist/server/utils/small-ticket.js +528 -0
- package/dist/solution/BaseSales/index.d.ts +10 -3
- package/dist/solution/BaseSales/index.js +307 -198
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -1
- package/dist/solution/BookingTicket/index.js +444 -264
- package/dist/solution/BookingTicket/types.d.ts +2 -1
- package/dist/solution/BookingTicket/types.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +6 -4
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +64 -4
- package/lib/modules/Order/types.d.ts +10 -0
- package/lib/modules/Order/utils.js +4 -3
- package/lib/modules/Payment/index.d.ts +0 -13
- package/lib/modules/Payment/index.js +6 -149
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +142 -0
- package/lib/server/index.js +867 -49
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +7 -0
- package/lib/server/modules/order/index.js +21 -7
- package/lib/server/modules/order/types.d.ts +15 -0
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/utils/small-ticket.d.ts +69 -0
- package/lib/server/utils/small-ticket.js +555 -0
- package/lib/solution/BaseSales/index.d.ts +10 -3
- package/lib/solution/BaseSales/index.js +98 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -1
- package/lib/solution/BookingTicket/index.js +109 -2
- package/lib/solution/BookingTicket/types.d.ts +2 -1
- package/lib/solution/BookingTicket/types.js +5 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ export type { ScheduleState, ScheduleItem } from './schedule/types';
|
|
|
16
16
|
export { OrderModule } from './order';
|
|
17
17
|
export type { OrderState, OrderData, OrderId, OrderSummary, OrderBookingItem, OrderProductLineItem, OrderPaymentItem, OrderSurchargeItem, OrderProductDiscountItem, OrderWithoutBookings, BookingData, OrderFilters, BookingFilters, OrderFilterResult, OrderFilterRejectDetail, OrderFilterRejectedEntry, BookingFilterResult, OrderModulePagedResult, } from './order/types';
|
|
18
18
|
export { OrderHooks } from './order/types';
|
|
19
|
+
export { PaymentServerModule } from './payment';
|
|
20
|
+
export type { PaymentMethod, PaymentMethodsChangedEventData, PaymentServerState } from './payment/types';
|
|
19
21
|
export { FloorPlanModule } from './floor-plan';
|
|
20
22
|
export type { FloorPlanItem, FloorPlanState, FloorPlanSyncMessage } from './floor-plan/types';
|
|
21
23
|
export { FloorPlanHooks } from './floor-plan/types';
|
|
@@ -25,6 +25,7 @@ __export(modules_exports, {
|
|
|
25
25
|
MenuModule: () => import_menu.MenuModule,
|
|
26
26
|
OrderHooks: () => import_types4.OrderHooks,
|
|
27
27
|
OrderModule: () => import_order.OrderModule,
|
|
28
|
+
PaymentServerModule: () => import_payment.PaymentServerModule,
|
|
28
29
|
ProductsHooks: () => import_types.ProductsHooks,
|
|
29
30
|
ProductsModule: () => import_products.ProductsModule,
|
|
30
31
|
QuotationHooks: () => import_types3.QuotationHooks,
|
|
@@ -44,6 +45,7 @@ var import_types3 = require("./quotation/types");
|
|
|
44
45
|
var import_schedule = require("./schedule");
|
|
45
46
|
var import_order = require("./order");
|
|
46
47
|
var import_types4 = require("./order/types");
|
|
48
|
+
var import_payment = require("./payment");
|
|
47
49
|
var import_floor_plan = require("./floor-plan");
|
|
48
50
|
var import_types5 = require("./floor-plan/types");
|
|
49
51
|
var import_resource = require("./resource");
|
|
@@ -56,6 +58,7 @@ var import_resource2 = require("./resource");
|
|
|
56
58
|
MenuModule,
|
|
57
59
|
OrderHooks,
|
|
58
60
|
OrderModule,
|
|
61
|
+
PaymentServerModule,
|
|
59
62
|
ProductsHooks,
|
|
60
63
|
ProductsModule,
|
|
61
64
|
QuotationHooks,
|
|
@@ -23,6 +23,13 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
23
23
|
/** 最近一次 SSE 全量拉取完成时间 */
|
|
24
24
|
private lastServerFullFetchAtMs;
|
|
25
25
|
constructor(name?: string, version?: string);
|
|
26
|
+
/**
|
|
27
|
+
* 广播订单变更事件,兼容全量列表订阅并额外携带本次变更订单。
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* await this.emitOrdersChanged([freshOrder], 'pubsub.bodyUpsert')
|
|
31
|
+
*/
|
|
32
|
+
private emitOrdersChanged;
|
|
26
33
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
27
34
|
/**
|
|
28
35
|
* 记录信息日志
|
|
@@ -63,6 +63,20 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
63
63
|
/** 最近一次 SSE 全量拉取完成时间 */
|
|
64
64
|
this.lastServerFullFetchAtMs = 0;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* 广播订单变更事件,兼容全量列表订阅并额外携带本次变更订单。
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await this.emitOrdersChanged([freshOrder], 'pubsub.bodyUpsert')
|
|
71
|
+
*/
|
|
72
|
+
async emitOrdersChanged(changedOrders = [], source) {
|
|
73
|
+
const payload = {
|
|
74
|
+
list: this.store.list,
|
|
75
|
+
changedOrders,
|
|
76
|
+
source
|
|
77
|
+
};
|
|
78
|
+
await this.core.effects.emit(import_types.OrderHooks.onOrdersChanged, payload);
|
|
79
|
+
}
|
|
66
80
|
async initialize(core, options) {
|
|
67
81
|
var _a, _b;
|
|
68
82
|
this.core = core;
|
|
@@ -119,7 +133,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
119
133
|
if (Array.isArray((_b = options == null ? void 0 : options.initialState) == null ? void 0 : _b.list)) {
|
|
120
134
|
this.store.list = options.initialState.list;
|
|
121
135
|
this.syncOrdersMap();
|
|
122
|
-
this.
|
|
136
|
+
this.emitOrdersChanged([], "initialState");
|
|
123
137
|
} else {
|
|
124
138
|
this.store.list = [];
|
|
125
139
|
this.store.map = /* @__PURE__ */ new Map();
|
|
@@ -336,7 +350,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
336
350
|
}
|
|
337
351
|
this.store.list = (0, import_lodash_es.cloneDeep)(orders);
|
|
338
352
|
this.syncOrdersMap();
|
|
339
|
-
this.
|
|
353
|
+
this.emitOrdersChanged([], "preload");
|
|
340
354
|
this.core.effects.emit(import_types.OrderHooks.onOrdersSyncCompleted, null);
|
|
341
355
|
};
|
|
342
356
|
getData();
|
|
@@ -416,7 +430,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
416
430
|
if (orders.length > 0) {
|
|
417
431
|
this.store.list = (0, import_lodash_es.cloneDeep)(orders);
|
|
418
432
|
this.syncOrdersMap();
|
|
419
|
-
this.
|
|
433
|
+
this.emitOrdersChanged([], "silentRefresh");
|
|
420
434
|
await this.core.effects.emit(import_types.OrderHooks.onOrdersSyncCompleted, null);
|
|
421
435
|
this.logInfo("silentRefresh 完成", {
|
|
422
436
|
orderCount: orders.length,
|
|
@@ -470,7 +484,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
470
484
|
orderId,
|
|
471
485
|
storeOrderCountAfter: this.store.list.length
|
|
472
486
|
});
|
|
473
|
-
await this.
|
|
487
|
+
await this.emitOrdersChanged([fresh], "overwriteExistingOrder");
|
|
474
488
|
return { overwritten: true };
|
|
475
489
|
}
|
|
476
490
|
/**
|
|
@@ -530,7 +544,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
530
544
|
count: patchedOrders.length,
|
|
531
545
|
storeOrderCountAfter: this.store.list.length
|
|
532
546
|
});
|
|
533
|
-
this.
|
|
547
|
+
this.emitOrdersChanged(patchedOrders, "upsertPendingSyncOrders");
|
|
534
548
|
}
|
|
535
549
|
/**
|
|
536
550
|
* 通过 SSE 按自定义 query 拉取订单(支持 select/with 精简字段)
|
|
@@ -879,7 +893,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
879
893
|
uniqueFreshCount,
|
|
880
894
|
storeOrderCountAfter: this.store.list.length
|
|
881
895
|
});
|
|
882
|
-
this.
|
|
896
|
+
this.emitOrdersChanged(patchedOrders, source);
|
|
883
897
|
}
|
|
884
898
|
normalizeOrderSyncMessage(res) {
|
|
885
899
|
const data = (res == null ? void 0 : res.data) || res;
|
|
@@ -1229,7 +1243,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1229
1243
|
});
|
|
1230
1244
|
}
|
|
1231
1245
|
this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, "");
|
|
1232
|
-
this.
|
|
1246
|
+
this.emitOrdersChanged([], "clear");
|
|
1233
1247
|
}
|
|
1234
1248
|
};
|
|
1235
1249
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -524,6 +524,21 @@ export interface OrderAblyEventPayload {
|
|
|
524
524
|
order_id?: OrderId;
|
|
525
525
|
timestamp: number;
|
|
526
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* 订单变更广播载荷。
|
|
529
|
+
* 用于保留原有全量列表通知能力,同时让订阅方可按 changedOrders 做增量处理。
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* const changedOrders = payload.changedOrders
|
|
533
|
+
*/
|
|
534
|
+
export interface OrderChangedPayload {
|
|
535
|
+
/** 当前订单 store 全量列表,兼容既有重算列表订阅 */
|
|
536
|
+
list: OrderData[];
|
|
537
|
+
/** 本次明确发生变更的订单;全量刷新等无法确定 delta 的场景可为空 */
|
|
538
|
+
changedOrders: OrderData[];
|
|
539
|
+
/** 触发来源,便于订阅者区分 pubsub / 远端覆盖 / 清空等场景 */
|
|
540
|
+
source?: string;
|
|
541
|
+
}
|
|
527
542
|
/**
|
|
528
543
|
* OrderSyncMessage - pubsub 同步消息结构
|
|
529
544
|
*/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../../types';
|
|
2
|
+
import { BaseModule } from '../../../modules/BaseModule';
|
|
3
|
+
import type { PaymentMethod } from './types';
|
|
4
|
+
export declare class PaymentServerModule extends BaseModule implements Module {
|
|
5
|
+
protected defaultName: string;
|
|
6
|
+
protected defaultVersion: string;
|
|
7
|
+
private request;
|
|
8
|
+
private app;
|
|
9
|
+
private logger;
|
|
10
|
+
private store;
|
|
11
|
+
private payMethodMemoryCache;
|
|
12
|
+
private payMethodListInFlight;
|
|
13
|
+
constructor(name?: string, version?: string);
|
|
14
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
15
|
+
getPayMethodListAsync(options?: {
|
|
16
|
+
shouldFilter?: boolean;
|
|
17
|
+
}): Promise<PaymentMethod[]>;
|
|
18
|
+
clearPayMethodCache(): void;
|
|
19
|
+
private loadPayMethodListAsync;
|
|
20
|
+
private fetchRemotePayMethods;
|
|
21
|
+
private shouldFilterPayMethods;
|
|
22
|
+
private resolvePayMethods;
|
|
23
|
+
private filterPayMethods;
|
|
24
|
+
private setPayMethodCache;
|
|
25
|
+
private logInfo;
|
|
26
|
+
private logWarning;
|
|
27
|
+
private logError;
|
|
28
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/server/modules/payment/index.ts
|
|
20
|
+
var payment_exports = {};
|
|
21
|
+
__export(payment_exports, {
|
|
22
|
+
PaymentServerModule: () => PaymentServerModule
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(payment_exports);
|
|
25
|
+
var import_BaseModule = require("../../../modules/BaseModule");
|
|
26
|
+
var WALLET_PASS_CODE = "WALLET_PASS";
|
|
27
|
+
var WALLET_DEPENDENT_CODES = /* @__PURE__ */ new Set(["PRODUCTVOUCHER", "GIFTCARD", "POINTCARD"]);
|
|
28
|
+
var PAYMENT_METHODS_LOADED_EVENT = "payment:onPaymentMethodsLoaded";
|
|
29
|
+
var PaymentServerModule = class extends import_BaseModule.BaseModule {
|
|
30
|
+
constructor(name, version) {
|
|
31
|
+
super(name || "payment", version);
|
|
32
|
+
this.defaultName = "payment";
|
|
33
|
+
this.defaultVersion = "1.0.0";
|
|
34
|
+
this.payMethodMemoryCache = null;
|
|
35
|
+
this.payMethodListInFlight = null;
|
|
36
|
+
}
|
|
37
|
+
async initialize(core, options) {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
this.core = core;
|
|
40
|
+
this.store = options == null ? void 0 : options.store;
|
|
41
|
+
if (!this.store)
|
|
42
|
+
this.store = { payMethods: [] };
|
|
43
|
+
if (!Array.isArray(this.store.payMethods))
|
|
44
|
+
this.store.payMethods = [];
|
|
45
|
+
this.request = core.getPlugin("request");
|
|
46
|
+
const appPlugin = core.getPlugin("app");
|
|
47
|
+
this.app = appPlugin == null ? void 0 : appPlugin.getApp();
|
|
48
|
+
this.logger = (_a = this.app) == null ? void 0 : _a.logger;
|
|
49
|
+
if (!this.request && !((_b = this.app) == null ? void 0 : _b.request)) {
|
|
50
|
+
throw new Error("PaymentServerModule 需要 request 插件或 app.request 支持");
|
|
51
|
+
}
|
|
52
|
+
this.logInfo("PaymentServerModule initialized successfully", {
|
|
53
|
+
hasAppRequest: !!((_c = this.app) == null ? void 0 : _c.request)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// getRoutes(): RouteDefinition[] {
|
|
57
|
+
// return [
|
|
58
|
+
// {
|
|
59
|
+
// method: 'get',
|
|
60
|
+
// path: '/pay/custom-payment/all',
|
|
61
|
+
// handler: async ({ data, config }) => {
|
|
62
|
+
// const payMethods = await this.getPayMethodListAsync({
|
|
63
|
+
// shouldFilter: this.shouldFilterPayMethods(data, config),
|
|
64
|
+
// });
|
|
65
|
+
// return {
|
|
66
|
+
// code: 200,
|
|
67
|
+
// status: true,
|
|
68
|
+
// data: payMethods,
|
|
69
|
+
// };
|
|
70
|
+
// },
|
|
71
|
+
// },
|
|
72
|
+
// ];
|
|
73
|
+
// }
|
|
74
|
+
async getPayMethodListAsync(options = {}) {
|
|
75
|
+
var _a;
|
|
76
|
+
this.logInfo("Starting getPayMethodListAsync");
|
|
77
|
+
if ((_a = this.payMethodMemoryCache) == null ? void 0 : _a.length) {
|
|
78
|
+
return this.resolvePayMethods(this.payMethodMemoryCache, options);
|
|
79
|
+
}
|
|
80
|
+
if (this.payMethodListInFlight) {
|
|
81
|
+
const payMethods2 = await this.payMethodListInFlight;
|
|
82
|
+
return this.resolvePayMethods(payMethods2, options);
|
|
83
|
+
}
|
|
84
|
+
this.payMethodListInFlight = this.loadPayMethodListAsync().finally(() => {
|
|
85
|
+
this.payMethodListInFlight = null;
|
|
86
|
+
});
|
|
87
|
+
const payMethods = await this.payMethodListInFlight;
|
|
88
|
+
return this.resolvePayMethods(payMethods, options);
|
|
89
|
+
}
|
|
90
|
+
clearPayMethodCache() {
|
|
91
|
+
this.payMethodMemoryCache = null;
|
|
92
|
+
this.store.payMethods = [];
|
|
93
|
+
}
|
|
94
|
+
async loadPayMethodListAsync() {
|
|
95
|
+
try {
|
|
96
|
+
const payMethods = await this.fetchRemotePayMethods();
|
|
97
|
+
this.setPayMethodCache(payMethods);
|
|
98
|
+
await this.core.effects.emit(PAYMENT_METHODS_LOADED_EVENT, payMethods);
|
|
99
|
+
this.logInfo("getPayMethodListAsync completed successfully", {
|
|
100
|
+
payMethods
|
|
101
|
+
});
|
|
102
|
+
return payMethods;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error("[PaymentServerModule] 获取支付方式列表失败", error);
|
|
105
|
+
this.logError("getPayMethodListAsync failed", error);
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async fetchRemotePayMethods() {
|
|
110
|
+
var _a;
|
|
111
|
+
const requester = ((_a = this.app) == null ? void 0 : _a.request) || this.request;
|
|
112
|
+
const response = await requester.get("/shop/pay/custom-payment/all", void 0);
|
|
113
|
+
const payMethods = (response == null ? void 0 : response.data) || response || [];
|
|
114
|
+
return Array.isArray(payMethods) ? payMethods : [];
|
|
115
|
+
}
|
|
116
|
+
shouldFilterPayMethods(data, config) {
|
|
117
|
+
return (data == null ? void 0 : data.filterPaymentMethods) === true || (config == null ? void 0 : config.filterPaymentMethods) === true;
|
|
118
|
+
}
|
|
119
|
+
resolvePayMethods(payMethods, options) {
|
|
120
|
+
if (!options.shouldFilter)
|
|
121
|
+
return payMethods;
|
|
122
|
+
return this.filterPayMethods(payMethods);
|
|
123
|
+
}
|
|
124
|
+
filterPayMethods(payMethods) {
|
|
125
|
+
if (!Array.isArray(payMethods))
|
|
126
|
+
return [];
|
|
127
|
+
let availableMethods = payMethods.filter(
|
|
128
|
+
(method) => method.status === 1 && method.disable === 0
|
|
129
|
+
);
|
|
130
|
+
const walletPassMethod = availableMethods.find(
|
|
131
|
+
(method) => method.code === WALLET_PASS_CODE
|
|
132
|
+
);
|
|
133
|
+
if (!walletPassMethod) {
|
|
134
|
+
return availableMethods.filter(
|
|
135
|
+
(method) => !WALLET_DEPENDENT_CODES.has(method.code)
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
availableMethods = availableMethods.map((method) => {
|
|
139
|
+
if (!WALLET_DEPENDENT_CODES.has(method.code))
|
|
140
|
+
return method;
|
|
141
|
+
return {
|
|
142
|
+
...method,
|
|
143
|
+
channel_application: walletPassMethod.channel_application
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
return availableMethods;
|
|
147
|
+
}
|
|
148
|
+
setPayMethodCache(payMethods) {
|
|
149
|
+
this.payMethodMemoryCache = payMethods;
|
|
150
|
+
this.store.payMethods = payMethods;
|
|
151
|
+
}
|
|
152
|
+
logInfo(title, metadata) {
|
|
153
|
+
try {
|
|
154
|
+
if (this.logger) {
|
|
155
|
+
this.logger.addLog({
|
|
156
|
+
type: "info",
|
|
157
|
+
title: `[PaymentServerModule] ${title}`,
|
|
158
|
+
metadata: metadata || {}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
logWarning(title, metadata) {
|
|
165
|
+
try {
|
|
166
|
+
if (this.logger) {
|
|
167
|
+
this.logger.addLog({
|
|
168
|
+
type: "warning",
|
|
169
|
+
title: `[PaymentServerModule] ${title}`,
|
|
170
|
+
metadata: metadata || {}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
} catch {
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
logError(title, metadata) {
|
|
177
|
+
try {
|
|
178
|
+
if (this.logger) {
|
|
179
|
+
this.logger.addLog({
|
|
180
|
+
type: "error",
|
|
181
|
+
title: `[PaymentServerModule] ${title}`,
|
|
182
|
+
metadata: metadata || {}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
190
|
+
0 && (module.exports = {
|
|
191
|
+
PaymentServerModule
|
|
192
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PaymentMethod } from '../../../modules/Payment/types';
|
|
2
|
+
export interface PaymentServerState {
|
|
3
|
+
payMethods: PaymentMethod[];
|
|
4
|
+
}
|
|
5
|
+
export interface PaymentMethodsChangedEventData {
|
|
6
|
+
oldMethods: PaymentMethod[];
|
|
7
|
+
newMethods: PaymentMethod[];
|
|
8
|
+
}
|
|
9
|
+
export type { PaymentMethod };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/server/modules/payment/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface SmallTicketShopInfo {
|
|
2
|
+
name?: string;
|
|
3
|
+
phone?: string;
|
|
4
|
+
address?: string;
|
|
5
|
+
address_street?: string;
|
|
6
|
+
address_detail?: string;
|
|
7
|
+
city?: string;
|
|
8
|
+
province?: string;
|
|
9
|
+
country?: string;
|
|
10
|
+
zip?: string;
|
|
11
|
+
tax_number?: string;
|
|
12
|
+
tax_title?: string;
|
|
13
|
+
currency_symbol?: string;
|
|
14
|
+
currency_code?: string;
|
|
15
|
+
primary_locale?: string;
|
|
16
|
+
timezone?: string;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export interface BuildSmallTicketDataParams {
|
|
20
|
+
order: Record<string, any>;
|
|
21
|
+
shopInfo?: SmallTicketShopInfo | null;
|
|
22
|
+
locales?: string[];
|
|
23
|
+
productMap?: Record<string | number, Record<string, any>>;
|
|
24
|
+
}
|
|
25
|
+
export interface SmallTicketItem {
|
|
26
|
+
item: string;
|
|
27
|
+
value: string;
|
|
28
|
+
size?: number;
|
|
29
|
+
align?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SmallTicketProduct {
|
|
32
|
+
product_title: string;
|
|
33
|
+
product_quantity: number;
|
|
34
|
+
selling_price: string;
|
|
35
|
+
original_price: string;
|
|
36
|
+
total_original_price: string;
|
|
37
|
+
extension_list: any[];
|
|
38
|
+
options?: Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}>;
|
|
42
|
+
variant?: string;
|
|
43
|
+
combinations?: any[];
|
|
44
|
+
}
|
|
45
|
+
export interface SmallTicketLocaleData {
|
|
46
|
+
base_data: Record<string, any>;
|
|
47
|
+
products: SmallTicketProduct[];
|
|
48
|
+
fees: {
|
|
49
|
+
fees: SmallTicketItem[];
|
|
50
|
+
countFee: Record<string, any>;
|
|
51
|
+
};
|
|
52
|
+
customer: SmallTicketItem[];
|
|
53
|
+
appointment: SmallTicketItem[];
|
|
54
|
+
delivery: SmallTicketItem[];
|
|
55
|
+
resources: Array<{
|
|
56
|
+
id: string | number;
|
|
57
|
+
code: string;
|
|
58
|
+
title: string;
|
|
59
|
+
form_title: string;
|
|
60
|
+
}>;
|
|
61
|
+
payment_data: SmallTicketItem[][];
|
|
62
|
+
tickets: any[];
|
|
63
|
+
source_shop: any[];
|
|
64
|
+
refund_data: any[];
|
|
65
|
+
expend_data: any[];
|
|
66
|
+
}
|
|
67
|
+
export type SmallTicketData = Record<string, SmallTicketLocaleData>;
|
|
68
|
+
export declare function buildSmallTicketData(params: BuildSmallTicketDataParams): SmallTicketData;
|
|
69
|
+
export declare function hasSmallTicketData(value: any): boolean;
|