@posx/core 5.5.51 → 5.5.52
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/build/index.d.ts +4698 -0
- package/build/index.js +1 -0
- package/package.json +1 -1
- package/package.publish.json +2 -2
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,4698 @@
|
|
|
1
|
+
declare module '@posx/core/index' {
|
|
2
|
+
export * from '@posx/core/types/auto.query.type';
|
|
3
|
+
export * from '@posx/core/types/wyo.customer.type';
|
|
4
|
+
export * from '@posx/core/types/wyo.coupon.type';
|
|
5
|
+
export * from '@posx/core/types/shift.type';
|
|
6
|
+
export * from '@posx/core/types/section.type';
|
|
7
|
+
export * from '@posx/core/types/role.type';
|
|
8
|
+
export * from '@posx/core/types/product.type';
|
|
9
|
+
export * from '@posx/core/types/printer.type';
|
|
10
|
+
export * from '@posx/core/types/payment.type';
|
|
11
|
+
export * from '@posx/core/types/note.type';
|
|
12
|
+
export * from '@posx/core/types/misc.type';
|
|
13
|
+
export * from '@posx/core/types/invoice.type';
|
|
14
|
+
export * from '@posx/core/types/employee.type';
|
|
15
|
+
export * from '@posx/core/types/config.type';
|
|
16
|
+
export * from '@posx/core/types/abstract.type';
|
|
17
|
+
export * from '@posx/core/types/request.type';
|
|
18
|
+
export * from '@posx/core/services/app.service';
|
|
19
|
+
export * from '@posx/core/services/abstract.service';
|
|
20
|
+
export * from '@posx/core/service.factory';
|
|
21
|
+
export * from '@posx/core/services/invoice.service';
|
|
22
|
+
export * from '@posx/core/libs/FindOptions';
|
|
23
|
+
export * from '@posx/core/types/report.type';
|
|
24
|
+
export * from '@posx/core/services/printer.service';
|
|
25
|
+
export * from '@posx/core/utils/misc.utils';
|
|
26
|
+
export * from '@posx/core/service.factory';
|
|
27
|
+
export * from '@posx/core/libs/escpos.printer';
|
|
28
|
+
export * from '@posx/core/services/ods.service';
|
|
29
|
+
export * from '@posx/core/types/ods.type';
|
|
30
|
+
export * from '@posx/core/utils/autoquery.utils';
|
|
31
|
+
export * from '@posx/core/libs/electron.socket';
|
|
32
|
+
export * from '@posx/core/types/condition.type';
|
|
33
|
+
export * from '@posx/core/types/merchant.type';
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
declare module '@posx/core/libs/electron.socket' {
|
|
37
|
+
export class ElectronSocket {
|
|
38
|
+
static State: {
|
|
39
|
+
CLOSED: number;
|
|
40
|
+
OPENING: number;
|
|
41
|
+
OPENED: number;
|
|
42
|
+
CLOSING: number;
|
|
43
|
+
};
|
|
44
|
+
private _state;
|
|
45
|
+
private cleanup?;
|
|
46
|
+
onData: ((data: Uint8Array) => void) | null;
|
|
47
|
+
onClose: ((hadError: boolean) => void) | null;
|
|
48
|
+
onError: ((error: string) => void) | null;
|
|
49
|
+
get state(): number;
|
|
50
|
+
static electronSocket: any;
|
|
51
|
+
static setWindow(win: {
|
|
52
|
+
electronSocket: typeof window.electronSocket;
|
|
53
|
+
}): void;
|
|
54
|
+
private setupListeners;
|
|
55
|
+
open(host: string, port: number, success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
|
|
56
|
+
write(data: Uint8Array, success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
|
|
57
|
+
close(success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
declare module '@posx/core/libs/escpos.printer' {
|
|
62
|
+
/**
|
|
63
|
+
* Represents an ESC/POS printer.
|
|
64
|
+
*/
|
|
65
|
+
export interface IEscPosPrinter {
|
|
66
|
+
/**
|
|
67
|
+
* Prints the content to the printer.
|
|
68
|
+
* @returns A promise that resolves to true if the printing is successful, otherwise false.
|
|
69
|
+
*/
|
|
70
|
+
testPrint(template: IPrintCommand): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Connects to the printer with the specified IP address and port number.
|
|
73
|
+
* @param ip The IP address of the printer.
|
|
74
|
+
* @param port The port number of the printer. Default is 9100.
|
|
75
|
+
* @param timeout The connection timeout in milliseconds. Default is 5000ms.
|
|
76
|
+
* @returns A promise that resolves to true if the connection is successful, otherwise false.
|
|
77
|
+
*/
|
|
78
|
+
connect(ip: string, port?: number, timeout?: number): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Writes the content to the printer.
|
|
81
|
+
* @param resultByte The content to write to the printer.
|
|
82
|
+
* @param timeout The write timeout in milliseconds. Default is 10000ms.
|
|
83
|
+
* @returns A promise that resolves to true if the writing is successful, otherwise false.
|
|
84
|
+
*/
|
|
85
|
+
write(resultByte: any, timeout?: number): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Interprets the print command and returns the encoded byte array.
|
|
88
|
+
* @param template The print command to interpret.
|
|
89
|
+
* @returns A promise that resolves to the encoded byte array.
|
|
90
|
+
*/
|
|
91
|
+
interpret(template: IPrintCommand): Promise<Uint8Array>;
|
|
92
|
+
}
|
|
93
|
+
export class EscPosPrinter implements IEscPosPrinter {
|
|
94
|
+
socket: any;
|
|
95
|
+
constructor();
|
|
96
|
+
/**
|
|
97
|
+
* Prints esc pos printer
|
|
98
|
+
* @returns print
|
|
99
|
+
*/
|
|
100
|
+
testPrint(template: IPrintCommand): Promise<boolean>;
|
|
101
|
+
connect(ip: string, port?: number, timeout?: number): Promise<boolean>;
|
|
102
|
+
write(resultByte: any, timeout?: number): Promise<boolean>;
|
|
103
|
+
interpret(template: IPrintCommand): Promise<Uint8Array>;
|
|
104
|
+
private formatTable;
|
|
105
|
+
private padEnd;
|
|
106
|
+
private padStart;
|
|
107
|
+
private wrapText;
|
|
108
|
+
disconnect(): Promise<boolean>;
|
|
109
|
+
private close;
|
|
110
|
+
private base64ToImageBitmap;
|
|
111
|
+
}
|
|
112
|
+
export enum Codepages {
|
|
113
|
+
English = "cp437",
|
|
114
|
+
Greek = "cp737",
|
|
115
|
+
WesternEurope = "cp850",
|
|
116
|
+
BalticRim = "cp775",
|
|
117
|
+
CentralEurope = "cp852",
|
|
118
|
+
Cyrillic = "cp855",
|
|
119
|
+
Turkish = "cp857",
|
|
120
|
+
MultilingualLatin1WithEuro = "cp858",
|
|
121
|
+
Portuguese = "cp860",
|
|
122
|
+
Icelandic = "cp861",
|
|
123
|
+
Hebrew = "cp862",
|
|
124
|
+
FrenchCanadian = "cp863",
|
|
125
|
+
Arabic = "cp864",
|
|
126
|
+
Nordic = "cp865",
|
|
127
|
+
Russian = "cp866",
|
|
128
|
+
ModernGreek = "cp869",
|
|
129
|
+
SimplifiedChinese = "cp936",
|
|
130
|
+
Korean = "cp949",
|
|
131
|
+
TraditionalChinese = "cp950",
|
|
132
|
+
WesternEuropeanLatin = "cp1252",
|
|
133
|
+
ArabicISO = "iso88596",
|
|
134
|
+
Japanese = "shiftjis",
|
|
135
|
+
CentralEuropeanLatinWindows = "windows1250",
|
|
136
|
+
CyrillicWindows = "windows1251",
|
|
137
|
+
WesternEuropeanLatinWindows = "windows1252",
|
|
138
|
+
GreekWindows = "windows1253",
|
|
139
|
+
TurkishWindows = "windows1254",
|
|
140
|
+
HebrewWindows = "windows1255",
|
|
141
|
+
ArabicWindows = "windows1256",
|
|
142
|
+
BalticWindows = "windows1257",
|
|
143
|
+
Vietnamese = "windows1258"
|
|
144
|
+
}
|
|
145
|
+
export enum PrintAlign {
|
|
146
|
+
Left = "left",
|
|
147
|
+
Center = "center",
|
|
148
|
+
Right = "right"
|
|
149
|
+
}
|
|
150
|
+
export enum PrintStyle {
|
|
151
|
+
Normal = "normal",
|
|
152
|
+
Bold = "bold",
|
|
153
|
+
Italic = "italic",
|
|
154
|
+
Underline = "underline"
|
|
155
|
+
}
|
|
156
|
+
export enum PrintSize {
|
|
157
|
+
Custom = "custom",
|
|
158
|
+
Normal = "normal",
|
|
159
|
+
Small = "small"
|
|
160
|
+
}
|
|
161
|
+
export enum PrintType {
|
|
162
|
+
Text = "text",
|
|
163
|
+
Table = "table",
|
|
164
|
+
Line = "line",
|
|
165
|
+
Image = "image",
|
|
166
|
+
QRCode = "qrcode",
|
|
167
|
+
NewLine = "newline",
|
|
168
|
+
Barcode = "barcode",
|
|
169
|
+
Cut = "cut",
|
|
170
|
+
Beeper = "beeper",
|
|
171
|
+
OpenCashDrawer = "open_cash_drawer"
|
|
172
|
+
}
|
|
173
|
+
export interface IPrintBarcode {
|
|
174
|
+
data: string;
|
|
175
|
+
symbology: 'upca' | 'upce' | 'ean13' | 'ean8' | 'coda39' | 'itf' | 'codabar';
|
|
176
|
+
height: number;
|
|
177
|
+
}
|
|
178
|
+
export interface IPrintQrcode {
|
|
179
|
+
data: string;
|
|
180
|
+
model: number;
|
|
181
|
+
size: number;
|
|
182
|
+
errorlevel: 'l' | 'm' | 'q' | 'h';
|
|
183
|
+
}
|
|
184
|
+
export type IFontSize = {
|
|
185
|
+
width?: number;
|
|
186
|
+
height?: number;
|
|
187
|
+
size: PrintSize;
|
|
188
|
+
};
|
|
189
|
+
export type IPrintText = IFontSize & {
|
|
190
|
+
text: string;
|
|
191
|
+
line_width?: number;
|
|
192
|
+
};
|
|
193
|
+
export type IPrintTableRowItem = {
|
|
194
|
+
text: string;
|
|
195
|
+
column_width: number;
|
|
196
|
+
};
|
|
197
|
+
export type IPrintTable = IFontSize & {
|
|
198
|
+
items: IPrintTableRowItem[];
|
|
199
|
+
line_width?: number;
|
|
200
|
+
};
|
|
201
|
+
export class PrintBarcode {
|
|
202
|
+
data: string;
|
|
203
|
+
symbology: 'upca' | 'upce' | 'ean13' | 'ean8' | 'coda39' | 'itf' | 'codabar';
|
|
204
|
+
height: number;
|
|
205
|
+
}
|
|
206
|
+
export class PrintQrcode {
|
|
207
|
+
data: string;
|
|
208
|
+
model: number;
|
|
209
|
+
size: number;
|
|
210
|
+
errorlevel: 'l' | 'm' | 'q' | 'h';
|
|
211
|
+
}
|
|
212
|
+
export type IPrintImage = {
|
|
213
|
+
base64_data: string;
|
|
214
|
+
width: number;
|
|
215
|
+
height: number;
|
|
216
|
+
algorithm: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson';
|
|
217
|
+
threshold: number;
|
|
218
|
+
};
|
|
219
|
+
export class PrintImage implements IPrintImage {
|
|
220
|
+
base64_data: string;
|
|
221
|
+
width: number;
|
|
222
|
+
height: number;
|
|
223
|
+
algorithm: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson';
|
|
224
|
+
threshold: number;
|
|
225
|
+
}
|
|
226
|
+
export type IPrintCommandLine = {
|
|
227
|
+
item?: IPrintText;
|
|
228
|
+
table?: IPrintTable;
|
|
229
|
+
image?: IPrintImage;
|
|
230
|
+
qrcode?: IPrintQrcode;
|
|
231
|
+
barcode?: IPrintBarcode;
|
|
232
|
+
align?: PrintAlign;
|
|
233
|
+
style?: PrintStyle;
|
|
234
|
+
type: PrintType;
|
|
235
|
+
repeat?: number;
|
|
236
|
+
codepage?: Codepages;
|
|
237
|
+
};
|
|
238
|
+
export type IPrintCommand = {
|
|
239
|
+
codepage: Codepages;
|
|
240
|
+
items: IPrintCommandLine[];
|
|
241
|
+
};
|
|
242
|
+
export enum EscPosCompatibility {
|
|
243
|
+
'SunmiPrinter' = 0
|
|
244
|
+
}
|
|
245
|
+
export class PrintCommand implements IPrintCommand {
|
|
246
|
+
codepage: Codepages;
|
|
247
|
+
items: IPrintCommandLine[];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
declare module '@posx/core/libs/FindOptions' {
|
|
252
|
+
export const Include: (query?: string) => (val: any) => any;
|
|
253
|
+
export const In: (query?: never[]) => (val: never) => boolean;
|
|
254
|
+
export const Between: (begin: number, end: number) => (val: number) => boolean;
|
|
255
|
+
export const Not: (query?: any) => (val: any, values: any) => boolean;
|
|
256
|
+
export const Raw: (fn: any) => any;
|
|
257
|
+
export const filterByParams: (params: {
|
|
258
|
+
[key: string]: any;
|
|
259
|
+
}) => (values: any) => boolean;
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
declare module '@posx/core/service.factory' {
|
|
263
|
+
import { IServiceOptions } from '@posx/core/types/misc.type';
|
|
264
|
+
import { IAppRemoteService } from '@posx/core/services/abstract.service';
|
|
265
|
+
import Dexie from 'dexie';
|
|
266
|
+
export const dbSchemas: {
|
|
267
|
+
items: string;
|
|
268
|
+
sections: string;
|
|
269
|
+
section_items: string;
|
|
270
|
+
categories: string;
|
|
271
|
+
shifts: string;
|
|
272
|
+
tills: string;
|
|
273
|
+
employees: string;
|
|
274
|
+
payment_methods: string;
|
|
275
|
+
invoices: string;
|
|
276
|
+
configs: string;
|
|
277
|
+
reports: string;
|
|
278
|
+
printers: string;
|
|
279
|
+
print_jobs: string;
|
|
280
|
+
print_templates: string;
|
|
281
|
+
employee_roles: string;
|
|
282
|
+
order_displays: string;
|
|
283
|
+
};
|
|
284
|
+
export class ServiceFactory {
|
|
285
|
+
readonly options: IServiceOptions;
|
|
286
|
+
readonly win: any;
|
|
287
|
+
private mode;
|
|
288
|
+
private readonly http;
|
|
289
|
+
private dataSource;
|
|
290
|
+
private status;
|
|
291
|
+
constructor(options: IServiceOptions, win: any);
|
|
292
|
+
initializeDatabase(): Promise<Dexie>;
|
|
293
|
+
dropDatabase(): Promise<void>;
|
|
294
|
+
clearTableData(tableName: string): import("dexie").PromiseExtended<void>;
|
|
295
|
+
getService<T>(serviceClass: any): Promise<T>;
|
|
296
|
+
getServiceByName(modelName: string): Promise<IAppRemoteService<any>>;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
declare module '@posx/core/services/abstract.service' {
|
|
301
|
+
import { IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
302
|
+
import { AxiosInstance } from 'axios';
|
|
303
|
+
import Dexie, { Observable } from 'dexie';
|
|
304
|
+
import { IServiceOptions } from '@posx/core/types/misc.type';
|
|
305
|
+
export type GetManyResult<T> = {
|
|
306
|
+
list: T[];
|
|
307
|
+
count: number;
|
|
308
|
+
page: number;
|
|
309
|
+
pageSize: number;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Interface for a generic service.
|
|
313
|
+
* @template T - Generic type parameter that extends IAppCoreModel.
|
|
314
|
+
*/
|
|
315
|
+
export interface IAppCoreService<T extends IAppCoreModel> {
|
|
316
|
+
db: Dexie;
|
|
317
|
+
table: Dexie.Table<T>;
|
|
318
|
+
moduleName: string;
|
|
319
|
+
/**
|
|
320
|
+
* Creates a live query.
|
|
321
|
+
* @param expr - Function that returns the query expression.
|
|
322
|
+
* @returns A live query.
|
|
323
|
+
*/
|
|
324
|
+
liveQuery<T>(expr: () => T): Observable;
|
|
325
|
+
/**
|
|
326
|
+
* Saves a single entity.
|
|
327
|
+
* @param item - Entity to save.
|
|
328
|
+
* @returns A Promise that resolves to the saved entity.
|
|
329
|
+
*/
|
|
330
|
+
saveOne(item: T): Promise<T>;
|
|
331
|
+
/**
|
|
332
|
+
* Saves multiple entities.
|
|
333
|
+
* @param items - Entities to save.
|
|
334
|
+
* @returns A Promise that resolves to the saved entities.
|
|
335
|
+
*/
|
|
336
|
+
saveMany(items: T[]): Promise<T[]>;
|
|
337
|
+
/**
|
|
338
|
+
* Checks if any entity exists.
|
|
339
|
+
* @returns A Promise that resolves to true if any entity exists or false otherwise.
|
|
340
|
+
*/
|
|
341
|
+
hasAny(): Promise<boolean>;
|
|
342
|
+
/**
|
|
343
|
+
* Retrieves a single entity by its unique identifier.
|
|
344
|
+
* @param id - Unique identifier of the entity to retrieve.
|
|
345
|
+
* @returns A Promise that resolves to the retrieved entity.
|
|
346
|
+
*/
|
|
347
|
+
getOne(id: string): Promise<T>;
|
|
348
|
+
/**
|
|
349
|
+
* Retrieves a single entity by its unique identifier.
|
|
350
|
+
* @param params - Filtering parameters.
|
|
351
|
+
* @returns A Promise that resolves to the retrieved entity or undefined.
|
|
352
|
+
*/
|
|
353
|
+
getOneByParams(params: Partial<T>): Promise<T | undefined>;
|
|
354
|
+
/**
|
|
355
|
+
* Retrieves a single entity by its unique identifier.
|
|
356
|
+
* @returns A Promise that resolves to the retrieved entity or undefined.
|
|
357
|
+
*/
|
|
358
|
+
getDefaultOne(): Promise<T | undefined>;
|
|
359
|
+
/**
|
|
360
|
+
* Retrieves all entities with optional pagination.
|
|
361
|
+
* @param skip - Number of entities to skip.
|
|
362
|
+
* @param take - Number of entities to take.
|
|
363
|
+
* @returns A Promise that resolves to an array of retrieved entities.
|
|
364
|
+
*/
|
|
365
|
+
getAll(): Promise<T[]>;
|
|
366
|
+
/**
|
|
367
|
+
* Retrieves multiple entities with optional pagination and filtering.
|
|
368
|
+
* @param params - [UNUSED PARAMETER, KEPT FOR POSSIBLE FUTURE USE]
|
|
369
|
+
* Filtering parameters.
|
|
370
|
+
* @param options - Query options including pagination.
|
|
371
|
+
* @returns An object containing the retrieved entities and total count.
|
|
372
|
+
*/
|
|
373
|
+
getMany(params: Partial<T>, options: {
|
|
374
|
+
page?: number;
|
|
375
|
+
pageSize?: number;
|
|
376
|
+
}): Promise<GetManyResult<T>>;
|
|
377
|
+
}
|
|
378
|
+
export abstract class AppCoreService<T extends IAppCoreModel> implements IAppCoreService<T> {
|
|
379
|
+
db: Dexie;
|
|
380
|
+
moduleName: string;
|
|
381
|
+
get table(): Dexie.Table<T>;
|
|
382
|
+
liveQuery<T>(expr: () => T): Observable<T>;
|
|
383
|
+
saveOne(item: T): Promise<T>;
|
|
384
|
+
saveMany(items: T[]): Promise<T[]>;
|
|
385
|
+
hasAny(): Promise<boolean>;
|
|
386
|
+
/**
|
|
387
|
+
* get one by uid
|
|
388
|
+
* @param uid Primary nano id
|
|
389
|
+
*/
|
|
390
|
+
getOne(uid: string): Promise<T>;
|
|
391
|
+
getOneByParams(params: Partial<T>): Promise<T | null>;
|
|
392
|
+
getDefaultOne(): Promise<T | undefined>;
|
|
393
|
+
getAll(): Promise<T[]>;
|
|
394
|
+
getMany(params?: Partial<T>, options?: any): Promise<GetManyResult<T>>;
|
|
395
|
+
}
|
|
396
|
+
export interface IAppLocalService<T extends IAppCoreModel> extends IAppCoreService<T> {
|
|
397
|
+
updateOne(id: string, item: Partial<T>): Promise<T>;
|
|
398
|
+
deleteOne(id: string): Promise<T>;
|
|
399
|
+
}
|
|
400
|
+
export class AppLocalService<T extends IAppCoreModel> extends AppCoreService<T> implements IAppLocalService<T> {
|
|
401
|
+
updateOne(id: string, item: Partial<T>): Promise<T>;
|
|
402
|
+
deleteOne(id: string): Promise<T>;
|
|
403
|
+
}
|
|
404
|
+
export interface IAppRemoteService<T extends IAppCoreModel> extends IAppCoreService<T> {
|
|
405
|
+
addOne(item: T): Promise<T>;
|
|
406
|
+
updateOne(id: number, item: Partial<T>): Promise<T>;
|
|
407
|
+
updateMany(items: T[]): Promise<T[]>;
|
|
408
|
+
deleteOne(model: T): Promise<T>;
|
|
409
|
+
}
|
|
410
|
+
export class AppRemoteService<T extends IAppCoreModel> extends AppCoreService<T> implements IAppRemoteService<T> {
|
|
411
|
+
protected readonly http: AxiosInstance;
|
|
412
|
+
readonly moduleName: string;
|
|
413
|
+
protected readonly methodName: string;
|
|
414
|
+
protected readonly options: IServiceOptions;
|
|
415
|
+
addOne(item: T): Promise<T>;
|
|
416
|
+
updateOne(id: number, item: Partial<T>): Promise<T>;
|
|
417
|
+
updateMany(items: T[]): Promise<T[]>;
|
|
418
|
+
deleteOne(model: T): Promise<T>;
|
|
419
|
+
}
|
|
420
|
+
export interface IAppModelSequence {
|
|
421
|
+
sequence: number;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
}
|
|
425
|
+
declare module '@posx/core/services/app.service' {
|
|
426
|
+
import { Employee, IEmployee } from '@posx/core/types/employee.type';
|
|
427
|
+
import { IEmployeeRole } from '@posx/core/types/role.type';
|
|
428
|
+
import { AppRemoteService, IAppRemoteService, IAppModelSequence } from '@posx/core/services/abstract.service';
|
|
429
|
+
import { IAppConfig, IConfig, UpdateGeneralConfigOptions, ICache } from '@posx/core/types/config.type';
|
|
430
|
+
import { IPrintJob, IPrintTemplate, IPrinter, IRenderPrintTemplateOptions, RenderPrintTemplateOptions } from '@posx/core/types/printer.type';
|
|
431
|
+
import { IPayment, IPaymentMethod, IPaymentSyncData } from '@posx/core/types/payment.type';
|
|
432
|
+
import { INote, INoteGroup } from '@posx/core/types/note.type';
|
|
433
|
+
import { ISection, ISectionItem } from '@posx/core/types/section.type';
|
|
434
|
+
import { Category, ICategory, ICoreItem, IItem, ISubcategory } from '@posx/core/types/product.type';
|
|
435
|
+
import { AxiosInstance } from 'axios';
|
|
436
|
+
import { IFileUploadResponse, IServiceOptions } from '@posx/core/types/misc.type';
|
|
437
|
+
import Dexie from 'dexie';
|
|
438
|
+
import { ICoreCategory } from '@posx/core/types/product.type';
|
|
439
|
+
import { IShift, ITill } from '@posx/core/types/shift.type';
|
|
440
|
+
import { IInvoice } from '@posx/core/types/invoice.type';
|
|
441
|
+
import { IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
442
|
+
import { IAppReport, IReportData, IReportRequest, ReportData } from '@posx/core/types/report.type';
|
|
443
|
+
import { IPrintCommand } from '@posx/core/libs/escpos.printer';
|
|
444
|
+
import { QueryBuilder } from '@posx/core/utils/autoquery.utils';
|
|
445
|
+
import { QueryResponse } from '@posx/core/types/auto.query.type';
|
|
446
|
+
export type IEmployeeRoleService = IAppRemoteService<IEmployeeRole> & IAppRemoteService<IEmployeeRole>;
|
|
447
|
+
export type INoteService = IAppRemoteService<INote>;
|
|
448
|
+
export type INoteGroupService = IAppRemoteService<INoteGroup>;
|
|
449
|
+
export type ISectionService = IAppRemoteService<ISection>;
|
|
450
|
+
export type ISubcategoryService = IAppRemoteService<ISubcategory>;
|
|
451
|
+
export class EmployeeRoleService extends AppRemoteService<IEmployeeRole> implements IEmployeeRoleService {
|
|
452
|
+
readonly http: AxiosInstance;
|
|
453
|
+
readonly db: Dexie;
|
|
454
|
+
readonly options: IServiceOptions;
|
|
455
|
+
readonly moduleName: string;
|
|
456
|
+
readonly methodName: string;
|
|
457
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Represents a service for managing items.
|
|
461
|
+
* Extends the IAppRemoteService interface for CRUD operations on IItem objects.
|
|
462
|
+
*/
|
|
463
|
+
/**
|
|
464
|
+
* Represents a service for managing section items.
|
|
465
|
+
* Extends the IAppRemoteService interface with ISectionItem type.
|
|
466
|
+
*/
|
|
467
|
+
export interface ISectionItemService extends IAppRemoteService<ISectionItem> {
|
|
468
|
+
/**
|
|
469
|
+
* Changes the section item with the specified uid to take out.
|
|
470
|
+
* @param uid - The unique identifier of the section item to change.
|
|
471
|
+
* @returns A promise that resolves with the updated section item.
|
|
472
|
+
*/
|
|
473
|
+
changeToTakeOut(uid: string): Promise<ISectionItem>;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Represents a service for managing employees.
|
|
477
|
+
* @template IEmployee The type of employee object.
|
|
478
|
+
* @extends IAppRemoteService<IEmployee> The interface for a remote service that manages employees.
|
|
479
|
+
*/
|
|
480
|
+
export interface IEmployeeService extends IAppRemoteService<IEmployee> {
|
|
481
|
+
/**
|
|
482
|
+
* Logs in a user with the given user uid and password.
|
|
483
|
+
* @param userUid The uid of the user to log in.
|
|
484
|
+
* @param password The password of the user to log in.
|
|
485
|
+
* @returns A promise that resolves to true if the login was successful, or false otherwise.
|
|
486
|
+
*/
|
|
487
|
+
login(userUid: string, password: string): Promise<boolean>;
|
|
488
|
+
createEmployee(employee: IEmployee): Promise<IEmployee>;
|
|
489
|
+
/**
|
|
490
|
+
* Changes the password of the user with the given user UID.
|
|
491
|
+
* @param userUid The UID of the user whose password should be changed.
|
|
492
|
+
* @param oldPassword The user's current password.
|
|
493
|
+
* @param newPassword The new password to set for the user.
|
|
494
|
+
* @returns A promise that resolves to true if the password was changed successfully, or false otherwise.
|
|
495
|
+
*/
|
|
496
|
+
changePassword(userUid: string, oldPassword: string, newPassword: string): Promise<boolean>;
|
|
497
|
+
}
|
|
498
|
+
export class EmployeeService extends AppRemoteService<Employee> implements IEmployeeService {
|
|
499
|
+
readonly http: any;
|
|
500
|
+
readonly db: Dexie;
|
|
501
|
+
readonly options: IServiceOptions;
|
|
502
|
+
readonly moduleName: string;
|
|
503
|
+
readonly methodName: string;
|
|
504
|
+
constructor(http: any, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
505
|
+
login(userUid: string, password: string): Promise<boolean>;
|
|
506
|
+
createEmployee(employee: IEmployee): Promise<IEmployee>;
|
|
507
|
+
changePassword(userUid: string, oldPassword: string, newPassword: string): Promise<boolean>;
|
|
508
|
+
}
|
|
509
|
+
export interface IItemService extends IAppRemoteService<IItem> {
|
|
510
|
+
/**
|
|
511
|
+
* Adds an image to an item.
|
|
512
|
+
* @param file - The image file to add.
|
|
513
|
+
* @param item - The item to add the image to.
|
|
514
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
515
|
+
*/
|
|
516
|
+
addImageAsync(file: File, item: ICoreItem): Promise<void>;
|
|
517
|
+
/**
|
|
518
|
+
* Adds a modifier category to an item.
|
|
519
|
+
* @param item - The item to add the modifier category to.
|
|
520
|
+
* @param category - The category to add.
|
|
521
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
522
|
+
*/
|
|
523
|
+
addModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
|
|
524
|
+
/**
|
|
525
|
+
* Updates a modifier category of an item.
|
|
526
|
+
* @param item - The item to update the modifier category of.
|
|
527
|
+
* @param category - The category to update.
|
|
528
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
529
|
+
*/
|
|
530
|
+
updateModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
|
|
531
|
+
/**
|
|
532
|
+
* Removes a modifier category from an item.
|
|
533
|
+
* @param item - The item to remove the modifier category from.
|
|
534
|
+
* @param category - The category to remove.
|
|
535
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
536
|
+
*/
|
|
537
|
+
removeModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
|
|
538
|
+
/**
|
|
539
|
+
* Adds a modifier to an item.
|
|
540
|
+
* @param item - The item to add the modifier to.
|
|
541
|
+
* @param modifier - The modifier to add.
|
|
542
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
543
|
+
*/
|
|
544
|
+
addModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
|
|
545
|
+
/**
|
|
546
|
+
* Updates a modifier of an item.
|
|
547
|
+
* @param item - The item to update the modifier of.
|
|
548
|
+
* @param modifier - The modifier to update.
|
|
549
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
550
|
+
*/
|
|
551
|
+
updateModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
|
|
552
|
+
/**
|
|
553
|
+
* Removes a modifier from an item.
|
|
554
|
+
* @param item - The item to remove the modifier from.
|
|
555
|
+
* @param modifier - The modifier to remove.
|
|
556
|
+
* @returns A Promise that resolves to the updated IItem object.
|
|
557
|
+
*/
|
|
558
|
+
removeModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
|
|
559
|
+
/**
|
|
560
|
+
* attach a ungrouped modifier to a modifier group (category)
|
|
561
|
+
* if you want to detach a modifier from a group, pass an empty string as the category_uid
|
|
562
|
+
* @param item the item to attach the modifier to it's modifier category
|
|
563
|
+
* @param modifier_uid the uid of the modifier to attach
|
|
564
|
+
* @param category_uid the uid of the category to attach the modifier to
|
|
565
|
+
*/
|
|
566
|
+
attachModifierToGroup(item: IItem, modifier_uid: string, category_uid: string): Promise<IItem>;
|
|
567
|
+
/**
|
|
568
|
+
* Searches for items by name, codename or barcode.
|
|
569
|
+
* @param query - The search query.
|
|
570
|
+
* @returns A Promise that resolves to an array of IItem objects.
|
|
571
|
+
*/
|
|
572
|
+
search(query: string): Promise<IItem[]>;
|
|
573
|
+
/**
|
|
574
|
+
* mark an item as sold out
|
|
575
|
+
* @param uid uid of the item to change to sold out
|
|
576
|
+
*/
|
|
577
|
+
changeToSoldOut(uid: string): Promise<IItem>;
|
|
578
|
+
/**
|
|
579
|
+
* change the stock of an item by increment or decrement
|
|
580
|
+
* @param uid uid of the item to change stock
|
|
581
|
+
* @param stock the quantity to change the stock by, can be negative
|
|
582
|
+
*/
|
|
583
|
+
changeStock(uid: string, stock: number): Promise<IItem>;
|
|
584
|
+
/**
|
|
585
|
+
* Clone an item
|
|
586
|
+
* @param item item to clone
|
|
587
|
+
* @returns cloned item
|
|
588
|
+
*/
|
|
589
|
+
cloneItem(item: IItem): Promise<IItem>;
|
|
590
|
+
/**
|
|
591
|
+
* Clone modifiers of an item
|
|
592
|
+
* @param item item to clone modifiers
|
|
593
|
+
* @returns cloned modifiers
|
|
594
|
+
*/
|
|
595
|
+
cloneModifiers(modifierCategory: ICoreCategory, modifiers: ICoreItem[]): Promise<{
|
|
596
|
+
modifierCategory: ICoreCategory;
|
|
597
|
+
modifiers: ICoreItem[];
|
|
598
|
+
}>;
|
|
599
|
+
}
|
|
600
|
+
export class ItemService extends AppRemoteService<IItem> implements IItemService {
|
|
601
|
+
readonly http: AxiosInstance;
|
|
602
|
+
readonly db: Dexie;
|
|
603
|
+
readonly options: IServiceOptions;
|
|
604
|
+
readonly moduleName: string;
|
|
605
|
+
readonly methodName: string;
|
|
606
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
607
|
+
search(query: string): Promise<IItem[]>;
|
|
608
|
+
addModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
|
|
609
|
+
updateModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
|
|
610
|
+
removeModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
|
|
611
|
+
addModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
|
|
612
|
+
updateModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
|
|
613
|
+
removeModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
|
|
614
|
+
attachModifierToGroup(item: IItem, modifier_uid: string, category_uid: string): Promise<IItem>;
|
|
615
|
+
addImageAsync(file: File, item: ICoreItem): Promise<void>;
|
|
616
|
+
changeToSoldOut(uid: string): Promise<IItem>;
|
|
617
|
+
changeStock(uid: string, stock: number): Promise<IItem>;
|
|
618
|
+
private convertFileToBase64;
|
|
619
|
+
private getFileExtension;
|
|
620
|
+
cloneItem(item: IItem): Promise<IItem>;
|
|
621
|
+
cloneModifiers(modifierCategory: ICoreCategory, modifiers: ICoreItem[]): Promise<{
|
|
622
|
+
modifierCategory: ICoreCategory;
|
|
623
|
+
modifiers: ICoreItem[];
|
|
624
|
+
}>;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Represents a service for managing categories.
|
|
628
|
+
* Extends the IAppRemoteService interface with the ICategory type.
|
|
629
|
+
*/
|
|
630
|
+
export interface ICategoryService extends IAppRemoteService<ICategory> {
|
|
631
|
+
/**
|
|
632
|
+
* Adds a subcategory to a category.
|
|
633
|
+
* @param category - The category to add the subcategory to.
|
|
634
|
+
* @param subcategory - The subcategory to add.
|
|
635
|
+
* @returns A promise that resolves to the updated category.
|
|
636
|
+
*/
|
|
637
|
+
addSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
|
|
638
|
+
/**
|
|
639
|
+
* Updates a subcategory of a category.
|
|
640
|
+
* @param category - The category that contains the subcategory.
|
|
641
|
+
* @param subcategory - The updated subcategory.
|
|
642
|
+
* @returns A promise that resolves to the updated category.
|
|
643
|
+
*/
|
|
644
|
+
updateSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
|
|
645
|
+
/**
|
|
646
|
+
* Removes a subcategory from a category.
|
|
647
|
+
* @param category - The category to remove the subcategory from.
|
|
648
|
+
* @param subcategoryUid - The unique identifier of the subcategory to remove.
|
|
649
|
+
* @returns A promise that resolves to the updated category.
|
|
650
|
+
*/
|
|
651
|
+
removeSubcategory(category: ICategory, subcategoryUid: string): Promise<ICategory>;
|
|
652
|
+
}
|
|
653
|
+
export class CategoryService extends AppRemoteService<Category> {
|
|
654
|
+
readonly http: AxiosInstance;
|
|
655
|
+
readonly db: Dexie;
|
|
656
|
+
readonly options: IServiceOptions;
|
|
657
|
+
readonly moduleName: string;
|
|
658
|
+
readonly methodName: string;
|
|
659
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
660
|
+
addSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
|
|
661
|
+
updateSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
|
|
662
|
+
removeSubcategory(category: ICategory, subcategoryUid: string): Promise<ICategory>;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Represents a configuration service that extends the IAppRemoteService interface and provides methods for updating general configuration.
|
|
666
|
+
*/
|
|
667
|
+
export interface IConfigService extends IAppRemoteService<IAppConfig> {
|
|
668
|
+
/**
|
|
669
|
+
* Updates the general configuration with the specified options.
|
|
670
|
+
* @param options The options for updating the general configuration.
|
|
671
|
+
* @returns A promise that resolves to the updated application configuration.
|
|
672
|
+
*/
|
|
673
|
+
updateGeneralConfig(options: UpdateGeneralConfigOptions): Promise<IAppConfig>;
|
|
674
|
+
/**
|
|
675
|
+
* Updates a config category with the specified options.
|
|
676
|
+
* @param configKey the config category key to update
|
|
677
|
+
* @param options the value to update the config category with
|
|
678
|
+
*/
|
|
679
|
+
updateConfig(configKey: keyof IConfig, options: Partial<IConfig[typeof configKey]>): Promise<IAppConfig>;
|
|
680
|
+
/**
|
|
681
|
+
* Uploads an image to the server.
|
|
682
|
+
* @param file - The file to upload.
|
|
683
|
+
* @returns A promise that resolves with the uploaded file.
|
|
684
|
+
*/
|
|
685
|
+
uploadFile(file: File): Promise<IFileUploadResponse>;
|
|
686
|
+
}
|
|
687
|
+
export class ConfigService extends AppRemoteService<IAppConfig> implements IConfigService {
|
|
688
|
+
readonly http: AxiosInstance;
|
|
689
|
+
readonly db: Dexie;
|
|
690
|
+
readonly options: IServiceOptions;
|
|
691
|
+
readonly moduleName: string;
|
|
692
|
+
readonly methodName: string;
|
|
693
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
694
|
+
private configFactories;
|
|
695
|
+
updateConfig<T extends keyof IConfig>(configKey: T, options: Partial<IConfig[T]>): Promise<IAppConfig>;
|
|
696
|
+
updateGeneralConfig(options: UpdateGeneralConfigOptions): Promise<IAppConfig>;
|
|
697
|
+
updateCache(partialCache: Partial<ICache>): Promise<IAppConfig>;
|
|
698
|
+
uploadFile(file: File): Promise<IFileUploadResponse>;
|
|
699
|
+
}
|
|
700
|
+
export class SectionService extends AppRemoteService<ISection> implements ISectionService {
|
|
701
|
+
readonly http: AxiosInstance;
|
|
702
|
+
readonly db: Dexie;
|
|
703
|
+
readonly options: IServiceOptions;
|
|
704
|
+
readonly moduleName: string;
|
|
705
|
+
readonly methodName: string;
|
|
706
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
707
|
+
}
|
|
708
|
+
export class SectionItemService extends AppRemoteService<ISectionItem> implements ISectionItemService {
|
|
709
|
+
readonly http: AxiosInstance;
|
|
710
|
+
readonly db: Dexie;
|
|
711
|
+
readonly options: IServiceOptions;
|
|
712
|
+
readonly moduleName: string;
|
|
713
|
+
readonly methodName: string;
|
|
714
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
715
|
+
changeToTakeOut(uid: string): Promise<ISectionItem>;
|
|
716
|
+
}
|
|
717
|
+
export type IProductService = IAppRemoteService<IItem>;
|
|
718
|
+
export class ProductService extends AppRemoteService<IItem> implements IProductService {
|
|
719
|
+
readonly http: AxiosInstance;
|
|
720
|
+
readonly db: Dexie;
|
|
721
|
+
readonly options: IServiceOptions;
|
|
722
|
+
readonly moduleName: string;
|
|
723
|
+
readonly methodName: string;
|
|
724
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
725
|
+
}
|
|
726
|
+
export interface IShiftService extends IAppRemoteService<IShift> {
|
|
727
|
+
closeShift(declareAmount: number, userUid: string): Promise<IShift>;
|
|
728
|
+
openShift(openAmount: number, userUid: string, note?: string): Promise<IShift>;
|
|
729
|
+
cashIn(amount: number, note: string): Promise<ITill>;
|
|
730
|
+
cashOut(amount: number, note: string): Promise<ITill>;
|
|
731
|
+
}
|
|
732
|
+
export class ShiftService extends AppRemoteService<IShift> implements IShiftService {
|
|
733
|
+
readonly http: AxiosInstance;
|
|
734
|
+
readonly db: Dexie;
|
|
735
|
+
readonly options: IServiceOptions;
|
|
736
|
+
readonly moduleName: string;
|
|
737
|
+
readonly methodName: string;
|
|
738
|
+
private tillService;
|
|
739
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
740
|
+
cashIn(amount: number, note: string): Promise<ITill>;
|
|
741
|
+
cashOut(amount: number, note: string): Promise<ITill>;
|
|
742
|
+
closeShift(declareAmount: number, userUid: string): Promise<IShift>;
|
|
743
|
+
openShift(openAmount: number, userUid: string, note?: string): Promise<IShift>;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Represents a service for creating cash invoice tills.
|
|
747
|
+
* @interface
|
|
748
|
+
* @extends IAppRemoteService
|
|
749
|
+
*/
|
|
750
|
+
export interface ITillService extends IAppRemoteService<ITill> {
|
|
751
|
+
/**
|
|
752
|
+
* Creates a cash invoice till.
|
|
753
|
+
* @param {IPayment[]} payments - Invoice payments.
|
|
754
|
+
* @param {string} shift_uid - The shift UID.
|
|
755
|
+
* @param {string} user_uid - The user UID.
|
|
756
|
+
* @param {string} [note] - The note for the till.
|
|
757
|
+
* @returns {Promise<ITill>} - A promise that resolves with the created till.
|
|
758
|
+
*/
|
|
759
|
+
createCashInvoiceTill(payments: IPayment[], shift_uid: string, user_uid: string, note?: string): Promise<ITill>;
|
|
760
|
+
}
|
|
761
|
+
export class TillService extends AppRemoteService<ITill> implements ITillService {
|
|
762
|
+
readonly http: AxiosInstance;
|
|
763
|
+
readonly db: Dexie;
|
|
764
|
+
readonly options: IServiceOptions;
|
|
765
|
+
readonly moduleName: string;
|
|
766
|
+
readonly methodName: string;
|
|
767
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
768
|
+
createCashInvoiceTill(payments: IPayment[], shift_uid: string, user_uid: string, note?: string): Promise<ITill>;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Represents a service for managing payment methods.
|
|
772
|
+
* Extends the IAppRemoteService interface for CRUD operations.
|
|
773
|
+
*/
|
|
774
|
+
export interface IPaymentMethodService extends IAppRemoteService<IPaymentMethod> {
|
|
775
|
+
/**
|
|
776
|
+
* Synchronizes the standard payment methods from server and updates database.
|
|
777
|
+
* @returns A promise that resolves with an array of IPaymentMethod objects.
|
|
778
|
+
*/
|
|
779
|
+
syncStandardPaymentMethods(): Promise<IPaymentMethod[]>;
|
|
780
|
+
/**
|
|
781
|
+
* Enables a payment method.
|
|
782
|
+
* @param paymentMethod - The payment method to enable.
|
|
783
|
+
* @returns A promise that resolves with the enabled IPaymentMethod object.
|
|
784
|
+
*/
|
|
785
|
+
enablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
786
|
+
/**
|
|
787
|
+
* Disables a payment method.
|
|
788
|
+
* @param paymentMethod - The payment method to disable.
|
|
789
|
+
* @returns A promise that resolves with the disabled IPaymentMethod object.
|
|
790
|
+
*/
|
|
791
|
+
disablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
792
|
+
/**
|
|
793
|
+
* Changes the sequence of a payment method.
|
|
794
|
+
* @param paymentMethod - The payment method to change the sequence of.
|
|
795
|
+
* @param sequence - The new sequence number for the payment method.
|
|
796
|
+
* @returns A promise that resolves with the updated IPaymentMethod object.
|
|
797
|
+
*/
|
|
798
|
+
changeSequence(paymentMethod: IPaymentMethod, sequence: number): Promise<IPaymentMethod>;
|
|
799
|
+
}
|
|
800
|
+
export class PaymentMethodService extends AppRemoteService<IPaymentMethod> implements IPaymentMethodService {
|
|
801
|
+
readonly http: AxiosInstance;
|
|
802
|
+
readonly db: Dexie;
|
|
803
|
+
readonly options: IServiceOptions;
|
|
804
|
+
readonly moduleName: string;
|
|
805
|
+
readonly methodName: string;
|
|
806
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
807
|
+
syncStandardPaymentMethods(): Promise<IPaymentMethod[]>;
|
|
808
|
+
enablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
809
|
+
disablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
|
|
810
|
+
changeSequence(paymentMethod: IPaymentMethod, sequence: number): Promise<IPaymentMethod>;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Interface for Payment Service that extends IAppRemoteService with IPayment type.
|
|
814
|
+
*/
|
|
815
|
+
export interface IPaymentService extends IAppRemoteService<IPayment> {
|
|
816
|
+
/**
|
|
817
|
+
* Adds a payment to an invoice.
|
|
818
|
+
* @param invoice - The invoice to add the payment to.
|
|
819
|
+
* @param amount - The amount of the payment.
|
|
820
|
+
* @param paymentMethod - The payment method used for the payment.
|
|
821
|
+
* @returns A promise that resolves to the updated invoice.
|
|
822
|
+
*/
|
|
823
|
+
addPayment(invoice: IInvoice, amount: number, paymentMethod: IPaymentMethod): Promise<IInvoice>;
|
|
824
|
+
/**
|
|
825
|
+
* Removes a payment from an invoice.
|
|
826
|
+
* @param invoice - The invoice to remove the payment from.
|
|
827
|
+
* @param payment_uid - The unique identifier of the payment to remove.
|
|
828
|
+
* @returns A promise that resolves to the updated invoice.
|
|
829
|
+
*/
|
|
830
|
+
removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
|
|
831
|
+
/**
|
|
832
|
+
* Sync payment status callback function type
|
|
833
|
+
*/
|
|
834
|
+
onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
|
|
835
|
+
/**
|
|
836
|
+
* Sync payment status to external systems
|
|
837
|
+
* @param data - Payment sync data
|
|
838
|
+
*/
|
|
839
|
+
syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Payment Service implementation
|
|
843
|
+
*
|
|
844
|
+
* Usage example for CDS payment status sync:
|
|
845
|
+
* ```typescript
|
|
846
|
+
* // Setup payment sync callback
|
|
847
|
+
* paymentService.onPaymentSync = async (data: IPaymentSyncData) => {
|
|
848
|
+
* // Send to CDS or other external systems
|
|
849
|
+
* console.log('Payment status:', data.status, 'for payment:', data.payment_uid);
|
|
850
|
+
* };
|
|
851
|
+
*
|
|
852
|
+
* // Manual payment status sync (for external payment flows)
|
|
853
|
+
* await paymentService.syncPaymentStatus({
|
|
854
|
+
* payment_uid: 'payment_123',
|
|
855
|
+
* invoice_uid: 'invoice_456',
|
|
856
|
+
* status: PaymentStatus.STARTED,
|
|
857
|
+
* payment_method: paymentMethod,
|
|
858
|
+
* amount: 100.00,
|
|
859
|
+
* timestamp: new Date()
|
|
860
|
+
* });
|
|
861
|
+
* ```
|
|
862
|
+
*/
|
|
863
|
+
export class PaymentService extends AppRemoteService<IPayment> implements IPaymentService {
|
|
864
|
+
readonly http: AxiosInstance;
|
|
865
|
+
readonly db: Dexie;
|
|
866
|
+
readonly options: IServiceOptions;
|
|
867
|
+
readonly moduleName: string;
|
|
868
|
+
readonly methodName: string;
|
|
869
|
+
onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
|
|
870
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
871
|
+
addPayment(invoice: IInvoice, amount: number, paymentMethod: IPaymentMethod): Promise<IInvoice>;
|
|
872
|
+
removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
|
|
873
|
+
syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Represents the interface for the AppMiscService.
|
|
877
|
+
*/
|
|
878
|
+
export interface IAppMiscService {
|
|
879
|
+
/**
|
|
880
|
+
* Calibrates the sequence for a given service.
|
|
881
|
+
* @param service - The service to calibrate the sequence for.
|
|
882
|
+
* @returns A promise that resolves when the calibration is complete.
|
|
883
|
+
*/
|
|
884
|
+
calibrateSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>): Promise<void>;
|
|
885
|
+
/**
|
|
886
|
+
* Changes the sequence of an item for a given service.
|
|
887
|
+
* @param service - The service to change the sequence for.
|
|
888
|
+
* @param item - The item to change the sequence of.
|
|
889
|
+
* @param sequence - The new sequence number for the item.
|
|
890
|
+
* @returns A promise that resolves with the updated item.
|
|
891
|
+
*/
|
|
892
|
+
changeSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>, item: T, sequence: number): Promise<T>;
|
|
893
|
+
}
|
|
894
|
+
export class AppMiscService implements IAppMiscService {
|
|
895
|
+
calibrateSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>): Promise<void>;
|
|
896
|
+
changeSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>, item: T, sequence: number): Promise<T>;
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Represents the interface for the App Report Service.
|
|
900
|
+
* Extends the IAppRemoteService interface with methods specific to report functionality.
|
|
901
|
+
*/
|
|
902
|
+
export interface IAppReportService extends IAppRemoteService<IAppReport> {
|
|
903
|
+
/**
|
|
904
|
+
* Synchronizes standard reports.
|
|
905
|
+
* @returns A promise that resolves to an instance of IAppReport.
|
|
906
|
+
*/
|
|
907
|
+
syncStandardReports(): Promise<IAppReport>;
|
|
908
|
+
/**
|
|
909
|
+
* Prints a report.
|
|
910
|
+
* @param request - The request object containing the necessary information for printing the report.
|
|
911
|
+
* @returns A promise that resolves when the report is printed successfully.
|
|
912
|
+
*/
|
|
913
|
+
printReport(request: IReportRequest): Promise<void>;
|
|
914
|
+
}
|
|
915
|
+
export class AppReportService extends AppRemoteService<IAppReport> implements IAppReportService {
|
|
916
|
+
readonly http: AxiosInstance;
|
|
917
|
+
readonly db: Dexie;
|
|
918
|
+
readonly options: IServiceOptions;
|
|
919
|
+
readonly moduleName: string;
|
|
920
|
+
readonly methodName: string;
|
|
921
|
+
private invoiceService;
|
|
922
|
+
private tillService;
|
|
923
|
+
private paymentService;
|
|
924
|
+
private printerService;
|
|
925
|
+
private printTemplateService;
|
|
926
|
+
private printJobService;
|
|
927
|
+
private configService;
|
|
928
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
929
|
+
syncStandardReports(): Promise<IAppReport>;
|
|
930
|
+
printReport(request: IReportRequest): Promise<void>;
|
|
931
|
+
private getReportData;
|
|
932
|
+
processReportInvoicesData(reportData: IReportData, invoices?: IInvoice[]): IReportData;
|
|
933
|
+
}
|
|
934
|
+
export type IPrintJobService = IAppRemoteService<IPrintJob> & {
|
|
935
|
+
/**
|
|
936
|
+
* Autoquery print jobs
|
|
937
|
+
* @param builder autoquery builder
|
|
938
|
+
*/
|
|
939
|
+
autoquery(builder: QueryBuilder<IPrintJob>): Promise<QueryResponse<IPrintJob>>;
|
|
940
|
+
replacePrinter(printJob: IPrintJob, printer: IPrinter): IPrintJob;
|
|
941
|
+
};
|
|
942
|
+
export class PrintJobService extends AppRemoteService<IPrintJob> implements IPrintJobService {
|
|
943
|
+
readonly http: AxiosInstance;
|
|
944
|
+
readonly db: Dexie;
|
|
945
|
+
readonly options: IServiceOptions;
|
|
946
|
+
readonly moduleName: string;
|
|
947
|
+
readonly methodName: string;
|
|
948
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
949
|
+
autoquery(builder: QueryBuilder<IPrintJob>): Promise<QueryResponse<IPrintJob>>;
|
|
950
|
+
replacePrinter(printJob: IPrintJob, printer: IPrinter): IPrintJob;
|
|
951
|
+
}
|
|
952
|
+
export interface IPrintTemplateService extends IAppRemoteService<IPrintTemplate> {
|
|
953
|
+
/**
|
|
954
|
+
* initialize all default print templates, it should be called only once
|
|
955
|
+
* @returns void
|
|
956
|
+
*/
|
|
957
|
+
initialize(): Promise<void>;
|
|
958
|
+
/**
|
|
959
|
+
* Render print template
|
|
960
|
+
* @param invoice invoice to render
|
|
961
|
+
* @param config config to render
|
|
962
|
+
* @param template template to render
|
|
963
|
+
* @returns print command
|
|
964
|
+
*/
|
|
965
|
+
renderPrintTemplate(invoice: IInvoice, config: IConfig, template: IPrintTemplate, options: IRenderPrintTemplateOptions): Promise<IPrintCommand>;
|
|
966
|
+
/**
|
|
967
|
+
* Render report print template
|
|
968
|
+
* @param reportData report data to render
|
|
969
|
+
* @param template template to render
|
|
970
|
+
* @returns print command
|
|
971
|
+
*/
|
|
972
|
+
renderReportPrintTemplate(reportData: IReportData, config: IConfig, template: IPrintTemplate, options?: IRenderPrintTemplateOptions): Promise<IPrintCommand>;
|
|
973
|
+
}
|
|
974
|
+
export class PrintTemplateService extends AppRemoteService<IPrintTemplate> implements IPrintTemplateService {
|
|
975
|
+
readonly http: AxiosInstance;
|
|
976
|
+
readonly db: Dexie;
|
|
977
|
+
readonly options: IServiceOptions;
|
|
978
|
+
readonly moduleName: string;
|
|
979
|
+
readonly methodName: string;
|
|
980
|
+
httpClient: AxiosInstance;
|
|
981
|
+
private secretKey;
|
|
982
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
983
|
+
initialize(): Promise<void>;
|
|
984
|
+
renderPrintTemplate(invoice: IInvoice, config: IConfig, template: IPrintTemplate, options?: RenderPrintTemplateOptions): Promise<IPrintCommand>;
|
|
985
|
+
renderReportPrintTemplate(reportData: ReportData, config: IConfig, template: IPrintTemplate, options?: RenderPrintTemplateOptions): Promise<IPrintCommand>;
|
|
986
|
+
private getPrintTemplate;
|
|
987
|
+
private getCodepageByCountryCode;
|
|
988
|
+
private renderPrintCommand;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
}
|
|
992
|
+
declare module '@posx/core/services/invoice.merge.test' {
|
|
993
|
+
export {};
|
|
994
|
+
|
|
995
|
+
}
|
|
996
|
+
declare module '@posx/core/services/invoice.service' {
|
|
997
|
+
import { IAppRemoteService, AppRemoteService } from '@posx/core/services/abstract.service';
|
|
998
|
+
import { CalcFlow, CalcType, IInvoice, IInvoiceLine, TaxMethod, IInvoiceCoreLine, CreateInvoiceOptions, CancelInvoiceOptions, CheckInvoiceOptions, DirectPayInvoiceOptions } from '@posx/core/types/invoice.type';
|
|
999
|
+
import { IAppConfig } from '@posx/core/types/config.type';
|
|
1000
|
+
import { ICoreItem, IItem } from '@posx/core/types/product.type';
|
|
1001
|
+
import { ICustomer } from '@posx/core/types/wyo.customer.type';
|
|
1002
|
+
import { IServiceOptions } from '@posx/core/types/misc.type';
|
|
1003
|
+
import { ISectionItem } from '@posx/core/types/section.type';
|
|
1004
|
+
import { ITillService, ISectionItemService, ConfigService, PrintTemplateService, PrintJobService } from '@posx/core/services/app.service';
|
|
1005
|
+
import { AxiosInstance } from 'axios';
|
|
1006
|
+
import Dexie from 'dexie';
|
|
1007
|
+
import { SwitchInvoiceOptions, PayInvoiceOptions, VoidInvoiceOptions, UpdateInvoiceOptions } from '@posx/core/types/invoice.type';
|
|
1008
|
+
import { ITill } from '@posx/core/types/shift.type';
|
|
1009
|
+
import { QueryResponse } from '@posx/core/types/auto.query.type';
|
|
1010
|
+
import { IChangePaymentMethodOption } from '@posx/core/types/payment.type';
|
|
1011
|
+
import { PrinterService } from '@posx/core/services/printer.service';
|
|
1012
|
+
import { IPrinter, PrinterType } from '@posx/core/types/printer.type';
|
|
1013
|
+
import { IEmployee } from '@posx/core/types/employee.type';
|
|
1014
|
+
import { QueryBuilder, QueryEtcParams } from '@posx/core/utils/autoquery.utils';
|
|
1015
|
+
export interface IInvoiceBaseService extends IAppRemoteService<IInvoice> {
|
|
1016
|
+
calculate(invoice: IInvoice, appConfig: IAppConfig, disableRounding?: boolean): IInvoice;
|
|
1017
|
+
calculateLines(invoice: IInvoice): void;
|
|
1018
|
+
calculateLine(line: IInvoiceLine): void;
|
|
1019
|
+
calculatePointSubtotal(invoice: IInvoice): void;
|
|
1020
|
+
calculateDeliveryCharge(invoice: IInvoice): void;
|
|
1021
|
+
calculateInvoiceServiceChargeableSubtotal(invoice: IInvoice): void;
|
|
1022
|
+
calculateDiscount(invoice: IInvoice, flow: CalcFlow): void;
|
|
1023
|
+
calculateRounding(invoice: IInvoice, roundingBase: number, roundingUp: boolean, roundingCashless: boolean): void;
|
|
1024
|
+
roundingStep(total: number, roundingBase: number, roundingUp: boolean): number;
|
|
1025
|
+
calculateServiceCharge(invoice: IInvoice, rate: number): void;
|
|
1026
|
+
calculateTax(invoice: IInvoice, taxRate: number, taxMethod: TaxMethod): void;
|
|
1027
|
+
calculateCreditDeduction(invoice: IInvoice): void;
|
|
1028
|
+
calculateTaxSubtotalRatio(invoice: IInvoice): number;
|
|
1029
|
+
calculateRewardCredit(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: any): void;
|
|
1030
|
+
calculateAddCredit(invoice: IInvoice): void;
|
|
1031
|
+
calculateRewardPoint(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
|
|
1032
|
+
calculateChangeAmount(invoice: IInvoice): void;
|
|
1033
|
+
calculateInvoiceCharges(invoice: IInvoice, flow: CalcFlow): void;
|
|
1034
|
+
}
|
|
1035
|
+
export type LineOptions = {
|
|
1036
|
+
quantity?: number;
|
|
1037
|
+
price?: number;
|
|
1038
|
+
remark?: string;
|
|
1039
|
+
};
|
|
1040
|
+
export class InvoiceBaseService extends AppRemoteService<IInvoice> implements IInvoiceBaseService {
|
|
1041
|
+
readonly http: AxiosInstance;
|
|
1042
|
+
readonly db: Dexie;
|
|
1043
|
+
readonly options: IServiceOptions;
|
|
1044
|
+
readonly moduleName: string;
|
|
1045
|
+
readonly methodName: string;
|
|
1046
|
+
protected tillService: ITillService;
|
|
1047
|
+
protected sectionItemService: ISectionItemService;
|
|
1048
|
+
protected configService: ConfigService;
|
|
1049
|
+
protected printTemplateService: PrintTemplateService;
|
|
1050
|
+
protected printerService: PrinterService;
|
|
1051
|
+
protected printJobService: PrintJobService;
|
|
1052
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
1053
|
+
calculate(invoice: IInvoice, appConfig: IAppConfig, disableRounding?: boolean): IInvoice;
|
|
1054
|
+
calculateLines(invoice: IInvoice): void;
|
|
1055
|
+
calculateLine(line: IInvoiceLine): void;
|
|
1056
|
+
calculatePointSubtotal(invoice: IInvoice): void;
|
|
1057
|
+
/**
|
|
1058
|
+
* Calculate the invoice subtotal without considering take out
|
|
1059
|
+
* @param invoice - The invoice object containing invoice lines
|
|
1060
|
+
* @returns The updated invoice object with calculated subtotals
|
|
1061
|
+
*/
|
|
1062
|
+
calculateInvoiceServiceChargeableSubtotal(invoice: IInvoice): void;
|
|
1063
|
+
/**
|
|
1064
|
+
* Calculate customer package and update line subtotals
|
|
1065
|
+
* @param invoice - The invoice object containing customer details and lines
|
|
1066
|
+
* @param line - The invoice line to be calculated
|
|
1067
|
+
* @param write - Flag to decide if customer spend history should be updated
|
|
1068
|
+
* @returns The calculated line subtotal
|
|
1069
|
+
*/
|
|
1070
|
+
/**
|
|
1071
|
+
* Calculate the total discount amount of an invoice and update grand total accordingly
|
|
1072
|
+
* @param invoice - The invoice object containing discount details and lines
|
|
1073
|
+
* @param flow - The calculation of discount flow
|
|
1074
|
+
* @returns The updated invoice object with calculated discount and grand total
|
|
1075
|
+
*/
|
|
1076
|
+
calculateDiscount(invoice: IInvoice, flow: CalcFlow): void;
|
|
1077
|
+
/**
|
|
1078
|
+
* Calculates the rounding for an invoice based on the given parameters.
|
|
1079
|
+
* @param invoice - The invoice to calculate the rounding for.
|
|
1080
|
+
* @param roundingBase - The base value to round to.
|
|
1081
|
+
* @param roundingUp - Whether to round up or down.
|
|
1082
|
+
* @param roundingCashless - Whether to apply rounding only for cash payments.
|
|
1083
|
+
*/
|
|
1084
|
+
calculateRounding(invoice: IInvoice, roundingBase: number, roundingUp: boolean, roundingCashless: boolean): void;
|
|
1085
|
+
roundingStep(total: number, roundingBase: number, roundingUp: boolean): number;
|
|
1086
|
+
/**
|
|
1087
|
+
* Calculate the delivery charge of an invoice
|
|
1088
|
+
* @param invoice - The invoice object containing delivery charge and type
|
|
1089
|
+
* @returns The updated invoice object with calculated grand total
|
|
1090
|
+
*/
|
|
1091
|
+
calculateDeliveryCharge(invoice: IInvoice): void;
|
|
1092
|
+
/**
|
|
1093
|
+
* Calculate and set the service charge for a given invoice.
|
|
1094
|
+
* The method updates the service_charge and grand_total fields of the invoice.
|
|
1095
|
+
*
|
|
1096
|
+
* @param invoice - invoice to calculate the service charge for
|
|
1097
|
+
* @param rate - service charge rate. e.g. 0.1 for 10%
|
|
1098
|
+
* @returns {void} -
|
|
1099
|
+
*/
|
|
1100
|
+
calculateServiceCharge(invoice: IInvoice, rate: number): void;
|
|
1101
|
+
/**
|
|
1102
|
+
* Calculates the tax for an invoice based on the tax rate and tax method.
|
|
1103
|
+
* @param invoice - The invoice to calculate the tax for.
|
|
1104
|
+
* @param taxRate - The tax rate to apply.
|
|
1105
|
+
* @param taxMethod - The tax method to use (inclusive or exclusive).
|
|
1106
|
+
*/
|
|
1107
|
+
calculateTax(invoice: IInvoice, taxRate: number, taxMethod: TaxMethod): void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Adjusts the grand total of the invoice by the deduction balance
|
|
1110
|
+
* @param invoice - The invoice to adjust.
|
|
1111
|
+
* @returns void
|
|
1112
|
+
*/
|
|
1113
|
+
calculateCreditDeduction(invoice: IInvoice): void;
|
|
1114
|
+
/**
|
|
1115
|
+
* Calculate the tax subtotal ratio for the invoice.
|
|
1116
|
+
* @param invoice - The invoice for which the ratio is calculated.
|
|
1117
|
+
* @returns The calculated ratio as a number.
|
|
1118
|
+
*/
|
|
1119
|
+
calculateTaxSubtotalRatio(invoice: IInvoice): number;
|
|
1120
|
+
/**
|
|
1121
|
+
* Calculates the rewarded credit for an invoice.
|
|
1122
|
+
* @param invoice - The invoice to calculate the rewarded credit for.
|
|
1123
|
+
* @param aboveInvoiceAmount - The minimum invoice amount required to be eligible for rewarded credit.
|
|
1124
|
+
* @param includeServiceCharge - Whether to include the service charge in the calculation.
|
|
1125
|
+
* @param includeTax - Whether to include the tax in the calculation.
|
|
1126
|
+
*/
|
|
1127
|
+
calculateRewardCredit(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
|
|
1128
|
+
calculateAddCredit(invoice: IInvoice): void;
|
|
1129
|
+
/**
|
|
1130
|
+
* Calculates and sets the rewarded points for the given invoice based on various conditions.
|
|
1131
|
+
* @param invoice - The invoice to calculate rewarded points for.
|
|
1132
|
+
* @returns void
|
|
1133
|
+
*/
|
|
1134
|
+
calculateRewardPoint(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
|
|
1135
|
+
private resetInvoiceCalculations;
|
|
1136
|
+
private resetLineCalculations;
|
|
1137
|
+
calculateChangeAmount(invoice: IInvoice): void;
|
|
1138
|
+
calculateInvoiceCharges(invoice: IInvoice, flow: CalcFlow): void;
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Interface for the Invoice Operation Service, which extends the IInvoiceBaseService interface.
|
|
1142
|
+
* Provides methods for adding an item to an invoice line and adding a modifier to a list of modifiers.
|
|
1143
|
+
*/
|
|
1144
|
+
/**
|
|
1145
|
+
* Represents an extended invoice operation service that includes additional methods for adding items and modifiers to an invoice.
|
|
1146
|
+
*/
|
|
1147
|
+
/**
|
|
1148
|
+
* Interface for the Invoice Operation Service, which extends the Invoice Base Service.
|
|
1149
|
+
*/
|
|
1150
|
+
/**
|
|
1151
|
+
* Interface for a service that performs operations on invoice lines.
|
|
1152
|
+
*/
|
|
1153
|
+
/**
|
|
1154
|
+
* Represents a service that provides operations for manipulating invoice lines.
|
|
1155
|
+
*/
|
|
1156
|
+
export interface ILineOperationService extends IInvoiceBaseService {
|
|
1157
|
+
/**
|
|
1158
|
+
* Adds an item to an invoice line. If the item already exists in the invoice, the quantity is increased, otherwise a new line is created.
|
|
1159
|
+
* Adding items with positive quantities
|
|
1160
|
+
* Reducing quantities of existing items with negative values
|
|
1161
|
+
* Automatic removal of lines when quantity reaches 0 or below
|
|
1162
|
+
* @param invoice - The invoice to add the item to.
|
|
1163
|
+
* @param customer - The customer associated with the invoice.
|
|
1164
|
+
* @param appConfig - The app configuration.
|
|
1165
|
+
* @param item - The item to add to the invoice line.
|
|
1166
|
+
* @param quantity - The quantity of the item to add.
|
|
1167
|
+
* @param price - The price of the item.
|
|
1168
|
+
* @param modifiers - An array of modifiers to apply to the item.
|
|
1169
|
+
* @param options - Additional options for the line.
|
|
1170
|
+
* @returns The updated invoice.
|
|
1171
|
+
*/
|
|
1172
|
+
addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], options?: LineOptions): IInvoice;
|
|
1173
|
+
/**
|
|
1174
|
+
* Duplicates an invoice line
|
|
1175
|
+
* @param invoice - The invoice to duplicate the line in.
|
|
1176
|
+
* @param line - The line to duplicate.
|
|
1177
|
+
* @returns The updated invoice.
|
|
1178
|
+
*/
|
|
1179
|
+
duplicateLine(invoice: IInvoice, line: IInvoiceLine): IInvoice;
|
|
1180
|
+
/**
|
|
1181
|
+
* Calibrates the duplicates in an invoice.
|
|
1182
|
+
* @param invoice - The invoice to calibrate the duplicates in.
|
|
1183
|
+
* @returns The updated invoice.
|
|
1184
|
+
*/
|
|
1185
|
+
calibrateDuplicates(invoice: IInvoice): IInvoice;
|
|
1186
|
+
/**
|
|
1187
|
+
* Decreases the quantity of an item in an invoice line.
|
|
1188
|
+
* @param invoice - The invoice to decrease the item quantity in.
|
|
1189
|
+
* @param line - The invoice line to decrease the item quantity in.
|
|
1190
|
+
* @param quantity - The quantity of the item to decrease.
|
|
1191
|
+
* @returns The updated invoice.
|
|
1192
|
+
*/
|
|
1193
|
+
minusLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
|
|
1194
|
+
/**
|
|
1195
|
+
* Increases the quantity of an item in an invoice line.
|
|
1196
|
+
* @param invoice - The invoice to increase the item quantity in.
|
|
1197
|
+
* @param line - The invoice line to increase the item quantity in.
|
|
1198
|
+
* @param quantity - The quantity of the item to increase.
|
|
1199
|
+
* @returns The updated invoice.
|
|
1200
|
+
*/
|
|
1201
|
+
addLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
|
|
1202
|
+
/**
|
|
1203
|
+
* Changes the unit price of an existing invoice line.
|
|
1204
|
+
* @param line - The invoice line to change the item price in.
|
|
1205
|
+
* @param price - The new price of the item.
|
|
1206
|
+
* @returns The updated invoice.
|
|
1207
|
+
*/
|
|
1208
|
+
changeLinePrice(line: IInvoiceLine, price: number): IInvoiceLine;
|
|
1209
|
+
/**
|
|
1210
|
+
* Changes the discount of an existing invoice line.
|
|
1211
|
+
* @param line - The invoice line to change the discount in.
|
|
1212
|
+
* @param discountType - The type of discount to apply.
|
|
1213
|
+
* @param amountOrPercent - The amount of the discount to apply.
|
|
1214
|
+
* @returns The updated invoice.
|
|
1215
|
+
*/
|
|
1216
|
+
changeLineDiscount(line: IInvoiceLine, discountType: CalcType, amountOrPercent: number): IInvoiceLine;
|
|
1217
|
+
/**
|
|
1218
|
+
* to convert a modifier to an invoice core line object
|
|
1219
|
+
* so it can be used in addModifier() method
|
|
1220
|
+
* @param modifier ICoreItem, the modifier to be added to the invoice line
|
|
1221
|
+
* @param quantity number, the quantity of the modifier to be added
|
|
1222
|
+
*/
|
|
1223
|
+
toInvoiceCoreLine(modifier: ICoreItem, quantity: number): IInvoiceCoreLine;
|
|
1224
|
+
/**
|
|
1225
|
+
* Adds a modifier to a list of modifiers, if the modifier already exists in the list, the quantity is increased, otherwise a new modifier is created.
|
|
1226
|
+
* @param modifiers - The list of modifiers to add the modifier to.
|
|
1227
|
+
* @param modifier - The modifier to add to the list.
|
|
1228
|
+
* @returns The updated list of modifiers.
|
|
1229
|
+
*/
|
|
1230
|
+
addModifier(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine): IInvoiceCoreLine[];
|
|
1231
|
+
/**
|
|
1232
|
+
* @deprecated use changeModifierQuantity instead
|
|
1233
|
+
* Decreases the quantity of a modifier in a list of modifiers.
|
|
1234
|
+
* @param modifiers - The list of modifiers to decrease the quantity in.
|
|
1235
|
+
* @param modifier - The modifier to decrease the quantity of.
|
|
1236
|
+
* @param quantity - The quantity of the modifier to decrease.
|
|
1237
|
+
* @returns The updated list of modifiers.
|
|
1238
|
+
*/
|
|
1239
|
+
minusModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
1240
|
+
/**
|
|
1241
|
+
* @deprecated use changeModifierQuantity instead
|
|
1242
|
+
* Increases the quantity of a modifier in a list of modifiers.
|
|
1243
|
+
* @param modifiers - The list of modifiers to increase the quantity in.
|
|
1244
|
+
* @param modifier - The modifier to increase the quantity of.
|
|
1245
|
+
* @param quantity - The quantity of the modifier to increase.
|
|
1246
|
+
* @returns The updated list of modifiers.
|
|
1247
|
+
*/
|
|
1248
|
+
addModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
1249
|
+
/**
|
|
1250
|
+
* Changes the quantity of a modifier in a list of modifiers.
|
|
1251
|
+
* Positive quantity will increase the modifier quantity.
|
|
1252
|
+
* Negative quantity will decrease the modifier quantity.
|
|
1253
|
+
* If quantity becomes 0 or negative, the modifier will be removed.
|
|
1254
|
+
* @param modifiers - The list of modifiers to change the quantity in.
|
|
1255
|
+
* @param modifier - The modifier to change the quantity of.
|
|
1256
|
+
* @param quantity - The quantity to add (positive) or subtract (negative).
|
|
1257
|
+
* @returns The updated list of modifiers.
|
|
1258
|
+
*/
|
|
1259
|
+
changeModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
1260
|
+
/**
|
|
1261
|
+
* Changes the unit price of a existing modifier.
|
|
1262
|
+
* @param modifier - The modifier to change the price of.
|
|
1263
|
+
* @param price - The new price of the modifier.
|
|
1264
|
+
* @returns The updated list of modifiers.
|
|
1265
|
+
*/
|
|
1266
|
+
changeModifierPrice(modifier: IInvoiceCoreLine, price: number): IInvoiceCoreLine;
|
|
1267
|
+
/**
|
|
1268
|
+
* Overwrites the note of an invoice line.
|
|
1269
|
+
* @param line - The invoice line to overwrite the note of.
|
|
1270
|
+
* @param note - The new note to overwrite the old note with.
|
|
1271
|
+
* @returns The updated invoice line.
|
|
1272
|
+
*/
|
|
1273
|
+
overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
|
|
1274
|
+
}
|
|
1275
|
+
export class LineOperationService extends InvoiceBaseService implements ILineOperationService {
|
|
1276
|
+
addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], lineOptions?: LineOptions): IInvoice;
|
|
1277
|
+
duplicateLine(invoice: IInvoice, line: IInvoiceLine): IInvoice;
|
|
1278
|
+
calibrateDuplicates(invoice: IInvoice): IInvoice;
|
|
1279
|
+
toInvoiceCoreLine(modifier: ICoreItem, quantity?: number): IInvoiceCoreLine;
|
|
1280
|
+
addModifier(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine): IInvoiceCoreLine[];
|
|
1281
|
+
changeLinePrice(line: IInvoiceLine, price: number): IInvoiceLine;
|
|
1282
|
+
changeLineDiscount(line: IInvoiceLine, discountType: CalcType, amountOrPercent: number): IInvoiceLine;
|
|
1283
|
+
minusLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
|
|
1284
|
+
addLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
|
|
1285
|
+
minusModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
1286
|
+
changeModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
1287
|
+
addModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
|
|
1288
|
+
changeModifierPrice(modifier: IInvoiceCoreLine, price: number): IInvoiceCoreLine;
|
|
1289
|
+
overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
|
|
1290
|
+
private findOrCreateLine;
|
|
1291
|
+
private createInvoiceLine;
|
|
1292
|
+
protected compareModifiers(target: IInvoiceCoreLine[], source: IInvoiceCoreLine[]): boolean;
|
|
1293
|
+
/**
|
|
1294
|
+
* false if not equal
|
|
1295
|
+
* true if equal
|
|
1296
|
+
* @param target
|
|
1297
|
+
* @param source
|
|
1298
|
+
*/
|
|
1299
|
+
protected compareLines(target: IInvoiceLine, source: IInvoiceLine): boolean;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Interface for invoice operation service that extends line operation service
|
|
1303
|
+
*/
|
|
1304
|
+
export interface IInvoiceOperationService extends ILineOperationService {
|
|
1305
|
+
/**
|
|
1306
|
+
* Creates an invoice
|
|
1307
|
+
* @param invoice - The invoice to create
|
|
1308
|
+
* @param sectionItem - The section item to associate with the invoice
|
|
1309
|
+
* @param employee - The employee to associate with the invoice
|
|
1310
|
+
* @returns A promise that resolves with the created invoice options
|
|
1311
|
+
*/
|
|
1312
|
+
createInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CreateInvoiceOptions>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Updates an invoice
|
|
1315
|
+
* @param invoice - The invoice to update
|
|
1316
|
+
* @param sectionItem - The section item to associate with the invoice
|
|
1317
|
+
* @param employee - The employee to associate with the invoice
|
|
1318
|
+
* @returns A promise that resolves with the updated invoice
|
|
1319
|
+
*/
|
|
1320
|
+
updateInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<UpdateInvoiceOptions>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Cancels an invoice
|
|
1323
|
+
* @param invoice - The invoice to cancel
|
|
1324
|
+
* @param sectionItem - The section item to associate with the invoice
|
|
1325
|
+
* @param employee - The employee to associate with the invoice
|
|
1326
|
+
* @returns A promise that resolves with the cancelled invoice options
|
|
1327
|
+
*/
|
|
1328
|
+
cancelInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CancelInvoiceOptions>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Checks an invoice
|
|
1331
|
+
* @param invoice - The invoice to check
|
|
1332
|
+
* @param SectionItem - The section item to associate with the invoice
|
|
1333
|
+
* @param employee - The employee to associate with the invoice
|
|
1334
|
+
* @returns A promise that resolves with the checked invoice options
|
|
1335
|
+
*/
|
|
1336
|
+
checkInvoice(invoice: IInvoice, SectionItem: ISectionItem, employee?: IEmployee): Promise<CheckInvoiceOptions>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Directly pays an invoice without creating it first (kiosk use case)
|
|
1339
|
+
* @param invoice the invoice to pay
|
|
1340
|
+
* @param till the till to use for the payment
|
|
1341
|
+
* @param employee the employee to associate with the invoice
|
|
1342
|
+
* @param specificPrinter the printer to use for the payment
|
|
1343
|
+
* @param specificKioskDeviceUid the kiosk device uid to use for the payment
|
|
1344
|
+
* @param kitchenPrintOverride override the kitchen print setting, if true, will print kitchen print even if kitchen print is disabled in config
|
|
1345
|
+
* @returns A promise that resolves with the direct pay invoice options
|
|
1346
|
+
* @internal 加入 specificKioskDeviceUid 主要是考虑到多台 kiosk 和 iPad 作为主 POS 情况下, iPad有可能没在运行 APP 的情况下, 需要指定 kiosk 设备来打印小票
|
|
1347
|
+
*/
|
|
1348
|
+
directPayInvoice(invoice: IInvoice, till?: ITill, employee?: IEmployee, specificPrinter?: IPrinter, specificKioskDeviceUid?: string, kitchenPrintOverride?: boolean): Promise<DirectPayInvoiceOptions>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Pays an invoice
|
|
1351
|
+
* @param invoice - The invoice to pay
|
|
1352
|
+
* @param sectionItem - The section item to associate with the invoice
|
|
1353
|
+
* @param till - (optional) The till to use for the payment
|
|
1354
|
+
* @param employee - (optional) The employee to associate with the invoice
|
|
1355
|
+
* @returns A promise that resolves with the paid invoice options
|
|
1356
|
+
*/
|
|
1357
|
+
payInvoice(invoice: IInvoice, sectionItem: ISectionItem, till?: ITill, employee?: IEmployee): Promise<PayInvoiceOptions>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Voids an invoice
|
|
1360
|
+
* @param invoice - The invoice to void
|
|
1361
|
+
* @param till - The till to use for the void
|
|
1362
|
+
* @param reason - The reason for the void
|
|
1363
|
+
* @returns A promise that resolves with the voided invoice options
|
|
1364
|
+
*/
|
|
1365
|
+
voidInvoice(invoice: IInvoice, till?: ITill, reason?: string, employee?: IEmployee): Promise<VoidInvoiceOptions>;
|
|
1366
|
+
/**
|
|
1367
|
+
* duplicate an invoice
|
|
1368
|
+
* @param invoice the invoice to duplicate
|
|
1369
|
+
* @param employee the employee to associate with the invoice
|
|
1370
|
+
*/
|
|
1371
|
+
duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
|
|
1372
|
+
/**
|
|
1373
|
+
* Switches an invoice from one section item to another
|
|
1374
|
+
* @param invoice - The invoice to switch
|
|
1375
|
+
* @param targetSectionItem - The target section item to switch to
|
|
1376
|
+
* @param sourceSectionItem - The source section item to switch from
|
|
1377
|
+
* @param employee - The employee to associate with the invoice
|
|
1378
|
+
* @returns A promise that resolves with the switched invoice options
|
|
1379
|
+
*/
|
|
1380
|
+
switchInvoice(invoice: IInvoice, targetSectionItem: ISectionItem, sourceSectionItem: ISectionItem, employee?: IEmployee): Promise<SwitchInvoiceOptions>;
|
|
1381
|
+
reprintReceipt(invoice: IInvoice): Promise<boolean>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Adds a discount to an invoice
|
|
1384
|
+
* @param invoice - The invoice to add the discount to
|
|
1385
|
+
* @param discountType - The type of discount to add
|
|
1386
|
+
* @param amountOrPercent - The amount or percent of the discount
|
|
1387
|
+
* @param calcFlow - The calculation flow to use for the discount
|
|
1388
|
+
* @returns The updated invoice with the added discount
|
|
1389
|
+
*/
|
|
1390
|
+
addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
|
|
1391
|
+
/**
|
|
1392
|
+
* Removes a discount from an invoice
|
|
1393
|
+
* @param invoice - The invoice to remove the discount from
|
|
1394
|
+
* @param discountUid - The uid of the discount to remove
|
|
1395
|
+
* @returns The updated invoice with the removed discount
|
|
1396
|
+
*/
|
|
1397
|
+
removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
|
|
1398
|
+
/**
|
|
1399
|
+
* Overwrites the note for an invoice
|
|
1400
|
+
* @param invoice - The invoice to overwrite the note for
|
|
1401
|
+
* @param note - The new note for the invoice
|
|
1402
|
+
* @returns The updated invoice with the new note
|
|
1403
|
+
*/
|
|
1404
|
+
overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
|
|
1405
|
+
/**
|
|
1406
|
+
* Adds a pax to an invoice
|
|
1407
|
+
* @param invoice - The invoice to add the pax to
|
|
1408
|
+
* @param pax - The pax to add to the invoice
|
|
1409
|
+
*/
|
|
1410
|
+
addPaxToInvoice(invoice: IInvoice, pax: number): IInvoice;
|
|
1411
|
+
/**
|
|
1412
|
+
* Adds a customer to an invoice
|
|
1413
|
+
* @param invoice - The invoice to add the customer to
|
|
1414
|
+
* @param customer - The customer to add to the invoice
|
|
1415
|
+
*/
|
|
1416
|
+
addCustomerToInvoice(invoice: IInvoice, customer: ICustomer): IInvoice;
|
|
1417
|
+
/**
|
|
1418
|
+
* Adds a payment to an invoice
|
|
1419
|
+
* @param invoice - The invoice to add the sales person to
|
|
1420
|
+
* @param salesUserUid - The sales person's uid to add to the invoice
|
|
1421
|
+
*/
|
|
1422
|
+
addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
|
|
1423
|
+
/**
|
|
1424
|
+
* merge invoice from local db and invoice sent from signalr
|
|
1425
|
+
* @param localInvoice invoice from local db
|
|
1426
|
+
* @param remoteInvoice invoice sent from signalr
|
|
1427
|
+
*/
|
|
1428
|
+
mergeInvoice(localInvoice: IInvoice, remoteInvoice: IInvoice): IInvoice;
|
|
1429
|
+
/**
|
|
1430
|
+
* Queries invoices using the QueryBuilder to construct filter parameters
|
|
1431
|
+
* @param query QueryBuilder instance to build the query
|
|
1432
|
+
*
|
|
1433
|
+
* Example usage:
|
|
1434
|
+
* ```typescript
|
|
1435
|
+
* // Create a new query builder
|
|
1436
|
+
* const builder = new QueryBuilder<IInvoice>()
|
|
1437
|
+
*
|
|
1438
|
+
* // Add filter conditions:
|
|
1439
|
+
* builder
|
|
1440
|
+
* .addParam('status', 'Equals', InvoiceStatus.Paid) // Filter by status
|
|
1441
|
+
* .addParam('created_at', 'GreaterThan', '2023-01-01') // Filter by date
|
|
1442
|
+
* .addParam('customer_id', 'Equals', 123) // Filter by customer
|
|
1443
|
+
* .addParam('grand_total', 'GreaterThan', 100) // Filter by amount
|
|
1444
|
+
* .addParam('ref_id', 'Contains', 'INV') // Search by reference ID
|
|
1445
|
+
*
|
|
1446
|
+
* // Add sorting
|
|
1447
|
+
* builder.orderBy('created_at', 'DESC')
|
|
1448
|
+
*
|
|
1449
|
+
* // Add pagination
|
|
1450
|
+
* builder.skip(0).take(10)
|
|
1451
|
+
*
|
|
1452
|
+
* // Execute query
|
|
1453
|
+
* const response = await invoiceService.autoQuery(builder)
|
|
1454
|
+
* ```
|
|
1455
|
+
*
|
|
1456
|
+
* Common operators:
|
|
1457
|
+
* - Equals: Exact match
|
|
1458
|
+
* - Contains: Partial text match
|
|
1459
|
+
* - GreaterThan/LessThan: Numeric/date comparisons
|
|
1460
|
+
* - In: Match array of values
|
|
1461
|
+
*
|
|
1462
|
+
* @returns Promise<QueryResponse<IInvoice>> Response containing filtered invoices and total count
|
|
1463
|
+
*/
|
|
1464
|
+
autoQuery(query: QueryBuilder<IInvoice>): Promise<QueryResponse<IInvoice>>;
|
|
1465
|
+
getRefId(): Promise<string>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Change payments of an invoice
|
|
1468
|
+
* @param invoice invoice to change
|
|
1469
|
+
* @param payments payments to change
|
|
1470
|
+
*/
|
|
1471
|
+
changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Adds a charge to an invoice
|
|
1474
|
+
* @param invoice - The invoice to add the charge to
|
|
1475
|
+
* @param name - The name of the charge
|
|
1476
|
+
* @param percentage - The percentage of the charge (0 for flat amount)
|
|
1477
|
+
* @param amount - The flat amount of the charge (0 for percentage)
|
|
1478
|
+
* @param calcFlow - The calculation flow to use for the charge
|
|
1479
|
+
* @returns The updated invoice with the added charge
|
|
1480
|
+
*/
|
|
1481
|
+
addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
|
|
1482
|
+
/**
|
|
1483
|
+
* Removes a charge from an invoice
|
|
1484
|
+
* @param invoice - The invoice to remove the charge from
|
|
1485
|
+
* @param chargeUid - The uid of the charge to remove
|
|
1486
|
+
* @returns The updated invoice with the removed charge
|
|
1487
|
+
*/
|
|
1488
|
+
removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
|
|
1489
|
+
/**
|
|
1490
|
+
* Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
|
|
1491
|
+
* @param invoice - The invoice to slice
|
|
1492
|
+
* @returns An array of sliced invoices, one for each item quantity
|
|
1493
|
+
*/
|
|
1494
|
+
sliceInvoice(invoice: IInvoice): IInvoice[];
|
|
1495
|
+
}
|
|
1496
|
+
export class InvoiceOperationService extends LineOperationService implements IInvoiceOperationService {
|
|
1497
|
+
createInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CreateInvoiceOptions>;
|
|
1498
|
+
updateInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<UpdateInvoiceOptions>;
|
|
1499
|
+
cancelInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CancelInvoiceOptions>;
|
|
1500
|
+
checkInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CheckInvoiceOptions>;
|
|
1501
|
+
switchInvoice(invoice: IInvoice, targetSectionItem: ISectionItem, sourceSectionItem: ISectionItem, employee?: IEmployee): Promise<SwitchInvoiceOptions>;
|
|
1502
|
+
payInvoice(invoice: IInvoice, sectionItem: ISectionItem, till?: ITill, employee?: IEmployee): Promise<PayInvoiceOptions>;
|
|
1503
|
+
directPayInvoice(invoice: IInvoice, till?: ITill, employee?: IEmployee, specificPrinter?: IPrinter, specificKioskDeviceUid?: string, kitchenPrintOverride?: boolean): Promise<DirectPayInvoiceOptions>;
|
|
1504
|
+
voidInvoice(invoice: IInvoice, till?: ITill, reason?: string, employee?: IEmployee): Promise<VoidInvoiceOptions>;
|
|
1505
|
+
duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
|
|
1506
|
+
reprintReceipt(invoice: IInvoice): Promise<boolean>;
|
|
1507
|
+
addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
|
|
1508
|
+
removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
|
|
1509
|
+
overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
|
|
1510
|
+
addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
|
|
1511
|
+
addPaxToInvoice(invoice: IInvoice, pax: number): IInvoice;
|
|
1512
|
+
addCustomerToInvoice(invoice: IInvoice, customer: ICustomer): IInvoice;
|
|
1513
|
+
autoQuery(query: QueryBuilder<IInvoice & QueryEtcParams>): Promise<QueryResponse<IInvoice>>;
|
|
1514
|
+
mergeInvoice(localInvoice: IInvoice, remoteInvoice: IInvoice): IInvoice;
|
|
1515
|
+
getRefId(): Promise<string>;
|
|
1516
|
+
changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
|
|
1517
|
+
private formatDate;
|
|
1518
|
+
private addEmployeeToInvoice;
|
|
1519
|
+
private createReceiptPrintJob;
|
|
1520
|
+
private createKitchenPrintJobs;
|
|
1521
|
+
private createOrderPrintJobs;
|
|
1522
|
+
private createLabelPrintJobs;
|
|
1523
|
+
filterLinesAndPrintersToPrint(invoiceLines: IInvoiceLine[], printerType: PrinterType): {
|
|
1524
|
+
lines: IInvoiceLine[];
|
|
1525
|
+
printerUids: string[];
|
|
1526
|
+
};
|
|
1527
|
+
private preprocessInvoice;
|
|
1528
|
+
/**
|
|
1529
|
+
* Adds a charge to an invoice
|
|
1530
|
+
* @param invoice - The invoice to add the charge to
|
|
1531
|
+
* @param name - The name of the charge
|
|
1532
|
+
* @param percentage - The percentage of the charge (0 for flat amount)
|
|
1533
|
+
* @param amount - The flat amount of the charge (0 for percentage)
|
|
1534
|
+
* @param calcFlow - The calculation flow to use for the charge
|
|
1535
|
+
* @returns The updated invoice with the added charge
|
|
1536
|
+
*/
|
|
1537
|
+
addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
|
|
1538
|
+
/**
|
|
1539
|
+
* Removes a charge from an invoice
|
|
1540
|
+
* @param invoice - The invoice to remove the charge from
|
|
1541
|
+
* @param chargeUid - The uid of the charge to remove
|
|
1542
|
+
* @returns The updated invoice with the removed charge
|
|
1543
|
+
*/
|
|
1544
|
+
removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
|
|
1545
|
+
/**
|
|
1546
|
+
* Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
|
|
1547
|
+
* @param invoice - The invoice to slice
|
|
1548
|
+
* @returns An array of sliced invoices, one for each item quantity
|
|
1549
|
+
*/
|
|
1550
|
+
sliceInvoice(invoice: IInvoice): IInvoice[];
|
|
1551
|
+
}
|
|
1552
|
+
export type IInvoiceService = IInvoiceOperationService;
|
|
1553
|
+
export class InvoiceService extends InvoiceOperationService implements IInvoiceService {
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
}
|
|
1557
|
+
declare module '@posx/core/services/misc.service' {
|
|
1558
|
+
export function preciseRound(num: any, decimalPlaces?: number): number;
|
|
1559
|
+
export function getFileExtension(file: File): string;
|
|
1560
|
+
export function convertFileToBase64(file: File): Promise<string>;
|
|
1561
|
+
|
|
1562
|
+
}
|
|
1563
|
+
declare module '@posx/core/services/ods.service' {
|
|
1564
|
+
import { AxiosInstance } from "axios";
|
|
1565
|
+
import { IOrderDisplay } from '@posx/core/types/ods.type';
|
|
1566
|
+
import { AppRemoteService, IAppRemoteService } from "@posx/core/services/abstract.service";
|
|
1567
|
+
import Dexie from "dexie";
|
|
1568
|
+
import { IServiceOptions } from "@posx/core/types/misc.type";
|
|
1569
|
+
/**
|
|
1570
|
+
* Represents the interface for the Order Display Service.
|
|
1571
|
+
* Extends the IAppRemoteService interface with the IOrderDisplay type.
|
|
1572
|
+
*/
|
|
1573
|
+
export interface IOrderDisplayService extends IAppRemoteService<IOrderDisplay> {
|
|
1574
|
+
/**
|
|
1575
|
+
* Changes the status of the order to ready for pickup
|
|
1576
|
+
* @param uid The uid of the order
|
|
1577
|
+
* @returns The updated order
|
|
1578
|
+
*/
|
|
1579
|
+
toPickUp(uid: string): Promise<IOrderDisplay>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Changes the status of the order to preparing
|
|
1582
|
+
* @param uid The uid of the order
|
|
1583
|
+
*/
|
|
1584
|
+
toPreparing(uid: string): Promise<IOrderDisplay>;
|
|
1585
|
+
/**
|
|
1586
|
+
* Undoes the last order that was marked as ready for pickup
|
|
1587
|
+
*/
|
|
1588
|
+
undo(): Promise<IOrderDisplay>;
|
|
1589
|
+
}
|
|
1590
|
+
export class OrderDisplayService extends AppRemoteService<IOrderDisplay> implements IOrderDisplayService {
|
|
1591
|
+
readonly http: AxiosInstance;
|
|
1592
|
+
readonly db: Dexie;
|
|
1593
|
+
readonly options: IServiceOptions;
|
|
1594
|
+
readonly moduleName: string;
|
|
1595
|
+
readonly methodName: string;
|
|
1596
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
1597
|
+
toPickUp(uid: string): Promise<IOrderDisplay>;
|
|
1598
|
+
toPreparing(uid: string): Promise<IOrderDisplay>;
|
|
1599
|
+
undo(): Promise<IOrderDisplay>;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
}
|
|
1603
|
+
declare module '@posx/core/services/printer.service' {
|
|
1604
|
+
import { AppRemoteService, IAppRemoteService } from '@posx/core/services/abstract.service';
|
|
1605
|
+
import { CustomResponse, IServiceOptions } from '@posx/core/types/misc.type';
|
|
1606
|
+
import { INodePrinter, IPrinter, INode } from '@posx/core/types/printer.type';
|
|
1607
|
+
import { AxiosInstance } from 'axios';
|
|
1608
|
+
import Dexie from 'dexie';
|
|
1609
|
+
import { PrintJobService } from '@posx/core/services/app.service';
|
|
1610
|
+
/**
|
|
1611
|
+
* Represents the Printer Service interface.
|
|
1612
|
+
* Extends the IAppRemoteService interface with IPrinter.
|
|
1613
|
+
*/
|
|
1614
|
+
export interface IPrinterService extends IAppRemoteService<IPrinter> {
|
|
1615
|
+
/**
|
|
1616
|
+
* Retrieves the physical printers from the node.
|
|
1617
|
+
* @returns A promise that resolves to an array of INodePrinter objects.
|
|
1618
|
+
*/
|
|
1619
|
+
getPhysicalPrintersFromNode(): Promise<INodePrinter[]>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Retrieves the unpaired node.
|
|
1622
|
+
* @returns A promise that resolves to an array of INode objects.
|
|
1623
|
+
*/
|
|
1624
|
+
getUnpairedNode(): Promise<CustomResponse<INode>>;
|
|
1625
|
+
/**
|
|
1626
|
+
* Pairs the node.
|
|
1627
|
+
* @param nodeUid The node UID.
|
|
1628
|
+
* @returns A promise that resolves to an array of INode objects.
|
|
1629
|
+
*/
|
|
1630
|
+
pairNode(nodeUid: string): Promise<CustomResponse<INode>>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Retrieves the default kiosk printer.
|
|
1633
|
+
* @returns A promise that resolves to an IPrinter object.
|
|
1634
|
+
*/
|
|
1635
|
+
getDefaultKioskPrinter(): Promise<IPrinter>;
|
|
1636
|
+
/**
|
|
1637
|
+
* Retrieves the default receipt printer.
|
|
1638
|
+
* @returns A promise that resolves to an IPrinter object.
|
|
1639
|
+
*/
|
|
1640
|
+
getDefaultReceiptPrinter(): Promise<IPrinter>;
|
|
1641
|
+
/**
|
|
1642
|
+
* Searches for available printers on the network with the specified IP address and port number.
|
|
1643
|
+
* @param wifiName The name of the wifi the device is connected to
|
|
1644
|
+
* @param port The port number of the network. Default is 9100.
|
|
1645
|
+
* @param refresh A boolean value indicating whether to refresh the cache. Default is false.
|
|
1646
|
+
* @returns A promise that resolves to an array of printer names found on the network.
|
|
1647
|
+
*/
|
|
1648
|
+
searchPrinters(refresh?: boolean, port?: number): Promise<string[]>;
|
|
1649
|
+
/**
|
|
1650
|
+
* Opens the cash drawer.
|
|
1651
|
+
*/
|
|
1652
|
+
openCashDrawer(): Promise<void>;
|
|
1653
|
+
}
|
|
1654
|
+
export class PrinterService extends AppRemoteService<IPrinter> implements IPrinterService {
|
|
1655
|
+
readonly http: AxiosInstance;
|
|
1656
|
+
readonly db: Dexie;
|
|
1657
|
+
readonly options: IServiceOptions;
|
|
1658
|
+
readonly moduleName: string;
|
|
1659
|
+
readonly methodName: string;
|
|
1660
|
+
private configService;
|
|
1661
|
+
protected printJobService: PrintJobService;
|
|
1662
|
+
private printersFromCache;
|
|
1663
|
+
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
1664
|
+
private init;
|
|
1665
|
+
getPhysicalPrintersFromNode(): Promise<INodePrinter[]>;
|
|
1666
|
+
getUnpairedNode(): Promise<CustomResponse<INode>>;
|
|
1667
|
+
pairNode(nodeUid: string): Promise<CustomResponse<INode>>;
|
|
1668
|
+
getDefaultReceiptPrinter(): Promise<IPrinter>;
|
|
1669
|
+
getDefaultKioskPrinter(): Promise<IPrinter>;
|
|
1670
|
+
getDefaultCheckPrinter(): Promise<IPrinter>;
|
|
1671
|
+
getDefaultKitchenPrinter(): Promise<IPrinter>;
|
|
1672
|
+
getDefaultOrderPrinter(): Promise<IPrinter>;
|
|
1673
|
+
getPrintersByUids(uids: string[]): Promise<IPrinter[]>;
|
|
1674
|
+
searchPrinters(refresh?: boolean, port?: number): Promise<string[]>;
|
|
1675
|
+
openCashDrawer(): Promise<void>;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
}
|
|
1679
|
+
declare module '@posx/core/types/abstract.type' {
|
|
1680
|
+
export const transformer: {
|
|
1681
|
+
from(value: string): string;
|
|
1682
|
+
to(value: string): string;
|
|
1683
|
+
};
|
|
1684
|
+
export interface IAppCoreModel {
|
|
1685
|
+
/**
|
|
1686
|
+
* primary unique id
|
|
1687
|
+
* @ignore
|
|
1688
|
+
*/
|
|
1689
|
+
uid: string;
|
|
1690
|
+
/**
|
|
1691
|
+
* the date when the object is updated
|
|
1692
|
+
* @ignore
|
|
1693
|
+
*/
|
|
1694
|
+
updated_at: Date;
|
|
1695
|
+
/**
|
|
1696
|
+
* the date when the object is created
|
|
1697
|
+
* @ignore
|
|
1698
|
+
*/
|
|
1699
|
+
created_at: Date;
|
|
1700
|
+
/**
|
|
1701
|
+
* the date when the object is created
|
|
1702
|
+
* @ignore
|
|
1703
|
+
*/
|
|
1704
|
+
created_at_timestamp: number;
|
|
1705
|
+
/**
|
|
1706
|
+
* the date when the object is deleted
|
|
1707
|
+
* @ignore
|
|
1708
|
+
*/
|
|
1709
|
+
deleted_at: Date;
|
|
1710
|
+
/**
|
|
1711
|
+
* timestamp in milliseconds
|
|
1712
|
+
* @ignore
|
|
1713
|
+
*/
|
|
1714
|
+
_timestamp: number;
|
|
1715
|
+
/**
|
|
1716
|
+
* Primary unique id in server 1,2,3,5
|
|
1717
|
+
* @ignore
|
|
1718
|
+
*/
|
|
1719
|
+
id_in_server: number;
|
|
1720
|
+
}
|
|
1721
|
+
export abstract class AppCoreModel implements IAppCoreModel {
|
|
1722
|
+
uid: string;
|
|
1723
|
+
updated_at: Date;
|
|
1724
|
+
created_at: Date;
|
|
1725
|
+
/**
|
|
1726
|
+
* the date when the object is created
|
|
1727
|
+
*/
|
|
1728
|
+
created_at_timestamp: number;
|
|
1729
|
+
deleted_at: any;
|
|
1730
|
+
_timestamp: number;
|
|
1731
|
+
id_in_server: number;
|
|
1732
|
+
constructor();
|
|
1733
|
+
}
|
|
1734
|
+
export interface IAppBaseModel extends IAppCoreModel {
|
|
1735
|
+
/**
|
|
1736
|
+
* name of the object
|
|
1737
|
+
*/
|
|
1738
|
+
name: string;
|
|
1739
|
+
/**
|
|
1740
|
+
* Translations of the name
|
|
1741
|
+
*/
|
|
1742
|
+
name_translations: Record<string, string>;
|
|
1743
|
+
}
|
|
1744
|
+
export class AppBaseModel extends AppCoreModel implements IAppBaseModel {
|
|
1745
|
+
name: string;
|
|
1746
|
+
name_translations: Record<string, string>;
|
|
1747
|
+
constructor();
|
|
1748
|
+
}
|
|
1749
|
+
export interface IAppExtraModel extends IAppBaseModel {
|
|
1750
|
+
/**
|
|
1751
|
+
* description of the object
|
|
1752
|
+
*/
|
|
1753
|
+
description: string;
|
|
1754
|
+
/**
|
|
1755
|
+
* Translations of the description
|
|
1756
|
+
*/
|
|
1757
|
+
description_translations: Record<string, string>;
|
|
1758
|
+
}
|
|
1759
|
+
export class AppExtraModel extends AppBaseModel implements IAppExtraModel {
|
|
1760
|
+
description: string;
|
|
1761
|
+
description_translations: {};
|
|
1762
|
+
}
|
|
1763
|
+
export type IAppCore = Omit<IAppCoreModel, "id_in_server" | "_timestamp">;
|
|
1764
|
+
export type IAppBase = Omit<IAppBaseModel, "id_in_server" | "_timestamp">;
|
|
1765
|
+
export type IAppExtra = Omit<IAppExtraModel, "id_in_server" | "_timestamp">;
|
|
1766
|
+
|
|
1767
|
+
}
|
|
1768
|
+
declare module '@posx/core/types/auto.query.type' {
|
|
1769
|
+
/**
|
|
1770
|
+
* The IBaseParams interface provides a structure for query parameters commonly used
|
|
1771
|
+
* in API requests to manipulate the presentation and organization of returned data.
|
|
1772
|
+
*
|
|
1773
|
+
* @property {string} [skip] - The number of records to skip before starting to collect the response set.
|
|
1774
|
+
* @property {string} [take] - The limit on the number of records to return in the response set.
|
|
1775
|
+
* @property {string} [format] - The desired format of the response (e.g., 'json', 'xml').
|
|
1776
|
+
* @property {string} [include] - A way to include data from related tables/entities.
|
|
1777
|
+
* @property {string} [jsconfig] - JavaScript configuration for client-side handling of the response.
|
|
1778
|
+
* @property {string} [orderBy] - A parameter to specify the field to order the results by in ascending order.
|
|
1779
|
+
* @property {string} [orderByDesc] - A parameter to specify the field to order the results by in descending order.
|
|
1780
|
+
*/
|
|
1781
|
+
export interface IBaseParams {
|
|
1782
|
+
skip?: number;
|
|
1783
|
+
take?: number;
|
|
1784
|
+
format?: string;
|
|
1785
|
+
include?: string;
|
|
1786
|
+
jsconfig?: string;
|
|
1787
|
+
orderBy?: string;
|
|
1788
|
+
orderByDesc?: string;
|
|
1789
|
+
}
|
|
1790
|
+
export interface IInvoiceParams extends IBaseParams {
|
|
1791
|
+
RefIdContains?: string;
|
|
1792
|
+
GrandTotal?: number;
|
|
1793
|
+
StatusContains?: string;
|
|
1794
|
+
PaidAtAfter?: string;
|
|
1795
|
+
PaidAtBefore?: string;
|
|
1796
|
+
PaidAtStartsWith?: string;
|
|
1797
|
+
}
|
|
1798
|
+
export interface IInvoicesQuery {
|
|
1799
|
+
params: IInvoiceParams;
|
|
1800
|
+
}
|
|
1801
|
+
export class InvoicesQuery implements IInvoicesQuery {
|
|
1802
|
+
params: {
|
|
1803
|
+
format: string;
|
|
1804
|
+
Include: string;
|
|
1805
|
+
jsconfig: string;
|
|
1806
|
+
};
|
|
1807
|
+
constructor(params: IInvoiceParams);
|
|
1808
|
+
}
|
|
1809
|
+
export interface IQueryResponse<T> {
|
|
1810
|
+
offset?: number;
|
|
1811
|
+
total?: number;
|
|
1812
|
+
results?: T[];
|
|
1813
|
+
meta?: {
|
|
1814
|
+
[index: string]: string;
|
|
1815
|
+
};
|
|
1816
|
+
responseStatus?: ResponseStatus;
|
|
1817
|
+
}
|
|
1818
|
+
export interface ResponseStatus {
|
|
1819
|
+
errorCode?: string;
|
|
1820
|
+
message?: string;
|
|
1821
|
+
stackTrace?: string;
|
|
1822
|
+
errors?: ValidationError[];
|
|
1823
|
+
}
|
|
1824
|
+
export interface ValidationError {
|
|
1825
|
+
errorCode?: string;
|
|
1826
|
+
fieldName?: string;
|
|
1827
|
+
message?: string;
|
|
1828
|
+
}
|
|
1829
|
+
export class QueryResponse<T> {
|
|
1830
|
+
offset?: number;
|
|
1831
|
+
total?: number;
|
|
1832
|
+
results?: T[];
|
|
1833
|
+
meta?: {
|
|
1834
|
+
[index: string]: string;
|
|
1835
|
+
};
|
|
1836
|
+
responseStatus?: ResponseStatus;
|
|
1837
|
+
}
|
|
1838
|
+
export enum SortOrder {
|
|
1839
|
+
Asc = "asc",
|
|
1840
|
+
Desc = "desc"
|
|
1841
|
+
}
|
|
1842
|
+
export type Operator<T> = T extends number ? keyof typeof NumericOperators : T extends string ? keyof typeof StringOperators : never;
|
|
1843
|
+
export type OperatorValueMap = {
|
|
1844
|
+
[K in Operator<any>]: K extends keyof typeof NumericOperators ? number : K extends keyof typeof StringOperators ? string : K extends keyof typeof MonthOperator ? MonthValues : K extends keyof typeof DayOperator ? string : never;
|
|
1845
|
+
};
|
|
1846
|
+
export enum NumericOperators {
|
|
1847
|
+
'>' = 0,
|
|
1848
|
+
'>=' = 1,
|
|
1849
|
+
'<' = 2,
|
|
1850
|
+
'<=' = 3,
|
|
1851
|
+
'=' = 4
|
|
1852
|
+
}
|
|
1853
|
+
export enum StringOperators {
|
|
1854
|
+
'Contains' = 0,
|
|
1855
|
+
'NotContains' = 1,
|
|
1856
|
+
'StartsWith' = 2,
|
|
1857
|
+
'EndsWith' = 3,
|
|
1858
|
+
"Like" = 4
|
|
1859
|
+
}
|
|
1860
|
+
export enum MonthOperator {
|
|
1861
|
+
WithinAMonth = "Contains"
|
|
1862
|
+
}
|
|
1863
|
+
export enum DayOperator {
|
|
1864
|
+
At = "StartsWith"
|
|
1865
|
+
}
|
|
1866
|
+
export enum MonthValues {
|
|
1867
|
+
Jan = "-01-",
|
|
1868
|
+
Feb = "-02-",
|
|
1869
|
+
Mar = "-03-",
|
|
1870
|
+
Apr = "-04-",
|
|
1871
|
+
May = "-05-",
|
|
1872
|
+
Jun = "-06-",
|
|
1873
|
+
Jul = "-07-",
|
|
1874
|
+
Aug = "-08-",
|
|
1875
|
+
Sep = "-09-",
|
|
1876
|
+
Oct = "-10-",
|
|
1877
|
+
Nov = "-11-",
|
|
1878
|
+
Dec = "-12-"
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
}
|
|
1882
|
+
declare module '@posx/core/types/condition.type' {
|
|
1883
|
+
export enum Condition {
|
|
1884
|
+
None = "",
|
|
1885
|
+
Always = "always"
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
}
|
|
1889
|
+
declare module '@posx/core/types/config.type' {
|
|
1890
|
+
import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
1891
|
+
import { TaxMethod } from '@posx/core/types/invoice.type';
|
|
1892
|
+
export interface IAppConfig extends IAppCoreModel {
|
|
1893
|
+
config: IConfig;
|
|
1894
|
+
cache: ICache;
|
|
1895
|
+
}
|
|
1896
|
+
export class AppConfig extends AppCoreModel implements IAppConfig {
|
|
1897
|
+
config: Config;
|
|
1898
|
+
cache: Cache;
|
|
1899
|
+
constructor();
|
|
1900
|
+
}
|
|
1901
|
+
export interface ICache {
|
|
1902
|
+
printers: string[];
|
|
1903
|
+
}
|
|
1904
|
+
export class Cache implements ICache {
|
|
1905
|
+
printers: any[];
|
|
1906
|
+
constructor();
|
|
1907
|
+
}
|
|
1908
|
+
export interface IConfig {
|
|
1909
|
+
/** General setting */
|
|
1910
|
+
general: IGeneralConfig;
|
|
1911
|
+
/** Till setting */
|
|
1912
|
+
till: ITillConfig;
|
|
1913
|
+
/** Report setting */
|
|
1914
|
+
report: IReportConfig;
|
|
1915
|
+
/** Receipt setting */
|
|
1916
|
+
receipt: IReceiptConfig;
|
|
1917
|
+
/** Kitchen slip setting */
|
|
1918
|
+
kitchen: IKitchenConfig;
|
|
1919
|
+
/** KDS setting */
|
|
1920
|
+
label: ILabelConfig;
|
|
1921
|
+
/** Order setting */
|
|
1922
|
+
order: IOrderConfig;
|
|
1923
|
+
/** Payment setting */
|
|
1924
|
+
payment: IPaymentConfig;
|
|
1925
|
+
/** User setting */
|
|
1926
|
+
user: IUserConfig;
|
|
1927
|
+
/** Service charge setting */
|
|
1928
|
+
/** Tax setting */
|
|
1929
|
+
tax: ITaxConfig;
|
|
1930
|
+
/** Rounding setting */
|
|
1931
|
+
rounding: IRoundingConfig;
|
|
1932
|
+
/** Charge setting */
|
|
1933
|
+
charges: IChargeConfig;
|
|
1934
|
+
/** Currency setting */
|
|
1935
|
+
currency: ICurrencyConfig;
|
|
1936
|
+
/** Inventory setting */
|
|
1937
|
+
inventory: IInventoryConfig;
|
|
1938
|
+
/** Pax setting */
|
|
1939
|
+
pax_config: IPaxConfig;
|
|
1940
|
+
/** Gto setting */
|
|
1941
|
+
gto: IGtoConfig;
|
|
1942
|
+
/** Cash drawer setting */
|
|
1943
|
+
cash_drawer: ICashDrawerConfig;
|
|
1944
|
+
/** Marketing setting */
|
|
1945
|
+
marketing: IMarketing;
|
|
1946
|
+
/** KDS setting */
|
|
1947
|
+
kds: IKdsConfig;
|
|
1948
|
+
/** Customer display system setting */
|
|
1949
|
+
cds: ICustomerDisplaySystemConfig;
|
|
1950
|
+
/** Kiosk system setting */
|
|
1951
|
+
kiosk: IKioskSystemConfig;
|
|
1952
|
+
/** Online order setting */
|
|
1953
|
+
online_order: IOnlineOrderConfig;
|
|
1954
|
+
}
|
|
1955
|
+
export interface ICustomerDisplaySystemConfig {
|
|
1956
|
+
full_screen_assets: string[];
|
|
1957
|
+
half_screen_assets: string[];
|
|
1958
|
+
}
|
|
1959
|
+
export class CustomerDisplaySystemConfig implements ICustomerDisplaySystemConfig {
|
|
1960
|
+
full_screen_assets: any[];
|
|
1961
|
+
half_screen_assets: any[];
|
|
1962
|
+
constructor();
|
|
1963
|
+
}
|
|
1964
|
+
export interface IKioskSystemConfig {
|
|
1965
|
+
takeaway_only: boolean;
|
|
1966
|
+
guest_order_only: boolean;
|
|
1967
|
+
disable_paynow_payment: boolean;
|
|
1968
|
+
disable_card_payment: boolean;
|
|
1969
|
+
landing_image: string;
|
|
1970
|
+
menu_banner_image: string;
|
|
1971
|
+
}
|
|
1972
|
+
export class KioskSystemConfig implements IKioskSystemConfig {
|
|
1973
|
+
takeaway_only: boolean;
|
|
1974
|
+
guest_order_only: boolean;
|
|
1975
|
+
disable_paynow_payment: boolean;
|
|
1976
|
+
disable_card_payment: boolean;
|
|
1977
|
+
landing_image: string;
|
|
1978
|
+
menu_banner_image: string;
|
|
1979
|
+
constructor();
|
|
1980
|
+
}
|
|
1981
|
+
export interface IMarketing {
|
|
1982
|
+
/** Marketing Point Configuration */
|
|
1983
|
+
point: IPoint;
|
|
1984
|
+
/** Marketing Credit Configuration */
|
|
1985
|
+
credit: ICredit;
|
|
1986
|
+
}
|
|
1987
|
+
export interface ICredit {
|
|
1988
|
+
/** Indicates if SMS notification is enabled */
|
|
1989
|
+
sms_notification: boolean;
|
|
1990
|
+
/** Threshold for invoices to apply credits */
|
|
1991
|
+
above_invoice_amount: number;
|
|
1992
|
+
/** Rate of conversion for credits */
|
|
1993
|
+
conversion_rate: number;
|
|
1994
|
+
/** Whether service charge is inclusive */
|
|
1995
|
+
inclusive_service_charge: boolean;
|
|
1996
|
+
/** Whether tax is inclusive */
|
|
1997
|
+
inclusive_tax: boolean;
|
|
1998
|
+
}
|
|
1999
|
+
export interface IPoint {
|
|
2000
|
+
/** Indicates if SMS notification is enabled */
|
|
2001
|
+
sms_notification: boolean;
|
|
2002
|
+
/** Threshold for invoices to apply points */
|
|
2003
|
+
above_invoice_amount: number;
|
|
2004
|
+
/** Rate of conversion for points */
|
|
2005
|
+
conversion_rate: number;
|
|
2006
|
+
/** Whether service charge is inclusive */
|
|
2007
|
+
inclusive_service_charge: boolean;
|
|
2008
|
+
/** Whether tax is inclusive */
|
|
2009
|
+
inclusive_tax: boolean;
|
|
2010
|
+
}
|
|
2011
|
+
export class MarketingConfig implements IMarketing {
|
|
2012
|
+
point: IPoint;
|
|
2013
|
+
credit: ICredit;
|
|
2014
|
+
constructor();
|
|
2015
|
+
}
|
|
2016
|
+
export class Config implements IConfig {
|
|
2017
|
+
general: GeneralConfig;
|
|
2018
|
+
till: TillConfig;
|
|
2019
|
+
report: ReportConfig;
|
|
2020
|
+
receipt: Receipt;
|
|
2021
|
+
kitchen: KitchenConfig;
|
|
2022
|
+
kds: KdsConfig;
|
|
2023
|
+
label: LabelConfig;
|
|
2024
|
+
order: OrderConfig;
|
|
2025
|
+
payment: PaymentConfig;
|
|
2026
|
+
user: UserConfig;
|
|
2027
|
+
tax: TaxConfig;
|
|
2028
|
+
rounding: RoundingConfig;
|
|
2029
|
+
inventory: InventoryConfig;
|
|
2030
|
+
pax_config: PaxConfig;
|
|
2031
|
+
gto: GTOConfig;
|
|
2032
|
+
cash_drawer: CashDrawerConfig;
|
|
2033
|
+
marketing: MarketingConfig;
|
|
2034
|
+
charges: ChargeConfig;
|
|
2035
|
+
currency: CurrencyConfig;
|
|
2036
|
+
cds: CustomerDisplaySystemConfig;
|
|
2037
|
+
kiosk: KioskSystemConfig;
|
|
2038
|
+
online_order: OnlineOrderConfig;
|
|
2039
|
+
constructor();
|
|
2040
|
+
}
|
|
2041
|
+
export interface IOnlineOrderConfig {
|
|
2042
|
+
menu_banner_image_url: string;
|
|
2043
|
+
}
|
|
2044
|
+
export class OnlineOrderConfig implements IOnlineOrderConfig {
|
|
2045
|
+
menu_banner_image_url: string;
|
|
2046
|
+
constructor();
|
|
2047
|
+
}
|
|
2048
|
+
export interface IGeneralConfig {
|
|
2049
|
+
/**
|
|
2050
|
+
* The default language for system interfaces and communications.
|
|
2051
|
+
*/
|
|
2052
|
+
language: string;
|
|
2053
|
+
/**
|
|
2054
|
+
* The official registered name of the company using the system.
|
|
2055
|
+
*/
|
|
2056
|
+
company_name: string;
|
|
2057
|
+
/**
|
|
2058
|
+
* An alternative name or shorthand for the company used for convenience.
|
|
2059
|
+
*/
|
|
2060
|
+
company_name_alias: string;
|
|
2061
|
+
/**
|
|
2062
|
+
* The logo of the company
|
|
2063
|
+
*/
|
|
2064
|
+
company_logo: string;
|
|
2065
|
+
/**
|
|
2066
|
+
* The official tax identification number for the company, used for legal and financial documentation.
|
|
2067
|
+
*/
|
|
2068
|
+
company_tax_reg_no: string;
|
|
2069
|
+
/**
|
|
2070
|
+
* The postal code where the company's primary office or headquarters is located.
|
|
2071
|
+
*/
|
|
2072
|
+
company_postcode: string;
|
|
2073
|
+
/**
|
|
2074
|
+
* The full street address of the company's primary location.
|
|
2075
|
+
*/
|
|
2076
|
+
company_address: string;
|
|
2077
|
+
/**
|
|
2078
|
+
* The country in which the company is legally registered and operates.
|
|
2079
|
+
*/
|
|
2080
|
+
company_country: string;
|
|
2081
|
+
/**
|
|
2082
|
+
* The main contact telephone number for the company.
|
|
2083
|
+
*/
|
|
2084
|
+
company_tel: string;
|
|
2085
|
+
/**
|
|
2086
|
+
* The name assigned to the table layout or map within the floor plan of the establishment.
|
|
2087
|
+
* @ignore
|
|
2088
|
+
*/
|
|
2089
|
+
floor_plan_table_name: string;
|
|
2090
|
+
/**
|
|
2091
|
+
* The software distribution channel used for the deployment of updates or the application itself.
|
|
2092
|
+
* @ignore
|
|
2093
|
+
*/
|
|
2094
|
+
deploy_channel: DeployChannel;
|
|
2095
|
+
/**
|
|
2096
|
+
* A flag indicating whether the system should run in debug mode for troubleshooting and development purposes.
|
|
2097
|
+
* @ignore
|
|
2098
|
+
*/
|
|
2099
|
+
debug: boolean;
|
|
2100
|
+
/**
|
|
2101
|
+
* A flag that indicates whether system events should be logged for review and auditing purposes.
|
|
2102
|
+
* @ignore
|
|
2103
|
+
*/
|
|
2104
|
+
logging: boolean;
|
|
2105
|
+
/**
|
|
2106
|
+
* A setting that determines whether the system is capable of operating without an active internet connection.
|
|
2107
|
+
* @ignore
|
|
2108
|
+
*/
|
|
2109
|
+
offline_mode: boolean;
|
|
2110
|
+
/**
|
|
2111
|
+
* Business schedules
|
|
2112
|
+
* @ignore
|
|
2113
|
+
*/
|
|
2114
|
+
opening_schedules: Schedule[];
|
|
2115
|
+
}
|
|
2116
|
+
export type UpdateGeneralConfigOptions = {
|
|
2117
|
+
[P in keyof IGeneralConfig]?: IGeneralConfig[P];
|
|
2118
|
+
};
|
|
2119
|
+
export enum DeployChannel {
|
|
2120
|
+
PROD = "prod",
|
|
2121
|
+
DEV = "dev"
|
|
2122
|
+
}
|
|
2123
|
+
export class GeneralConfig implements IGeneralConfig {
|
|
2124
|
+
/** Name of the company */
|
|
2125
|
+
company_name: string;
|
|
2126
|
+
/** Alias for the company name */
|
|
2127
|
+
company_name_alias: string;
|
|
2128
|
+
/** Logo of the company */
|
|
2129
|
+
company_logo: string;
|
|
2130
|
+
/** Tax registration number of the company */
|
|
2131
|
+
company_tax_reg_no: string;
|
|
2132
|
+
/** Postcode of the company */
|
|
2133
|
+
company_postcode: string;
|
|
2134
|
+
/** Address of the company */
|
|
2135
|
+
company_address: string;
|
|
2136
|
+
/** Country of the company */
|
|
2137
|
+
company_country: string;
|
|
2138
|
+
/** Telephone number of the company */
|
|
2139
|
+
company_tel: string;
|
|
2140
|
+
/** Name of the floor plan table */
|
|
2141
|
+
floor_plan_table_name: string;
|
|
2142
|
+
/** Deployment channel */
|
|
2143
|
+
deploy_channel: DeployChannel;
|
|
2144
|
+
/** Language setting */
|
|
2145
|
+
language: string;
|
|
2146
|
+
/** Debug mode status */
|
|
2147
|
+
debug: boolean;
|
|
2148
|
+
/** Logging status */
|
|
2149
|
+
logging: boolean;
|
|
2150
|
+
/** Offline mode status */
|
|
2151
|
+
offline_mode: boolean;
|
|
2152
|
+
/** Open schedule */
|
|
2153
|
+
opening_schedules: Schedule[];
|
|
2154
|
+
constructor();
|
|
2155
|
+
}
|
|
2156
|
+
export type OpenHours = {
|
|
2157
|
+
open: string;
|
|
2158
|
+
close: string;
|
|
2159
|
+
};
|
|
2160
|
+
export type DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
|
|
2161
|
+
export type SpecialDay = {
|
|
2162
|
+
date: string;
|
|
2163
|
+
hours: OpenHours[];
|
|
2164
|
+
};
|
|
2165
|
+
export type Holiday = {
|
|
2166
|
+
name: string;
|
|
2167
|
+
date: string;
|
|
2168
|
+
};
|
|
2169
|
+
export type BreakPeriod = {
|
|
2170
|
+
days: DayOfWeek[];
|
|
2171
|
+
time: {
|
|
2172
|
+
start: string;
|
|
2173
|
+
end: string;
|
|
2174
|
+
};
|
|
2175
|
+
};
|
|
2176
|
+
export type Schedule = {
|
|
2177
|
+
opening_hours: OpenHours;
|
|
2178
|
+
};
|
|
2179
|
+
export interface ITillConfig {
|
|
2180
|
+
/** Control flag for Till */
|
|
2181
|
+
control: boolean;
|
|
2182
|
+
/** Slip flag for Till */
|
|
2183
|
+
slip: boolean;
|
|
2184
|
+
}
|
|
2185
|
+
export class TillConfig implements ITillConfig {
|
|
2186
|
+
/** Control flag for Till */
|
|
2187
|
+
control: boolean;
|
|
2188
|
+
/** Slip flag for Till */
|
|
2189
|
+
slip: boolean;
|
|
2190
|
+
constructor();
|
|
2191
|
+
}
|
|
2192
|
+
export interface IReportConfig {
|
|
2193
|
+
/** Flag for itemized consolidated report */
|
|
2194
|
+
itemized_consolidated: boolean;
|
|
2195
|
+
/** Itemized separated report value */
|
|
2196
|
+
itemized_separated: string;
|
|
2197
|
+
/** Flag for shift itemized report */
|
|
2198
|
+
shift_itemized: boolean;
|
|
2199
|
+
/** Start time for report */
|
|
2200
|
+
start_time: string;
|
|
2201
|
+
/** End time for report */
|
|
2202
|
+
end_time: string;
|
|
2203
|
+
/** Time for shift print */
|
|
2204
|
+
shift_print_time: number;
|
|
2205
|
+
/** Flag to disable shift */
|
|
2206
|
+
shift_disable: boolean;
|
|
2207
|
+
/** Flag for email report */
|
|
2208
|
+
email: boolean;
|
|
2209
|
+
}
|
|
2210
|
+
export class ReportConfig implements IReportConfig {
|
|
2211
|
+
itemized_consolidated: boolean;
|
|
2212
|
+
itemized_separated: string;
|
|
2213
|
+
shift_itemized: boolean;
|
|
2214
|
+
start_time: string;
|
|
2215
|
+
end_time: string;
|
|
2216
|
+
shift_print_time: number;
|
|
2217
|
+
shift_disable: boolean;
|
|
2218
|
+
email: boolean;
|
|
2219
|
+
constructor();
|
|
2220
|
+
}
|
|
2221
|
+
export interface IReceiptConfig {
|
|
2222
|
+
enabled: boolean;
|
|
2223
|
+
show_print_dialog: boolean;
|
|
2224
|
+
print_docket: boolean;
|
|
2225
|
+
hide_non_price_item: boolean;
|
|
2226
|
+
receipt_no_reset_daily: boolean;
|
|
2227
|
+
language: string;
|
|
2228
|
+
}
|
|
2229
|
+
export class Receipt implements IReceiptConfig {
|
|
2230
|
+
enabled: boolean;
|
|
2231
|
+
show_print_dialog: boolean;
|
|
2232
|
+
print_docket: boolean;
|
|
2233
|
+
hide_non_price_item: boolean;
|
|
2234
|
+
receipt_no_reset_daily: boolean;
|
|
2235
|
+
language: string;
|
|
2236
|
+
constructor();
|
|
2237
|
+
}
|
|
2238
|
+
export interface IKitchenConfig {
|
|
2239
|
+
/** Flag to print */
|
|
2240
|
+
enabled: boolean;
|
|
2241
|
+
/** Flag to print slip price */
|
|
2242
|
+
print_item_price: boolean;
|
|
2243
|
+
/** Flag to print cancel slip */
|
|
2244
|
+
print_cancel_slip: boolean;
|
|
2245
|
+
/**
|
|
2246
|
+
* The language to use for the kitchen slip.
|
|
2247
|
+
*/
|
|
2248
|
+
language: string;
|
|
2249
|
+
}
|
|
2250
|
+
export class KitchenConfig implements IKitchenConfig {
|
|
2251
|
+
enabled: boolean;
|
|
2252
|
+
print_item_price: boolean;
|
|
2253
|
+
print_cancel_slip: boolean;
|
|
2254
|
+
language: string;
|
|
2255
|
+
constructor();
|
|
2256
|
+
}
|
|
2257
|
+
export interface IKdsConfig {
|
|
2258
|
+
enabled: boolean;
|
|
2259
|
+
/** Display order after payment */
|
|
2260
|
+
display_order_after_payment: boolean;
|
|
2261
|
+
/** Print slip upon completion */
|
|
2262
|
+
print_slip_upon_completed: boolean;
|
|
2263
|
+
}
|
|
2264
|
+
export class KdsConfig implements IKdsConfig {
|
|
2265
|
+
enabled: boolean;
|
|
2266
|
+
display_order_after_payment: boolean;
|
|
2267
|
+
print_slip_upon_completed: boolean;
|
|
2268
|
+
constructor();
|
|
2269
|
+
}
|
|
2270
|
+
export interface ILabelConfig {
|
|
2271
|
+
/** Flag for printing the label */
|
|
2272
|
+
print: boolean;
|
|
2273
|
+
}
|
|
2274
|
+
export class LabelConfig implements ILabelConfig {
|
|
2275
|
+
print: boolean;
|
|
2276
|
+
constructor();
|
|
2277
|
+
}
|
|
2278
|
+
export interface IOrderConfig {
|
|
2279
|
+
/** Separation line for order */
|
|
2280
|
+
separation_line: boolean;
|
|
2281
|
+
/** Slip for order */
|
|
2282
|
+
slip: boolean;
|
|
2283
|
+
/** Font size ratio for the slip */
|
|
2284
|
+
slip_font_size_ratio: number;
|
|
2285
|
+
/** Maximum dining time in minutes */
|
|
2286
|
+
max_dinning: number;
|
|
2287
|
+
/** Flag to exit the menu after payment */
|
|
2288
|
+
exit_menu_after_payment: boolean;
|
|
2289
|
+
}
|
|
2290
|
+
export class OrderConfig implements IOrderConfig {
|
|
2291
|
+
separation_line: boolean;
|
|
2292
|
+
slip: boolean;
|
|
2293
|
+
slip_font_size_ratio: number;
|
|
2294
|
+
max_dinning: number;
|
|
2295
|
+
exit_menu_after_payment: boolean;
|
|
2296
|
+
constructor();
|
|
2297
|
+
}
|
|
2298
|
+
export interface IPaymentConfig {
|
|
2299
|
+
/** Quick cash payment */
|
|
2300
|
+
quick_cash_payment: boolean;
|
|
2301
|
+
/** Notification for payment */
|
|
2302
|
+
notification: boolean;
|
|
2303
|
+
/** Quick payment option */
|
|
2304
|
+
quick: boolean;
|
|
2305
|
+
}
|
|
2306
|
+
export class PaymentConfig implements IPaymentConfig {
|
|
2307
|
+
quick_cash_payment: boolean;
|
|
2308
|
+
notification: boolean;
|
|
2309
|
+
quick: boolean;
|
|
2310
|
+
constructor();
|
|
2311
|
+
}
|
|
2312
|
+
export interface IUserConfig {
|
|
2313
|
+
/** Control for the user */
|
|
2314
|
+
control: boolean;
|
|
2315
|
+
}
|
|
2316
|
+
export class UserConfig implements IUserConfig {
|
|
2317
|
+
control: boolean;
|
|
2318
|
+
constructor();
|
|
2319
|
+
}
|
|
2320
|
+
export interface ITaxConfig {
|
|
2321
|
+
/** Tax applicable flag */
|
|
2322
|
+
enabled: boolean;
|
|
2323
|
+
/** Method for the tax */
|
|
2324
|
+
method: TaxMethod;
|
|
2325
|
+
/** Rate of the tax */
|
|
2326
|
+
rate: number;
|
|
2327
|
+
/** Name of the tax */
|
|
2328
|
+
name: string;
|
|
2329
|
+
}
|
|
2330
|
+
export class TaxConfig implements ITaxConfig {
|
|
2331
|
+
enabled: boolean;
|
|
2332
|
+
method: TaxMethod;
|
|
2333
|
+
rate: number;
|
|
2334
|
+
name: string;
|
|
2335
|
+
constructor();
|
|
2336
|
+
}
|
|
2337
|
+
export interface IRoundingConfig {
|
|
2338
|
+
/** Base for rounding */
|
|
2339
|
+
base: number;
|
|
2340
|
+
/** Rounding up flag */
|
|
2341
|
+
up: boolean;
|
|
2342
|
+
/** Cashless rounding flag */
|
|
2343
|
+
cashless: boolean;
|
|
2344
|
+
}
|
|
2345
|
+
export interface IChargeConfig {
|
|
2346
|
+
service_charge: boolean;
|
|
2347
|
+
service_charge_rate: number;
|
|
2348
|
+
}
|
|
2349
|
+
export class ChargeConfig implements IChargeConfig {
|
|
2350
|
+
service_charge: boolean;
|
|
2351
|
+
service_charge_rate: number;
|
|
2352
|
+
constructor();
|
|
2353
|
+
}
|
|
2354
|
+
export interface ICurrencyConfig {
|
|
2355
|
+
currency_symbol: string;
|
|
2356
|
+
}
|
|
2357
|
+
export class CurrencyConfig implements ICurrencyConfig {
|
|
2358
|
+
currency_symbol: string;
|
|
2359
|
+
constructor();
|
|
2360
|
+
}
|
|
2361
|
+
export class RoundingConfig implements IRoundingConfig {
|
|
2362
|
+
base: number;
|
|
2363
|
+
up: boolean;
|
|
2364
|
+
cashless: boolean;
|
|
2365
|
+
constructor();
|
|
2366
|
+
}
|
|
2367
|
+
/** Inventory Configuration */
|
|
2368
|
+
export interface IInventoryConfig {
|
|
2369
|
+
/** Control flag for inventory */
|
|
2370
|
+
control: boolean;
|
|
2371
|
+
}
|
|
2372
|
+
export class InventoryConfig implements IInventoryConfig {
|
|
2373
|
+
control: boolean;
|
|
2374
|
+
constructor();
|
|
2375
|
+
}
|
|
2376
|
+
/** Pax Configuration */
|
|
2377
|
+
export interface IPaxConfig {
|
|
2378
|
+
/** Pax flag */
|
|
2379
|
+
pax: boolean;
|
|
2380
|
+
/** Detail flag for Pax */
|
|
2381
|
+
detail: boolean;
|
|
2382
|
+
}
|
|
2383
|
+
export class PaxConfig implements IPaxConfig {
|
|
2384
|
+
pax: boolean;
|
|
2385
|
+
detail: boolean;
|
|
2386
|
+
constructor();
|
|
2387
|
+
}
|
|
2388
|
+
/** GTO Configuration */
|
|
2389
|
+
export interface IGtoConfig {
|
|
2390
|
+
/** Interface type */
|
|
2391
|
+
interface: string;
|
|
2392
|
+
/** Genesis date */
|
|
2393
|
+
genesis_date: string;
|
|
2394
|
+
/** Upload time */
|
|
2395
|
+
upload_time: string;
|
|
2396
|
+
/** FTP server */
|
|
2397
|
+
ftp_svr: string;
|
|
2398
|
+
/** FTP user */
|
|
2399
|
+
ftp_usr: string;
|
|
2400
|
+
/** FTP port */
|
|
2401
|
+
ftp_port: string;
|
|
2402
|
+
/** FTP path */
|
|
2403
|
+
ftp_path: string;
|
|
2404
|
+
/** FTP password */
|
|
2405
|
+
ftp_pwd: string;
|
|
2406
|
+
/** Mall ID */
|
|
2407
|
+
mall_id: string;
|
|
2408
|
+
/** Machine ID */
|
|
2409
|
+
machine_id: string;
|
|
2410
|
+
/** FTP type */
|
|
2411
|
+
ftp_type: string;
|
|
2412
|
+
}
|
|
2413
|
+
export class GTOConfig implements IGtoConfig {
|
|
2414
|
+
interface: string;
|
|
2415
|
+
genesis_date: string;
|
|
2416
|
+
upload_time: string;
|
|
2417
|
+
ftp_svr: string;
|
|
2418
|
+
ftp_usr: string;
|
|
2419
|
+
ftp_port: string;
|
|
2420
|
+
ftp_path: string;
|
|
2421
|
+
ftp_pwd: string;
|
|
2422
|
+
mall_id: string;
|
|
2423
|
+
machine_id: string;
|
|
2424
|
+
ftp_type: string;
|
|
2425
|
+
constructor();
|
|
2426
|
+
}
|
|
2427
|
+
/** CashDrawer Configuration */
|
|
2428
|
+
export interface ICashDrawerConfig {
|
|
2429
|
+
/** CashDrawer code */
|
|
2430
|
+
kick_code: string;
|
|
2431
|
+
/** Connection mode */
|
|
2432
|
+
connection_mode: 'via_receipt_printer' | 'via_imin_pos';
|
|
2433
|
+
}
|
|
2434
|
+
export class CashDrawerConfig implements ICashDrawerConfig {
|
|
2435
|
+
/**
|
|
2436
|
+
* The kick code for the cash drawer.
|
|
2437
|
+
*/
|
|
2438
|
+
kick_code: string;
|
|
2439
|
+
/** Connection mode */
|
|
2440
|
+
connection_mode: 'via_receipt_printer' | 'via_imin_pos';
|
|
2441
|
+
/**
|
|
2442
|
+
* Creates a new instance of the CashDrawerConfig class.
|
|
2443
|
+
*/
|
|
2444
|
+
constructor();
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
}
|
|
2448
|
+
declare module '@posx/core/types/employee.type' {
|
|
2449
|
+
import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
2450
|
+
export interface IEmployee extends IAppCoreModel {
|
|
2451
|
+
/** User ID */
|
|
2452
|
+
user_uid: string;
|
|
2453
|
+
/** User name */
|
|
2454
|
+
name: string;
|
|
2455
|
+
/** User email */
|
|
2456
|
+
email: string;
|
|
2457
|
+
/** 6 digits of password */
|
|
2458
|
+
password: string;
|
|
2459
|
+
/** role uid */
|
|
2460
|
+
role_uid: string;
|
|
2461
|
+
/** language preference */
|
|
2462
|
+
language: string;
|
|
2463
|
+
}
|
|
2464
|
+
export class Employee extends AppCoreModel implements IEmployee {
|
|
2465
|
+
user_uid: string;
|
|
2466
|
+
name: string;
|
|
2467
|
+
email: string;
|
|
2468
|
+
password: string;
|
|
2469
|
+
uid: string;
|
|
2470
|
+
role_uid: string;
|
|
2471
|
+
language: string;
|
|
2472
|
+
constructor();
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
}
|
|
2476
|
+
declare module '@posx/core/types/invoice.type' {
|
|
2477
|
+
import { IAppCoreModel, AppCoreModel } from '@posx/core/types/abstract.type';
|
|
2478
|
+
import { IPayment } from '@posx/core/types/payment.type';
|
|
2479
|
+
import { CoreItem, ICoreItem, IItem, Item } from '@posx/core/types/product.type';
|
|
2480
|
+
import { Address, Customer, IAddress, ICustomer } from '@posx/core/types/wyo.customer.type';
|
|
2481
|
+
import { ISectionItem } from '@posx/core/types/section.type';
|
|
2482
|
+
import { ITill } from '@posx/core/types/shift.type';
|
|
2483
|
+
import { IPrintJob } from '@posx/core/types/printer.type';
|
|
2484
|
+
import { Condition } from '@posx/core/types/condition.type';
|
|
2485
|
+
export enum InvoiceType {
|
|
2486
|
+
DineIn = "dine_in",
|
|
2487
|
+
TakeOut = "take_out",
|
|
2488
|
+
Delivery = "delivery"
|
|
2489
|
+
}
|
|
2490
|
+
export enum TaxMethod {
|
|
2491
|
+
Inclusive = "inclusive",
|
|
2492
|
+
Exclusive = "exclusive"
|
|
2493
|
+
}
|
|
2494
|
+
export enum InvoiceStatus {
|
|
2495
|
+
Open = "open",
|
|
2496
|
+
OnHold = "on_hold",
|
|
2497
|
+
Paying = "paying",
|
|
2498
|
+
Paid = "paid",
|
|
2499
|
+
Void = "void"
|
|
2500
|
+
}
|
|
2501
|
+
export enum InvoiceAction {
|
|
2502
|
+
Calibration = "calibration",
|
|
2503
|
+
Create = "create",
|
|
2504
|
+
Update = "update",
|
|
2505
|
+
Cancel = "cancel",
|
|
2506
|
+
Hold = "hold",
|
|
2507
|
+
PaymentAsync = "payment_async",
|
|
2508
|
+
Check = "check",
|
|
2509
|
+
Void = "void",
|
|
2510
|
+
Switch = "switch",
|
|
2511
|
+
Reprint = "reprint",
|
|
2512
|
+
Display = "display",
|
|
2513
|
+
Merge = "merge",
|
|
2514
|
+
Calculate = "calculate",
|
|
2515
|
+
Delivery = "delivery",
|
|
2516
|
+
Payment = "payment",
|
|
2517
|
+
ChangePayment = "change_payment",
|
|
2518
|
+
AddCustomer = "add_customer",
|
|
2519
|
+
VoidAndDuplicate = "void_and_duplicate",
|
|
2520
|
+
Duplicate = "duplicate"
|
|
2521
|
+
}
|
|
2522
|
+
export enum UomType {
|
|
2523
|
+
quantity = "quantity",
|
|
2524
|
+
weight = "weight"
|
|
2525
|
+
}
|
|
2526
|
+
export enum CalcType {
|
|
2527
|
+
Flat = "flat",
|
|
2528
|
+
Percent = "percent"
|
|
2529
|
+
}
|
|
2530
|
+
export enum CalcFlow {
|
|
2531
|
+
AfterSubtotal = "after_subtotal",
|
|
2532
|
+
AfterServiceCharge = "after_service_charge",
|
|
2533
|
+
AfterGrantTotal = "after_grant_total"
|
|
2534
|
+
}
|
|
2535
|
+
export enum DiscountType {
|
|
2536
|
+
Custom = "custom",
|
|
2537
|
+
Voucher = "voucher",
|
|
2538
|
+
Coupon = "coupon"
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Interface for invoice charge items
|
|
2542
|
+
*/
|
|
2543
|
+
export interface IInvoiceCharge {
|
|
2544
|
+
/** Charge unique id */
|
|
2545
|
+
uid: string;
|
|
2546
|
+
/** Charge name */
|
|
2547
|
+
name: string;
|
|
2548
|
+
/** Charge amount */
|
|
2549
|
+
percentage: number;
|
|
2550
|
+
/** Charge amount */
|
|
2551
|
+
amount: number;
|
|
2552
|
+
/** Charge calculation flow */
|
|
2553
|
+
calc_flow: CalcFlow;
|
|
2554
|
+
}
|
|
2555
|
+
export class InvoiceCharge implements IInvoiceCharge {
|
|
2556
|
+
uid: string;
|
|
2557
|
+
name: string;
|
|
2558
|
+
percentage: number;
|
|
2559
|
+
amount: number;
|
|
2560
|
+
calc_flow: CalcFlow;
|
|
2561
|
+
}
|
|
2562
|
+
export interface IInvoiceActivity {
|
|
2563
|
+
/** Action */
|
|
2564
|
+
action: InvoiceAction;
|
|
2565
|
+
/** Action by */
|
|
2566
|
+
action_by: string;
|
|
2567
|
+
/** Device unique id */
|
|
2568
|
+
device_uid: string;
|
|
2569
|
+
/** Action at */
|
|
2570
|
+
action_at: Date;
|
|
2571
|
+
}
|
|
2572
|
+
export class InvoiceActivity {
|
|
2573
|
+
action: InvoiceAction;
|
|
2574
|
+
action_by: string;
|
|
2575
|
+
device_uid: string;
|
|
2576
|
+
action_at: Date;
|
|
2577
|
+
}
|
|
2578
|
+
export interface IDiscount {
|
|
2579
|
+
uid: string;
|
|
2580
|
+
calc_type: CalcType;
|
|
2581
|
+
amount: number;
|
|
2582
|
+
percent: number;
|
|
2583
|
+
percent_amount: number;
|
|
2584
|
+
}
|
|
2585
|
+
export interface ICharge {
|
|
2586
|
+
uid: string;
|
|
2587
|
+
name: string;
|
|
2588
|
+
percent: number;
|
|
2589
|
+
calc_flow: CalcFlow;
|
|
2590
|
+
trigger_condition: Condition | string;
|
|
2591
|
+
}
|
|
2592
|
+
export class Charge implements ICharge {
|
|
2593
|
+
uid: string;
|
|
2594
|
+
name: string;
|
|
2595
|
+
percent: number;
|
|
2596
|
+
calc_flow: CalcFlow;
|
|
2597
|
+
trigger_condition: string;
|
|
2598
|
+
}
|
|
2599
|
+
export interface IInvoiceDiscount extends IDiscount {
|
|
2600
|
+
/** the name can be the voucher or coupon name */
|
|
2601
|
+
name?: string;
|
|
2602
|
+
/** Discount Type */
|
|
2603
|
+
type: DiscountType;
|
|
2604
|
+
/** Discount unique id */
|
|
2605
|
+
voucher_uid?: string;
|
|
2606
|
+
/** Discount unique id */
|
|
2607
|
+
coupon_uid?: string;
|
|
2608
|
+
/** Calculation flow */
|
|
2609
|
+
calc_flow: CalcFlow;
|
|
2610
|
+
}
|
|
2611
|
+
export class InvoiceDiscount implements IInvoiceDiscount {
|
|
2612
|
+
calc_type: CalcType;
|
|
2613
|
+
amount: number;
|
|
2614
|
+
percent: number;
|
|
2615
|
+
percent_amount: number;
|
|
2616
|
+
type: DiscountType;
|
|
2617
|
+
calc_flow: CalcFlow;
|
|
2618
|
+
name: string;
|
|
2619
|
+
voucher_uid: string;
|
|
2620
|
+
coupon_uid: string;
|
|
2621
|
+
uid: string;
|
|
2622
|
+
}
|
|
2623
|
+
export interface IInvoiceCoreLine {
|
|
2624
|
+
/** Item unique id */
|
|
2625
|
+
item_uid: string;
|
|
2626
|
+
/** The item being sold on the line item. */
|
|
2627
|
+
item: ICoreItem;
|
|
2628
|
+
/** Item unit price */
|
|
2629
|
+
price: number;
|
|
2630
|
+
/** Unit of measure (1:quantity | 2:weight) */
|
|
2631
|
+
unit_of_measure: UomType;
|
|
2632
|
+
/** Quantity if it is quantity*/
|
|
2633
|
+
quantity: number;
|
|
2634
|
+
/** Whether it is sent to server*/
|
|
2635
|
+
sent: number;
|
|
2636
|
+
}
|
|
2637
|
+
/**
|
|
2638
|
+
* Represents a line item on an invoice.
|
|
2639
|
+
*/
|
|
2640
|
+
export interface IInvoiceLine extends IAppCoreModel, Omit<IInvoiceCoreLine, 'item'> {
|
|
2641
|
+
item: IItem;
|
|
2642
|
+
/** Invoice Line unique id */
|
|
2643
|
+
invoice_uid: string;
|
|
2644
|
+
/** Line discount calculation type */
|
|
2645
|
+
discount_calc_type: CalcType;
|
|
2646
|
+
/** The amount of discount applied to the line item. */
|
|
2647
|
+
discount_amount: number;
|
|
2648
|
+
/** The percentage of discount applied to the line item. */
|
|
2649
|
+
discount_percent: number;
|
|
2650
|
+
/** The subtotal for the line item. */
|
|
2651
|
+
subtotal: number;
|
|
2652
|
+
/** The subtotal for the line item before any discounts were applied. */
|
|
2653
|
+
subtotal_before_discount: number;
|
|
2654
|
+
/** The unit price of the item. */
|
|
2655
|
+
price: number;
|
|
2656
|
+
/** The point value of the item. */
|
|
2657
|
+
point: number;
|
|
2658
|
+
/** The subtotal for the line item in points. */
|
|
2659
|
+
point_subtotal: number;
|
|
2660
|
+
/** The unit of measurement for the item. */
|
|
2661
|
+
unit_of_measure: UomType;
|
|
2662
|
+
/** The quantity of the item being sold on the line item. */
|
|
2663
|
+
quantity: number;
|
|
2664
|
+
/** Any additional remarks for the line item. */
|
|
2665
|
+
remark: string;
|
|
2666
|
+
/** Whether the item size is up-sized. */
|
|
2667
|
+
up_size: boolean;
|
|
2668
|
+
/** Whether the line item is for take-out. If so, the service charge is not counted. */
|
|
2669
|
+
is_take_out: boolean;
|
|
2670
|
+
/** Whether the line item is a duplicate. */
|
|
2671
|
+
is_duplicate: boolean;
|
|
2672
|
+
/** The line item that this line item is duplicated from. */
|
|
2673
|
+
duplicated_from_uid: string;
|
|
2674
|
+
/** Any modifiers applied to the line item. */
|
|
2675
|
+
modifiers: IInvoiceCoreLine[];
|
|
2676
|
+
/** Meta data for the line item */
|
|
2677
|
+
meta: Record<string, any>;
|
|
2678
|
+
}
|
|
2679
|
+
export interface IInvoice extends IAppCoreModel {
|
|
2680
|
+
/** Invoice reference number which is used for look-up */
|
|
2681
|
+
ref_id: string;
|
|
2682
|
+
/** The number which will be printed on kitchen slip
|
|
2683
|
+
or receipt or display to call when order is ready */
|
|
2684
|
+
call_num: string;
|
|
2685
|
+
/** Table unique id */
|
|
2686
|
+
table_uid: string;
|
|
2687
|
+
/**
|
|
2688
|
+
* Table name
|
|
2689
|
+
*/
|
|
2690
|
+
table_name: string;
|
|
2691
|
+
/** Invoice type */
|
|
2692
|
+
type: InvoiceType;
|
|
2693
|
+
/** Total number of people including adult, child and baby */
|
|
2694
|
+
pax: number;
|
|
2695
|
+
/** Number of Adult People */
|
|
2696
|
+
adult_pax: number;
|
|
2697
|
+
/** Number of Child People */
|
|
2698
|
+
child_pax: number;
|
|
2699
|
+
/** Number of Baby People */
|
|
2700
|
+
baby_pax: number;
|
|
2701
|
+
/** Invoice subtotal */
|
|
2702
|
+
subtotal: number;
|
|
2703
|
+
/** Invoice point subtotal */
|
|
2704
|
+
point_subtotal: number;
|
|
2705
|
+
/** Invoice subtotal applicable to service charge */
|
|
2706
|
+
service_chargeable_subtotal: number;
|
|
2707
|
+
/** Invoice subtotal applicable to discount */
|
|
2708
|
+
discountable_subtotal: number;
|
|
2709
|
+
/** Invoice service charge */
|
|
2710
|
+
service_charge: number;
|
|
2711
|
+
/** Online delivery id */
|
|
2712
|
+
delivery_id: number;
|
|
2713
|
+
/** Online delivery charge */
|
|
2714
|
+
delivery_charge: number;
|
|
2715
|
+
/** Online delivery type */
|
|
2716
|
+
delivery_type: string;
|
|
2717
|
+
/** Online delivery driver */
|
|
2718
|
+
delivery_by: string;
|
|
2719
|
+
/** If customer package is used in this invoice */
|
|
2720
|
+
/** Package deduction amount */
|
|
2721
|
+
/** If customer point is used in this invoice */
|
|
2722
|
+
use_customer_point: boolean;
|
|
2723
|
+
/** Add point */
|
|
2724
|
+
add_point: number;
|
|
2725
|
+
/** minus point */
|
|
2726
|
+
minus_point: number;
|
|
2727
|
+
/** rewarded point rate */
|
|
2728
|
+
rewarded_point_rate: number;
|
|
2729
|
+
/** Rewarded Point */
|
|
2730
|
+
rewarded_point: number;
|
|
2731
|
+
/** if customer balance is used in this invoice */
|
|
2732
|
+
use_customer_balance: boolean;
|
|
2733
|
+
/** add credit */
|
|
2734
|
+
add_credit: number;
|
|
2735
|
+
/** minus credit */
|
|
2736
|
+
minus_credit: number;
|
|
2737
|
+
/** rewarded credit rate */
|
|
2738
|
+
rewarded_credit_rate: number;
|
|
2739
|
+
/** Rewarded Credit */
|
|
2740
|
+
rewarded_credit: number;
|
|
2741
|
+
/** Discount List */
|
|
2742
|
+
discounts: IInvoiceDiscount[];
|
|
2743
|
+
/** Total discount amount */
|
|
2744
|
+
discount_amount: number;
|
|
2745
|
+
/** Tax */
|
|
2746
|
+
tax: number;
|
|
2747
|
+
/** Rounding */
|
|
2748
|
+
rounding: number;
|
|
2749
|
+
/** Tip Amount */
|
|
2750
|
+
tip: number;
|
|
2751
|
+
/** Grand Total */
|
|
2752
|
+
grand_total: number;
|
|
2753
|
+
/** Customer ID */
|
|
2754
|
+
customer_id: number;
|
|
2755
|
+
/** Remark */
|
|
2756
|
+
remark: string;
|
|
2757
|
+
/** Sales User ID */
|
|
2758
|
+
sales_user_uid: string;
|
|
2759
|
+
/** Status */
|
|
2760
|
+
status: InvoiceStatus;
|
|
2761
|
+
/** Payment Method */
|
|
2762
|
+
paid_at: Date;
|
|
2763
|
+
/** Human readable date */
|
|
2764
|
+
humanized_paid_at: string;
|
|
2765
|
+
/** Payment Method */
|
|
2766
|
+
voided_at: Date;
|
|
2767
|
+
/** Human readable date */
|
|
2768
|
+
humanized_voided_at: string;
|
|
2769
|
+
humanized_created_at: string;
|
|
2770
|
+
/** Order ID */
|
|
2771
|
+
order_id: number;
|
|
2772
|
+
/** To Address */
|
|
2773
|
+
to_address: IAddress;
|
|
2774
|
+
/** Payment Source Method */
|
|
2775
|
+
payment_source_method: string;
|
|
2776
|
+
/** Payment Source Last4 */
|
|
2777
|
+
payment_source_last4: string;
|
|
2778
|
+
/** Payment Source Charge Reference */
|
|
2779
|
+
payment_source_charge_ref: string;
|
|
2780
|
+
/** Is Sales Exclusive */
|
|
2781
|
+
is_sales_exclusive: boolean;
|
|
2782
|
+
/** Etc */
|
|
2783
|
+
etc: Record<string, any>;
|
|
2784
|
+
/** Action */
|
|
2785
|
+
action: InvoiceAction;
|
|
2786
|
+
/** Invoice Lines */
|
|
2787
|
+
lines: IInvoiceLine[];
|
|
2788
|
+
/** Deleted invoice lines */
|
|
2789
|
+
deleted_lines: IInvoiceLine[];
|
|
2790
|
+
/** Invoice Signature */
|
|
2791
|
+
/**
|
|
2792
|
+
* if invoice payments has cash payment
|
|
2793
|
+
*/
|
|
2794
|
+
payment_has_cash: boolean;
|
|
2795
|
+
/** Payment */
|
|
2796
|
+
payments: IPayment[];
|
|
2797
|
+
/** Table Switch ID */
|
|
2798
|
+
table_switch_id: number;
|
|
2799
|
+
/** Customer Spend */
|
|
2800
|
+
/** Reservation */
|
|
2801
|
+
/** Receipt Print Override */
|
|
2802
|
+
employee_uid: string;
|
|
2803
|
+
/**Employee Name */
|
|
2804
|
+
employee_name: string;
|
|
2805
|
+
receipt_print_override: boolean;
|
|
2806
|
+
/** Customer */
|
|
2807
|
+
customer: ICustomer;
|
|
2808
|
+
/** Is Duplicate */
|
|
2809
|
+
is_duplicate: boolean;
|
|
2810
|
+
/** Kitchen Print Override */
|
|
2811
|
+
kitchen_print_override: boolean;
|
|
2812
|
+
/** OTP */
|
|
2813
|
+
otp: string;
|
|
2814
|
+
/** Invoice Activity */
|
|
2815
|
+
activities: any[];
|
|
2816
|
+
/** Receipt printer unique id */
|
|
2817
|
+
receipt_print_job_uid: string;
|
|
2818
|
+
/** Additional charges */
|
|
2819
|
+
charges: IInvoiceCharge[];
|
|
2820
|
+
/** Flag to track if charge has been manually deleted by user */
|
|
2821
|
+
is_charge_triggered?: boolean;
|
|
2822
|
+
}
|
|
2823
|
+
export class InvoiceCoreLine implements IInvoiceCoreLine {
|
|
2824
|
+
item_uid: string;
|
|
2825
|
+
item: CoreItem;
|
|
2826
|
+
price: number;
|
|
2827
|
+
unit_of_measure: UomType;
|
|
2828
|
+
quantity: number;
|
|
2829
|
+
sent: number;
|
|
2830
|
+
constructor();
|
|
2831
|
+
}
|
|
2832
|
+
export class InvoiceLine extends AppCoreModel implements IInvoiceLine {
|
|
2833
|
+
item_uid: string;
|
|
2834
|
+
price: number;
|
|
2835
|
+
unit_of_measure: UomType;
|
|
2836
|
+
quantity: number;
|
|
2837
|
+
remark: string;
|
|
2838
|
+
invoice_uid: string;
|
|
2839
|
+
discount_calc_type: CalcType;
|
|
2840
|
+
discount_amount: number;
|
|
2841
|
+
discount_percent: number;
|
|
2842
|
+
subtotal: number;
|
|
2843
|
+
subtotal_before_discount: number;
|
|
2844
|
+
item: Item;
|
|
2845
|
+
point: number;
|
|
2846
|
+
point_subtotal: number;
|
|
2847
|
+
up_size: boolean;
|
|
2848
|
+
is_take_out: boolean;
|
|
2849
|
+
is_duplicate: boolean;
|
|
2850
|
+
modifiers: any[];
|
|
2851
|
+
duplicated_from_uid: string;
|
|
2852
|
+
sent: number;
|
|
2853
|
+
meta: {};
|
|
2854
|
+
constructor();
|
|
2855
|
+
}
|
|
2856
|
+
export class Invoice extends AppCoreModel implements IInvoice {
|
|
2857
|
+
ref_id: string;
|
|
2858
|
+
call_num: string;
|
|
2859
|
+
table_uid: string;
|
|
2860
|
+
table_name: string;
|
|
2861
|
+
type: InvoiceType;
|
|
2862
|
+
pax: number;
|
|
2863
|
+
adult_pax: number;
|
|
2864
|
+
child_pax: number;
|
|
2865
|
+
baby_pax: number;
|
|
2866
|
+
subtotal: number;
|
|
2867
|
+
point_subtotal: number;
|
|
2868
|
+
service_chargeable_subtotal: number;
|
|
2869
|
+
discountable_subtotal: number;
|
|
2870
|
+
service_charge: number;
|
|
2871
|
+
delivery_id: number;
|
|
2872
|
+
delivery_charge: number;
|
|
2873
|
+
delivery_type: string;
|
|
2874
|
+
delivery_by: string;
|
|
2875
|
+
use_customer_point: boolean;
|
|
2876
|
+
add_point: number;
|
|
2877
|
+
minus_point: number;
|
|
2878
|
+
rewarded_point_rate: number;
|
|
2879
|
+
rewarded_point: number;
|
|
2880
|
+
use_customer_balance: boolean;
|
|
2881
|
+
add_credit: number;
|
|
2882
|
+
minus_credit: number;
|
|
2883
|
+
rewarded_credit_rate: number;
|
|
2884
|
+
rewarded_credit: number;
|
|
2885
|
+
discounts: any[];
|
|
2886
|
+
discount_amount: number;
|
|
2887
|
+
tax: number;
|
|
2888
|
+
rounding: number;
|
|
2889
|
+
tip: number;
|
|
2890
|
+
grand_total: number;
|
|
2891
|
+
customer_id: number;
|
|
2892
|
+
remark: string;
|
|
2893
|
+
sales_user_uid: string;
|
|
2894
|
+
status: InvoiceStatus;
|
|
2895
|
+
paid_at: Date;
|
|
2896
|
+
voided_at: Date;
|
|
2897
|
+
humanized_paid_at: string;
|
|
2898
|
+
humanized_voided_at: string;
|
|
2899
|
+
humanized_created_at: string;
|
|
2900
|
+
order_id: number;
|
|
2901
|
+
to_address: Address;
|
|
2902
|
+
payment_source_method: string;
|
|
2903
|
+
payment_source_last4: string;
|
|
2904
|
+
payment_source_charge_ref: string;
|
|
2905
|
+
is_sales_exclusive: boolean;
|
|
2906
|
+
etc: Record<string, any>;
|
|
2907
|
+
action: InvoiceAction.Create;
|
|
2908
|
+
lines: IInvoiceLine[];
|
|
2909
|
+
deleted_lines: IInvoiceLine[];
|
|
2910
|
+
payment_has_cash: boolean;
|
|
2911
|
+
payments: IPayment[];
|
|
2912
|
+
table_switch_id: number;
|
|
2913
|
+
employee_uid: string;
|
|
2914
|
+
employee_name: string;
|
|
2915
|
+
receipt_print_override: boolean;
|
|
2916
|
+
customer: Customer;
|
|
2917
|
+
is_duplicate: boolean;
|
|
2918
|
+
kitchen_print_override: boolean;
|
|
2919
|
+
otp: string;
|
|
2920
|
+
activities: any[];
|
|
2921
|
+
receipt_print_job_uid: string;
|
|
2922
|
+
charges: IInvoiceCharge[];
|
|
2923
|
+
/** Flag to track if charge has been manually deleted by user */
|
|
2924
|
+
is_charge_triggered: boolean;
|
|
2925
|
+
uid: string;
|
|
2926
|
+
constructor();
|
|
2927
|
+
}
|
|
2928
|
+
export type CreateInvoiceOptions = {
|
|
2929
|
+
invoice: IInvoice;
|
|
2930
|
+
section_item: ISectionItem;
|
|
2931
|
+
print_jobs?: IPrintJob[];
|
|
2932
|
+
};
|
|
2933
|
+
export type CancelInvoiceOptions = CreateInvoiceOptions & {
|
|
2934
|
+
print_jobs?: IPrintJob[];
|
|
2935
|
+
};
|
|
2936
|
+
export type CheckInvoiceOptions = CreateInvoiceOptions & {
|
|
2937
|
+
print_jobs?: IPrintJob[];
|
|
2938
|
+
};
|
|
2939
|
+
export type UpdateInvoiceOptions = CreateInvoiceOptions;
|
|
2940
|
+
export type SwitchInvoiceOptions = {
|
|
2941
|
+
invoice: IInvoice;
|
|
2942
|
+
target_section_item: ISectionItem;
|
|
2943
|
+
source_section_item: ISectionItem;
|
|
2944
|
+
};
|
|
2945
|
+
export type VoidInvoiceOptions = {
|
|
2946
|
+
invoice: IInvoice;
|
|
2947
|
+
till: ITill;
|
|
2948
|
+
print_jobs?: IPrintJob[];
|
|
2949
|
+
section_item?: ISectionItem;
|
|
2950
|
+
};
|
|
2951
|
+
export type PayInvoiceOptions = VoidInvoiceOptions & {
|
|
2952
|
+
section_item: ISectionItem;
|
|
2953
|
+
print_jobs?: IPrintJob[];
|
|
2954
|
+
};
|
|
2955
|
+
export type DirectPayInvoiceOptions = VoidInvoiceOptions & {
|
|
2956
|
+
print_jobs?: IPrintJob[];
|
|
2957
|
+
};
|
|
2958
|
+
|
|
2959
|
+
}
|
|
2960
|
+
declare module '@posx/core/types/merchant.type' {
|
|
2961
|
+
export type IMerchantAsset = {
|
|
2962
|
+
guid: string;
|
|
2963
|
+
name: string;
|
|
2964
|
+
tags: AssetTags[];
|
|
2965
|
+
asset_type: AssetType;
|
|
2966
|
+
url: string;
|
|
2967
|
+
created_at: Date;
|
|
2968
|
+
};
|
|
2969
|
+
export enum AssetType {
|
|
2970
|
+
Image = "image",
|
|
2971
|
+
Video = "video",
|
|
2972
|
+
Unsupported = "unsupported"
|
|
2973
|
+
}
|
|
2974
|
+
export enum AssetTags {
|
|
2975
|
+
CdsFullScreenImage = "cds_full_screen_image",
|
|
2976
|
+
CdsHalfScreenImage = "cds_half_screen_image"
|
|
2977
|
+
}
|
|
2978
|
+
export type IEtc = {
|
|
2979
|
+
assets: IMerchantAsset[];
|
|
2980
|
+
};
|
|
2981
|
+
export class Merchant implements IMerchant {
|
|
2982
|
+
name: string;
|
|
2983
|
+
address: string;
|
|
2984
|
+
postcode: string;
|
|
2985
|
+
tel: string;
|
|
2986
|
+
tax_number: string;
|
|
2987
|
+
user_id: string;
|
|
2988
|
+
uid: string;
|
|
2989
|
+
api_key: string;
|
|
2990
|
+
ip_address: string;
|
|
2991
|
+
}
|
|
2992
|
+
export type IMerchant = {
|
|
2993
|
+
name: string;
|
|
2994
|
+
address: string;
|
|
2995
|
+
postcode: string;
|
|
2996
|
+
tel: string;
|
|
2997
|
+
tax_number: string;
|
|
2998
|
+
user_id: string;
|
|
2999
|
+
uid: string;
|
|
3000
|
+
api_key: string;
|
|
3001
|
+
ip_address: string;
|
|
3002
|
+
};
|
|
3003
|
+
|
|
3004
|
+
}
|
|
3005
|
+
declare module '@posx/core/types/misc.type' {
|
|
3006
|
+
export enum ModelPrefix {
|
|
3007
|
+
Merchant = "mnt_",
|
|
3008
|
+
Section = "sec_",
|
|
3009
|
+
SectionItem = "sit_",
|
|
3010
|
+
Category = "cat_",
|
|
3011
|
+
Subcategory = "sat_",
|
|
3012
|
+
Item = "itm_",
|
|
3013
|
+
ItemModifier = "iod_",
|
|
3014
|
+
ItemModifierCategory = "imc_",
|
|
3015
|
+
Config = "cfg_",
|
|
3016
|
+
Device = "dev_",
|
|
3017
|
+
Invoice = "inv_",
|
|
3018
|
+
InvoiceLine = "iln_",
|
|
3019
|
+
InvoiceCharge = "ich_",
|
|
3020
|
+
Payment = "pay_",
|
|
3021
|
+
Employee = "emp_",
|
|
3022
|
+
Shift = "shf_",
|
|
3023
|
+
Till = "til_",
|
|
3024
|
+
ReportCategory = "rpc_",
|
|
3025
|
+
Report = "rpt_",
|
|
3026
|
+
AppReport = "apr_",
|
|
3027
|
+
PaymentMethod = "pmd_",
|
|
3028
|
+
PrintTemplate = "ptl_",
|
|
3029
|
+
PrintJob = "pjb_",
|
|
3030
|
+
Printer = "prt_",
|
|
3031
|
+
InvoiceDiscount = "ind_",
|
|
3032
|
+
EmployeeRole = "emr_",
|
|
3033
|
+
OrderDisplaySystem = "ods_",
|
|
3034
|
+
Charge = "chr_"
|
|
3035
|
+
}
|
|
3036
|
+
export enum ModelType {
|
|
3037
|
+
Merchant = "mnt",
|
|
3038
|
+
Section = "sec",
|
|
3039
|
+
SectionItem = "sit",
|
|
3040
|
+
Category = "cat",
|
|
3041
|
+
Subcategory = "sat",
|
|
3042
|
+
Item = "itm",
|
|
3043
|
+
Config = "cfg",
|
|
3044
|
+
Device = "dev",
|
|
3045
|
+
Invoice = "inv"
|
|
3046
|
+
}
|
|
3047
|
+
export enum ServiceMode {
|
|
3048
|
+
LOCAL = "local",
|
|
3049
|
+
CLOUD = "cloud"
|
|
3050
|
+
}
|
|
3051
|
+
export interface IServiceOptions {
|
|
3052
|
+
mode: ServiceMode;
|
|
3053
|
+
base_url: string;
|
|
3054
|
+
device_uid: string;
|
|
3055
|
+
merchant_uid: string;
|
|
3056
|
+
token: string;
|
|
3057
|
+
database: {
|
|
3058
|
+
version: number;
|
|
3059
|
+
name: string;
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
export class ServiceOptions implements IServiceOptions {
|
|
3063
|
+
mode: ServiceMode;
|
|
3064
|
+
base_url: string;
|
|
3065
|
+
device_uid: string;
|
|
3066
|
+
merchant_uid: string;
|
|
3067
|
+
token: string;
|
|
3068
|
+
database: {
|
|
3069
|
+
version: 1;
|
|
3070
|
+
name: '';
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3073
|
+
export enum MessageType {
|
|
3074
|
+
Data = "DataMessage",
|
|
3075
|
+
Event = "EventMessage"
|
|
3076
|
+
}
|
|
3077
|
+
/** Interface for push_data */
|
|
3078
|
+
export interface IPushData {
|
|
3079
|
+
model: string;
|
|
3080
|
+
/** Push Data Content */
|
|
3081
|
+
data: string;
|
|
3082
|
+
has_many: boolean;
|
|
3083
|
+
type: MessageType;
|
|
3084
|
+
}
|
|
3085
|
+
/** Model for push_data */
|
|
3086
|
+
export class PushData implements IPushData {
|
|
3087
|
+
model: string;
|
|
3088
|
+
/** Push Data Content */
|
|
3089
|
+
data: string;
|
|
3090
|
+
has_many: boolean;
|
|
3091
|
+
type: MessageType;
|
|
3092
|
+
}
|
|
3093
|
+
export class SystemError extends Error {
|
|
3094
|
+
constructor(message: string);
|
|
3095
|
+
}
|
|
3096
|
+
export type CustomResponse<T> = {
|
|
3097
|
+
data: T;
|
|
3098
|
+
error: ErrorMsgs | string;
|
|
3099
|
+
error_code: number;
|
|
3100
|
+
};
|
|
3101
|
+
export enum ErrorMsgs {
|
|
3102
|
+
outdatedInvoice = "outdated invoice",
|
|
3103
|
+
outdatedSectionItem = "outdated section item",
|
|
3104
|
+
outdatedSourceSectionItem = "outdated source section item",
|
|
3105
|
+
outdatedTargetSectionItem = "outdated target section item"
|
|
3106
|
+
}
|
|
3107
|
+
export interface IFileUploadResponse {
|
|
3108
|
+
file_url: string;
|
|
3109
|
+
thumbnail_url: string;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
}
|
|
3113
|
+
declare module '@posx/core/types/note.type' {
|
|
3114
|
+
import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
|
|
3115
|
+
import { ModelType } from '@posx/core/types/misc.type';
|
|
3116
|
+
export type INoteGroupEntity = IAppBaseModel;
|
|
3117
|
+
export class NoteGroupEntity extends AppBaseModel implements INoteGroupEntity {
|
|
3118
|
+
constructor();
|
|
3119
|
+
}
|
|
3120
|
+
export type INoteGroup = INoteGroupEntity;
|
|
3121
|
+
export class NoteGroup extends NoteGroupEntity {
|
|
3122
|
+
constructor();
|
|
3123
|
+
}
|
|
3124
|
+
export interface INoteEntity extends IAppBaseModel {
|
|
3125
|
+
/** Group ID */
|
|
3126
|
+
note_group_uid: string;
|
|
3127
|
+
/** Type of the Note */
|
|
3128
|
+
related_model: ModelType;
|
|
3129
|
+
/** Usage */
|
|
3130
|
+
usage: number;
|
|
3131
|
+
}
|
|
3132
|
+
export class NoteEntity extends AppBaseModel implements INoteEntity {
|
|
3133
|
+
note_group_uid: string;
|
|
3134
|
+
related_model: ModelType;
|
|
3135
|
+
usage: number;
|
|
3136
|
+
constructor();
|
|
3137
|
+
}
|
|
3138
|
+
export type INote = INoteEntity;
|
|
3139
|
+
export class Note extends NoteEntity {
|
|
3140
|
+
constructor();
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
}
|
|
3144
|
+
declare module '@posx/core/types/ods.type' {
|
|
3145
|
+
import { AppCoreModel, IAppCoreModel } from "@posx/core/types/abstract.type";
|
|
3146
|
+
export interface IOrderDisplay extends IAppCoreModel {
|
|
3147
|
+
order_number: string;
|
|
3148
|
+
status: OrderDisplayStatus;
|
|
3149
|
+
}
|
|
3150
|
+
export class OrderDisplay extends AppCoreModel implements IOrderDisplay {
|
|
3151
|
+
uid: string;
|
|
3152
|
+
order_number: string;
|
|
3153
|
+
status: OrderDisplayStatus;
|
|
3154
|
+
constructor();
|
|
3155
|
+
}
|
|
3156
|
+
export enum OrderDisplayStatus {
|
|
3157
|
+
Preparing = "preparing",
|
|
3158
|
+
ReadyForPickup = "ready_for_pickup"
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
}
|
|
3162
|
+
declare module '@posx/core/types/payment.type' {
|
|
3163
|
+
import { AppBaseModel, AppCoreModel, IAppBaseModel, IAppCoreModel } from "@posx/core/types/abstract.type";
|
|
3164
|
+
import { IAppModelSequence } from '@posx/core/services/abstract.service';
|
|
3165
|
+
/**
|
|
3166
|
+
* Payment Entity Interface
|
|
3167
|
+
*/
|
|
3168
|
+
export interface IPayment extends IAppCoreModel {
|
|
3169
|
+
/** Invoice ID */
|
|
3170
|
+
invoice_uid: string;
|
|
3171
|
+
/** Tender Amount */
|
|
3172
|
+
tender_amount: number;
|
|
3173
|
+
/** Change Amount */
|
|
3174
|
+
change_amount: number;
|
|
3175
|
+
/** Payment Method ID */
|
|
3176
|
+
payment_method_uid: string;
|
|
3177
|
+
/** Payment Method Code */
|
|
3178
|
+
payment_method_code: string;
|
|
3179
|
+
/** Selected Payment Method */
|
|
3180
|
+
payment_method_name: string;
|
|
3181
|
+
/** Selected Payment Method */
|
|
3182
|
+
payment_method: IPaymentMethod;
|
|
3183
|
+
}
|
|
3184
|
+
export class Payment extends AppCoreModel implements IPayment {
|
|
3185
|
+
invoice_uid: string;
|
|
3186
|
+
tender_amount: number;
|
|
3187
|
+
change_amount: number;
|
|
3188
|
+
payment_method_uid: string;
|
|
3189
|
+
payment_method_code: string;
|
|
3190
|
+
payment_method_name: string;
|
|
3191
|
+
payment_method: PaymentMethod;
|
|
3192
|
+
uid: string;
|
|
3193
|
+
updated_at: Date;
|
|
3194
|
+
constructor();
|
|
3195
|
+
}
|
|
3196
|
+
/**
|
|
3197
|
+
* Payment Method Entity Interface
|
|
3198
|
+
*/
|
|
3199
|
+
export interface IPaymentMethod extends IAppBaseModel, IAppModelSequence {
|
|
3200
|
+
/** Payment Currency ID */
|
|
3201
|
+
payment_currency_id: number;
|
|
3202
|
+
/** Currency Code */
|
|
3203
|
+
currency_code: string;
|
|
3204
|
+
/** Payment Method Code */
|
|
3205
|
+
currency_symbol: string;
|
|
3206
|
+
/** Payment Method Code */
|
|
3207
|
+
payment_method_code: string;
|
|
3208
|
+
/** Payment Name */
|
|
3209
|
+
name: string;
|
|
3210
|
+
/** Code Name */
|
|
3211
|
+
codename: string;
|
|
3212
|
+
/** Name Abbreviation */
|
|
3213
|
+
name_abbrev: string;
|
|
3214
|
+
/** Enable Drawer */
|
|
3215
|
+
enable_drawer: boolean;
|
|
3216
|
+
/** Enable Receipt */
|
|
3217
|
+
enable_receipt: boolean;
|
|
3218
|
+
/** Image URL */
|
|
3219
|
+
image_url: string;
|
|
3220
|
+
/** Is Cash */
|
|
3221
|
+
is_cash: boolean;
|
|
3222
|
+
/** Is Integrated */
|
|
3223
|
+
is_integrated: boolean;
|
|
3224
|
+
/** Is Disabled */
|
|
3225
|
+
is_disabled: boolean;
|
|
3226
|
+
/** Type */
|
|
3227
|
+
type: number;
|
|
3228
|
+
/** API ID */
|
|
3229
|
+
api_id: string;
|
|
3230
|
+
/** API Key */
|
|
3231
|
+
api_key: string;
|
|
3232
|
+
/** Is Sales Exclusive */
|
|
3233
|
+
is_sales_exclusive: boolean;
|
|
3234
|
+
}
|
|
3235
|
+
export class PaymentMethod extends AppBaseModel implements IPaymentMethod {
|
|
3236
|
+
sequence: number;
|
|
3237
|
+
payment_currency_id: number;
|
|
3238
|
+
currency_code: string;
|
|
3239
|
+
currency_symbol: string;
|
|
3240
|
+
payment_method_code: string;
|
|
3241
|
+
name: string;
|
|
3242
|
+
codename: string;
|
|
3243
|
+
name_abbrev: string;
|
|
3244
|
+
enable_drawer: boolean;
|
|
3245
|
+
enable_receipt: boolean;
|
|
3246
|
+
image_url: string;
|
|
3247
|
+
is_cash: boolean;
|
|
3248
|
+
is_integrated: boolean;
|
|
3249
|
+
is_disabled: boolean;
|
|
3250
|
+
type: number;
|
|
3251
|
+
api_id: string;
|
|
3252
|
+
api_key: string;
|
|
3253
|
+
is_sales_exclusive: boolean;
|
|
3254
|
+
uid: string;
|
|
3255
|
+
constructor();
|
|
3256
|
+
}
|
|
3257
|
+
export interface IStandardPaymentMethod {
|
|
3258
|
+
/** Access Token */
|
|
3259
|
+
access_token: string | null;
|
|
3260
|
+
/** Base64 encoded image */
|
|
3261
|
+
image_base64: string | null;
|
|
3262
|
+
/** Error message */
|
|
3263
|
+
error: string | null;
|
|
3264
|
+
/** Currency code */
|
|
3265
|
+
currency_code: string | null;
|
|
3266
|
+
/** Payment method code */
|
|
3267
|
+
payment_method_code: string;
|
|
3268
|
+
/** Codename of the payment method */
|
|
3269
|
+
codename: string | null;
|
|
3270
|
+
/** Abbreviated name */
|
|
3271
|
+
name_abbrev: string | null;
|
|
3272
|
+
/** Full name */
|
|
3273
|
+
name: string;
|
|
3274
|
+
/** Flag to enable drawer */
|
|
3275
|
+
enable_drawer: boolean;
|
|
3276
|
+
/** Flag to enable receipt */
|
|
3277
|
+
enable_receipt: boolean;
|
|
3278
|
+
/** Image URL */
|
|
3279
|
+
image_url: string;
|
|
3280
|
+
/** Flag for cash payment */
|
|
3281
|
+
is_cash: boolean;
|
|
3282
|
+
/** Flag for integrated payment */
|
|
3283
|
+
is_integrated: boolean;
|
|
3284
|
+
/** Flag to disable the payment method */
|
|
3285
|
+
is_disabled: boolean;
|
|
3286
|
+
/** Type of payment method */
|
|
3287
|
+
type: number;
|
|
3288
|
+
/** API ID */
|
|
3289
|
+
api_id: string | null;
|
|
3290
|
+
/** API Key */
|
|
3291
|
+
api_key: string | null;
|
|
3292
|
+
/** Timestamp of creation */
|
|
3293
|
+
timestamp_create: number;
|
|
3294
|
+
/** Timestamp of last update */
|
|
3295
|
+
timestamp_update: number;
|
|
3296
|
+
toPaymentMethod(): PaymentMethod;
|
|
3297
|
+
}
|
|
3298
|
+
export class StandardPaymentMethod implements IStandardPaymentMethod {
|
|
3299
|
+
access_token: any;
|
|
3300
|
+
image_base64: any;
|
|
3301
|
+
error: any;
|
|
3302
|
+
currency_code: any;
|
|
3303
|
+
payment_method_code: string;
|
|
3304
|
+
codename: any;
|
|
3305
|
+
name_abbrev: any;
|
|
3306
|
+
name: string;
|
|
3307
|
+
enable_drawer: boolean;
|
|
3308
|
+
enable_receipt: boolean;
|
|
3309
|
+
image_url: string;
|
|
3310
|
+
is_cash: boolean;
|
|
3311
|
+
is_integrated: boolean;
|
|
3312
|
+
is_disabled: boolean;
|
|
3313
|
+
type: number;
|
|
3314
|
+
api_id: any;
|
|
3315
|
+
api_key: any;
|
|
3316
|
+
timestamp_create: number;
|
|
3317
|
+
timestamp_update: number;
|
|
3318
|
+
toPaymentMethod(): PaymentMethod;
|
|
3319
|
+
constructor(init?: Partial<IPaymentMethod>);
|
|
3320
|
+
}
|
|
3321
|
+
export type IChangePaymentMethodOption = {
|
|
3322
|
+
source_payment: IPayment;
|
|
3323
|
+
target_payment_method: IPaymentMethod;
|
|
3324
|
+
};
|
|
3325
|
+
/**
|
|
3326
|
+
* Payment sync status enum
|
|
3327
|
+
*/
|
|
3328
|
+
export enum PaymentStatus {
|
|
3329
|
+
STARTED = "payment_started",
|
|
3330
|
+
PROCESSING = "payment_processing",
|
|
3331
|
+
COMPLETED = "payment_completed",
|
|
3332
|
+
FAILED = "payment_failed"
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Payment sync data interface
|
|
3336
|
+
*/
|
|
3337
|
+
export interface IPaymentSyncData {
|
|
3338
|
+
/** Payment unique identifier */
|
|
3339
|
+
payment_uid: string;
|
|
3340
|
+
/** Associated invoice ID */
|
|
3341
|
+
invoice_uid: string;
|
|
3342
|
+
/** Table ID */
|
|
3343
|
+
table_uid?: string;
|
|
3344
|
+
/** Payment status */
|
|
3345
|
+
status: PaymentStatus;
|
|
3346
|
+
/** Payment method */
|
|
3347
|
+
payment_method: IPaymentMethod;
|
|
3348
|
+
/** Payment amount */
|
|
3349
|
+
amount: number;
|
|
3350
|
+
/** Actual tender amount */
|
|
3351
|
+
tender_amount?: number;
|
|
3352
|
+
/** Change amount */
|
|
3353
|
+
change_amount?: number;
|
|
3354
|
+
/** Payment result */
|
|
3355
|
+
result?: 'success' | 'failed';
|
|
3356
|
+
/** Error message */
|
|
3357
|
+
error_message?: string;
|
|
3358
|
+
/** Timestamp */
|
|
3359
|
+
timestamp: Date;
|
|
3360
|
+
/** Employee UID */
|
|
3361
|
+
employee_uid?: string;
|
|
3362
|
+
/** Terminal ID */
|
|
3363
|
+
terminal_id?: string;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
}
|
|
3367
|
+
declare module '@posx/core/types/printer.type' {
|
|
3368
|
+
import { IPrintCommand, PrintCommand } from '@posx/core/libs/escpos.printer';
|
|
3369
|
+
import { AppBaseModel, IAppBaseModel, IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
3370
|
+
import { IConfig } from '@posx/core/types/config.type';
|
|
3371
|
+
import { IInvoice } from '@posx/core/types/invoice.type';
|
|
3372
|
+
import { IReportData } from '@posx/core/types/report.type';
|
|
3373
|
+
export interface IDevice extends IAppCoreModel {
|
|
3374
|
+
machine_name: string;
|
|
3375
|
+
connection_id: string;
|
|
3376
|
+
type: DeviceType;
|
|
3377
|
+
etc: DeviceEtc;
|
|
3378
|
+
}
|
|
3379
|
+
export type DeviceEtc = {
|
|
3380
|
+
fomopay_terminal_id: string;
|
|
3381
|
+
hirector_public_key: string;
|
|
3382
|
+
hirector_private_key: string;
|
|
3383
|
+
};
|
|
3384
|
+
export type INode = IDevice;
|
|
3385
|
+
export class Device extends AppBaseModel implements IDevice {
|
|
3386
|
+
machine_name: string;
|
|
3387
|
+
connection_id: string;
|
|
3388
|
+
type: DeviceType;
|
|
3389
|
+
etc: DeviceEtc;
|
|
3390
|
+
constructor();
|
|
3391
|
+
}
|
|
3392
|
+
export class Node extends AppBaseModel implements INode {
|
|
3393
|
+
type: DeviceType;
|
|
3394
|
+
machine_name: string;
|
|
3395
|
+
connection_id: string;
|
|
3396
|
+
etc: DeviceEtc;
|
|
3397
|
+
constructor();
|
|
3398
|
+
}
|
|
3399
|
+
export enum DeviceType {
|
|
3400
|
+
Client = "client",
|
|
3401
|
+
Node = "node"
|
|
3402
|
+
}
|
|
3403
|
+
export enum PrinterType {
|
|
3404
|
+
ReceiptPrinter = "receipt_printer",
|
|
3405
|
+
CheckPrinter = "check_printer",
|
|
3406
|
+
OrderPrinter = "order_printer",
|
|
3407
|
+
KitchenPrinter = "kitchen_printer",
|
|
3408
|
+
KioskPrinter = "kiosk_printer",
|
|
3409
|
+
LabelPrinter = "label_printer"
|
|
3410
|
+
}
|
|
3411
|
+
export interface INodePrinter {
|
|
3412
|
+
printer_name: string;
|
|
3413
|
+
status: string;
|
|
3414
|
+
port_name: string;
|
|
3415
|
+
error: string;
|
|
3416
|
+
}
|
|
3417
|
+
export class NodePrinter implements INodePrinter {
|
|
3418
|
+
printer_name: string;
|
|
3419
|
+
status: string;
|
|
3420
|
+
port_name: string;
|
|
3421
|
+
error: string;
|
|
3422
|
+
}
|
|
3423
|
+
export enum PrinterProtocols {
|
|
3424
|
+
ESCPOS = "ESC/POS",
|
|
3425
|
+
TSPL = "TSPL"
|
|
3426
|
+
}
|
|
3427
|
+
export enum PrinterConnections {
|
|
3428
|
+
USB = "USB",
|
|
3429
|
+
WINDOWS_DRIVER = "WINDOWS_DRIVER",
|
|
3430
|
+
ETHERNET = "ETHERNET",
|
|
3431
|
+
BLUETOOTH = "BLUETOOTH",
|
|
3432
|
+
BUILTIN = "BUILTIN"
|
|
3433
|
+
}
|
|
3434
|
+
export type IPrintTemplateCore = {
|
|
3435
|
+
header: string;
|
|
3436
|
+
body: string;
|
|
3437
|
+
footer: string;
|
|
3438
|
+
commands: string;
|
|
3439
|
+
};
|
|
3440
|
+
export class PrintTemplateCore implements IPrintTemplateCore {
|
|
3441
|
+
header: string;
|
|
3442
|
+
body: string;
|
|
3443
|
+
footer: string;
|
|
3444
|
+
commands: string;
|
|
3445
|
+
type: PrinterType;
|
|
3446
|
+
constructor();
|
|
3447
|
+
}
|
|
3448
|
+
export type IPrintTemplate = IPrintTemplateCore & IAppBaseModel & {
|
|
3449
|
+
printer_type: PrinterType;
|
|
3450
|
+
report_code_name: string;
|
|
3451
|
+
};
|
|
3452
|
+
export class PrintTemplate extends AppBaseModel implements IPrintTemplate {
|
|
3453
|
+
header: string;
|
|
3454
|
+
body: string;
|
|
3455
|
+
footer: string;
|
|
3456
|
+
commands: string;
|
|
3457
|
+
printer_type: PrinterType;
|
|
3458
|
+
uid: string;
|
|
3459
|
+
report_code_name: string;
|
|
3460
|
+
constructor();
|
|
3461
|
+
}
|
|
3462
|
+
export enum PrintJobStatus {
|
|
3463
|
+
Queued = "queued",
|
|
3464
|
+
Printed = "printed",
|
|
3465
|
+
Failed = "failed",
|
|
3466
|
+
Expired = "expired"
|
|
3467
|
+
}
|
|
3468
|
+
export interface IPrintJob extends IAppCoreModel {
|
|
3469
|
+
printer_name: string;
|
|
3470
|
+
/** Actual printer name using printer driver*/
|
|
3471
|
+
driver_printer_name: string;
|
|
3472
|
+
printer_ip: string;
|
|
3473
|
+
printer_uid: string;
|
|
3474
|
+
printer_type: PrinterType;
|
|
3475
|
+
protocol: PrinterProtocols;
|
|
3476
|
+
connection_type: PrinterConnections;
|
|
3477
|
+
data: IPrintCommand;
|
|
3478
|
+
commands: string;
|
|
3479
|
+
status: PrintJobStatus;
|
|
3480
|
+
retries: number;
|
|
3481
|
+
save_only: boolean;
|
|
3482
|
+
print_times: number;
|
|
3483
|
+
printed: number;
|
|
3484
|
+
/** Targeting which device to print */
|
|
3485
|
+
device_uid_to_print: string;
|
|
3486
|
+
/** Designated Table Sections */
|
|
3487
|
+
designated_table_section_uids: string[];
|
|
3488
|
+
/** Job ID */
|
|
3489
|
+
job_id: number;
|
|
3490
|
+
}
|
|
3491
|
+
export class PrintJob extends AppBaseModel implements IPrintJob {
|
|
3492
|
+
printer_name: string;
|
|
3493
|
+
driver_printer_name: string;
|
|
3494
|
+
printer_ip: string;
|
|
3495
|
+
printer_uid: string;
|
|
3496
|
+
printer_type: PrinterType;
|
|
3497
|
+
protocol: PrinterProtocols;
|
|
3498
|
+
connection_type: PrinterConnections;
|
|
3499
|
+
data: PrintCommand;
|
|
3500
|
+
status: PrintJobStatus;
|
|
3501
|
+
retries: number;
|
|
3502
|
+
commands: string;
|
|
3503
|
+
uid: string;
|
|
3504
|
+
save_only: boolean;
|
|
3505
|
+
print_times: number;
|
|
3506
|
+
printed: number;
|
|
3507
|
+
device_uid_to_print: string;
|
|
3508
|
+
designated_table_section_uids: any[];
|
|
3509
|
+
job_id: number;
|
|
3510
|
+
constructor(printer: IPrinter, printData: IPrintCommand, saveOnly?: boolean, printTimes?: number);
|
|
3511
|
+
}
|
|
3512
|
+
export enum PrinterStatus {
|
|
3513
|
+
Online = "online",
|
|
3514
|
+
Offline = "offline"
|
|
3515
|
+
}
|
|
3516
|
+
export interface IPrinter extends IAppBaseModel {
|
|
3517
|
+
/** Printer terminal ID */
|
|
3518
|
+
device_uid: string;
|
|
3519
|
+
/** Printer type */
|
|
3520
|
+
type: PrinterType;
|
|
3521
|
+
/** Actual printer name using printer driver*/
|
|
3522
|
+
driver_printer_name: string;
|
|
3523
|
+
/** Backup printer ID */
|
|
3524
|
+
fallback_printer_uid: number;
|
|
3525
|
+
/** Printer protocol */
|
|
3526
|
+
protocol: PrinterProtocols;
|
|
3527
|
+
/** Printer connection type */
|
|
3528
|
+
connection_type: PrinterConnections;
|
|
3529
|
+
/** Print template UID */
|
|
3530
|
+
print_template_uid?: string;
|
|
3531
|
+
/** Printer IP address */
|
|
3532
|
+
ip_address?: string;
|
|
3533
|
+
/** Printer status */
|
|
3534
|
+
status: PrinterStatus;
|
|
3535
|
+
/** if it is consolidated print or itemized print when it is kitchen printer */
|
|
3536
|
+
kitchen_itemized_print: boolean;
|
|
3537
|
+
/** Number of times to print */
|
|
3538
|
+
print_times: number;
|
|
3539
|
+
/** Number of retries */
|
|
3540
|
+
retries: number;
|
|
3541
|
+
}
|
|
3542
|
+
export class Printer extends AppBaseModel implements IPrinter {
|
|
3543
|
+
device_uid: string;
|
|
3544
|
+
type: PrinterType;
|
|
3545
|
+
driver_printer_name: string;
|
|
3546
|
+
fallback_printer_uid: number;
|
|
3547
|
+
protocol: PrinterProtocols;
|
|
3548
|
+
connection_type: PrinterConnections;
|
|
3549
|
+
print_template_uid: string;
|
|
3550
|
+
uid: string;
|
|
3551
|
+
ip_address: string;
|
|
3552
|
+
status: PrinterStatus;
|
|
3553
|
+
kitchen_itemized_print: boolean;
|
|
3554
|
+
print_times: number;
|
|
3555
|
+
retries: number;
|
|
3556
|
+
constructor();
|
|
3557
|
+
}
|
|
3558
|
+
export interface TemplateData {
|
|
3559
|
+
config: IConfig;
|
|
3560
|
+
invoice: IInvoice;
|
|
3561
|
+
printer_name: string;
|
|
3562
|
+
printed_at: Date;
|
|
3563
|
+
normalized_printed_at: string;
|
|
3564
|
+
report_data: IReportData;
|
|
3565
|
+
}
|
|
3566
|
+
export class TemplateData implements TemplateData {
|
|
3567
|
+
config: IConfig;
|
|
3568
|
+
invoice: IInvoice;
|
|
3569
|
+
report_data: IReportData;
|
|
3570
|
+
printer_name: string;
|
|
3571
|
+
printed_at: Date;
|
|
3572
|
+
normalized_printed_at: string;
|
|
3573
|
+
}
|
|
3574
|
+
export type IRenderPrintTemplateOptions = {
|
|
3575
|
+
printer_name: string;
|
|
3576
|
+
kitchen_itemized_print: boolean;
|
|
3577
|
+
};
|
|
3578
|
+
export class RenderPrintTemplateOptions implements IRenderPrintTemplateOptions {
|
|
3579
|
+
printer_name: string;
|
|
3580
|
+
kitchen_itemized_print: boolean;
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
}
|
|
3584
|
+
declare module '@posx/core/types/product.type' {
|
|
3585
|
+
import { IAppModelSequence } from '@posx/core/services/abstract.service';
|
|
3586
|
+
import { AppCoreModel, AppExtraModel, IAppCoreModel, IAppExtraModel } from '@posx/core/types/abstract.type';
|
|
3587
|
+
export interface IProductBase extends IAppExtraModel, IAppModelSequence {
|
|
3588
|
+
/**
|
|
3589
|
+
* color of the object
|
|
3590
|
+
*/
|
|
3591
|
+
color: string;
|
|
3592
|
+
/**
|
|
3593
|
+
* icon of the object
|
|
3594
|
+
*/
|
|
3595
|
+
icon: string;
|
|
3596
|
+
/**
|
|
3597
|
+
* meta data
|
|
3598
|
+
* @ignore
|
|
3599
|
+
*/
|
|
3600
|
+
meta: Record<string, any>;
|
|
3601
|
+
/**
|
|
3602
|
+
* extra data
|
|
3603
|
+
* @ignore
|
|
3604
|
+
*/
|
|
3605
|
+
etc: Record<string, any>;
|
|
3606
|
+
/**
|
|
3607
|
+
* assets of the product (for image, etc)
|
|
3608
|
+
* Predefined keys that can be used by the system
|
|
3609
|
+
*/
|
|
3610
|
+
assets: ProductPartialAssets & Record<string, any>;
|
|
3611
|
+
/**
|
|
3612
|
+
* config of the product
|
|
3613
|
+
* Predefined keys that can be used by the system
|
|
3614
|
+
*/
|
|
3615
|
+
config: ProductPartialConfig & Record<string, any>;
|
|
3616
|
+
}
|
|
3617
|
+
/**
|
|
3618
|
+
* Predefined asset keys that can be used in the product assets
|
|
3619
|
+
*/
|
|
3620
|
+
export type ProductPartialAssets = {
|
|
3621
|
+
/**
|
|
3622
|
+
* large image url for online order
|
|
3623
|
+
*/
|
|
3624
|
+
online_order_large_image_url?: string;
|
|
3625
|
+
/**
|
|
3626
|
+
* large image thumbnail url for online order
|
|
3627
|
+
*/
|
|
3628
|
+
online_order_large_image_thumbnail_url?: string;
|
|
3629
|
+
/**
|
|
3630
|
+
* large image file path for online order
|
|
3631
|
+
*/
|
|
3632
|
+
online_order_large_image_file_path?: string;
|
|
3633
|
+
/**
|
|
3634
|
+
* small image url for online order
|
|
3635
|
+
*/
|
|
3636
|
+
online_order_small_image_url?: string;
|
|
3637
|
+
/**
|
|
3638
|
+
* small image thumbnail url for online order
|
|
3639
|
+
*/
|
|
3640
|
+
online_order_small_image_thumbnail_url?: string;
|
|
3641
|
+
/**
|
|
3642
|
+
* small image file path for online order
|
|
3643
|
+
*/
|
|
3644
|
+
online_order_small_image_file_path?: string;
|
|
3645
|
+
};
|
|
3646
|
+
/**
|
|
3647
|
+
* Predefined config keys that can be used in the product configs
|
|
3648
|
+
*/
|
|
3649
|
+
export type ProductPartialConfig = {
|
|
3650
|
+
/**
|
|
3651
|
+
* display large image for online order, if false, small image will be displayed
|
|
3652
|
+
*/
|
|
3653
|
+
online_order_display_large_image: boolean;
|
|
3654
|
+
};
|
|
3655
|
+
export class ProductBase extends AppExtraModel implements IProductBase {
|
|
3656
|
+
meta: {};
|
|
3657
|
+
etc: {};
|
|
3658
|
+
assets: {};
|
|
3659
|
+
config: {
|
|
3660
|
+
online_order_display_large_image: boolean;
|
|
3661
|
+
};
|
|
3662
|
+
color: string;
|
|
3663
|
+
icon: string;
|
|
3664
|
+
sequence: number;
|
|
3665
|
+
constructor();
|
|
3666
|
+
}
|
|
3667
|
+
export interface IVisibility {
|
|
3668
|
+
system: System;
|
|
3669
|
+
visible: boolean;
|
|
3670
|
+
sequence: number;
|
|
3671
|
+
}
|
|
3672
|
+
export class Visibility implements IVisibility {
|
|
3673
|
+
system: System;
|
|
3674
|
+
visible: boolean;
|
|
3675
|
+
sequence: number;
|
|
3676
|
+
constructor();
|
|
3677
|
+
}
|
|
3678
|
+
export enum System {
|
|
3679
|
+
POS = "pos",
|
|
3680
|
+
QrCodeOrder = "qr_code_order"
|
|
3681
|
+
}
|
|
3682
|
+
export interface ICoreCategory extends IProductBase {
|
|
3683
|
+
type: CategoryType;
|
|
3684
|
+
visibility: Array<Visibility>;
|
|
3685
|
+
/**
|
|
3686
|
+
* maximum order quantity before you can order
|
|
3687
|
+
*/
|
|
3688
|
+
max_order: number;
|
|
3689
|
+
/**
|
|
3690
|
+
* minimum order quantity before you can order
|
|
3691
|
+
*/
|
|
3692
|
+
min_order: number;
|
|
3693
|
+
}
|
|
3694
|
+
export interface ICategory extends ICoreCategory {
|
|
3695
|
+
image_url: string;
|
|
3696
|
+
/**
|
|
3697
|
+
* image file path
|
|
3698
|
+
*/
|
|
3699
|
+
image_file_path: string;
|
|
3700
|
+
/**
|
|
3701
|
+
*
|
|
3702
|
+
*/
|
|
3703
|
+
image_thumbnail_url: string;
|
|
3704
|
+
/**
|
|
3705
|
+
* image thumbnail file path
|
|
3706
|
+
*/
|
|
3707
|
+
image_thumbnail_file_path: string;
|
|
3708
|
+
/** if category has subcategory */
|
|
3709
|
+
has_subcategory: boolean;
|
|
3710
|
+
/** Printing sequence number */
|
|
3711
|
+
printing_sequence: number;
|
|
3712
|
+
/**
|
|
3713
|
+
* subcategories of the category
|
|
3714
|
+
*/
|
|
3715
|
+
subcategories: Array<ISubcategory>;
|
|
3716
|
+
}
|
|
3717
|
+
export enum CategoryType {
|
|
3718
|
+
Product = "product",
|
|
3719
|
+
Modifier = "modifier"
|
|
3720
|
+
}
|
|
3721
|
+
export class CoreCategory extends ProductBase implements ICoreCategory {
|
|
3722
|
+
type: CategoryType;
|
|
3723
|
+
visibility: Visibility[];
|
|
3724
|
+
uid: string;
|
|
3725
|
+
max_order: number;
|
|
3726
|
+
min_order: number;
|
|
3727
|
+
constructor();
|
|
3728
|
+
}
|
|
3729
|
+
export class Category extends ProductBase implements ICategory {
|
|
3730
|
+
image_url: string;
|
|
3731
|
+
image_file_path: string;
|
|
3732
|
+
image_thumbnail_url: string;
|
|
3733
|
+
image_thumbnail_file_path: string;
|
|
3734
|
+
has_subcategory: boolean;
|
|
3735
|
+
name_translations: Record<string, string>;
|
|
3736
|
+
visibility: Visibility[];
|
|
3737
|
+
printing_sequence: number;
|
|
3738
|
+
type: CategoryType;
|
|
3739
|
+
subcategories: any[];
|
|
3740
|
+
uid: string;
|
|
3741
|
+
max_order: number;
|
|
3742
|
+
min_order: number;
|
|
3743
|
+
constructor();
|
|
3744
|
+
}
|
|
3745
|
+
export interface ISubcategory extends IProductBase {
|
|
3746
|
+
/** Category ID */
|
|
3747
|
+
category_uid: string;
|
|
3748
|
+
}
|
|
3749
|
+
export class Subcategory extends ProductBase implements ISubcategory {
|
|
3750
|
+
category_uid: string;
|
|
3751
|
+
uid: string;
|
|
3752
|
+
constructor();
|
|
3753
|
+
}
|
|
3754
|
+
export enum ProductType {
|
|
3755
|
+
ByQuantity = "by_quantity",
|
|
3756
|
+
ByWeight = "by_weight",
|
|
3757
|
+
Service = "service",
|
|
3758
|
+
Combo = "combo",
|
|
3759
|
+
Modifier = "modifier",
|
|
3760
|
+
Package = "package"
|
|
3761
|
+
}
|
|
3762
|
+
/**
|
|
3763
|
+
* Interface for a core item, which extends the IProductBase interface.
|
|
3764
|
+
*/
|
|
3765
|
+
export interface ICoreItem extends IProductBase {
|
|
3766
|
+
/**
|
|
3767
|
+
* Rank of the item
|
|
3768
|
+
*/
|
|
3769
|
+
image_url: string;
|
|
3770
|
+
/**
|
|
3771
|
+
* image file path
|
|
3772
|
+
*/
|
|
3773
|
+
image_file_path: string;
|
|
3774
|
+
/**
|
|
3775
|
+
* @ignore
|
|
3776
|
+
*/
|
|
3777
|
+
image_thumbnail_url: string;
|
|
3778
|
+
/**
|
|
3779
|
+
* image thumbnail file path
|
|
3780
|
+
*/
|
|
3781
|
+
image_thumbnail_file_path: string;
|
|
3782
|
+
/**
|
|
3783
|
+
* The SKU (stock keeping unit) of the item.
|
|
3784
|
+
*/
|
|
3785
|
+
sku: string;
|
|
3786
|
+
/**
|
|
3787
|
+
* The type of product.
|
|
3788
|
+
*/
|
|
3789
|
+
type: ProductType;
|
|
3790
|
+
/**
|
|
3791
|
+
* The visibility of the item.
|
|
3792
|
+
*/
|
|
3793
|
+
visibility: Array<Visibility>;
|
|
3794
|
+
/**
|
|
3795
|
+
* The barcode of the item.
|
|
3796
|
+
*/
|
|
3797
|
+
barcode: string;
|
|
3798
|
+
/**
|
|
3799
|
+
* The price of the item.
|
|
3800
|
+
*/
|
|
3801
|
+
price: number;
|
|
3802
|
+
/**
|
|
3803
|
+
* The unique identifier of the category that the item belongs to.
|
|
3804
|
+
*/
|
|
3805
|
+
category_uid: string;
|
|
3806
|
+
/**
|
|
3807
|
+
* The current stock level of the item.
|
|
3808
|
+
* @ignore
|
|
3809
|
+
*/
|
|
3810
|
+
stock: number;
|
|
3811
|
+
/**
|
|
3812
|
+
* Whether or not the item is sold out.
|
|
3813
|
+
*/
|
|
3814
|
+
is_sold_out: boolean;
|
|
3815
|
+
/**
|
|
3816
|
+
* Whether or not the item should be printed on the receipt.
|
|
3817
|
+
*/
|
|
3818
|
+
print_on_receipt: boolean;
|
|
3819
|
+
/**
|
|
3820
|
+
* Whether or not the price of the item can be adjusted.
|
|
3821
|
+
*/
|
|
3822
|
+
price_adjustable: boolean;
|
|
3823
|
+
}
|
|
3824
|
+
export class CoreItem extends ProductBase implements ICoreItem {
|
|
3825
|
+
image_url: string;
|
|
3826
|
+
image_file_path: string;
|
|
3827
|
+
image_thumbnail_url: string;
|
|
3828
|
+
image_thumbnail_file_path: string;
|
|
3829
|
+
visibility: Visibility[];
|
|
3830
|
+
sku: string;
|
|
3831
|
+
type: ProductType;
|
|
3832
|
+
barcode: string;
|
|
3833
|
+
category_uid: string;
|
|
3834
|
+
price: number;
|
|
3835
|
+
stock: number;
|
|
3836
|
+
print_on_receipt: boolean;
|
|
3837
|
+
price_adjustable: boolean;
|
|
3838
|
+
is_sold_out: boolean;
|
|
3839
|
+
uid: string;
|
|
3840
|
+
constructor();
|
|
3841
|
+
}
|
|
3842
|
+
/**
|
|
3843
|
+
* Items
|
|
3844
|
+
*/
|
|
3845
|
+
export interface IItem extends ICoreItem {
|
|
3846
|
+
/**
|
|
3847
|
+
* Codename of the item
|
|
3848
|
+
*/
|
|
3849
|
+
codename: string;
|
|
3850
|
+
/**
|
|
3851
|
+
* Recipe of the item
|
|
3852
|
+
*/
|
|
3853
|
+
recipe: string;
|
|
3854
|
+
/**
|
|
3855
|
+
* Credit value of the item
|
|
3856
|
+
*/
|
|
3857
|
+
add_credit: number;
|
|
3858
|
+
/**
|
|
3859
|
+
* Subcategory ID of the item
|
|
3860
|
+
*/
|
|
3861
|
+
subcategory_uid: string;
|
|
3862
|
+
/**
|
|
3863
|
+
* Unit of the item
|
|
3864
|
+
* @ignore
|
|
3865
|
+
*/
|
|
3866
|
+
unit: number;
|
|
3867
|
+
/**
|
|
3868
|
+
* Number of items sold
|
|
3869
|
+
* @ignore
|
|
3870
|
+
*/
|
|
3871
|
+
sold: number;
|
|
3872
|
+
/**
|
|
3873
|
+
* if editor will be opened by default when item is clicked
|
|
3874
|
+
*/
|
|
3875
|
+
open_editor: boolean;
|
|
3876
|
+
/**
|
|
3877
|
+
* how many points will be used to purchase the item
|
|
3878
|
+
*/
|
|
3879
|
+
minus_point: number;
|
|
3880
|
+
/**
|
|
3881
|
+
* Cost of the item
|
|
3882
|
+
*/
|
|
3883
|
+
cost: number;
|
|
3884
|
+
/**
|
|
3885
|
+
* Indicates whether the item is discountable
|
|
3886
|
+
*/
|
|
3887
|
+
discountable: boolean;
|
|
3888
|
+
/**
|
|
3889
|
+
* Printing sequence of the item
|
|
3890
|
+
* @ignore
|
|
3891
|
+
*/
|
|
3892
|
+
printing_sequence: number;
|
|
3893
|
+
/**
|
|
3894
|
+
* Number of likes for the item
|
|
3895
|
+
* @ignore
|
|
3896
|
+
*/
|
|
3897
|
+
likes: number;
|
|
3898
|
+
/**
|
|
3899
|
+
* Number of dislikes for the item
|
|
3900
|
+
* @ignore
|
|
3901
|
+
*/
|
|
3902
|
+
dislikes: number;
|
|
3903
|
+
/**
|
|
3904
|
+
* if the item is recommended
|
|
3905
|
+
*/
|
|
3906
|
+
recommended: boolean;
|
|
3907
|
+
/**
|
|
3908
|
+
* Indicates whether the item is tax exempt
|
|
3909
|
+
*/
|
|
3910
|
+
is_tax_exempt: boolean;
|
|
3911
|
+
/**
|
|
3912
|
+
* Indicates whether the item is service charge exempt
|
|
3913
|
+
*/
|
|
3914
|
+
is_service_charge_exempt: boolean;
|
|
3915
|
+
/**
|
|
3916
|
+
* Indicates whether the item is point reward exempt
|
|
3917
|
+
*/
|
|
3918
|
+
is_point_reward_exempt: boolean;
|
|
3919
|
+
/**
|
|
3920
|
+
* Indicates whether the item is credit reward exempt
|
|
3921
|
+
*/
|
|
3922
|
+
is_credit_reward_exempt: boolean;
|
|
3923
|
+
/**
|
|
3924
|
+
* Indicates whether the item is internal and displayed in the POS only
|
|
3925
|
+
*/
|
|
3926
|
+
is_internal: boolean;
|
|
3927
|
+
/**
|
|
3928
|
+
* Modifier IDs of the item
|
|
3929
|
+
*/
|
|
3930
|
+
modifiers?: Array<ICoreItem>;
|
|
3931
|
+
/**
|
|
3932
|
+
* Modifier Group IDs of the item
|
|
3933
|
+
*/
|
|
3934
|
+
modifier_categories?: Array<ICoreCategory>;
|
|
3935
|
+
/**
|
|
3936
|
+
* Kitchen printer IDs of the item
|
|
3937
|
+
*/
|
|
3938
|
+
kitchen_printers_uids: Array<string>;
|
|
3939
|
+
/**
|
|
3940
|
+
* Order printer IDs of the item
|
|
3941
|
+
*/
|
|
3942
|
+
order_printers_uids: Array<string>;
|
|
3943
|
+
/**
|
|
3944
|
+
* Label printer IDs of the item
|
|
3945
|
+
*/
|
|
3946
|
+
label_printers_uids: Array<string>;
|
|
3947
|
+
/**
|
|
3948
|
+
* if editor will be opened by default when item is clicked
|
|
3949
|
+
*/
|
|
3950
|
+
open_editor_panel: boolean;
|
|
3951
|
+
/**
|
|
3952
|
+
* if price editor will be opened by default when item is clicked
|
|
3953
|
+
*/
|
|
3954
|
+
open_price_editor: boolean;
|
|
3955
|
+
}
|
|
3956
|
+
export class Item extends ProductBase implements IItem {
|
|
3957
|
+
image_url: string;
|
|
3958
|
+
image_file_path: string;
|
|
3959
|
+
image_thumbnail_url: string;
|
|
3960
|
+
image_thumbnail_file_path: string;
|
|
3961
|
+
visibility: Visibility[];
|
|
3962
|
+
codename: string;
|
|
3963
|
+
sku: string;
|
|
3964
|
+
recipe: string;
|
|
3965
|
+
barcode: string;
|
|
3966
|
+
type: ProductType;
|
|
3967
|
+
add_credit: number;
|
|
3968
|
+
category_uid: string;
|
|
3969
|
+
subcategory_uid: string;
|
|
3970
|
+
unit: number;
|
|
3971
|
+
stock: number;
|
|
3972
|
+
is_sold_out: boolean;
|
|
3973
|
+
sold: number;
|
|
3974
|
+
print_on_receipt: boolean;
|
|
3975
|
+
price: number;
|
|
3976
|
+
open_editor: boolean;
|
|
3977
|
+
price_adjustable: boolean;
|
|
3978
|
+
minus_point: number;
|
|
3979
|
+
cost: number;
|
|
3980
|
+
discountable: boolean;
|
|
3981
|
+
printing_sequence: number;
|
|
3982
|
+
recommended: boolean;
|
|
3983
|
+
likes: number;
|
|
3984
|
+
dislikes: number;
|
|
3985
|
+
is_tax_exempt: boolean;
|
|
3986
|
+
is_service_charge_exempt: boolean;
|
|
3987
|
+
is_point_reward_exempt: boolean;
|
|
3988
|
+
is_credit_reward_exempt: boolean;
|
|
3989
|
+
is_internal: boolean;
|
|
3990
|
+
uid: string;
|
|
3991
|
+
kitchen_printers_uids: any[];
|
|
3992
|
+
order_printers_uids: any[];
|
|
3993
|
+
label_printers_uids: any[];
|
|
3994
|
+
open_editor_panel: boolean;
|
|
3995
|
+
open_price_editor: boolean;
|
|
3996
|
+
constructor();
|
|
3997
|
+
}
|
|
3998
|
+
export interface IPrice extends IAppCoreModel {
|
|
3999
|
+
/** keys to look up the price */
|
|
4000
|
+
lookup_keys: Array<string>;
|
|
4001
|
+
/** product uid*/
|
|
4002
|
+
product_uid: string;
|
|
4003
|
+
/** price of the item */
|
|
4004
|
+
amount: number;
|
|
4005
|
+
}
|
|
4006
|
+
export class Price extends AppCoreModel implements IPrice {
|
|
4007
|
+
lookup_keys: any[];
|
|
4008
|
+
product_uid: string;
|
|
4009
|
+
amount: any;
|
|
4010
|
+
constructor();
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
}
|
|
4014
|
+
declare module '@posx/core/types/report.type' {
|
|
4015
|
+
import { IAppBase, IAppCoreModel, AppCoreModel } from '@posx/core/types/abstract.type';
|
|
4016
|
+
import { IConfig } from '@posx/core/types/config.type';
|
|
4017
|
+
export type IReportCategory = IAppBase & {
|
|
4018
|
+
reports: IReport[];
|
|
4019
|
+
};
|
|
4020
|
+
export type IReport = IAppBase & {
|
|
4021
|
+
type: ReportType;
|
|
4022
|
+
codename: string;
|
|
4023
|
+
};
|
|
4024
|
+
export enum ReportType {
|
|
4025
|
+
'printable' = 0,
|
|
4026
|
+
'generative' = 1
|
|
4027
|
+
}
|
|
4028
|
+
export class ReportCategory implements IReportCategory {
|
|
4029
|
+
uid: string;
|
|
4030
|
+
name: string;
|
|
4031
|
+
name_translations: Record<string, string>;
|
|
4032
|
+
reports: Report[];
|
|
4033
|
+
created_at: Date;
|
|
4034
|
+
created_at_timestamp: number;
|
|
4035
|
+
updated_at: Date;
|
|
4036
|
+
deleted_at: any;
|
|
4037
|
+
constructor();
|
|
4038
|
+
}
|
|
4039
|
+
export class Report implements IReport {
|
|
4040
|
+
uid: string;
|
|
4041
|
+
name: string;
|
|
4042
|
+
name_translations: Record<string, string>;
|
|
4043
|
+
type: ReportType.printable;
|
|
4044
|
+
codename: string;
|
|
4045
|
+
created_at: Date;
|
|
4046
|
+
created_at_timestamp: number;
|
|
4047
|
+
updated_at: Date;
|
|
4048
|
+
deleted_at: any;
|
|
4049
|
+
constructor();
|
|
4050
|
+
}
|
|
4051
|
+
export interface IAppReport extends IAppCoreModel {
|
|
4052
|
+
reports: IReportCategory[];
|
|
4053
|
+
version: number;
|
|
4054
|
+
}
|
|
4055
|
+
export class AppReport extends AppCoreModel implements IAppReport {
|
|
4056
|
+
uid: string;
|
|
4057
|
+
reports: ReportCategory[];
|
|
4058
|
+
version: number;
|
|
4059
|
+
constructor();
|
|
4060
|
+
}
|
|
4061
|
+
export type IReportRequest = {
|
|
4062
|
+
/**
|
|
4063
|
+
* shift uid (if shift uid is provided, start and end date time will be ignored, and the report will be generated for the shift period.)
|
|
4064
|
+
*/
|
|
4065
|
+
shift_uid: string;
|
|
4066
|
+
/**
|
|
4067
|
+
* start date and time
|
|
4068
|
+
*/
|
|
4069
|
+
start_datetime: Date;
|
|
4070
|
+
/**
|
|
4071
|
+
* end date and time
|
|
4072
|
+
*/
|
|
4073
|
+
end_datetime: Date;
|
|
4074
|
+
/**
|
|
4075
|
+
* report code name
|
|
4076
|
+
*/
|
|
4077
|
+
report_code_name: string;
|
|
4078
|
+
/**
|
|
4079
|
+
* number of copies, default is 1
|
|
4080
|
+
*/
|
|
4081
|
+
copies: number;
|
|
4082
|
+
declared_amount: number;
|
|
4083
|
+
};
|
|
4084
|
+
export type IReportData = {
|
|
4085
|
+
start_datetime: string;
|
|
4086
|
+
humanized_start_datetime: string;
|
|
4087
|
+
end_datetime: string;
|
|
4088
|
+
humanized_end_datetime: string;
|
|
4089
|
+
sales_summary: ISalesSummary;
|
|
4090
|
+
drawer_summary: IDrawerSummary;
|
|
4091
|
+
payments_summary: IPaymentSummary[];
|
|
4092
|
+
loyalty_program_summary: ILoyaltyProgramSummary;
|
|
4093
|
+
config: IConfig;
|
|
4094
|
+
};
|
|
4095
|
+
export class ReportData implements IReportData {
|
|
4096
|
+
start_datetime: string;
|
|
4097
|
+
humanized_start_datetime: string;
|
|
4098
|
+
end_datetime: string;
|
|
4099
|
+
humanized_end_datetime: string;
|
|
4100
|
+
sales_summary: SalesSummary;
|
|
4101
|
+
drawer_summary: DrawerSummary;
|
|
4102
|
+
payments_summary: PaymentSummary[];
|
|
4103
|
+
loyalty_program_summary: LoyaltyProgramSummary;
|
|
4104
|
+
config: IConfig;
|
|
4105
|
+
}
|
|
4106
|
+
export type ISalesSummary = {
|
|
4107
|
+
sales_total: number;
|
|
4108
|
+
foc_sales_total: number;
|
|
4109
|
+
foc_sales_count: number;
|
|
4110
|
+
rounding_total: number;
|
|
4111
|
+
tax_total: number;
|
|
4112
|
+
service_charge_total: number;
|
|
4113
|
+
discount_total: number;
|
|
4114
|
+
voucher_total: number;
|
|
4115
|
+
voucher_count: number;
|
|
4116
|
+
coupon_total: number;
|
|
4117
|
+
coupon_count: number;
|
|
4118
|
+
paid_invoice_count: number;
|
|
4119
|
+
paid_invoice_total: number;
|
|
4120
|
+
void_invoice_count: number;
|
|
4121
|
+
void_invoice_total: number;
|
|
4122
|
+
total_pax: number;
|
|
4123
|
+
};
|
|
4124
|
+
export class SalesSummary implements ISalesSummary {
|
|
4125
|
+
sales_total: number;
|
|
4126
|
+
foc_sales_total: number;
|
|
4127
|
+
foc_sales_count: number;
|
|
4128
|
+
rounding_total: number;
|
|
4129
|
+
tax_total: number;
|
|
4130
|
+
service_charge_total: number;
|
|
4131
|
+
discount_total: number;
|
|
4132
|
+
voucher_total: number;
|
|
4133
|
+
voucher_count: number;
|
|
4134
|
+
coupon_total: number;
|
|
4135
|
+
coupon_count: number;
|
|
4136
|
+
paid_invoice_count: number;
|
|
4137
|
+
paid_invoice_total: number;
|
|
4138
|
+
void_invoice_count: number;
|
|
4139
|
+
void_invoice_total: number;
|
|
4140
|
+
total_pax: number;
|
|
4141
|
+
}
|
|
4142
|
+
export type IDrawerSummary = {
|
|
4143
|
+
open_amount: number;
|
|
4144
|
+
declared_amount: number;
|
|
4145
|
+
drawer_amount: number;
|
|
4146
|
+
difference: number;
|
|
4147
|
+
pay_in_total: number;
|
|
4148
|
+
pay_in_count: number;
|
|
4149
|
+
pay_out_total: number;
|
|
4150
|
+
pay_out_count: number;
|
|
4151
|
+
};
|
|
4152
|
+
export class DrawerSummary implements IDrawerSummary {
|
|
4153
|
+
open_amount: number;
|
|
4154
|
+
declared_amount: number;
|
|
4155
|
+
drawer_amount: number;
|
|
4156
|
+
difference: number;
|
|
4157
|
+
pay_in_total: number;
|
|
4158
|
+
pay_in_count: number;
|
|
4159
|
+
cash_invoice_total: number;
|
|
4160
|
+
cash_invoice_count: number;
|
|
4161
|
+
pay_out_total: number;
|
|
4162
|
+
pay_out_count: number;
|
|
4163
|
+
}
|
|
4164
|
+
export type IPaymentSummary = {
|
|
4165
|
+
code: string;
|
|
4166
|
+
name: string;
|
|
4167
|
+
total: number;
|
|
4168
|
+
count: number;
|
|
4169
|
+
};
|
|
4170
|
+
export class PaymentSummary implements IPaymentSummary {
|
|
4171
|
+
code: string;
|
|
4172
|
+
name: string;
|
|
4173
|
+
total: number;
|
|
4174
|
+
count: number;
|
|
4175
|
+
}
|
|
4176
|
+
export type ILoyaltyProgramSummary = {
|
|
4177
|
+
add_credit_total: number;
|
|
4178
|
+
add_credit_count: number;
|
|
4179
|
+
rewarded_credit_total: number;
|
|
4180
|
+
rewarded_credit_count: number;
|
|
4181
|
+
minus_credit_total: number;
|
|
4182
|
+
minus_credit_count: number;
|
|
4183
|
+
rewarded_point_total: number;
|
|
4184
|
+
rewarded_point_count: number;
|
|
4185
|
+
minus_point_total: number;
|
|
4186
|
+
minus_point_count: number;
|
|
4187
|
+
};
|
|
4188
|
+
export class LoyaltyProgramSummary implements ILoyaltyProgramSummary {
|
|
4189
|
+
add_credit_total: number;
|
|
4190
|
+
add_credit_count: number;
|
|
4191
|
+
rewarded_credit_total: number;
|
|
4192
|
+
rewarded_credit_count: number;
|
|
4193
|
+
minus_credit_total: number;
|
|
4194
|
+
minus_credit_count: number;
|
|
4195
|
+
rewarded_point_total: number;
|
|
4196
|
+
rewarded_point_count: number;
|
|
4197
|
+
minus_point_total: number;
|
|
4198
|
+
minus_point_count: number;
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4201
|
+
}
|
|
4202
|
+
declare module '@posx/core/types/request.type' {
|
|
4203
|
+
export interface IFileUploadRequest {
|
|
4204
|
+
name: string;
|
|
4205
|
+
base64: string;
|
|
4206
|
+
extension: string;
|
|
4207
|
+
}
|
|
4208
|
+
export class FileUploadRequest implements IFileUploadRequest {
|
|
4209
|
+
name: string;
|
|
4210
|
+
base64: string;
|
|
4211
|
+
extension: string;
|
|
4212
|
+
constructor(init?: Partial<IFileUploadRequest>);
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
}
|
|
4216
|
+
declare module '@posx/core/types/role.type' {
|
|
4217
|
+
import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
|
|
4218
|
+
export interface IEmployeeRole extends IAppBaseModel {
|
|
4219
|
+
permissions: string[];
|
|
4220
|
+
is_default: boolean;
|
|
4221
|
+
}
|
|
4222
|
+
export class EmployeeRole extends AppBaseModel implements IEmployeeRole {
|
|
4223
|
+
permissions: string[];
|
|
4224
|
+
is_default: boolean;
|
|
4225
|
+
uid: string;
|
|
4226
|
+
constructor();
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
}
|
|
4230
|
+
declare module '@posx/core/types/section.type' {
|
|
4231
|
+
import { IAppModelSequence } from '@posx/core/services/abstract.service';
|
|
4232
|
+
import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
|
|
4233
|
+
export enum SectionItemStatus {
|
|
4234
|
+
CLOSED = "closed",
|
|
4235
|
+
OPENED = "opened",
|
|
4236
|
+
PAYMENT = "payment"
|
|
4237
|
+
}
|
|
4238
|
+
export interface ISectionItem extends IAppBaseModel {
|
|
4239
|
+
/** List of printer ID order */
|
|
4240
|
+
printer_id_order_list: number[];
|
|
4241
|
+
/** Total amount */
|
|
4242
|
+
total: number;
|
|
4243
|
+
/** Time duration */
|
|
4244
|
+
time: number;
|
|
4245
|
+
/** Number of persons */
|
|
4246
|
+
pax: number;
|
|
4247
|
+
/** Invoice created timestamp */
|
|
4248
|
+
invoice_created_at: string;
|
|
4249
|
+
/** Number of child persons */
|
|
4250
|
+
child_pax: number;
|
|
4251
|
+
/** Number of baby persons */
|
|
4252
|
+
baby_pax: number;
|
|
4253
|
+
/** Invoice ID */
|
|
4254
|
+
invoice_uid: string;
|
|
4255
|
+
/** Section ID */
|
|
4256
|
+
section_uid: string;
|
|
4257
|
+
/** Table status */
|
|
4258
|
+
status: SectionItemStatus;
|
|
4259
|
+
/** Table size in X direction */
|
|
4260
|
+
size_x: number;
|
|
4261
|
+
/** Table size in Y direction */
|
|
4262
|
+
size_y: number;
|
|
4263
|
+
/** Table x axis */
|
|
4264
|
+
row: number;
|
|
4265
|
+
/** Table y axis */
|
|
4266
|
+
col: number;
|
|
4267
|
+
/** Flag for take out */
|
|
4268
|
+
is_take_out: boolean;
|
|
4269
|
+
/** Soup base quota */
|
|
4270
|
+
soup_base_quota: number;
|
|
4271
|
+
/** Soup base type */
|
|
4272
|
+
soup_base_type: number;
|
|
4273
|
+
}
|
|
4274
|
+
export class SectionItem extends AppBaseModel implements ISectionItem {
|
|
4275
|
+
printer_id_order_list: number[];
|
|
4276
|
+
total: number;
|
|
4277
|
+
time: number;
|
|
4278
|
+
pax: number;
|
|
4279
|
+
invoice_created_at: string;
|
|
4280
|
+
child_pax: number;
|
|
4281
|
+
baby_pax: number;
|
|
4282
|
+
uid: string;
|
|
4283
|
+
invoice_uid: string;
|
|
4284
|
+
section_uid: string;
|
|
4285
|
+
status: SectionItemStatus;
|
|
4286
|
+
size_x: number;
|
|
4287
|
+
size_y: number;
|
|
4288
|
+
row: number;
|
|
4289
|
+
col: number;
|
|
4290
|
+
is_take_out: boolean;
|
|
4291
|
+
soup_base_quota: number;
|
|
4292
|
+
soup_base_type: number;
|
|
4293
|
+
is_delete: boolean;
|
|
4294
|
+
constructor();
|
|
4295
|
+
}
|
|
4296
|
+
export type ISection = IAppBaseModel & IAppModelSequence;
|
|
4297
|
+
export class Section extends AppBaseModel implements ISection {
|
|
4298
|
+
sequence: number;
|
|
4299
|
+
uid: string;
|
|
4300
|
+
constructor();
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
}
|
|
4304
|
+
declare module '@posx/core/types/shift.type' {
|
|
4305
|
+
import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
4306
|
+
export enum ShiftStatus {
|
|
4307
|
+
Open = "opened",
|
|
4308
|
+
Closed = "closed"
|
|
4309
|
+
}
|
|
4310
|
+
export interface IShift extends IAppCoreModel {
|
|
4311
|
+
/** user uid */
|
|
4312
|
+
user_uid: string;
|
|
4313
|
+
/** shift started at */
|
|
4314
|
+
started_at: Date;
|
|
4315
|
+
/** shift closed at */
|
|
4316
|
+
ended_at: Date;
|
|
4317
|
+
/** amount declared by user */
|
|
4318
|
+
declared_amount: number;
|
|
4319
|
+
/** amount recorded by */
|
|
4320
|
+
drawer_amount: number;
|
|
4321
|
+
/** Operation Status */
|
|
4322
|
+
status: ShiftStatus;
|
|
4323
|
+
/** first invoice number */
|
|
4324
|
+
first_invoice_number: number;
|
|
4325
|
+
}
|
|
4326
|
+
export class Shift extends AppCoreModel implements IShift {
|
|
4327
|
+
user_uid: string;
|
|
4328
|
+
started_at: Date;
|
|
4329
|
+
ended_at: Date;
|
|
4330
|
+
declared_amount: number;
|
|
4331
|
+
drawer_amount: number;
|
|
4332
|
+
first_invoice_number: number;
|
|
4333
|
+
status: ShiftStatus;
|
|
4334
|
+
uid: string;
|
|
4335
|
+
constructor();
|
|
4336
|
+
}
|
|
4337
|
+
export enum TillType {
|
|
4338
|
+
OpenDeposit = "open_deposit",
|
|
4339
|
+
CashDeposit = "cash_deposit",
|
|
4340
|
+
CashIn = "cash_in",
|
|
4341
|
+
CashOut = "cash_out",
|
|
4342
|
+
CashInvoice = "cash_invoice"
|
|
4343
|
+
}
|
|
4344
|
+
export interface ITill extends AppCoreModel {
|
|
4345
|
+
/** user uid */
|
|
4346
|
+
user_uid: string;
|
|
4347
|
+
/** operation history id */
|
|
4348
|
+
shift_uid: string;
|
|
4349
|
+
/** invoice uid */
|
|
4350
|
+
invoice_uid: string;
|
|
4351
|
+
/** Till Type */
|
|
4352
|
+
type: TillType;
|
|
4353
|
+
/** Amount */
|
|
4354
|
+
amount: number;
|
|
4355
|
+
/** Note */
|
|
4356
|
+
note: string;
|
|
4357
|
+
}
|
|
4358
|
+
export class Till extends AppCoreModel implements ITill {
|
|
4359
|
+
user_uid: string;
|
|
4360
|
+
shift_uid: string;
|
|
4361
|
+
invoice_uid: string;
|
|
4362
|
+
type: TillType;
|
|
4363
|
+
amount: number;
|
|
4364
|
+
note: string;
|
|
4365
|
+
uid: string;
|
|
4366
|
+
constructor();
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4369
|
+
}
|
|
4370
|
+
declare module '@posx/core/types/wyo.coupon.type' {
|
|
4371
|
+
enum ApplyingType {
|
|
4372
|
+
All = 1,
|
|
4373
|
+
Inclusive = 2,
|
|
4374
|
+
Exclusive = 3
|
|
4375
|
+
}
|
|
4376
|
+
enum CalcType {
|
|
4377
|
+
Flat = 1,
|
|
4378
|
+
Percent = 2
|
|
4379
|
+
}
|
|
4380
|
+
export interface IApplying<T> {
|
|
4381
|
+
applyingType: ApplyingType;
|
|
4382
|
+
applyingItems: T[];
|
|
4383
|
+
}
|
|
4384
|
+
export interface ICoupon {
|
|
4385
|
+
/** Coupon guid */
|
|
4386
|
+
guid: string;
|
|
4387
|
+
/** Promotion code which is used to look up the coupon */
|
|
4388
|
+
promo_code: string;
|
|
4389
|
+
/** If this coupon can be used for multiple stores */
|
|
4390
|
+
is_multi_stores?: boolean;
|
|
4391
|
+
/** Coupon primary name */
|
|
4392
|
+
name: string;
|
|
4393
|
+
/** Coupon alias */
|
|
4394
|
+
alias?: string;
|
|
4395
|
+
/** Coupon primary description */
|
|
4396
|
+
description?: string;
|
|
4397
|
+
/** Coupon alias description */
|
|
4398
|
+
description_alias?: string;
|
|
4399
|
+
/** Applying PLUs (Price Lookup Code) */
|
|
4400
|
+
applying_plus: IApplying<string>;
|
|
4401
|
+
/** Applying User Tags */
|
|
4402
|
+
applying_user_tags: IApplying<string>;
|
|
4403
|
+
/** Applying User Groups */
|
|
4404
|
+
applying_user_groups: IApplying<number>;
|
|
4405
|
+
/** Discount Calculation Type */
|
|
4406
|
+
discount_calc_type: CalcType;
|
|
4407
|
+
/** Flat discount amount */
|
|
4408
|
+
discount_amount?: number;
|
|
4409
|
+
/** Percent discount (e.g. 30% => 0.3) */
|
|
4410
|
+
discount_percent?: number;
|
|
4411
|
+
/** Expiring duration in day after coupon is purchased */
|
|
4412
|
+
duration?: number;
|
|
4413
|
+
/** How many of this coupon has been redeemed */
|
|
4414
|
+
usage_count: number;
|
|
4415
|
+
/** How many of this coupon can be redeemed within an invoice */
|
|
4416
|
+
usage_limit_per_invoice?: number;
|
|
4417
|
+
/** Only above a specified invoice total before this coupon can be redeemed */
|
|
4418
|
+
above_invoice_amount?: number;
|
|
4419
|
+
/** Only below a specified invoice total before this coupon can be redeemed */
|
|
4420
|
+
below_invoice_amount?: number;
|
|
4421
|
+
/** Can this coupon be used to offset delivery fee */
|
|
4422
|
+
is_delivery_free?: boolean;
|
|
4423
|
+
/** If this coupon can only be used individually without stacking other coupons together */
|
|
4424
|
+
is_individual_use?: boolean;
|
|
4425
|
+
/** The amount of points to redeem this coupon */
|
|
4426
|
+
price_in_points?: number;
|
|
4427
|
+
/** Styles of the coupon */
|
|
4428
|
+
styles?: Record<string, string>;
|
|
4429
|
+
/** When this coupon will be expired */
|
|
4430
|
+
expired_at?: Date;
|
|
4431
|
+
/** If auto generation is true, the coupon will be automatically generated for all applicable users */
|
|
4432
|
+
auto_gen?: boolean;
|
|
4433
|
+
/** If this coupon has been disabled for purchasing */
|
|
4434
|
+
can_sell?: boolean;
|
|
4435
|
+
/** If this coupon has been disabled for redemption */
|
|
4436
|
+
can_redeem?: boolean;
|
|
4437
|
+
}
|
|
4438
|
+
export class Coupon implements ICoupon {
|
|
4439
|
+
guid: string;
|
|
4440
|
+
promo_code: string;
|
|
4441
|
+
is_multi_stores: boolean;
|
|
4442
|
+
name: string;
|
|
4443
|
+
alias?: string;
|
|
4444
|
+
description?: string;
|
|
4445
|
+
description_alias?: string;
|
|
4446
|
+
applying_plus: IApplying<string>;
|
|
4447
|
+
applying_user_tags: IApplying<string>;
|
|
4448
|
+
applying_user_groups: IApplying<number>;
|
|
4449
|
+
discount_calc_type: CalcType;
|
|
4450
|
+
discount_amount?: number;
|
|
4451
|
+
discount_percent?: number;
|
|
4452
|
+
duration: number;
|
|
4453
|
+
usage_count: number;
|
|
4454
|
+
usage_limit_per_invoice: number;
|
|
4455
|
+
above_invoice_amount?: number;
|
|
4456
|
+
below_invoice_amount?: number;
|
|
4457
|
+
is_delivery_free: boolean;
|
|
4458
|
+
is_individual_use: boolean;
|
|
4459
|
+
price_in_points?: number;
|
|
4460
|
+
styles: Record<string, string>;
|
|
4461
|
+
expired_at?: Date;
|
|
4462
|
+
auto_gen: boolean;
|
|
4463
|
+
can_sell: boolean;
|
|
4464
|
+
can_redeem: boolean;
|
|
4465
|
+
constructor(couponToClone?: Coupon);
|
|
4466
|
+
}
|
|
4467
|
+
export interface ICouponUsage {
|
|
4468
|
+
invoice_uid: string;
|
|
4469
|
+
}
|
|
4470
|
+
export class CouponUsage implements ICouponUsage {
|
|
4471
|
+
invoice_uid: string;
|
|
4472
|
+
constructor(couponUsageToClone?: CouponUsage);
|
|
4473
|
+
}
|
|
4474
|
+
export interface ICouponItemized {
|
|
4475
|
+
/** Coupon itemized guid */
|
|
4476
|
+
guid: string;
|
|
4477
|
+
/** A snapshot of coupon at the time of purchase */
|
|
4478
|
+
coupon: ICoupon;
|
|
4479
|
+
/** If this coupon can be used for multiple stores, default: false */
|
|
4480
|
+
is_multi_stores?: boolean;
|
|
4481
|
+
/** Coupon usage record if it is redeemed */
|
|
4482
|
+
usage: ICouponUsage;
|
|
4483
|
+
/** Employee unique id */
|
|
4484
|
+
employee_uid: string;
|
|
4485
|
+
/** Promotion code which is used to look up the coupon */
|
|
4486
|
+
promo_code: string;
|
|
4487
|
+
/** If coupons are expired */
|
|
4488
|
+
is_expired: boolean;
|
|
4489
|
+
/** If the coupons are fully redeemed */
|
|
4490
|
+
is_redeemed: boolean;
|
|
4491
|
+
/** If the coupon is generated instead of purchase */
|
|
4492
|
+
is_generated: boolean;
|
|
4493
|
+
}
|
|
4494
|
+
export class CouponItemized implements ICouponItemized {
|
|
4495
|
+
guid: string;
|
|
4496
|
+
coupon: Coupon;
|
|
4497
|
+
is_multi_stores?: boolean;
|
|
4498
|
+
usage: CouponUsage;
|
|
4499
|
+
employee_uid: string;
|
|
4500
|
+
promo_code: string;
|
|
4501
|
+
is_expired: boolean;
|
|
4502
|
+
is_redeemed: boolean;
|
|
4503
|
+
is_generated: boolean;
|
|
4504
|
+
constructor(itemized?: CouponItemized);
|
|
4505
|
+
}
|
|
4506
|
+
export {};
|
|
4507
|
+
|
|
4508
|
+
}
|
|
4509
|
+
declare module '@posx/core/types/wyo.customer.type' {
|
|
4510
|
+
export interface IAddress {
|
|
4511
|
+
/** Address line 1 */
|
|
4512
|
+
address1: string;
|
|
4513
|
+
/** Address line 2 */
|
|
4514
|
+
address2: string;
|
|
4515
|
+
/** Latitude coordinate */
|
|
4516
|
+
lat: string;
|
|
4517
|
+
/** Longitude coordinate */
|
|
4518
|
+
lng: string;
|
|
4519
|
+
/** Postal code */
|
|
4520
|
+
postcode: string;
|
|
4521
|
+
/** Note associated with the address */
|
|
4522
|
+
note: string;
|
|
4523
|
+
/** Indicates if the address is the default one */
|
|
4524
|
+
is_default: boolean;
|
|
4525
|
+
/** Name associated with the address */
|
|
4526
|
+
name: string;
|
|
4527
|
+
/** Salutation associated with the address */
|
|
4528
|
+
salute: string;
|
|
4529
|
+
/** Phone number associated with the address */
|
|
4530
|
+
phone_number: string;
|
|
4531
|
+
}
|
|
4532
|
+
/**
|
|
4533
|
+
* Class representing the Address model.
|
|
4534
|
+
*/
|
|
4535
|
+
export class Address implements IAddress {
|
|
4536
|
+
address1: string;
|
|
4537
|
+
address2: string;
|
|
4538
|
+
lat: string;
|
|
4539
|
+
lng: string;
|
|
4540
|
+
postcode: string;
|
|
4541
|
+
note: string;
|
|
4542
|
+
is_default: boolean;
|
|
4543
|
+
name: string;
|
|
4544
|
+
salute: string;
|
|
4545
|
+
phone_number: string;
|
|
4546
|
+
constructor();
|
|
4547
|
+
}
|
|
4548
|
+
export interface IUser {
|
|
4549
|
+
id: number;
|
|
4550
|
+
/** Reference ID */
|
|
4551
|
+
ref_id: string;
|
|
4552
|
+
/** Image URL */
|
|
4553
|
+
image_url: string;
|
|
4554
|
+
/** Stripe Token */
|
|
4555
|
+
stripe_token: string;
|
|
4556
|
+
/** Stripe Customer ID */
|
|
4557
|
+
stripe_customer_id: string;
|
|
4558
|
+
/** User Name */
|
|
4559
|
+
username: string;
|
|
4560
|
+
/** Normalized User Name */
|
|
4561
|
+
normalized_username: string;
|
|
4562
|
+
/** Company */
|
|
4563
|
+
company: string;
|
|
4564
|
+
/** Identification Card */
|
|
4565
|
+
ic: string;
|
|
4566
|
+
/** Display Name */
|
|
4567
|
+
display_name: string;
|
|
4568
|
+
/** Full Name */
|
|
4569
|
+
full_name: string;
|
|
4570
|
+
/** Birth Date */
|
|
4571
|
+
birth_date: string;
|
|
4572
|
+
/** Gender */
|
|
4573
|
+
gender: string;
|
|
4574
|
+
/** Address */
|
|
4575
|
+
address: string;
|
|
4576
|
+
/** Postcode */
|
|
4577
|
+
postcode: string;
|
|
4578
|
+
/** Note */
|
|
4579
|
+
note: string;
|
|
4580
|
+
/** Language */
|
|
4581
|
+
language: string;
|
|
4582
|
+
/** Time Zone */
|
|
4583
|
+
time_zone: string;
|
|
4584
|
+
/** Created At */
|
|
4585
|
+
created_at: Date;
|
|
4586
|
+
/** Updated At */
|
|
4587
|
+
updated_at: Date;
|
|
4588
|
+
/** License IDs */
|
|
4589
|
+
license_ids: string;
|
|
4590
|
+
/** Security Stamp */
|
|
4591
|
+
security_stamp: string;
|
|
4592
|
+
/** Phone Number */
|
|
4593
|
+
phone_number: string;
|
|
4594
|
+
}
|
|
4595
|
+
export class User implements IUser {
|
|
4596
|
+
id: number;
|
|
4597
|
+
ref_id: string;
|
|
4598
|
+
image_url: string;
|
|
4599
|
+
stripe_token: string;
|
|
4600
|
+
stripe_customer_id: string;
|
|
4601
|
+
username: string;
|
|
4602
|
+
normalized_username: string;
|
|
4603
|
+
company: string;
|
|
4604
|
+
ic: string;
|
|
4605
|
+
display_name: string;
|
|
4606
|
+
full_name: string;
|
|
4607
|
+
birth_date: string;
|
|
4608
|
+
gender: string;
|
|
4609
|
+
address: string;
|
|
4610
|
+
postcode: string;
|
|
4611
|
+
note: string;
|
|
4612
|
+
language: string;
|
|
4613
|
+
time_zone: string;
|
|
4614
|
+
created_at: Date;
|
|
4615
|
+
updated_at: Date;
|
|
4616
|
+
license_ids: string;
|
|
4617
|
+
security_stamp: string;
|
|
4618
|
+
phone_number: string;
|
|
4619
|
+
constructor();
|
|
4620
|
+
}
|
|
4621
|
+
export interface ICustomer extends IUser {
|
|
4622
|
+
/** License ID */
|
|
4623
|
+
license_id: number;
|
|
4624
|
+
/** Credit */
|
|
4625
|
+
credit: number;
|
|
4626
|
+
/** Point */
|
|
4627
|
+
point: number;
|
|
4628
|
+
/** Transaction Total */
|
|
4629
|
+
transaction_total: number;
|
|
4630
|
+
/** Transaction Time */
|
|
4631
|
+
transaction_time: number;
|
|
4632
|
+
/** User Group ID */
|
|
4633
|
+
user_group_id: number;
|
|
4634
|
+
/** User Group Name */
|
|
4635
|
+
user_group_name: string;
|
|
4636
|
+
/** Group Expires At */
|
|
4637
|
+
group_expires_at: Date | null;
|
|
4638
|
+
/** Error */
|
|
4639
|
+
error: string;
|
|
4640
|
+
}
|
|
4641
|
+
export class Customer extends User implements ICustomer {
|
|
4642
|
+
license_id: number;
|
|
4643
|
+
credit: number;
|
|
4644
|
+
point: number;
|
|
4645
|
+
transaction_total: number;
|
|
4646
|
+
transaction_time: number;
|
|
4647
|
+
user_group_id: number;
|
|
4648
|
+
user_group_name: string;
|
|
4649
|
+
group_expires_at: Date | null;
|
|
4650
|
+
error: string;
|
|
4651
|
+
constructor();
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4654
|
+
}
|
|
4655
|
+
declare module '@posx/core/utils/autoquery.utils' {
|
|
4656
|
+
import { Operator, OperatorValueMap, SortOrder } from '@posx/core/types/auto.query.type';
|
|
4657
|
+
export class QueryBuilder<T> {
|
|
4658
|
+
private params;
|
|
4659
|
+
addParam<K extends keyof T, O extends Operator<T[K]>>(property: K, operator: O, value: OperatorValueMap[O]): this;
|
|
4660
|
+
addRawParam(key: string, value: string): this;
|
|
4661
|
+
includeTotal(flag: boolean): this;
|
|
4662
|
+
skip(skip: number): this;
|
|
4663
|
+
take(take: number): this;
|
|
4664
|
+
sortBy<K extends keyof T>(property: K, orderBy: SortOrder): this;
|
|
4665
|
+
jsconfig(param: string): this;
|
|
4666
|
+
/** @internal */
|
|
4667
|
+
_build(): Record<string, string>;
|
|
4668
|
+
}
|
|
4669
|
+
export type QueryEtcParams = {
|
|
4670
|
+
search_keywords: string | undefined;
|
|
4671
|
+
};
|
|
4672
|
+
|
|
4673
|
+
}
|
|
4674
|
+
declare module '@posx/core/utils/http.utils' {
|
|
4675
|
+
/**
|
|
4676
|
+
* create a new instance of axios
|
|
4677
|
+
* @param baseURL
|
|
4678
|
+
* @param key
|
|
4679
|
+
* @param uid
|
|
4680
|
+
* @param token
|
|
4681
|
+
* @returns
|
|
4682
|
+
*/
|
|
4683
|
+
export function createInstance(baseURL: string, uid: string, token: string): import("axios").AxiosInstance;
|
|
4684
|
+
|
|
4685
|
+
}
|
|
4686
|
+
declare module '@posx/core/utils/misc.utils' {
|
|
4687
|
+
export function humanizedData(date: Date): string;
|
|
4688
|
+
export function normalizedDate(date: Date): string;
|
|
4689
|
+
|
|
4690
|
+
}
|
|
4691
|
+
declare module '@posx/core/utils/obj.utils' {
|
|
4692
|
+
export function nameOf<T>(nameExtractor: (obj: T) => any): string;
|
|
4693
|
+
|
|
4694
|
+
}
|
|
4695
|
+
declare module '@posx/core' {
|
|
4696
|
+
import main = require('@posx/core/index');
|
|
4697
|
+
export = main;
|
|
4698
|
+
}
|