@posx/core 5.5.38 → 5.5.41

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 DELETED
@@ -1,4693 +0,0 @@
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/FindOptions' {
37
- export const Include: (query?: string) => (val: any) => any;
38
- export const In: (query?: never[]) => (val: never) => boolean;
39
- export const Between: (begin: number, end: number) => (val: number) => boolean;
40
- export const Not: (query?: any) => (val: any, values: any) => boolean;
41
- export const Raw: (fn: any) => any;
42
- export const filterByParams: (params: {
43
- [key: string]: any;
44
- }) => (values: any) => boolean;
45
-
46
- }
47
- declare module '@posx/core/libs/electron.socket' {
48
- export class ElectronSocket {
49
- static State: {
50
- CLOSED: number;
51
- OPENING: number;
52
- OPENED: number;
53
- CLOSING: number;
54
- };
55
- private _state;
56
- private cleanup?;
57
- onData: ((data: Uint8Array) => void) | null;
58
- onClose: ((hadError: boolean) => void) | null;
59
- onError: ((error: string) => void) | null;
60
- get state(): number;
61
- static electronSocket: any;
62
- static setWindow(win: {
63
- electronSocket: typeof window.electronSocket;
64
- }): void;
65
- private setupListeners;
66
- open(host: string, port: number, success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
67
- write(data: Uint8Array, success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
68
- close(success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
69
- }
70
-
71
- }
72
- declare module '@posx/core/libs/escpos.printer' {
73
- /**
74
- * Represents an ESC/POS printer.
75
- */
76
- export interface IEscPosPrinter {
77
- /**
78
- * Prints the content to the printer.
79
- * @returns A promise that resolves to true if the printing is successful, otherwise false.
80
- */
81
- testPrint(template: IPrintCommand): Promise<boolean>;
82
- /**
83
- * Connects to the printer with the specified IP address and port number.
84
- * @param ip The IP address of the printer.
85
- * @param port The port number of the printer. Default is 9100.
86
- * @param timeout The connection timeout in milliseconds. Default is 5000ms.
87
- * @returns A promise that resolves to true if the connection is successful, otherwise false.
88
- */
89
- connect(ip: string, port?: number, timeout?: number): Promise<boolean>;
90
- /**
91
- * Writes the content to the printer.
92
- * @param resultByte The content to write to the printer.
93
- * @param timeout The write timeout in milliseconds. Default is 10000ms.
94
- * @returns A promise that resolves to true if the writing is successful, otherwise false.
95
- */
96
- write(resultByte: any, timeout?: number): Promise<boolean>;
97
- /**
98
- * Interprets the print command and returns the encoded byte array.
99
- * @param template The print command to interpret.
100
- * @returns A promise that resolves to the encoded byte array.
101
- */
102
- interpret(template: IPrintCommand): Promise<Uint8Array>;
103
- }
104
- export class EscPosPrinter implements IEscPosPrinter {
105
- socket: any;
106
- constructor();
107
- /**
108
- * Prints esc pos printer
109
- * @returns print
110
- */
111
- testPrint(template: IPrintCommand): Promise<boolean>;
112
- connect(ip: string, port?: number, timeout?: number): Promise<boolean>;
113
- write(resultByte: any, timeout?: number): Promise<boolean>;
114
- interpret(template: IPrintCommand): Promise<Uint8Array>;
115
- private formatTable;
116
- private padEnd;
117
- private padStart;
118
- private wrapText;
119
- disconnect(): Promise<boolean>;
120
- private close;
121
- private base64ToImageBitmap;
122
- }
123
- export enum Codepages {
124
- English = "cp437",
125
- Greek = "cp737",
126
- WesternEurope = "cp850",
127
- BalticRim = "cp775",
128
- CentralEurope = "cp852",
129
- Cyrillic = "cp855",
130
- Turkish = "cp857",
131
- MultilingualLatin1WithEuro = "cp858",
132
- Portuguese = "cp860",
133
- Icelandic = "cp861",
134
- Hebrew = "cp862",
135
- FrenchCanadian = "cp863",
136
- Arabic = "cp864",
137
- Nordic = "cp865",
138
- Russian = "cp866",
139
- ModernGreek = "cp869",
140
- SimplifiedChinese = "cp936",
141
- Korean = "cp949",
142
- TraditionalChinese = "cp950",
143
- WesternEuropeanLatin = "cp1252",
144
- ArabicISO = "iso88596",
145
- Japanese = "shiftjis",
146
- CentralEuropeanLatinWindows = "windows1250",
147
- CyrillicWindows = "windows1251",
148
- WesternEuropeanLatinWindows = "windows1252",
149
- GreekWindows = "windows1253",
150
- TurkishWindows = "windows1254",
151
- HebrewWindows = "windows1255",
152
- ArabicWindows = "windows1256",
153
- BalticWindows = "windows1257",
154
- Vietnamese = "windows1258"
155
- }
156
- export enum PrintAlign {
157
- Left = "left",
158
- Center = "center",
159
- Right = "right"
160
- }
161
- export enum PrintStyle {
162
- Normal = "normal",
163
- Bold = "bold",
164
- Italic = "italic",
165
- Underline = "underline"
166
- }
167
- export enum PrintSize {
168
- Custom = "custom",
169
- Normal = "normal",
170
- Small = "small"
171
- }
172
- export enum PrintType {
173
- Text = "text",
174
- Table = "table",
175
- Line = "line",
176
- Image = "image",
177
- QRCode = "qrcode",
178
- NewLine = "newline",
179
- Barcode = "barcode",
180
- Cut = "cut",
181
- Beeper = "beeper",
182
- OpenCashDrawer = "open_cash_drawer"
183
- }
184
- export interface IPrintBarcode {
185
- data: string;
186
- symbology: 'upca' | 'upce' | 'ean13' | 'ean8' | 'coda39' | 'itf' | 'codabar';
187
- height: number;
188
- }
189
- export interface IPrintQrcode {
190
- data: string;
191
- model: number;
192
- size: number;
193
- errorlevel: 'l' | 'm' | 'q' | 'h';
194
- }
195
- export type IFontSize = {
196
- width?: number;
197
- height?: number;
198
- size: PrintSize;
199
- };
200
- export type IPrintText = IFontSize & {
201
- text: string;
202
- line_width?: number;
203
- };
204
- export type IPrintTableRowItem = {
205
- text: string;
206
- column_width: number;
207
- };
208
- export type IPrintTable = IFontSize & {
209
- items: IPrintTableRowItem[];
210
- line_width?: number;
211
- };
212
- export class PrintBarcode {
213
- data: string;
214
- symbology: 'upca' | 'upce' | 'ean13' | 'ean8' | 'coda39' | 'itf' | 'codabar';
215
- height: number;
216
- }
217
- export class PrintQrcode {
218
- data: string;
219
- model: number;
220
- size: number;
221
- errorlevel: 'l' | 'm' | 'q' | 'h';
222
- }
223
- export type IPrintImage = {
224
- base64_data: string;
225
- width: number;
226
- height: number;
227
- algorithm: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson';
228
- threshold: number;
229
- };
230
- export class PrintImage implements IPrintImage {
231
- base64_data: string;
232
- width: number;
233
- height: number;
234
- algorithm: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson';
235
- threshold: number;
236
- }
237
- export type IPrintCommandLine = {
238
- item?: IPrintText;
239
- table?: IPrintTable;
240
- image?: IPrintImage;
241
- qrcode?: IPrintQrcode;
242
- barcode?: IPrintBarcode;
243
- align?: PrintAlign;
244
- style?: PrintStyle;
245
- type: PrintType;
246
- repeat?: number;
247
- codepage?: Codepages;
248
- };
249
- export type IPrintCommand = {
250
- codepage: Codepages;
251
- items: IPrintCommandLine[];
252
- };
253
- export enum EscPosCompatibility {
254
- 'SunmiPrinter' = 0
255
- }
256
- export class PrintCommand implements IPrintCommand {
257
- codepage: Codepages;
258
- items: IPrintCommandLine[];
259
- }
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
- * @returns A promise that resolves with the direct pay invoice options
1345
- * @internal 加入 specificKioskDeviceUid 主要是考虑到多台 kiosk 和 iPad 作为主 POS 情况下, iPad有可能没在运行 APP 的情况下, 需要指定 kiosk 设备来打印小票
1346
- */
1347
- directPayInvoice(invoice: IInvoice, till?: ITill, employee?: IEmployee, specificPrinter?: IPrinter, specificKioskDeviceUid?: string): Promise<DirectPayInvoiceOptions>;
1348
- /**
1349
- * Pays an invoice
1350
- * @param invoice - The invoice to pay
1351
- * @param sectionItem - The section item to associate with the invoice
1352
- * @param till - (optional) The till to use for the payment
1353
- * @param employee - (optional) The employee to associate with the invoice
1354
- * @returns A promise that resolves with the paid invoice options
1355
- */
1356
- payInvoice(invoice: IInvoice, sectionItem: ISectionItem, till?: ITill, employee?: IEmployee): Promise<PayInvoiceOptions>;
1357
- /**
1358
- * Voids an invoice
1359
- * @param invoice - The invoice to void
1360
- * @param till - The till to use for the void
1361
- * @param reason - The reason for the void
1362
- * @returns A promise that resolves with the voided invoice options
1363
- */
1364
- voidInvoice(invoice: IInvoice, till?: ITill, reason?: string, employee?: IEmployee): Promise<VoidInvoiceOptions>;
1365
- /**
1366
- * duplicate an invoice
1367
- * @param invoice the invoice to duplicate
1368
- * @param employee the employee to associate with the invoice
1369
- */
1370
- duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
1371
- /**
1372
- * Switches an invoice from one section item to another
1373
- * @param invoice - The invoice to switch
1374
- * @param targetSectionItem - The target section item to switch to
1375
- * @param sourceSectionItem - The source section item to switch from
1376
- * @param employee - The employee to associate with the invoice
1377
- * @returns A promise that resolves with the switched invoice options
1378
- */
1379
- switchInvoice(invoice: IInvoice, targetSectionItem: ISectionItem, sourceSectionItem: ISectionItem, employee?: IEmployee): Promise<SwitchInvoiceOptions>;
1380
- reprintReceipt(invoice: IInvoice): Promise<boolean>;
1381
- /**
1382
- * Adds a discount to an invoice
1383
- * @param invoice - The invoice to add the discount to
1384
- * @param discountType - The type of discount to add
1385
- * @param amountOrPercent - The amount or percent of the discount
1386
- * @param calcFlow - The calculation flow to use for the discount
1387
- * @returns The updated invoice with the added discount
1388
- */
1389
- addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
1390
- /**
1391
- * Removes a discount from an invoice
1392
- * @param invoice - The invoice to remove the discount from
1393
- * @param discountUid - The uid of the discount to remove
1394
- * @returns The updated invoice with the removed discount
1395
- */
1396
- removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
1397
- /**
1398
- * Overwrites the note for an invoice
1399
- * @param invoice - The invoice to overwrite the note for
1400
- * @param note - The new note for the invoice
1401
- * @returns The updated invoice with the new note
1402
- */
1403
- overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
1404
- /**
1405
- * Adds a pax to an invoice
1406
- * @param invoice - The invoice to add the pax to
1407
- * @param pax - The pax to add to the invoice
1408
- */
1409
- addPaxToInvoice(invoice: IInvoice, pax: number): IInvoice;
1410
- /**
1411
- * Adds a customer to an invoice
1412
- * @param invoice - The invoice to add the customer to
1413
- * @param customer - The customer to add to the invoice
1414
- */
1415
- addCustomerToInvoice(invoice: IInvoice, customer: ICustomer): IInvoice;
1416
- /**
1417
- * Adds a payment to an invoice
1418
- * @param invoice - The invoice to add the sales person to
1419
- * @param salesUserUid - The sales person's uid to add to the invoice
1420
- */
1421
- addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
1422
- /**
1423
- * merge invoice from local db and invoice sent from signalr
1424
- * @param localInvoice invoice from local db
1425
- * @param remoteInvoice invoice sent from signalr
1426
- */
1427
- mergeInvoice(localInvoice: IInvoice, remoteInvoice: IInvoice): IInvoice;
1428
- /**
1429
- * Queries invoices using the QueryBuilder to construct filter parameters
1430
- * @param query QueryBuilder instance to build the query
1431
- *
1432
- * Example usage:
1433
- * ```typescript
1434
- * // Create a new query builder
1435
- * const builder = new QueryBuilder<IInvoice>()
1436
- *
1437
- * // Add filter conditions:
1438
- * builder
1439
- * .addParam('status', 'Equals', InvoiceStatus.Paid) // Filter by status
1440
- * .addParam('created_at', 'GreaterThan', '2023-01-01') // Filter by date
1441
- * .addParam('customer_id', 'Equals', 123) // Filter by customer
1442
- * .addParam('grand_total', 'GreaterThan', 100) // Filter by amount
1443
- * .addParam('ref_id', 'Contains', 'INV') // Search by reference ID
1444
- *
1445
- * // Add sorting
1446
- * builder.orderBy('created_at', 'DESC')
1447
- *
1448
- * // Add pagination
1449
- * builder.skip(0).take(10)
1450
- *
1451
- * // Execute query
1452
- * const response = await invoiceService.autoQuery(builder)
1453
- * ```
1454
- *
1455
- * Common operators:
1456
- * - Equals: Exact match
1457
- * - Contains: Partial text match
1458
- * - GreaterThan/LessThan: Numeric/date comparisons
1459
- * - In: Match array of values
1460
- *
1461
- * @returns Promise<QueryResponse<IInvoice>> Response containing filtered invoices and total count
1462
- */
1463
- autoQuery(query: QueryBuilder<IInvoice>): Promise<QueryResponse<IInvoice>>;
1464
- getRefId(): Promise<string>;
1465
- /**
1466
- * Change payments of an invoice
1467
- * @param invoice invoice to change
1468
- * @param payments payments to change
1469
- */
1470
- changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
1471
- /**
1472
- * Adds a charge to an invoice
1473
- * @param invoice - The invoice to add the charge to
1474
- * @param name - The name of the charge
1475
- * @param percentage - The percentage of the charge (0 for flat amount)
1476
- * @param amount - The flat amount of the charge (0 for percentage)
1477
- * @param calcFlow - The calculation flow to use for the charge
1478
- * @returns The updated invoice with the added charge
1479
- */
1480
- addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
1481
- /**
1482
- * Removes a charge from an invoice
1483
- * @param invoice - The invoice to remove the charge from
1484
- * @param chargeUid - The uid of the charge to remove
1485
- * @returns The updated invoice with the removed charge
1486
- */
1487
- removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
1488
- /**
1489
- * Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
1490
- * @param invoice - The invoice to slice
1491
- * @returns An array of sliced invoices, one for each item quantity
1492
- */
1493
- sliceInvoice(invoice: IInvoice): IInvoice[];
1494
- }
1495
- export class InvoiceOperationService extends LineOperationService implements IInvoiceOperationService {
1496
- createInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CreateInvoiceOptions>;
1497
- updateInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<UpdateInvoiceOptions>;
1498
- cancelInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CancelInvoiceOptions>;
1499
- checkInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CheckInvoiceOptions>;
1500
- switchInvoice(invoice: IInvoice, targetSectionItem: ISectionItem, sourceSectionItem: ISectionItem, employee?: IEmployee): Promise<SwitchInvoiceOptions>;
1501
- payInvoice(invoice: IInvoice, sectionItem: ISectionItem, till?: ITill, employee?: IEmployee): Promise<PayInvoiceOptions>;
1502
- directPayInvoice(invoice: IInvoice, till?: ITill, employee?: IEmployee, specificPrinter?: IPrinter, specificKioskDeviceUid?: string, kitchenPrintOverride?: boolean): Promise<DirectPayInvoiceOptions>;
1503
- voidInvoice(invoice: IInvoice, till?: ITill, reason?: string, employee?: IEmployee): Promise<VoidInvoiceOptions>;
1504
- duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
1505
- reprintReceipt(invoice: IInvoice): Promise<boolean>;
1506
- addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
1507
- removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
1508
- overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
1509
- addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
1510
- addPaxToInvoice(invoice: IInvoice, pax: number): IInvoice;
1511
- addCustomerToInvoice(invoice: IInvoice, customer: ICustomer): IInvoice;
1512
- autoQuery(query: QueryBuilder<IInvoice & QueryEtcParams>): Promise<QueryResponse<IInvoice>>;
1513
- mergeInvoice(localInvoice: IInvoice, remoteInvoice: IInvoice): IInvoice;
1514
- getRefId(): Promise<string>;
1515
- changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
1516
- private formatDate;
1517
- private addEmployeeToInvoice;
1518
- private createReceiptPrintJob;
1519
- private createKitchenPrintJobs;
1520
- private createOrderPrintJobs;
1521
- private createLabelPrintJobs;
1522
- filterLinesAndPrintersToPrint(invoiceLines: IInvoiceLine[], printerType: PrinterType): {
1523
- lines: IInvoiceLine[];
1524
- printerUids: string[];
1525
- };
1526
- private preprocessInvoice;
1527
- /**
1528
- * Adds a charge to an invoice
1529
- * @param invoice - The invoice to add the charge to
1530
- * @param name - The name of the charge
1531
- * @param percentage - The percentage of the charge (0 for flat amount)
1532
- * @param amount - The flat amount of the charge (0 for percentage)
1533
- * @param calcFlow - The calculation flow to use for the charge
1534
- * @returns The updated invoice with the added charge
1535
- */
1536
- addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
1537
- /**
1538
- * Removes a charge from an invoice
1539
- * @param invoice - The invoice to remove the charge from
1540
- * @param chargeUid - The uid of the charge to remove
1541
- * @returns The updated invoice with the removed charge
1542
- */
1543
- removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
1544
- /**
1545
- * Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
1546
- * @param invoice - The invoice to slice
1547
- * @returns An array of sliced invoices, one for each item quantity
1548
- */
1549
- sliceInvoice(invoice: IInvoice): IInvoice[];
1550
- }
1551
- export type IInvoiceService = IInvoiceOperationService;
1552
- export class InvoiceService extends InvoiceOperationService implements IInvoiceService {
1553
- }
1554
-
1555
- }
1556
- declare module '@posx/core/services/misc.service' {
1557
- export function preciseRound(num: any, decimalPlaces?: number): number;
1558
- export function getFileExtension(file: File): string;
1559
- export function convertFileToBase64(file: File): Promise<string>;
1560
-
1561
- }
1562
- declare module '@posx/core/services/ods.service' {
1563
- import { AxiosInstance } from "axios";
1564
- import { IOrderDisplay } from '@posx/core/types/ods.type';
1565
- import { AppRemoteService, IAppRemoteService } from "@posx/core/services/abstract.service";
1566
- import Dexie from "dexie";
1567
- import { IServiceOptions } from "@posx/core/types/misc.type";
1568
- /**
1569
- * Represents the interface for the Order Display Service.
1570
- * Extends the IAppRemoteService interface with the IOrderDisplay type.
1571
- */
1572
- export interface IOrderDisplayService extends IAppRemoteService<IOrderDisplay> {
1573
- /**
1574
- * Changes the status of the order to ready for pickup
1575
- * @param uid The uid of the order
1576
- * @returns The updated order
1577
- */
1578
- toPickUp(uid: string): Promise<IOrderDisplay>;
1579
- /**
1580
- * Changes the status of the order to preparing
1581
- * @param uid The uid of the order
1582
- */
1583
- toPreparing(uid: string): Promise<IOrderDisplay>;
1584
- /**
1585
- * Undoes the last order that was marked as ready for pickup
1586
- */
1587
- undo(): Promise<IOrderDisplay>;
1588
- }
1589
- export class OrderDisplayService extends AppRemoteService<IOrderDisplay> implements IOrderDisplayService {
1590
- readonly http: AxiosInstance;
1591
- readonly db: Dexie;
1592
- readonly options: IServiceOptions;
1593
- readonly moduleName: string;
1594
- readonly methodName: string;
1595
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
1596
- toPickUp(uid: string): Promise<IOrderDisplay>;
1597
- toPreparing(uid: string): Promise<IOrderDisplay>;
1598
- undo(): Promise<IOrderDisplay>;
1599
- }
1600
-
1601
- }
1602
- declare module '@posx/core/services/printer.service' {
1603
- import { AppRemoteService, IAppRemoteService } from '@posx/core/services/abstract.service';
1604
- import { CustomResponse, IServiceOptions } from '@posx/core/types/misc.type';
1605
- import { INodePrinter, IPrinter, INode } from '@posx/core/types/printer.type';
1606
- import { AxiosInstance } from 'axios';
1607
- import Dexie from 'dexie';
1608
- import { PrintJobService } from '@posx/core/services/app.service';
1609
- /**
1610
- * Represents the Printer Service interface.
1611
- * Extends the IAppRemoteService interface with IPrinter.
1612
- */
1613
- export interface IPrinterService extends IAppRemoteService<IPrinter> {
1614
- /**
1615
- * Retrieves the physical printers from the node.
1616
- * @returns A promise that resolves to an array of INodePrinter objects.
1617
- */
1618
- getPhysicalPrintersFromNode(): Promise<INodePrinter[]>;
1619
- /**
1620
- * Retrieves the unpaired node.
1621
- * @returns A promise that resolves to an array of INode objects.
1622
- */
1623
- getUnpairedNode(): Promise<CustomResponse<INode>>;
1624
- /**
1625
- * Pairs the node.
1626
- * @param nodeUid The node UID.
1627
- * @returns A promise that resolves to an array of INode objects.
1628
- */
1629
- pairNode(nodeUid: string): Promise<CustomResponse<INode>>;
1630
- /**
1631
- * Retrieves the default kiosk printer.
1632
- * @returns A promise that resolves to an IPrinter object.
1633
- */
1634
- getDefaultKioskPrinter(): Promise<IPrinter>;
1635
- /**
1636
- * Retrieves the default receipt printer.
1637
- * @returns A promise that resolves to an IPrinter object.
1638
- */
1639
- getDefaultReceiptPrinter(): Promise<IPrinter>;
1640
- /**
1641
- * Searches for available printers on the network with the specified IP address and port number.
1642
- * @param wifiName The name of the wifi the device is connected to
1643
- * @param port The port number of the network. Default is 9100.
1644
- * @param refresh A boolean value indicating whether to refresh the cache. Default is false.
1645
- * @returns A promise that resolves to an array of printer names found on the network.
1646
- */
1647
- searchPrinters(refresh?: boolean, port?: number): Promise<string[]>;
1648
- /**
1649
- * Opens the cash drawer.
1650
- */
1651
- openCashDrawer(): Promise<void>;
1652
- }
1653
- export class PrinterService extends AppRemoteService<IPrinter> implements IPrinterService {
1654
- readonly http: AxiosInstance;
1655
- readonly db: Dexie;
1656
- readonly options: IServiceOptions;
1657
- readonly moduleName: string;
1658
- readonly methodName: string;
1659
- private configService;
1660
- protected printJobService: PrintJobService;
1661
- private printersFromCache;
1662
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
1663
- private init;
1664
- getPhysicalPrintersFromNode(): Promise<INodePrinter[]>;
1665
- getUnpairedNode(): Promise<CustomResponse<INode>>;
1666
- pairNode(nodeUid: string): Promise<CustomResponse<INode>>;
1667
- getDefaultReceiptPrinter(): Promise<IPrinter>;
1668
- getDefaultKioskPrinter(): Promise<IPrinter>;
1669
- getDefaultCheckPrinter(): Promise<IPrinter>;
1670
- getDefaultKitchenPrinter(): Promise<IPrinter>;
1671
- getDefaultOrderPrinter(): Promise<IPrinter>;
1672
- getPrintersByUids(uids: string[]): Promise<IPrinter[]>;
1673
- searchPrinters(refresh?: boolean, port?: number): Promise<string[]>;
1674
- openCashDrawer(): Promise<void>;
1675
- }
1676
-
1677
- }
1678
- declare module '@posx/core/types/abstract.type' {
1679
- export const transformer: {
1680
- from(value: string): string;
1681
- to(value: string): string;
1682
- };
1683
- export interface IAppCoreModel {
1684
- /**
1685
- * primary unique id
1686
- * @ignore
1687
- */
1688
- uid: string;
1689
- /**
1690
- * the date when the object is updated
1691
- * @ignore
1692
- */
1693
- updated_at: Date;
1694
- /**
1695
- * the date when the object is created
1696
- * @ignore
1697
- */
1698
- created_at: Date;
1699
- /**
1700
- * the date when the object is created
1701
- * @ignore
1702
- */
1703
- created_at_timestamp: number;
1704
- /**
1705
- * the date when the object is deleted
1706
- * @ignore
1707
- */
1708
- deleted_at: Date;
1709
- /**
1710
- * timestamp in milliseconds
1711
- * @ignore
1712
- */
1713
- _timestamp: number;
1714
- /**
1715
- * Primary unique id in server 1,2,3,5
1716
- * @ignore
1717
- */
1718
- id_in_server: number;
1719
- }
1720
- export abstract class AppCoreModel implements IAppCoreModel {
1721
- uid: string;
1722
- updated_at: Date;
1723
- created_at: Date;
1724
- /**
1725
- * the date when the object is created
1726
- */
1727
- created_at_timestamp: number;
1728
- deleted_at: any;
1729
- _timestamp: number;
1730
- id_in_server: number;
1731
- constructor();
1732
- }
1733
- export interface IAppBaseModel extends IAppCoreModel {
1734
- /**
1735
- * name of the object
1736
- */
1737
- name: string;
1738
- /**
1739
- * Translations of the name
1740
- */
1741
- name_translations: Record<string, string>;
1742
- }
1743
- export class AppBaseModel extends AppCoreModel implements IAppBaseModel {
1744
- name: string;
1745
- name_translations: Record<string, string>;
1746
- constructor();
1747
- }
1748
- export interface IAppExtraModel extends IAppBaseModel {
1749
- /**
1750
- * description of the object
1751
- */
1752
- description: string;
1753
- /**
1754
- * Translations of the description
1755
- */
1756
- description_translations: Record<string, string>;
1757
- }
1758
- export class AppExtraModel extends AppBaseModel implements IAppExtraModel {
1759
- description: string;
1760
- description_translations: {};
1761
- }
1762
- export type IAppCore = Omit<IAppCoreModel, "id_in_server" | "_timestamp">;
1763
- export type IAppBase = Omit<IAppBaseModel, "id_in_server" | "_timestamp">;
1764
- export type IAppExtra = Omit<IAppExtraModel, "id_in_server" | "_timestamp">;
1765
-
1766
- }
1767
- declare module '@posx/core/types/auto.query.type' {
1768
- /**
1769
- * The IBaseParams interface provides a structure for query parameters commonly used
1770
- * in API requests to manipulate the presentation and organization of returned data.
1771
- *
1772
- * @property {string} [skip] - The number of records to skip before starting to collect the response set.
1773
- * @property {string} [take] - The limit on the number of records to return in the response set.
1774
- * @property {string} [format] - The desired format of the response (e.g., 'json', 'xml').
1775
- * @property {string} [include] - A way to include data from related tables/entities.
1776
- * @property {string} [jsconfig] - JavaScript configuration for client-side handling of the response.
1777
- * @property {string} [orderBy] - A parameter to specify the field to order the results by in ascending order.
1778
- * @property {string} [orderByDesc] - A parameter to specify the field to order the results by in descending order.
1779
- */
1780
- export interface IBaseParams {
1781
- skip?: number;
1782
- take?: number;
1783
- format?: string;
1784
- include?: string;
1785
- jsconfig?: string;
1786
- orderBy?: string;
1787
- orderByDesc?: string;
1788
- }
1789
- export interface IInvoiceParams extends IBaseParams {
1790
- RefIdContains?: string;
1791
- GrandTotal?: number;
1792
- StatusContains?: string;
1793
- PaidAtAfter?: string;
1794
- PaidAtBefore?: string;
1795
- PaidAtStartsWith?: string;
1796
- }
1797
- export interface IInvoicesQuery {
1798
- params: IInvoiceParams;
1799
- }
1800
- export class InvoicesQuery implements IInvoicesQuery {
1801
- params: {
1802
- format: string;
1803
- Include: string;
1804
- jsconfig: string;
1805
- };
1806
- constructor(params: IInvoiceParams);
1807
- }
1808
- export interface IQueryResponse<T> {
1809
- offset?: number;
1810
- total?: number;
1811
- results?: T[];
1812
- meta?: {
1813
- [index: string]: string;
1814
- };
1815
- responseStatus?: ResponseStatus;
1816
- }
1817
- export interface ResponseStatus {
1818
- errorCode?: string;
1819
- message?: string;
1820
- stackTrace?: string;
1821
- errors?: ValidationError[];
1822
- }
1823
- export interface ValidationError {
1824
- errorCode?: string;
1825
- fieldName?: string;
1826
- message?: string;
1827
- }
1828
- export class QueryResponse<T> {
1829
- offset?: number;
1830
- total?: number;
1831
- results?: T[];
1832
- meta?: {
1833
- [index: string]: string;
1834
- };
1835
- responseStatus?: ResponseStatus;
1836
- }
1837
- export enum SortOrder {
1838
- Asc = "asc",
1839
- Desc = "desc"
1840
- }
1841
- export type Operator<T> = T extends number ? keyof typeof NumericOperators : T extends string ? keyof typeof StringOperators : never;
1842
- export type OperatorValueMap = {
1843
- [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;
1844
- };
1845
- export enum NumericOperators {
1846
- '>' = 0,
1847
- '>=' = 1,
1848
- '<' = 2,
1849
- '<=' = 3,
1850
- '=' = 4
1851
- }
1852
- export enum StringOperators {
1853
- 'Contains' = 0,
1854
- 'NotContains' = 1,
1855
- 'StartsWith' = 2,
1856
- 'EndsWith' = 3,
1857
- "Like" = 4
1858
- }
1859
- export enum MonthOperator {
1860
- WithinAMonth = "Contains"
1861
- }
1862
- export enum DayOperator {
1863
- At = "StartsWith"
1864
- }
1865
- export enum MonthValues {
1866
- Jan = "-01-",
1867
- Feb = "-02-",
1868
- Mar = "-03-",
1869
- Apr = "-04-",
1870
- May = "-05-",
1871
- Jun = "-06-",
1872
- Jul = "-07-",
1873
- Aug = "-08-",
1874
- Sep = "-09-",
1875
- Oct = "-10-",
1876
- Nov = "-11-",
1877
- Dec = "-12-"
1878
- }
1879
-
1880
- }
1881
- declare module '@posx/core/types/condition.type' {
1882
- export enum Condition {
1883
- None = "",
1884
- Always = "always"
1885
- }
1886
-
1887
- }
1888
- declare module '@posx/core/types/config.type' {
1889
- import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
1890
- import { TaxMethod } from '@posx/core/types/invoice.type';
1891
- export interface IAppConfig extends IAppCoreModel {
1892
- config: IConfig;
1893
- cache: ICache;
1894
- }
1895
- export class AppConfig extends AppCoreModel implements IAppConfig {
1896
- config: Config;
1897
- cache: Cache;
1898
- constructor();
1899
- }
1900
- export interface ICache {
1901
- printers: string[];
1902
- }
1903
- export class Cache implements ICache {
1904
- printers: any[];
1905
- constructor();
1906
- }
1907
- export interface IConfig {
1908
- /** General setting */
1909
- general: IGeneralConfig;
1910
- /** Till setting */
1911
- till: ITillConfig;
1912
- /** Report setting */
1913
- report: IReportConfig;
1914
- /** Receipt setting */
1915
- receipt: IReceiptConfig;
1916
- /** Kitchen slip setting */
1917
- kitchen: IKitchenConfig;
1918
- /** KDS setting */
1919
- label: ILabelConfig;
1920
- /** Order setting */
1921
- order: IOrderConfig;
1922
- /** Payment setting */
1923
- payment: IPaymentConfig;
1924
- /** User setting */
1925
- user: IUserConfig;
1926
- /** Service charge setting */
1927
- /** Tax setting */
1928
- tax: ITaxConfig;
1929
- /** Rounding setting */
1930
- rounding: IRoundingConfig;
1931
- /** Charge setting */
1932
- charges: IChargeConfig;
1933
- /** Currency setting */
1934
- currency: ICurrencyConfig;
1935
- /** Inventory setting */
1936
- inventory: IInventoryConfig;
1937
- /** Pax setting */
1938
- pax_config: IPaxConfig;
1939
- /** Gto setting */
1940
- gto: IGtoConfig;
1941
- /** Cash drawer setting */
1942
- cash_drawer: ICashDrawerConfig;
1943
- /** Marketing setting */
1944
- marketing: IMarketing;
1945
- /** KDS setting */
1946
- kds: IKdsConfig;
1947
- /** Customer display system setting */
1948
- cds: ICustomerDisplaySystemConfig;
1949
- /** Kiosk system setting */
1950
- kiosk: IKioskSystemConfig;
1951
- /** Online order setting */
1952
- online_order: IOnlineOrderConfig;
1953
- }
1954
- export interface ICustomerDisplaySystemConfig {
1955
- full_screen_assets: string[];
1956
- half_screen_assets: string[];
1957
- }
1958
- export class CustomerDisplaySystemConfig implements ICustomerDisplaySystemConfig {
1959
- full_screen_assets: any[];
1960
- half_screen_assets: any[];
1961
- constructor();
1962
- }
1963
- export interface IKioskSystemConfig {
1964
- takeaway_only: boolean;
1965
- guest_order_only: boolean;
1966
- disable_paynow_payment: boolean;
1967
- disable_card_payment: boolean;
1968
- }
1969
- export class KioskSystemConfig implements IKioskSystemConfig {
1970
- takeaway_only: boolean;
1971
- guest_order_only: boolean;
1972
- disable_paynow_payment: boolean;
1973
- disable_card_payment: boolean;
1974
- constructor();
1975
- }
1976
- export interface IMarketing {
1977
- /** Marketing Point Configuration */
1978
- point: IPoint;
1979
- /** Marketing Credit Configuration */
1980
- credit: ICredit;
1981
- }
1982
- export interface ICredit {
1983
- /** Indicates if SMS notification is enabled */
1984
- sms_notification: boolean;
1985
- /** Threshold for invoices to apply credits */
1986
- above_invoice_amount: number;
1987
- /** Rate of conversion for credits */
1988
- conversion_rate: number;
1989
- /** Whether service charge is inclusive */
1990
- inclusive_service_charge: boolean;
1991
- /** Whether tax is inclusive */
1992
- inclusive_tax: boolean;
1993
- }
1994
- export interface IPoint {
1995
- /** Indicates if SMS notification is enabled */
1996
- sms_notification: boolean;
1997
- /** Threshold for invoices to apply points */
1998
- above_invoice_amount: number;
1999
- /** Rate of conversion for points */
2000
- conversion_rate: number;
2001
- /** Whether service charge is inclusive */
2002
- inclusive_service_charge: boolean;
2003
- /** Whether tax is inclusive */
2004
- inclusive_tax: boolean;
2005
- }
2006
- export class MarketingConfig implements IMarketing {
2007
- point: IPoint;
2008
- credit: ICredit;
2009
- constructor();
2010
- }
2011
- export class Config implements IConfig {
2012
- general: GeneralConfig;
2013
- till: TillConfig;
2014
- report: ReportConfig;
2015
- receipt: Receipt;
2016
- kitchen: KitchenConfig;
2017
- kds: KdsConfig;
2018
- label: LabelConfig;
2019
- order: OrderConfig;
2020
- payment: PaymentConfig;
2021
- user: UserConfig;
2022
- tax: TaxConfig;
2023
- rounding: RoundingConfig;
2024
- inventory: InventoryConfig;
2025
- pax_config: PaxConfig;
2026
- gto: GTOConfig;
2027
- cash_drawer: CashDrawerConfig;
2028
- marketing: MarketingConfig;
2029
- charges: ChargeConfig;
2030
- currency: CurrencyConfig;
2031
- cds: CustomerDisplaySystemConfig;
2032
- kiosk: KioskSystemConfig;
2033
- online_order: OnlineOrderConfig;
2034
- constructor();
2035
- }
2036
- export interface IOnlineOrderConfig {
2037
- menu_banner_image_url: string;
2038
- }
2039
- export class OnlineOrderConfig implements IOnlineOrderConfig {
2040
- menu_banner_image_url: string;
2041
- constructor();
2042
- }
2043
- export interface IGeneralConfig {
2044
- /**
2045
- * The default language for system interfaces and communications.
2046
- */
2047
- language: string;
2048
- /**
2049
- * The official registered name of the company using the system.
2050
- */
2051
- company_name: string;
2052
- /**
2053
- * An alternative name or shorthand for the company used for convenience.
2054
- */
2055
- company_name_alias: string;
2056
- /**
2057
- * The logo of the company
2058
- */
2059
- company_logo: string;
2060
- /**
2061
- * The official tax identification number for the company, used for legal and financial documentation.
2062
- */
2063
- company_tax_reg_no: string;
2064
- /**
2065
- * The postal code where the company's primary office or headquarters is located.
2066
- */
2067
- company_postcode: string;
2068
- /**
2069
- * The full street address of the company's primary location.
2070
- */
2071
- company_address: string;
2072
- /**
2073
- * The country in which the company is legally registered and operates.
2074
- */
2075
- company_country: string;
2076
- /**
2077
- * The main contact telephone number for the company.
2078
- */
2079
- company_tel: string;
2080
- /**
2081
- * The name assigned to the table layout or map within the floor plan of the establishment.
2082
- * @ignore
2083
- */
2084
- floor_plan_table_name: string;
2085
- /**
2086
- * The software distribution channel used for the deployment of updates or the application itself.
2087
- * @ignore
2088
- */
2089
- deploy_channel: DeployChannel;
2090
- /**
2091
- * A flag indicating whether the system should run in debug mode for troubleshooting and development purposes.
2092
- * @ignore
2093
- */
2094
- debug: boolean;
2095
- /**
2096
- * A flag that indicates whether system events should be logged for review and auditing purposes.
2097
- * @ignore
2098
- */
2099
- logging: boolean;
2100
- /**
2101
- * A setting that determines whether the system is capable of operating without an active internet connection.
2102
- * @ignore
2103
- */
2104
- offline_mode: boolean;
2105
- /**
2106
- * Business schedules
2107
- * @ignore
2108
- */
2109
- opening_schedules: Schedule[];
2110
- }
2111
- export type UpdateGeneralConfigOptions = {
2112
- [P in keyof IGeneralConfig]?: IGeneralConfig[P];
2113
- };
2114
- export enum DeployChannel {
2115
- PROD = "prod",
2116
- DEV = "dev"
2117
- }
2118
- export class GeneralConfig implements IGeneralConfig {
2119
- /** Name of the company */
2120
- company_name: string;
2121
- /** Alias for the company name */
2122
- company_name_alias: string;
2123
- /** Logo of the company */
2124
- company_logo: string;
2125
- /** Tax registration number of the company */
2126
- company_tax_reg_no: string;
2127
- /** Postcode of the company */
2128
- company_postcode: string;
2129
- /** Address of the company */
2130
- company_address: string;
2131
- /** Country of the company */
2132
- company_country: string;
2133
- /** Telephone number of the company */
2134
- company_tel: string;
2135
- /** Name of the floor plan table */
2136
- floor_plan_table_name: string;
2137
- /** Deployment channel */
2138
- deploy_channel: DeployChannel;
2139
- /** Language setting */
2140
- language: string;
2141
- /** Debug mode status */
2142
- debug: boolean;
2143
- /** Logging status */
2144
- logging: boolean;
2145
- /** Offline mode status */
2146
- offline_mode: boolean;
2147
- /** Open schedule */
2148
- opening_schedules: Schedule[];
2149
- constructor();
2150
- }
2151
- export type OpenHours = {
2152
- open: string;
2153
- close: string;
2154
- };
2155
- export type DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
2156
- export type SpecialDay = {
2157
- date: string;
2158
- hours: OpenHours[];
2159
- };
2160
- export type Holiday = {
2161
- name: string;
2162
- date: string;
2163
- };
2164
- export type BreakPeriod = {
2165
- days: DayOfWeek[];
2166
- time: {
2167
- start: string;
2168
- end: string;
2169
- };
2170
- };
2171
- export type Schedule = {
2172
- opening_hours: OpenHours;
2173
- };
2174
- export interface ITillConfig {
2175
- /** Control flag for Till */
2176
- control: boolean;
2177
- /** Slip flag for Till */
2178
- slip: boolean;
2179
- }
2180
- export class TillConfig implements ITillConfig {
2181
- /** Control flag for Till */
2182
- control: boolean;
2183
- /** Slip flag for Till */
2184
- slip: boolean;
2185
- constructor();
2186
- }
2187
- export interface IReportConfig {
2188
- /** Flag for itemized consolidated report */
2189
- itemized_consolidated: boolean;
2190
- /** Itemized separated report value */
2191
- itemized_separated: string;
2192
- /** Flag for shift itemized report */
2193
- shift_itemized: boolean;
2194
- /** Start time for report */
2195
- start_time: string;
2196
- /** End time for report */
2197
- end_time: string;
2198
- /** Time for shift print */
2199
- shift_print_time: number;
2200
- /** Flag to disable shift */
2201
- shift_disable: boolean;
2202
- /** Flag for email report */
2203
- email: boolean;
2204
- }
2205
- export class ReportConfig implements IReportConfig {
2206
- itemized_consolidated: boolean;
2207
- itemized_separated: string;
2208
- shift_itemized: boolean;
2209
- start_time: string;
2210
- end_time: string;
2211
- shift_print_time: number;
2212
- shift_disable: boolean;
2213
- email: boolean;
2214
- constructor();
2215
- }
2216
- export interface IReceiptConfig {
2217
- enabled: boolean;
2218
- show_print_dialog: boolean;
2219
- print_docket: boolean;
2220
- hide_non_price_item: boolean;
2221
- receipt_no_reset_daily: boolean;
2222
- language: string;
2223
- }
2224
- export class Receipt implements IReceiptConfig {
2225
- enabled: boolean;
2226
- show_print_dialog: boolean;
2227
- print_docket: boolean;
2228
- hide_non_price_item: boolean;
2229
- receipt_no_reset_daily: boolean;
2230
- language: string;
2231
- constructor();
2232
- }
2233
- export interface IKitchenConfig {
2234
- /** Flag to print */
2235
- enabled: boolean;
2236
- /** Flag to print slip price */
2237
- print_item_price: boolean;
2238
- /** Flag to print cancel slip */
2239
- print_cancel_slip: boolean;
2240
- /**
2241
- * The language to use for the kitchen slip.
2242
- */
2243
- language: string;
2244
- }
2245
- export class KitchenConfig implements IKitchenConfig {
2246
- enabled: boolean;
2247
- print_item_price: boolean;
2248
- print_cancel_slip: boolean;
2249
- language: string;
2250
- constructor();
2251
- }
2252
- export interface IKdsConfig {
2253
- enabled: boolean;
2254
- /** Display order after payment */
2255
- display_order_after_payment: boolean;
2256
- /** Print slip upon completion */
2257
- print_slip_upon_completed: boolean;
2258
- }
2259
- export class KdsConfig implements IKdsConfig {
2260
- enabled: boolean;
2261
- display_order_after_payment: boolean;
2262
- print_slip_upon_completed: boolean;
2263
- constructor();
2264
- }
2265
- export interface ILabelConfig {
2266
- /** Flag for printing the label */
2267
- print: boolean;
2268
- }
2269
- export class LabelConfig implements ILabelConfig {
2270
- print: boolean;
2271
- constructor();
2272
- }
2273
- export interface IOrderConfig {
2274
- /** Separation line for order */
2275
- separation_line: boolean;
2276
- /** Slip for order */
2277
- slip: boolean;
2278
- /** Font size ratio for the slip */
2279
- slip_font_size_ratio: number;
2280
- /** Maximum dining time in minutes */
2281
- max_dinning: number;
2282
- /** Flag to exit the menu after payment */
2283
- exit_menu_after_payment: boolean;
2284
- }
2285
- export class OrderConfig implements IOrderConfig {
2286
- separation_line: boolean;
2287
- slip: boolean;
2288
- slip_font_size_ratio: number;
2289
- max_dinning: number;
2290
- exit_menu_after_payment: boolean;
2291
- constructor();
2292
- }
2293
- export interface IPaymentConfig {
2294
- /** Quick cash payment */
2295
- quick_cash_payment: boolean;
2296
- /** Notification for payment */
2297
- notification: boolean;
2298
- /** Quick payment option */
2299
- quick: boolean;
2300
- }
2301
- export class PaymentConfig implements IPaymentConfig {
2302
- quick_cash_payment: boolean;
2303
- notification: boolean;
2304
- quick: boolean;
2305
- constructor();
2306
- }
2307
- export interface IUserConfig {
2308
- /** Control for the user */
2309
- control: boolean;
2310
- }
2311
- export class UserConfig implements IUserConfig {
2312
- control: boolean;
2313
- constructor();
2314
- }
2315
- export interface ITaxConfig {
2316
- /** Tax applicable flag */
2317
- enabled: boolean;
2318
- /** Method for the tax */
2319
- method: TaxMethod;
2320
- /** Rate of the tax */
2321
- rate: number;
2322
- /** Name of the tax */
2323
- name: string;
2324
- }
2325
- export class TaxConfig implements ITaxConfig {
2326
- enabled: boolean;
2327
- method: TaxMethod;
2328
- rate: number;
2329
- name: string;
2330
- constructor();
2331
- }
2332
- export interface IRoundingConfig {
2333
- /** Base for rounding */
2334
- base: number;
2335
- /** Rounding up flag */
2336
- up: boolean;
2337
- /** Cashless rounding flag */
2338
- cashless: boolean;
2339
- }
2340
- export interface IChargeConfig {
2341
- service_charge: boolean;
2342
- service_charge_rate: number;
2343
- }
2344
- export class ChargeConfig implements IChargeConfig {
2345
- service_charge: boolean;
2346
- service_charge_rate: number;
2347
- constructor();
2348
- }
2349
- export interface ICurrencyConfig {
2350
- currency_symbol: string;
2351
- }
2352
- export class CurrencyConfig implements ICurrencyConfig {
2353
- currency_symbol: string;
2354
- constructor();
2355
- }
2356
- export class RoundingConfig implements IRoundingConfig {
2357
- base: number;
2358
- up: boolean;
2359
- cashless: boolean;
2360
- constructor();
2361
- }
2362
- /** Inventory Configuration */
2363
- export interface IInventoryConfig {
2364
- /** Control flag for inventory */
2365
- control: boolean;
2366
- }
2367
- export class InventoryConfig implements IInventoryConfig {
2368
- control: boolean;
2369
- constructor();
2370
- }
2371
- /** Pax Configuration */
2372
- export interface IPaxConfig {
2373
- /** Pax flag */
2374
- pax: boolean;
2375
- /** Detail flag for Pax */
2376
- detail: boolean;
2377
- }
2378
- export class PaxConfig implements IPaxConfig {
2379
- pax: boolean;
2380
- detail: boolean;
2381
- constructor();
2382
- }
2383
- /** GTO Configuration */
2384
- export interface IGtoConfig {
2385
- /** Interface type */
2386
- interface: string;
2387
- /** Genesis date */
2388
- genesis_date: string;
2389
- /** Upload time */
2390
- upload_time: string;
2391
- /** FTP server */
2392
- ftp_svr: string;
2393
- /** FTP user */
2394
- ftp_usr: string;
2395
- /** FTP port */
2396
- ftp_port: string;
2397
- /** FTP path */
2398
- ftp_path: string;
2399
- /** FTP password */
2400
- ftp_pwd: string;
2401
- /** Mall ID */
2402
- mall_id: string;
2403
- /** Machine ID */
2404
- machine_id: string;
2405
- /** FTP type */
2406
- ftp_type: string;
2407
- }
2408
- export class GTOConfig implements IGtoConfig {
2409
- interface: string;
2410
- genesis_date: string;
2411
- upload_time: string;
2412
- ftp_svr: string;
2413
- ftp_usr: string;
2414
- ftp_port: string;
2415
- ftp_path: string;
2416
- ftp_pwd: string;
2417
- mall_id: string;
2418
- machine_id: string;
2419
- ftp_type: string;
2420
- constructor();
2421
- }
2422
- /** CashDrawer Configuration */
2423
- export interface ICashDrawerConfig {
2424
- /** CashDrawer code */
2425
- kick_code: string;
2426
- /** Connection mode */
2427
- connection_mode: 'via_receipt_printer' | 'via_imin_pos';
2428
- }
2429
- export class CashDrawerConfig implements ICashDrawerConfig {
2430
- /**
2431
- * The kick code for the cash drawer.
2432
- */
2433
- kick_code: string;
2434
- /** Connection mode */
2435
- connection_mode: 'via_receipt_printer' | 'via_imin_pos';
2436
- /**
2437
- * Creates a new instance of the CashDrawerConfig class.
2438
- */
2439
- constructor();
2440
- }
2441
-
2442
- }
2443
- declare module '@posx/core/types/employee.type' {
2444
- import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
2445
- export interface IEmployee extends IAppCoreModel {
2446
- /** User ID */
2447
- user_uid: string;
2448
- /** User name */
2449
- name: string;
2450
- /** User email */
2451
- email: string;
2452
- /** 6 digits of password */
2453
- password: string;
2454
- /** role uid */
2455
- role_uid: string;
2456
- /** language preference */
2457
- language: string;
2458
- }
2459
- export class Employee extends AppCoreModel implements IEmployee {
2460
- user_uid: string;
2461
- name: string;
2462
- email: string;
2463
- password: string;
2464
- uid: string;
2465
- role_uid: string;
2466
- language: string;
2467
- constructor();
2468
- }
2469
-
2470
- }
2471
- declare module '@posx/core/types/invoice.type' {
2472
- import { IAppCoreModel, AppCoreModel } from '@posx/core/types/abstract.type';
2473
- import { IPayment } from '@posx/core/types/payment.type';
2474
- import { CoreItem, ICoreItem, IItem, Item } from '@posx/core/types/product.type';
2475
- import { Address, Customer, IAddress, ICustomer } from '@posx/core/types/wyo.customer.type';
2476
- import { ISectionItem } from '@posx/core/types/section.type';
2477
- import { ITill } from '@posx/core/types/shift.type';
2478
- import { IPrintJob } from '@posx/core/types/printer.type';
2479
- import { Condition } from '@posx/core/types/condition.type';
2480
- export enum InvoiceType {
2481
- DineIn = "dine_in",
2482
- TakeOut = "take_out",
2483
- Delivery = "delivery"
2484
- }
2485
- export enum TaxMethod {
2486
- Inclusive = "inclusive",
2487
- Exclusive = "exclusive"
2488
- }
2489
- export enum InvoiceStatus {
2490
- Open = "open",
2491
- OnHold = "on_hold",
2492
- Paying = "paying",
2493
- Paid = "paid",
2494
- Void = "void"
2495
- }
2496
- export enum InvoiceAction {
2497
- Calibration = "calibration",
2498
- Create = "create",
2499
- Update = "update",
2500
- Cancel = "cancel",
2501
- Hold = "hold",
2502
- PaymentAsync = "payment_async",
2503
- Check = "check",
2504
- Void = "void",
2505
- Switch = "switch",
2506
- Reprint = "reprint",
2507
- Display = "display",
2508
- Merge = "merge",
2509
- Calculate = "calculate",
2510
- Delivery = "delivery",
2511
- Payment = "payment",
2512
- ChangePayment = "change_payment",
2513
- AddCustomer = "add_customer",
2514
- VoidAndDuplicate = "void_and_duplicate",
2515
- Duplicate = "duplicate"
2516
- }
2517
- export enum UomType {
2518
- quantity = "quantity",
2519
- weight = "weight"
2520
- }
2521
- export enum CalcType {
2522
- Flat = "flat",
2523
- Percent = "percent"
2524
- }
2525
- export enum CalcFlow {
2526
- AfterSubtotal = "after_subtotal",
2527
- AfterServiceCharge = "after_service_charge",
2528
- AfterGrantTotal = "after_grant_total"
2529
- }
2530
- export enum DiscountType {
2531
- Custom = "custom",
2532
- Voucher = "voucher",
2533
- Coupon = "coupon"
2534
- }
2535
- /**
2536
- * Interface for invoice charge items
2537
- */
2538
- export interface IInvoiceCharge {
2539
- /** Charge unique id */
2540
- uid: string;
2541
- /** Charge name */
2542
- name: string;
2543
- /** Charge amount */
2544
- percentage: number;
2545
- /** Charge amount */
2546
- amount: number;
2547
- /** Charge calculation flow */
2548
- calc_flow: CalcFlow;
2549
- }
2550
- export class InvoiceCharge implements IInvoiceCharge {
2551
- uid: string;
2552
- name: string;
2553
- percentage: number;
2554
- amount: number;
2555
- calc_flow: CalcFlow;
2556
- }
2557
- export interface IInvoiceActivity {
2558
- /** Action */
2559
- action: InvoiceAction;
2560
- /** Action by */
2561
- action_by: string;
2562
- /** Device unique id */
2563
- device_uid: string;
2564
- /** Action at */
2565
- action_at: Date;
2566
- }
2567
- export class InvoiceActivity {
2568
- action: InvoiceAction;
2569
- action_by: string;
2570
- device_uid: string;
2571
- action_at: Date;
2572
- }
2573
- export interface IDiscount {
2574
- uid: string;
2575
- calc_type: CalcType;
2576
- amount: number;
2577
- percent: number;
2578
- percent_amount: number;
2579
- }
2580
- export interface ICharge {
2581
- uid: string;
2582
- name: string;
2583
- percent: number;
2584
- calc_flow: CalcFlow;
2585
- trigger_condition: Condition | string;
2586
- }
2587
- export class Charge implements ICharge {
2588
- uid: string;
2589
- name: string;
2590
- percent: number;
2591
- calc_flow: CalcFlow;
2592
- trigger_condition: string;
2593
- }
2594
- export interface IInvoiceDiscount extends IDiscount {
2595
- /** the name can be the voucher or coupon name */
2596
- name?: string;
2597
- /** Discount Type */
2598
- type: DiscountType;
2599
- /** Discount unique id */
2600
- voucher_uid?: string;
2601
- /** Discount unique id */
2602
- coupon_uid?: string;
2603
- /** Calculation flow */
2604
- calc_flow: CalcFlow;
2605
- }
2606
- export class InvoiceDiscount implements IInvoiceDiscount {
2607
- calc_type: CalcType;
2608
- amount: number;
2609
- percent: number;
2610
- percent_amount: number;
2611
- type: DiscountType;
2612
- calc_flow: CalcFlow;
2613
- name: string;
2614
- voucher_uid: string;
2615
- coupon_uid: string;
2616
- uid: string;
2617
- }
2618
- export interface IInvoiceCoreLine {
2619
- /** Item unique id */
2620
- item_uid: string;
2621
- /** The item being sold on the line item. */
2622
- item: ICoreItem;
2623
- /** Item unit price */
2624
- price: number;
2625
- /** Unit of measure (1:quantity | 2:weight) */
2626
- unit_of_measure: UomType;
2627
- /** Quantity if it is quantity*/
2628
- quantity: number;
2629
- /** Whether it is sent to server*/
2630
- sent: number;
2631
- }
2632
- /**
2633
- * Represents a line item on an invoice.
2634
- */
2635
- export interface IInvoiceLine extends IAppCoreModel, Omit<IInvoiceCoreLine, 'item'> {
2636
- item: IItem;
2637
- /** Invoice Line unique id */
2638
- invoice_uid: string;
2639
- /** Line discount calculation type */
2640
- discount_calc_type: CalcType;
2641
- /** The amount of discount applied to the line item. */
2642
- discount_amount: number;
2643
- /** The percentage of discount applied to the line item. */
2644
- discount_percent: number;
2645
- /** The subtotal for the line item. */
2646
- subtotal: number;
2647
- /** The subtotal for the line item before any discounts were applied. */
2648
- subtotal_before_discount: number;
2649
- /** The unit price of the item. */
2650
- price: number;
2651
- /** The point value of the item. */
2652
- point: number;
2653
- /** The subtotal for the line item in points. */
2654
- point_subtotal: number;
2655
- /** The unit of measurement for the item. */
2656
- unit_of_measure: UomType;
2657
- /** The quantity of the item being sold on the line item. */
2658
- quantity: number;
2659
- /** Any additional remarks for the line item. */
2660
- remark: string;
2661
- /** Whether the item size is up-sized. */
2662
- up_size: boolean;
2663
- /** Whether the line item is for take-out. If so, the service charge is not counted. */
2664
- is_take_out: boolean;
2665
- /** Whether the line item is a duplicate. */
2666
- is_duplicate: boolean;
2667
- /** The line item that this line item is duplicated from. */
2668
- duplicated_from_uid: string;
2669
- /** Any modifiers applied to the line item. */
2670
- modifiers: IInvoiceCoreLine[];
2671
- /** Meta data for the line item */
2672
- meta: Record<string, any>;
2673
- }
2674
- export interface IInvoice extends IAppCoreModel {
2675
- /** Invoice reference number which is used for look-up */
2676
- ref_id: string;
2677
- /** The number which will be printed on kitchen slip
2678
- or receipt or display to call when order is ready */
2679
- call_num: string;
2680
- /** Table unique id */
2681
- table_uid: string;
2682
- /**
2683
- * Table name
2684
- */
2685
- table_name: string;
2686
- /** Invoice type */
2687
- type: InvoiceType;
2688
- /** Total number of people including adult, child and baby */
2689
- pax: number;
2690
- /** Number of Adult People */
2691
- adult_pax: number;
2692
- /** Number of Child People */
2693
- child_pax: number;
2694
- /** Number of Baby People */
2695
- baby_pax: number;
2696
- /** Invoice subtotal */
2697
- subtotal: number;
2698
- /** Invoice point subtotal */
2699
- point_subtotal: number;
2700
- /** Invoice subtotal applicable to service charge */
2701
- service_chargeable_subtotal: number;
2702
- /** Invoice subtotal applicable to discount */
2703
- discountable_subtotal: number;
2704
- /** Invoice service charge */
2705
- service_charge: number;
2706
- /** Online delivery id */
2707
- delivery_id: number;
2708
- /** Online delivery charge */
2709
- delivery_charge: number;
2710
- /** Online delivery type */
2711
- delivery_type: string;
2712
- /** Online delivery driver */
2713
- delivery_by: string;
2714
- /** If customer package is used in this invoice */
2715
- /** Package deduction amount */
2716
- /** If customer point is used in this invoice */
2717
- use_customer_point: boolean;
2718
- /** Add point */
2719
- add_point: number;
2720
- /** minus point */
2721
- minus_point: number;
2722
- /** rewarded point rate */
2723
- rewarded_point_rate: number;
2724
- /** Rewarded Point */
2725
- rewarded_point: number;
2726
- /** if customer balance is used in this invoice */
2727
- use_customer_balance: boolean;
2728
- /** add credit */
2729
- add_credit: number;
2730
- /** minus credit */
2731
- minus_credit: number;
2732
- /** rewarded credit rate */
2733
- rewarded_credit_rate: number;
2734
- /** Rewarded Credit */
2735
- rewarded_credit: number;
2736
- /** Discount List */
2737
- discounts: IInvoiceDiscount[];
2738
- /** Total discount amount */
2739
- discount_amount: number;
2740
- /** Tax */
2741
- tax: number;
2742
- /** Rounding */
2743
- rounding: number;
2744
- /** Tip Amount */
2745
- tip: number;
2746
- /** Grand Total */
2747
- grand_total: number;
2748
- /** Customer ID */
2749
- customer_id: number;
2750
- /** Remark */
2751
- remark: string;
2752
- /** Sales User ID */
2753
- sales_user_uid: string;
2754
- /** Status */
2755
- status: InvoiceStatus;
2756
- /** Payment Method */
2757
- paid_at: Date;
2758
- /** Human readable date */
2759
- humanized_paid_at: string;
2760
- /** Payment Method */
2761
- voided_at: Date;
2762
- /** Human readable date */
2763
- humanized_voided_at: string;
2764
- humanized_created_at: string;
2765
- /** Order ID */
2766
- order_id: number;
2767
- /** To Address */
2768
- to_address: IAddress;
2769
- /** Payment Source Method */
2770
- payment_source_method: string;
2771
- /** Payment Source Last4 */
2772
- payment_source_last4: string;
2773
- /** Payment Source Charge Reference */
2774
- payment_source_charge_ref: string;
2775
- /** Is Sales Exclusive */
2776
- is_sales_exclusive: boolean;
2777
- /** Etc */
2778
- etc: Record<string, any>;
2779
- /** Action */
2780
- action: InvoiceAction;
2781
- /** Invoice Lines */
2782
- lines: IInvoiceLine[];
2783
- /** Deleted invoice lines */
2784
- deleted_lines: IInvoiceLine[];
2785
- /** Invoice Signature */
2786
- /**
2787
- * if invoice payments has cash payment
2788
- */
2789
- payment_has_cash: boolean;
2790
- /** Payment */
2791
- payments: IPayment[];
2792
- /** Table Switch ID */
2793
- table_switch_id: number;
2794
- /** Customer Spend */
2795
- /** Reservation */
2796
- /** Receipt Print Override */
2797
- employee_uid: string;
2798
- /**Employee Name */
2799
- employee_name: string;
2800
- receipt_print_override: boolean;
2801
- /** Customer */
2802
- customer: ICustomer;
2803
- /** Is Duplicate */
2804
- is_duplicate: boolean;
2805
- /** Kitchen Print Override */
2806
- kitchen_print_override: boolean;
2807
- /** OTP */
2808
- otp: string;
2809
- /** Invoice Activity */
2810
- activities: any[];
2811
- /** Receipt printer unique id */
2812
- receipt_print_job_uid: string;
2813
- /** Additional charges */
2814
- charges: IInvoiceCharge[];
2815
- /** Flag to track if charge has been manually deleted by user */
2816
- is_charge_triggered?: boolean;
2817
- }
2818
- export class InvoiceCoreLine implements IInvoiceCoreLine {
2819
- item_uid: string;
2820
- item: CoreItem;
2821
- price: number;
2822
- unit_of_measure: UomType;
2823
- quantity: number;
2824
- sent: number;
2825
- constructor();
2826
- }
2827
- export class InvoiceLine extends AppCoreModel implements IInvoiceLine {
2828
- item_uid: string;
2829
- price: number;
2830
- unit_of_measure: UomType;
2831
- quantity: number;
2832
- remark: string;
2833
- invoice_uid: string;
2834
- discount_calc_type: CalcType;
2835
- discount_amount: number;
2836
- discount_percent: number;
2837
- subtotal: number;
2838
- subtotal_before_discount: number;
2839
- item: Item;
2840
- point: number;
2841
- point_subtotal: number;
2842
- up_size: boolean;
2843
- is_take_out: boolean;
2844
- is_duplicate: boolean;
2845
- modifiers: any[];
2846
- duplicated_from_uid: string;
2847
- sent: number;
2848
- meta: {};
2849
- constructor();
2850
- }
2851
- export class Invoice extends AppCoreModel implements IInvoice {
2852
- ref_id: string;
2853
- call_num: string;
2854
- table_uid: string;
2855
- table_name: string;
2856
- type: InvoiceType;
2857
- pax: number;
2858
- adult_pax: number;
2859
- child_pax: number;
2860
- baby_pax: number;
2861
- subtotal: number;
2862
- point_subtotal: number;
2863
- service_chargeable_subtotal: number;
2864
- discountable_subtotal: number;
2865
- service_charge: number;
2866
- delivery_id: number;
2867
- delivery_charge: number;
2868
- delivery_type: string;
2869
- delivery_by: string;
2870
- use_customer_point: boolean;
2871
- add_point: number;
2872
- minus_point: number;
2873
- rewarded_point_rate: number;
2874
- rewarded_point: number;
2875
- use_customer_balance: boolean;
2876
- add_credit: number;
2877
- minus_credit: number;
2878
- rewarded_credit_rate: number;
2879
- rewarded_credit: number;
2880
- discounts: any[];
2881
- discount_amount: number;
2882
- tax: number;
2883
- rounding: number;
2884
- tip: number;
2885
- grand_total: number;
2886
- customer_id: number;
2887
- remark: string;
2888
- sales_user_uid: string;
2889
- status: InvoiceStatus;
2890
- paid_at: Date;
2891
- voided_at: Date;
2892
- humanized_paid_at: string;
2893
- humanized_voided_at: string;
2894
- humanized_created_at: string;
2895
- order_id: number;
2896
- to_address: Address;
2897
- payment_source_method: string;
2898
- payment_source_last4: string;
2899
- payment_source_charge_ref: string;
2900
- is_sales_exclusive: boolean;
2901
- etc: Record<string, any>;
2902
- action: InvoiceAction.Create;
2903
- lines: IInvoiceLine[];
2904
- deleted_lines: IInvoiceLine[];
2905
- payment_has_cash: boolean;
2906
- payments: IPayment[];
2907
- table_switch_id: number;
2908
- employee_uid: string;
2909
- employee_name: string;
2910
- receipt_print_override: boolean;
2911
- customer: Customer;
2912
- is_duplicate: boolean;
2913
- kitchen_print_override: boolean;
2914
- otp: string;
2915
- activities: any[];
2916
- receipt_print_job_uid: string;
2917
- charges: IInvoiceCharge[];
2918
- /** Flag to track if charge has been manually deleted by user */
2919
- is_charge_triggered: boolean;
2920
- uid: string;
2921
- constructor();
2922
- }
2923
- export type CreateInvoiceOptions = {
2924
- invoice: IInvoice;
2925
- section_item: ISectionItem;
2926
- print_jobs?: IPrintJob[];
2927
- };
2928
- export type CancelInvoiceOptions = CreateInvoiceOptions & {
2929
- print_jobs?: IPrintJob[];
2930
- };
2931
- export type CheckInvoiceOptions = CreateInvoiceOptions & {
2932
- print_jobs?: IPrintJob[];
2933
- };
2934
- export type UpdateInvoiceOptions = CreateInvoiceOptions;
2935
- export type SwitchInvoiceOptions = {
2936
- invoice: IInvoice;
2937
- target_section_item: ISectionItem;
2938
- source_section_item: ISectionItem;
2939
- };
2940
- export type VoidInvoiceOptions = {
2941
- invoice: IInvoice;
2942
- till: ITill;
2943
- print_jobs?: IPrintJob[];
2944
- section_item?: ISectionItem;
2945
- };
2946
- export type PayInvoiceOptions = VoidInvoiceOptions & {
2947
- section_item: ISectionItem;
2948
- print_jobs?: IPrintJob[];
2949
- };
2950
- export type DirectPayInvoiceOptions = VoidInvoiceOptions & {
2951
- print_jobs?: IPrintJob[];
2952
- };
2953
-
2954
- }
2955
- declare module '@posx/core/types/merchant.type' {
2956
- export type IMerchantAsset = {
2957
- guid: string;
2958
- name: string;
2959
- tags: AssetTags[];
2960
- asset_type: AssetType;
2961
- url: string;
2962
- created_at: Date;
2963
- };
2964
- export enum AssetType {
2965
- Image = "image",
2966
- Video = "video",
2967
- Unsupported = "unsupported"
2968
- }
2969
- export enum AssetTags {
2970
- CdsFullScreenImage = "cds_full_screen_image",
2971
- CdsHalfScreenImage = "cds_half_screen_image"
2972
- }
2973
- export type IEtc = {
2974
- assets: IMerchantAsset[];
2975
- };
2976
- export class Merchant implements IMerchant {
2977
- name: string;
2978
- address: string;
2979
- postcode: string;
2980
- tel: string;
2981
- tax_number: string;
2982
- user_id: string;
2983
- uid: string;
2984
- api_key: string;
2985
- ip_address: string;
2986
- }
2987
- export type IMerchant = {
2988
- name: string;
2989
- address: string;
2990
- postcode: string;
2991
- tel: string;
2992
- tax_number: string;
2993
- user_id: string;
2994
- uid: string;
2995
- api_key: string;
2996
- ip_address: string;
2997
- };
2998
-
2999
- }
3000
- declare module '@posx/core/types/misc.type' {
3001
- export enum ModelPrefix {
3002
- Merchant = "mnt_",
3003
- Section = "sec_",
3004
- SectionItem = "sit_",
3005
- Category = "cat_",
3006
- Subcategory = "sat_",
3007
- Item = "itm_",
3008
- ItemModifier = "iod_",
3009
- ItemModifierCategory = "imc_",
3010
- Config = "cfg_",
3011
- Device = "dev_",
3012
- Invoice = "inv_",
3013
- InvoiceLine = "iln_",
3014
- InvoiceCharge = "ich_",
3015
- Payment = "pay_",
3016
- Employee = "emp_",
3017
- Shift = "shf_",
3018
- Till = "til_",
3019
- ReportCategory = "rpc_",
3020
- Report = "rpt_",
3021
- AppReport = "apr_",
3022
- PaymentMethod = "pmd_",
3023
- PrintTemplate = "ptl_",
3024
- PrintJob = "pjb_",
3025
- Printer = "prt_",
3026
- InvoiceDiscount = "ind_",
3027
- EmployeeRole = "emr_",
3028
- OrderDisplaySystem = "ods_",
3029
- Charge = "chr_"
3030
- }
3031
- export enum ModelType {
3032
- Merchant = "mnt",
3033
- Section = "sec",
3034
- SectionItem = "sit",
3035
- Category = "cat",
3036
- Subcategory = "sat",
3037
- Item = "itm",
3038
- Config = "cfg",
3039
- Device = "dev",
3040
- Invoice = "inv"
3041
- }
3042
- export enum ServiceMode {
3043
- LOCAL = "local",
3044
- CLOUD = "cloud"
3045
- }
3046
- export interface IServiceOptions {
3047
- mode: ServiceMode;
3048
- base_url: string;
3049
- device_uid: string;
3050
- merchant_uid: string;
3051
- token: string;
3052
- database: {
3053
- version: number;
3054
- name: string;
3055
- };
3056
- }
3057
- export class ServiceOptions implements IServiceOptions {
3058
- mode: ServiceMode;
3059
- base_url: string;
3060
- device_uid: string;
3061
- merchant_uid: string;
3062
- token: string;
3063
- database: {
3064
- version: 1;
3065
- name: '';
3066
- };
3067
- }
3068
- export enum MessageType {
3069
- Data = "DataMessage",
3070
- Event = "EventMessage"
3071
- }
3072
- /** Interface for push_data */
3073
- export interface IPushData {
3074
- model: string;
3075
- /** Push Data Content */
3076
- data: string;
3077
- has_many: boolean;
3078
- type: MessageType;
3079
- }
3080
- /** Model for push_data */
3081
- export class PushData implements IPushData {
3082
- model: string;
3083
- /** Push Data Content */
3084
- data: string;
3085
- has_many: boolean;
3086
- type: MessageType;
3087
- }
3088
- export class SystemError extends Error {
3089
- constructor(message: string);
3090
- }
3091
- export type CustomResponse<T> = {
3092
- data: T;
3093
- error: ErrorMsgs | string;
3094
- error_code: number;
3095
- };
3096
- export enum ErrorMsgs {
3097
- outdatedInvoice = "outdated invoice",
3098
- outdatedSectionItem = "outdated section item",
3099
- outdatedSourceSectionItem = "outdated source section item",
3100
- outdatedTargetSectionItem = "outdated target section item"
3101
- }
3102
- export interface IFileUploadResponse {
3103
- file_url: string;
3104
- thumbnail_url: string;
3105
- }
3106
-
3107
- }
3108
- declare module '@posx/core/types/note.type' {
3109
- import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
3110
- import { ModelType } from '@posx/core/types/misc.type';
3111
- export type INoteGroupEntity = IAppBaseModel;
3112
- export class NoteGroupEntity extends AppBaseModel implements INoteGroupEntity {
3113
- constructor();
3114
- }
3115
- export type INoteGroup = INoteGroupEntity;
3116
- export class NoteGroup extends NoteGroupEntity {
3117
- constructor();
3118
- }
3119
- export interface INoteEntity extends IAppBaseModel {
3120
- /** Group ID */
3121
- note_group_uid: string;
3122
- /** Type of the Note */
3123
- related_model: ModelType;
3124
- /** Usage */
3125
- usage: number;
3126
- }
3127
- export class NoteEntity extends AppBaseModel implements INoteEntity {
3128
- note_group_uid: string;
3129
- related_model: ModelType;
3130
- usage: number;
3131
- constructor();
3132
- }
3133
- export type INote = INoteEntity;
3134
- export class Note extends NoteEntity {
3135
- constructor();
3136
- }
3137
-
3138
- }
3139
- declare module '@posx/core/types/ods.type' {
3140
- import { AppCoreModel, IAppCoreModel } from "@posx/core/types/abstract.type";
3141
- export interface IOrderDisplay extends IAppCoreModel {
3142
- order_number: string;
3143
- status: OrderDisplayStatus;
3144
- }
3145
- export class OrderDisplay extends AppCoreModel implements IOrderDisplay {
3146
- uid: string;
3147
- order_number: string;
3148
- status: OrderDisplayStatus;
3149
- constructor();
3150
- }
3151
- export enum OrderDisplayStatus {
3152
- Preparing = "preparing",
3153
- ReadyForPickup = "ready_for_pickup"
3154
- }
3155
-
3156
- }
3157
- declare module '@posx/core/types/payment.type' {
3158
- import { AppBaseModel, AppCoreModel, IAppBaseModel, IAppCoreModel } from "@posx/core/types/abstract.type";
3159
- import { IAppModelSequence } from '@posx/core/services/abstract.service';
3160
- /**
3161
- * Payment Entity Interface
3162
- */
3163
- export interface IPayment extends IAppCoreModel {
3164
- /** Invoice ID */
3165
- invoice_uid: string;
3166
- /** Tender Amount */
3167
- tender_amount: number;
3168
- /** Change Amount */
3169
- change_amount: number;
3170
- /** Payment Method ID */
3171
- payment_method_uid: string;
3172
- /** Payment Method Code */
3173
- payment_method_code: string;
3174
- /** Selected Payment Method */
3175
- payment_method_name: string;
3176
- /** Selected Payment Method */
3177
- payment_method: IPaymentMethod;
3178
- }
3179
- export class Payment extends AppCoreModel implements IPayment {
3180
- invoice_uid: string;
3181
- tender_amount: number;
3182
- change_amount: number;
3183
- payment_method_uid: string;
3184
- payment_method_code: string;
3185
- payment_method_name: string;
3186
- payment_method: PaymentMethod;
3187
- uid: string;
3188
- updated_at: Date;
3189
- constructor();
3190
- }
3191
- /**
3192
- * Payment Method Entity Interface
3193
- */
3194
- export interface IPaymentMethod extends IAppBaseModel, IAppModelSequence {
3195
- /** Payment Currency ID */
3196
- payment_currency_id: number;
3197
- /** Currency Code */
3198
- currency_code: string;
3199
- /** Payment Method Code */
3200
- currency_symbol: string;
3201
- /** Payment Method Code */
3202
- payment_method_code: string;
3203
- /** Payment Name */
3204
- name: string;
3205
- /** Code Name */
3206
- codename: string;
3207
- /** Name Abbreviation */
3208
- name_abbrev: string;
3209
- /** Enable Drawer */
3210
- enable_drawer: boolean;
3211
- /** Enable Receipt */
3212
- enable_receipt: boolean;
3213
- /** Image URL */
3214
- image_url: string;
3215
- /** Is Cash */
3216
- is_cash: boolean;
3217
- /** Is Integrated */
3218
- is_integrated: boolean;
3219
- /** Is Disabled */
3220
- is_disabled: boolean;
3221
- /** Type */
3222
- type: number;
3223
- /** API ID */
3224
- api_id: string;
3225
- /** API Key */
3226
- api_key: string;
3227
- /** Is Sales Exclusive */
3228
- is_sales_exclusive: boolean;
3229
- }
3230
- export class PaymentMethod extends AppBaseModel implements IPaymentMethod {
3231
- sequence: number;
3232
- payment_currency_id: number;
3233
- currency_code: string;
3234
- currency_symbol: string;
3235
- payment_method_code: string;
3236
- name: string;
3237
- codename: string;
3238
- name_abbrev: string;
3239
- enable_drawer: boolean;
3240
- enable_receipt: boolean;
3241
- image_url: string;
3242
- is_cash: boolean;
3243
- is_integrated: boolean;
3244
- is_disabled: boolean;
3245
- type: number;
3246
- api_id: string;
3247
- api_key: string;
3248
- is_sales_exclusive: boolean;
3249
- uid: string;
3250
- constructor();
3251
- }
3252
- export interface IStandardPaymentMethod {
3253
- /** Access Token */
3254
- access_token: string | null;
3255
- /** Base64 encoded image */
3256
- image_base64: string | null;
3257
- /** Error message */
3258
- error: string | null;
3259
- /** Currency code */
3260
- currency_code: string | null;
3261
- /** Payment method code */
3262
- payment_method_code: string;
3263
- /** Codename of the payment method */
3264
- codename: string | null;
3265
- /** Abbreviated name */
3266
- name_abbrev: string | null;
3267
- /** Full name */
3268
- name: string;
3269
- /** Flag to enable drawer */
3270
- enable_drawer: boolean;
3271
- /** Flag to enable receipt */
3272
- enable_receipt: boolean;
3273
- /** Image URL */
3274
- image_url: string;
3275
- /** Flag for cash payment */
3276
- is_cash: boolean;
3277
- /** Flag for integrated payment */
3278
- is_integrated: boolean;
3279
- /** Flag to disable the payment method */
3280
- is_disabled: boolean;
3281
- /** Type of payment method */
3282
- type: number;
3283
- /** API ID */
3284
- api_id: string | null;
3285
- /** API Key */
3286
- api_key: string | null;
3287
- /** Timestamp of creation */
3288
- timestamp_create: number;
3289
- /** Timestamp of last update */
3290
- timestamp_update: number;
3291
- toPaymentMethod(): PaymentMethod;
3292
- }
3293
- export class StandardPaymentMethod implements IStandardPaymentMethod {
3294
- access_token: any;
3295
- image_base64: any;
3296
- error: any;
3297
- currency_code: any;
3298
- payment_method_code: string;
3299
- codename: any;
3300
- name_abbrev: any;
3301
- name: string;
3302
- enable_drawer: boolean;
3303
- enable_receipt: boolean;
3304
- image_url: string;
3305
- is_cash: boolean;
3306
- is_integrated: boolean;
3307
- is_disabled: boolean;
3308
- type: number;
3309
- api_id: any;
3310
- api_key: any;
3311
- timestamp_create: number;
3312
- timestamp_update: number;
3313
- toPaymentMethod(): PaymentMethod;
3314
- constructor(init?: Partial<IPaymentMethod>);
3315
- }
3316
- export type IChangePaymentMethodOption = {
3317
- source_payment: IPayment;
3318
- target_payment_method: IPaymentMethod;
3319
- };
3320
- /**
3321
- * Payment sync status enum
3322
- */
3323
- export enum PaymentStatus {
3324
- STARTED = "payment_started",
3325
- PROCESSING = "payment_processing",
3326
- COMPLETED = "payment_completed",
3327
- FAILED = "payment_failed"
3328
- }
3329
- /**
3330
- * Payment sync data interface
3331
- */
3332
- export interface IPaymentSyncData {
3333
- /** Payment unique identifier */
3334
- payment_uid: string;
3335
- /** Associated invoice ID */
3336
- invoice_uid: string;
3337
- /** Table ID */
3338
- table_uid?: string;
3339
- /** Payment status */
3340
- status: PaymentStatus;
3341
- /** Payment method */
3342
- payment_method: IPaymentMethod;
3343
- /** Payment amount */
3344
- amount: number;
3345
- /** Actual tender amount */
3346
- tender_amount?: number;
3347
- /** Change amount */
3348
- change_amount?: number;
3349
- /** Payment result */
3350
- result?: 'success' | 'failed';
3351
- /** Error message */
3352
- error_message?: string;
3353
- /** Timestamp */
3354
- timestamp: Date;
3355
- /** Employee UID */
3356
- employee_uid?: string;
3357
- /** Terminal ID */
3358
- terminal_id?: string;
3359
- }
3360
-
3361
- }
3362
- declare module '@posx/core/types/printer.type' {
3363
- import { IPrintCommand, PrintCommand } from '@posx/core/libs/escpos.printer';
3364
- import { AppBaseModel, IAppBaseModel, IAppCoreModel } from '@posx/core/types/abstract.type';
3365
- import { IConfig } from '@posx/core/types/config.type';
3366
- import { IInvoice } from '@posx/core/types/invoice.type';
3367
- import { IReportData } from '@posx/core/types/report.type';
3368
- export interface IDevice extends IAppCoreModel {
3369
- machine_name: string;
3370
- connection_id: string;
3371
- type: DeviceType;
3372
- etc: DeviceEtc;
3373
- }
3374
- export type DeviceEtc = {
3375
- fomopay_terminal_id: string;
3376
- hirector_public_key: string;
3377
- hirector_private_key: string;
3378
- };
3379
- export type INode = IDevice;
3380
- export class Device extends AppBaseModel implements IDevice {
3381
- machine_name: string;
3382
- connection_id: string;
3383
- type: DeviceType;
3384
- etc: DeviceEtc;
3385
- constructor();
3386
- }
3387
- export class Node extends AppBaseModel implements INode {
3388
- type: DeviceType;
3389
- machine_name: string;
3390
- connection_id: string;
3391
- etc: DeviceEtc;
3392
- constructor();
3393
- }
3394
- export enum DeviceType {
3395
- Client = "client",
3396
- Node = "node"
3397
- }
3398
- export enum PrinterType {
3399
- ReceiptPrinter = "receipt_printer",
3400
- CheckPrinter = "check_printer",
3401
- OrderPrinter = "order_printer",
3402
- KitchenPrinter = "kitchen_printer",
3403
- KioskPrinter = "kiosk_printer",
3404
- LabelPrinter = "label_printer"
3405
- }
3406
- export interface INodePrinter {
3407
- printer_name: string;
3408
- status: string;
3409
- port_name: string;
3410
- error: string;
3411
- }
3412
- export class NodePrinter implements INodePrinter {
3413
- printer_name: string;
3414
- status: string;
3415
- port_name: string;
3416
- error: string;
3417
- }
3418
- export enum PrinterProtocols {
3419
- ESCPOS = "ESC/POS",
3420
- TSPL = "TSPL"
3421
- }
3422
- export enum PrinterConnections {
3423
- USB = "USB",
3424
- WINDOWS_DRIVER = "WINDOWS_DRIVER",
3425
- ETHERNET = "ETHERNET",
3426
- BLUETOOTH = "BLUETOOTH",
3427
- BUILTIN = "BUILTIN"
3428
- }
3429
- export type IPrintTemplateCore = {
3430
- header: string;
3431
- body: string;
3432
- footer: string;
3433
- commands: string;
3434
- };
3435
- export class PrintTemplateCore implements IPrintTemplateCore {
3436
- header: string;
3437
- body: string;
3438
- footer: string;
3439
- commands: string;
3440
- type: PrinterType;
3441
- constructor();
3442
- }
3443
- export type IPrintTemplate = IPrintTemplateCore & IAppBaseModel & {
3444
- printer_type: PrinterType;
3445
- report_code_name: string;
3446
- };
3447
- export class PrintTemplate extends AppBaseModel implements IPrintTemplate {
3448
- header: string;
3449
- body: string;
3450
- footer: string;
3451
- commands: string;
3452
- printer_type: PrinterType;
3453
- uid: string;
3454
- report_code_name: string;
3455
- constructor();
3456
- }
3457
- export enum PrintJobStatus {
3458
- Queued = "queued",
3459
- Printed = "printed",
3460
- Failed = "failed",
3461
- Expired = "expired"
3462
- }
3463
- export interface IPrintJob extends IAppCoreModel {
3464
- printer_name: string;
3465
- /** Actual printer name using printer driver*/
3466
- driver_printer_name: string;
3467
- printer_ip: string;
3468
- printer_uid: string;
3469
- printer_type: PrinterType;
3470
- protocol: PrinterProtocols;
3471
- connection_type: PrinterConnections;
3472
- data: IPrintCommand;
3473
- commands: string;
3474
- status: PrintJobStatus;
3475
- retries: number;
3476
- save_only: boolean;
3477
- print_times: number;
3478
- printed: number;
3479
- /** Targeting which device to print */
3480
- device_uid_to_print: string;
3481
- /** Designated Table Sections */
3482
- designated_table_section_uids: string[];
3483
- /** Job ID */
3484
- job_id: number;
3485
- }
3486
- export class PrintJob extends AppBaseModel implements IPrintJob {
3487
- printer_name: string;
3488
- driver_printer_name: string;
3489
- printer_ip: string;
3490
- printer_uid: string;
3491
- printer_type: PrinterType;
3492
- protocol: PrinterProtocols;
3493
- connection_type: PrinterConnections;
3494
- data: PrintCommand;
3495
- status: PrintJobStatus;
3496
- retries: number;
3497
- commands: string;
3498
- uid: string;
3499
- save_only: boolean;
3500
- print_times: number;
3501
- printed: number;
3502
- device_uid_to_print: string;
3503
- designated_table_section_uids: any[];
3504
- job_id: number;
3505
- constructor(printer: IPrinter, printData: IPrintCommand, saveOnly?: boolean, printTimes?: number);
3506
- }
3507
- export enum PrinterStatus {
3508
- Online = "online",
3509
- Offline = "offline"
3510
- }
3511
- export interface IPrinter extends IAppBaseModel {
3512
- /** Printer terminal ID */
3513
- device_uid: string;
3514
- /** Printer type */
3515
- type: PrinterType;
3516
- /** Actual printer name using printer driver*/
3517
- driver_printer_name: string;
3518
- /** Backup printer ID */
3519
- fallback_printer_uid: number;
3520
- /** Printer protocol */
3521
- protocol: PrinterProtocols;
3522
- /** Printer connection type */
3523
- connection_type: PrinterConnections;
3524
- /** Print template UID */
3525
- print_template_uid?: string;
3526
- /** Printer IP address */
3527
- ip_address?: string;
3528
- /** Printer status */
3529
- status: PrinterStatus;
3530
- /** if it is consolidated print or itemized print when it is kitchen printer */
3531
- kitchen_itemized_print: boolean;
3532
- /** Number of times to print */
3533
- print_times: number;
3534
- /** Number of retries */
3535
- retries: number;
3536
- }
3537
- export class Printer extends AppBaseModel implements IPrinter {
3538
- device_uid: string;
3539
- type: PrinterType;
3540
- driver_printer_name: string;
3541
- fallback_printer_uid: number;
3542
- protocol: PrinterProtocols;
3543
- connection_type: PrinterConnections;
3544
- print_template_uid: string;
3545
- uid: string;
3546
- ip_address: string;
3547
- status: PrinterStatus;
3548
- kitchen_itemized_print: boolean;
3549
- print_times: number;
3550
- retries: number;
3551
- constructor();
3552
- }
3553
- export interface TemplateData {
3554
- config: IConfig;
3555
- invoice: IInvoice;
3556
- printer_name: string;
3557
- printed_at: Date;
3558
- normalized_printed_at: string;
3559
- report_data: IReportData;
3560
- }
3561
- export class TemplateData implements TemplateData {
3562
- config: IConfig;
3563
- invoice: IInvoice;
3564
- report_data: IReportData;
3565
- printer_name: string;
3566
- printed_at: Date;
3567
- normalized_printed_at: string;
3568
- }
3569
- export type IRenderPrintTemplateOptions = {
3570
- printer_name: string;
3571
- kitchen_itemized_print: boolean;
3572
- };
3573
- export class RenderPrintTemplateOptions implements IRenderPrintTemplateOptions {
3574
- printer_name: string;
3575
- kitchen_itemized_print: boolean;
3576
- }
3577
-
3578
- }
3579
- declare module '@posx/core/types/product.type' {
3580
- import { IAppModelSequence } from '@posx/core/services/abstract.service';
3581
- import { AppCoreModel, AppExtraModel, IAppCoreModel, IAppExtraModel } from '@posx/core/types/abstract.type';
3582
- export interface IProductBase extends IAppExtraModel, IAppModelSequence {
3583
- /**
3584
- * color of the object
3585
- */
3586
- color: string;
3587
- /**
3588
- * icon of the object
3589
- */
3590
- icon: string;
3591
- /**
3592
- * meta data
3593
- * @ignore
3594
- */
3595
- meta: Record<string, any>;
3596
- /**
3597
- * extra data
3598
- * @ignore
3599
- */
3600
- etc: Record<string, any>;
3601
- /**
3602
- * assets of the product (for image, etc)
3603
- * Predefined keys that can be used by the system
3604
- */
3605
- assets: ProductPartialAssets & Record<string, any>;
3606
- /**
3607
- * config of the product
3608
- * Predefined keys that can be used by the system
3609
- */
3610
- config: ProductPartialConfig & Record<string, any>;
3611
- }
3612
- /**
3613
- * Predefined asset keys that can be used in the product assets
3614
- */
3615
- export type ProductPartialAssets = {
3616
- /**
3617
- * large image url for online order
3618
- */
3619
- online_order_large_image_url?: string;
3620
- /**
3621
- * large image thumbnail url for online order
3622
- */
3623
- online_order_large_image_thumbnail_url?: string;
3624
- /**
3625
- * large image file path for online order
3626
- */
3627
- online_order_large_image_file_path?: string;
3628
- /**
3629
- * small image url for online order
3630
- */
3631
- online_order_small_image_url?: string;
3632
- /**
3633
- * small image thumbnail url for online order
3634
- */
3635
- online_order_small_image_thumbnail_url?: string;
3636
- /**
3637
- * small image file path for online order
3638
- */
3639
- online_order_small_image_file_path?: string;
3640
- };
3641
- /**
3642
- * Predefined config keys that can be used in the product configs
3643
- */
3644
- export type ProductPartialConfig = {
3645
- /**
3646
- * display large image for online order, if false, small image will be displayed
3647
- */
3648
- online_order_display_large_image: boolean;
3649
- };
3650
- export class ProductBase extends AppExtraModel implements IProductBase {
3651
- meta: {};
3652
- etc: {};
3653
- assets: {};
3654
- config: {
3655
- online_order_display_large_image: boolean;
3656
- };
3657
- color: string;
3658
- icon: string;
3659
- sequence: number;
3660
- constructor();
3661
- }
3662
- export interface IVisibility {
3663
- system: System;
3664
- visible: boolean;
3665
- sequence: number;
3666
- }
3667
- export class Visibility implements IVisibility {
3668
- system: System;
3669
- visible: boolean;
3670
- sequence: number;
3671
- constructor();
3672
- }
3673
- export enum System {
3674
- POS = "pos",
3675
- QrCodeOrder = "qr_code_order"
3676
- }
3677
- export interface ICoreCategory extends IProductBase {
3678
- type: CategoryType;
3679
- visibility: Array<Visibility>;
3680
- /**
3681
- * maximum order quantity before you can order
3682
- */
3683
- max_order: number;
3684
- /**
3685
- * minimum order quantity before you can order
3686
- */
3687
- min_order: number;
3688
- }
3689
- export interface ICategory extends ICoreCategory {
3690
- image_url: string;
3691
- /**
3692
- * image file path
3693
- */
3694
- image_file_path: string;
3695
- /**
3696
- *
3697
- */
3698
- image_thumbnail_url: string;
3699
- /**
3700
- * image thumbnail file path
3701
- */
3702
- image_thumbnail_file_path: string;
3703
- /** if category has subcategory */
3704
- has_subcategory: boolean;
3705
- /** Printing sequence number */
3706
- printing_sequence: number;
3707
- /**
3708
- * subcategories of the category
3709
- */
3710
- subcategories: Array<ISubcategory>;
3711
- }
3712
- export enum CategoryType {
3713
- Product = "product",
3714
- Modifier = "modifier"
3715
- }
3716
- export class CoreCategory extends ProductBase implements ICoreCategory {
3717
- type: CategoryType;
3718
- visibility: Visibility[];
3719
- uid: string;
3720
- max_order: number;
3721
- min_order: number;
3722
- constructor();
3723
- }
3724
- export class Category extends ProductBase implements ICategory {
3725
- image_url: string;
3726
- image_file_path: string;
3727
- image_thumbnail_url: string;
3728
- image_thumbnail_file_path: string;
3729
- has_subcategory: boolean;
3730
- name_translations: Record<string, string>;
3731
- visibility: Visibility[];
3732
- printing_sequence: number;
3733
- type: CategoryType;
3734
- subcategories: any[];
3735
- uid: string;
3736
- max_order: number;
3737
- min_order: number;
3738
- constructor();
3739
- }
3740
- export interface ISubcategory extends IProductBase {
3741
- /** Category ID */
3742
- category_uid: string;
3743
- }
3744
- export class Subcategory extends ProductBase implements ISubcategory {
3745
- category_uid: string;
3746
- uid: string;
3747
- constructor();
3748
- }
3749
- export enum ProductType {
3750
- ByQuantity = "by_quantity",
3751
- ByWeight = "by_weight",
3752
- Service = "service",
3753
- Combo = "combo",
3754
- Modifier = "modifier",
3755
- Package = "package"
3756
- }
3757
- /**
3758
- * Interface for a core item, which extends the IProductBase interface.
3759
- */
3760
- export interface ICoreItem extends IProductBase {
3761
- /**
3762
- * Rank of the item
3763
- */
3764
- image_url: string;
3765
- /**
3766
- * image file path
3767
- */
3768
- image_file_path: string;
3769
- /**
3770
- * @ignore
3771
- */
3772
- image_thumbnail_url: string;
3773
- /**
3774
- * image thumbnail file path
3775
- */
3776
- image_thumbnail_file_path: string;
3777
- /**
3778
- * The SKU (stock keeping unit) of the item.
3779
- */
3780
- sku: string;
3781
- /**
3782
- * The type of product.
3783
- */
3784
- type: ProductType;
3785
- /**
3786
- * The visibility of the item.
3787
- */
3788
- visibility: Array<Visibility>;
3789
- /**
3790
- * The barcode of the item.
3791
- */
3792
- barcode: string;
3793
- /**
3794
- * The price of the item.
3795
- */
3796
- price: number;
3797
- /**
3798
- * The unique identifier of the category that the item belongs to.
3799
- */
3800
- category_uid: string;
3801
- /**
3802
- * The current stock level of the item.
3803
- * @ignore
3804
- */
3805
- stock: number;
3806
- /**
3807
- * Whether or not the item is sold out.
3808
- */
3809
- is_sold_out: boolean;
3810
- /**
3811
- * Whether or not the item should be printed on the receipt.
3812
- */
3813
- print_on_receipt: boolean;
3814
- /**
3815
- * Whether or not the price of the item can be adjusted.
3816
- */
3817
- price_adjustable: boolean;
3818
- }
3819
- export class CoreItem extends ProductBase implements ICoreItem {
3820
- image_url: string;
3821
- image_file_path: string;
3822
- image_thumbnail_url: string;
3823
- image_thumbnail_file_path: string;
3824
- visibility: Visibility[];
3825
- sku: string;
3826
- type: ProductType;
3827
- barcode: string;
3828
- category_uid: string;
3829
- price: number;
3830
- stock: number;
3831
- print_on_receipt: boolean;
3832
- price_adjustable: boolean;
3833
- is_sold_out: boolean;
3834
- uid: string;
3835
- constructor();
3836
- }
3837
- /**
3838
- * Items
3839
- */
3840
- export interface IItem extends ICoreItem {
3841
- /**
3842
- * Codename of the item
3843
- */
3844
- codename: string;
3845
- /**
3846
- * Recipe of the item
3847
- */
3848
- recipe: string;
3849
- /**
3850
- * Credit value of the item
3851
- */
3852
- add_credit: number;
3853
- /**
3854
- * Subcategory ID of the item
3855
- */
3856
- subcategory_uid: string;
3857
- /**
3858
- * Unit of the item
3859
- * @ignore
3860
- */
3861
- unit: number;
3862
- /**
3863
- * Number of items sold
3864
- * @ignore
3865
- */
3866
- sold: number;
3867
- /**
3868
- * if editor will be opened by default when item is clicked
3869
- */
3870
- open_editor: boolean;
3871
- /**
3872
- * how many points will be used to purchase the item
3873
- */
3874
- minus_point: number;
3875
- /**
3876
- * Cost of the item
3877
- */
3878
- cost: number;
3879
- /**
3880
- * Indicates whether the item is discountable
3881
- */
3882
- discountable: boolean;
3883
- /**
3884
- * Printing sequence of the item
3885
- * @ignore
3886
- */
3887
- printing_sequence: number;
3888
- /**
3889
- * Number of likes for the item
3890
- * @ignore
3891
- */
3892
- likes: number;
3893
- /**
3894
- * Number of dislikes for the item
3895
- * @ignore
3896
- */
3897
- dislikes: number;
3898
- /**
3899
- * if the item is recommended
3900
- */
3901
- recommended: boolean;
3902
- /**
3903
- * Indicates whether the item is tax exempt
3904
- */
3905
- is_tax_exempt: boolean;
3906
- /**
3907
- * Indicates whether the item is service charge exempt
3908
- */
3909
- is_service_charge_exempt: boolean;
3910
- /**
3911
- * Indicates whether the item is point reward exempt
3912
- */
3913
- is_point_reward_exempt: boolean;
3914
- /**
3915
- * Indicates whether the item is credit reward exempt
3916
- */
3917
- is_credit_reward_exempt: boolean;
3918
- /**
3919
- * Indicates whether the item is internal and displayed in the POS only
3920
- */
3921
- is_internal: boolean;
3922
- /**
3923
- * Modifier IDs of the item
3924
- */
3925
- modifiers?: Array<ICoreItem>;
3926
- /**
3927
- * Modifier Group IDs of the item
3928
- */
3929
- modifier_categories?: Array<ICoreCategory>;
3930
- /**
3931
- * Kitchen printer IDs of the item
3932
- */
3933
- kitchen_printers_uids: Array<string>;
3934
- /**
3935
- * Order printer IDs of the item
3936
- */
3937
- order_printers_uids: Array<string>;
3938
- /**
3939
- * Label printer IDs of the item
3940
- */
3941
- label_printers_uids: Array<string>;
3942
- /**
3943
- * if editor will be opened by default when item is clicked
3944
- */
3945
- open_editor_panel: boolean;
3946
- /**
3947
- * if price editor will be opened by default when item is clicked
3948
- */
3949
- open_price_editor: boolean;
3950
- }
3951
- export class Item extends ProductBase implements IItem {
3952
- image_url: string;
3953
- image_file_path: string;
3954
- image_thumbnail_url: string;
3955
- image_thumbnail_file_path: string;
3956
- visibility: Visibility[];
3957
- codename: string;
3958
- sku: string;
3959
- recipe: string;
3960
- barcode: string;
3961
- type: ProductType;
3962
- add_credit: number;
3963
- category_uid: string;
3964
- subcategory_uid: string;
3965
- unit: number;
3966
- stock: number;
3967
- is_sold_out: boolean;
3968
- sold: number;
3969
- print_on_receipt: boolean;
3970
- price: number;
3971
- open_editor: boolean;
3972
- price_adjustable: boolean;
3973
- minus_point: number;
3974
- cost: number;
3975
- discountable: boolean;
3976
- printing_sequence: number;
3977
- recommended: boolean;
3978
- likes: number;
3979
- dislikes: number;
3980
- is_tax_exempt: boolean;
3981
- is_service_charge_exempt: boolean;
3982
- is_point_reward_exempt: boolean;
3983
- is_credit_reward_exempt: boolean;
3984
- is_internal: boolean;
3985
- uid: string;
3986
- kitchen_printers_uids: any[];
3987
- order_printers_uids: any[];
3988
- label_printers_uids: any[];
3989
- open_editor_panel: boolean;
3990
- open_price_editor: boolean;
3991
- constructor();
3992
- }
3993
- export interface IPrice extends IAppCoreModel {
3994
- /** keys to look up the price */
3995
- lookup_keys: Array<string>;
3996
- /** product uid*/
3997
- product_uid: string;
3998
- /** price of the item */
3999
- amount: number;
4000
- }
4001
- export class Price extends AppCoreModel implements IPrice {
4002
- lookup_keys: any[];
4003
- product_uid: string;
4004
- amount: any;
4005
- constructor();
4006
- }
4007
-
4008
- }
4009
- declare module '@posx/core/types/report.type' {
4010
- import { IAppBase, IAppCoreModel, AppCoreModel } from '@posx/core/types/abstract.type';
4011
- import { IConfig } from '@posx/core/types/config.type';
4012
- export type IReportCategory = IAppBase & {
4013
- reports: IReport[];
4014
- };
4015
- export type IReport = IAppBase & {
4016
- type: ReportType;
4017
- codename: string;
4018
- };
4019
- export enum ReportType {
4020
- 'printable' = 0,
4021
- 'generative' = 1
4022
- }
4023
- export class ReportCategory implements IReportCategory {
4024
- uid: string;
4025
- name: string;
4026
- name_translations: Record<string, string>;
4027
- reports: Report[];
4028
- created_at: Date;
4029
- created_at_timestamp: number;
4030
- updated_at: Date;
4031
- deleted_at: any;
4032
- constructor();
4033
- }
4034
- export class Report implements IReport {
4035
- uid: string;
4036
- name: string;
4037
- name_translations: Record<string, string>;
4038
- type: ReportType.printable;
4039
- codename: string;
4040
- created_at: Date;
4041
- created_at_timestamp: number;
4042
- updated_at: Date;
4043
- deleted_at: any;
4044
- constructor();
4045
- }
4046
- export interface IAppReport extends IAppCoreModel {
4047
- reports: IReportCategory[];
4048
- version: number;
4049
- }
4050
- export class AppReport extends AppCoreModel implements IAppReport {
4051
- uid: string;
4052
- reports: ReportCategory[];
4053
- version: number;
4054
- constructor();
4055
- }
4056
- export type IReportRequest = {
4057
- /**
4058
- * 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.)
4059
- */
4060
- shift_uid: string;
4061
- /**
4062
- * start date and time
4063
- */
4064
- start_datetime: Date;
4065
- /**
4066
- * end date and time
4067
- */
4068
- end_datetime: Date;
4069
- /**
4070
- * report code name
4071
- */
4072
- report_code_name: string;
4073
- /**
4074
- * number of copies, default is 1
4075
- */
4076
- copies: number;
4077
- declared_amount: number;
4078
- };
4079
- export type IReportData = {
4080
- start_datetime: string;
4081
- humanized_start_datetime: string;
4082
- end_datetime: string;
4083
- humanized_end_datetime: string;
4084
- sales_summary: ISalesSummary;
4085
- drawer_summary: IDrawerSummary;
4086
- payments_summary: IPaymentSummary[];
4087
- loyalty_program_summary: ILoyaltyProgramSummary;
4088
- config: IConfig;
4089
- };
4090
- export class ReportData implements IReportData {
4091
- start_datetime: string;
4092
- humanized_start_datetime: string;
4093
- end_datetime: string;
4094
- humanized_end_datetime: string;
4095
- sales_summary: SalesSummary;
4096
- drawer_summary: DrawerSummary;
4097
- payments_summary: PaymentSummary[];
4098
- loyalty_program_summary: LoyaltyProgramSummary;
4099
- config: IConfig;
4100
- }
4101
- export type ISalesSummary = {
4102
- sales_total: number;
4103
- foc_sales_total: number;
4104
- foc_sales_count: number;
4105
- rounding_total: number;
4106
- tax_total: number;
4107
- service_charge_total: number;
4108
- discount_total: number;
4109
- voucher_total: number;
4110
- voucher_count: number;
4111
- coupon_total: number;
4112
- coupon_count: number;
4113
- paid_invoice_count: number;
4114
- paid_invoice_total: number;
4115
- void_invoice_count: number;
4116
- void_invoice_total: number;
4117
- total_pax: number;
4118
- };
4119
- export class SalesSummary implements ISalesSummary {
4120
- sales_total: number;
4121
- foc_sales_total: number;
4122
- foc_sales_count: number;
4123
- rounding_total: number;
4124
- tax_total: number;
4125
- service_charge_total: number;
4126
- discount_total: number;
4127
- voucher_total: number;
4128
- voucher_count: number;
4129
- coupon_total: number;
4130
- coupon_count: number;
4131
- paid_invoice_count: number;
4132
- paid_invoice_total: number;
4133
- void_invoice_count: number;
4134
- void_invoice_total: number;
4135
- total_pax: number;
4136
- }
4137
- export type IDrawerSummary = {
4138
- open_amount: number;
4139
- declared_amount: number;
4140
- drawer_amount: number;
4141
- difference: number;
4142
- pay_in_total: number;
4143
- pay_in_count: number;
4144
- pay_out_total: number;
4145
- pay_out_count: number;
4146
- };
4147
- export class DrawerSummary implements IDrawerSummary {
4148
- open_amount: number;
4149
- declared_amount: number;
4150
- drawer_amount: number;
4151
- difference: number;
4152
- pay_in_total: number;
4153
- pay_in_count: number;
4154
- cash_invoice_total: number;
4155
- cash_invoice_count: number;
4156
- pay_out_total: number;
4157
- pay_out_count: number;
4158
- }
4159
- export type IPaymentSummary = {
4160
- code: string;
4161
- name: string;
4162
- total: number;
4163
- count: number;
4164
- };
4165
- export class PaymentSummary implements IPaymentSummary {
4166
- code: string;
4167
- name: string;
4168
- total: number;
4169
- count: number;
4170
- }
4171
- export type ILoyaltyProgramSummary = {
4172
- add_credit_total: number;
4173
- add_credit_count: number;
4174
- rewarded_credit_total: number;
4175
- rewarded_credit_count: number;
4176
- minus_credit_total: number;
4177
- minus_credit_count: number;
4178
- rewarded_point_total: number;
4179
- rewarded_point_count: number;
4180
- minus_point_total: number;
4181
- minus_point_count: number;
4182
- };
4183
- export class LoyaltyProgramSummary implements ILoyaltyProgramSummary {
4184
- add_credit_total: number;
4185
- add_credit_count: number;
4186
- rewarded_credit_total: number;
4187
- rewarded_credit_count: number;
4188
- minus_credit_total: number;
4189
- minus_credit_count: number;
4190
- rewarded_point_total: number;
4191
- rewarded_point_count: number;
4192
- minus_point_total: number;
4193
- minus_point_count: number;
4194
- }
4195
-
4196
- }
4197
- declare module '@posx/core/types/request.type' {
4198
- export interface IFileUploadRequest {
4199
- name: string;
4200
- base64: string;
4201
- extension: string;
4202
- }
4203
- export class FileUploadRequest implements IFileUploadRequest {
4204
- name: string;
4205
- base64: string;
4206
- extension: string;
4207
- constructor(init?: Partial<IFileUploadRequest>);
4208
- }
4209
-
4210
- }
4211
- declare module '@posx/core/types/role.type' {
4212
- import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
4213
- export interface IEmployeeRole extends IAppBaseModel {
4214
- permissions: string[];
4215
- is_default: boolean;
4216
- }
4217
- export class EmployeeRole extends AppBaseModel implements IEmployeeRole {
4218
- permissions: string[];
4219
- is_default: boolean;
4220
- uid: string;
4221
- constructor();
4222
- }
4223
-
4224
- }
4225
- declare module '@posx/core/types/section.type' {
4226
- import { IAppModelSequence } from '@posx/core/services/abstract.service';
4227
- import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
4228
- export enum SectionItemStatus {
4229
- CLOSED = "closed",
4230
- OPENED = "opened",
4231
- PAYMENT = "payment"
4232
- }
4233
- export interface ISectionItem extends IAppBaseModel {
4234
- /** List of printer ID order */
4235
- printer_id_order_list: number[];
4236
- /** Total amount */
4237
- total: number;
4238
- /** Time duration */
4239
- time: number;
4240
- /** Number of persons */
4241
- pax: number;
4242
- /** Invoice created timestamp */
4243
- invoice_created_at: string;
4244
- /** Number of child persons */
4245
- child_pax: number;
4246
- /** Number of baby persons */
4247
- baby_pax: number;
4248
- /** Invoice ID */
4249
- invoice_uid: string;
4250
- /** Section ID */
4251
- section_uid: string;
4252
- /** Table status */
4253
- status: SectionItemStatus;
4254
- /** Table size in X direction */
4255
- size_x: number;
4256
- /** Table size in Y direction */
4257
- size_y: number;
4258
- /** Table x axis */
4259
- row: number;
4260
- /** Table y axis */
4261
- col: number;
4262
- /** Flag for take out */
4263
- is_take_out: boolean;
4264
- /** Soup base quota */
4265
- soup_base_quota: number;
4266
- /** Soup base type */
4267
- soup_base_type: number;
4268
- }
4269
- export class SectionItem extends AppBaseModel implements ISectionItem {
4270
- printer_id_order_list: number[];
4271
- total: number;
4272
- time: number;
4273
- pax: number;
4274
- invoice_created_at: string;
4275
- child_pax: number;
4276
- baby_pax: number;
4277
- uid: string;
4278
- invoice_uid: string;
4279
- section_uid: string;
4280
- status: SectionItemStatus;
4281
- size_x: number;
4282
- size_y: number;
4283
- row: number;
4284
- col: number;
4285
- is_take_out: boolean;
4286
- soup_base_quota: number;
4287
- soup_base_type: number;
4288
- is_delete: boolean;
4289
- constructor();
4290
- }
4291
- export type ISection = IAppBaseModel & IAppModelSequence;
4292
- export class Section extends AppBaseModel implements ISection {
4293
- sequence: number;
4294
- uid: string;
4295
- constructor();
4296
- }
4297
-
4298
- }
4299
- declare module '@posx/core/types/shift.type' {
4300
- import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
4301
- export enum ShiftStatus {
4302
- Open = "opened",
4303
- Closed = "closed"
4304
- }
4305
- export interface IShift extends IAppCoreModel {
4306
- /** user uid */
4307
- user_uid: string;
4308
- /** shift started at */
4309
- started_at: Date;
4310
- /** shift closed at */
4311
- ended_at: Date;
4312
- /** amount declared by user */
4313
- declared_amount: number;
4314
- /** amount recorded by */
4315
- drawer_amount: number;
4316
- /** Operation Status */
4317
- status: ShiftStatus;
4318
- /** first invoice number */
4319
- first_invoice_number: number;
4320
- }
4321
- export class Shift extends AppCoreModel implements IShift {
4322
- user_uid: string;
4323
- started_at: Date;
4324
- ended_at: Date;
4325
- declared_amount: number;
4326
- drawer_amount: number;
4327
- first_invoice_number: number;
4328
- status: ShiftStatus;
4329
- uid: string;
4330
- constructor();
4331
- }
4332
- export enum TillType {
4333
- OpenDeposit = "open_deposit",
4334
- CashDeposit = "cash_deposit",
4335
- CashIn = "cash_in",
4336
- CashOut = "cash_out",
4337
- CashInvoice = "cash_invoice"
4338
- }
4339
- export interface ITill extends AppCoreModel {
4340
- /** user uid */
4341
- user_uid: string;
4342
- /** operation history id */
4343
- shift_uid: string;
4344
- /** invoice uid */
4345
- invoice_uid: string;
4346
- /** Till Type */
4347
- type: TillType;
4348
- /** Amount */
4349
- amount: number;
4350
- /** Note */
4351
- note: string;
4352
- }
4353
- export class Till extends AppCoreModel implements ITill {
4354
- user_uid: string;
4355
- shift_uid: string;
4356
- invoice_uid: string;
4357
- type: TillType;
4358
- amount: number;
4359
- note: string;
4360
- uid: string;
4361
- constructor();
4362
- }
4363
-
4364
- }
4365
- declare module '@posx/core/types/wyo.coupon.type' {
4366
- enum ApplyingType {
4367
- All = 1,
4368
- Inclusive = 2,
4369
- Exclusive = 3
4370
- }
4371
- enum CalcType {
4372
- Flat = 1,
4373
- Percent = 2
4374
- }
4375
- export interface IApplying<T> {
4376
- applyingType: ApplyingType;
4377
- applyingItems: T[];
4378
- }
4379
- export interface ICoupon {
4380
- /** Coupon guid */
4381
- guid: string;
4382
- /** Promotion code which is used to look up the coupon */
4383
- promo_code: string;
4384
- /** If this coupon can be used for multiple stores */
4385
- is_multi_stores?: boolean;
4386
- /** Coupon primary name */
4387
- name: string;
4388
- /** Coupon alias */
4389
- alias?: string;
4390
- /** Coupon primary description */
4391
- description?: string;
4392
- /** Coupon alias description */
4393
- description_alias?: string;
4394
- /** Applying PLUs (Price Lookup Code) */
4395
- applying_plus: IApplying<string>;
4396
- /** Applying User Tags */
4397
- applying_user_tags: IApplying<string>;
4398
- /** Applying User Groups */
4399
- applying_user_groups: IApplying<number>;
4400
- /** Discount Calculation Type */
4401
- discount_calc_type: CalcType;
4402
- /** Flat discount amount */
4403
- discount_amount?: number;
4404
- /** Percent discount (e.g. 30% => 0.3) */
4405
- discount_percent?: number;
4406
- /** Expiring duration in day after coupon is purchased */
4407
- duration?: number;
4408
- /** How many of this coupon has been redeemed */
4409
- usage_count: number;
4410
- /** How many of this coupon can be redeemed within an invoice */
4411
- usage_limit_per_invoice?: number;
4412
- /** Only above a specified invoice total before this coupon can be redeemed */
4413
- above_invoice_amount?: number;
4414
- /** Only below a specified invoice total before this coupon can be redeemed */
4415
- below_invoice_amount?: number;
4416
- /** Can this coupon be used to offset delivery fee */
4417
- is_delivery_free?: boolean;
4418
- /** If this coupon can only be used individually without stacking other coupons together */
4419
- is_individual_use?: boolean;
4420
- /** The amount of points to redeem this coupon */
4421
- price_in_points?: number;
4422
- /** Styles of the coupon */
4423
- styles?: Record<string, string>;
4424
- /** When this coupon will be expired */
4425
- expired_at?: Date;
4426
- /** If auto generation is true, the coupon will be automatically generated for all applicable users */
4427
- auto_gen?: boolean;
4428
- /** If this coupon has been disabled for purchasing */
4429
- can_sell?: boolean;
4430
- /** If this coupon has been disabled for redemption */
4431
- can_redeem?: boolean;
4432
- }
4433
- export class Coupon implements ICoupon {
4434
- guid: string;
4435
- promo_code: string;
4436
- is_multi_stores: boolean;
4437
- name: string;
4438
- alias?: string;
4439
- description?: string;
4440
- description_alias?: string;
4441
- applying_plus: IApplying<string>;
4442
- applying_user_tags: IApplying<string>;
4443
- applying_user_groups: IApplying<number>;
4444
- discount_calc_type: CalcType;
4445
- discount_amount?: number;
4446
- discount_percent?: number;
4447
- duration: number;
4448
- usage_count: number;
4449
- usage_limit_per_invoice: number;
4450
- above_invoice_amount?: number;
4451
- below_invoice_amount?: number;
4452
- is_delivery_free: boolean;
4453
- is_individual_use: boolean;
4454
- price_in_points?: number;
4455
- styles: Record<string, string>;
4456
- expired_at?: Date;
4457
- auto_gen: boolean;
4458
- can_sell: boolean;
4459
- can_redeem: boolean;
4460
- constructor(couponToClone?: Coupon);
4461
- }
4462
- export interface ICouponUsage {
4463
- invoice_uid: string;
4464
- }
4465
- export class CouponUsage implements ICouponUsage {
4466
- invoice_uid: string;
4467
- constructor(couponUsageToClone?: CouponUsage);
4468
- }
4469
- export interface ICouponItemized {
4470
- /** Coupon itemized guid */
4471
- guid: string;
4472
- /** A snapshot of coupon at the time of purchase */
4473
- coupon: ICoupon;
4474
- /** If this coupon can be used for multiple stores, default: false */
4475
- is_multi_stores?: boolean;
4476
- /** Coupon usage record if it is redeemed */
4477
- usage: ICouponUsage;
4478
- /** Employee unique id */
4479
- employee_uid: string;
4480
- /** Promotion code which is used to look up the coupon */
4481
- promo_code: string;
4482
- /** If coupons are expired */
4483
- is_expired: boolean;
4484
- /** If the coupons are fully redeemed */
4485
- is_redeemed: boolean;
4486
- /** If the coupon is generated instead of purchase */
4487
- is_generated: boolean;
4488
- }
4489
- export class CouponItemized implements ICouponItemized {
4490
- guid: string;
4491
- coupon: Coupon;
4492
- is_multi_stores?: boolean;
4493
- usage: CouponUsage;
4494
- employee_uid: string;
4495
- promo_code: string;
4496
- is_expired: boolean;
4497
- is_redeemed: boolean;
4498
- is_generated: boolean;
4499
- constructor(itemized?: CouponItemized);
4500
- }
4501
- export {};
4502
-
4503
- }
4504
- declare module '@posx/core/types/wyo.customer.type' {
4505
- export interface IAddress {
4506
- /** Address line 1 */
4507
- address1: string;
4508
- /** Address line 2 */
4509
- address2: string;
4510
- /** Latitude coordinate */
4511
- lat: string;
4512
- /** Longitude coordinate */
4513
- lng: string;
4514
- /** Postal code */
4515
- postcode: string;
4516
- /** Note associated with the address */
4517
- note: string;
4518
- /** Indicates if the address is the default one */
4519
- is_default: boolean;
4520
- /** Name associated with the address */
4521
- name: string;
4522
- /** Salutation associated with the address */
4523
- salute: string;
4524
- /** Phone number associated with the address */
4525
- phone_number: string;
4526
- }
4527
- /**
4528
- * Class representing the Address model.
4529
- */
4530
- export class Address implements IAddress {
4531
- address1: string;
4532
- address2: string;
4533
- lat: string;
4534
- lng: string;
4535
- postcode: string;
4536
- note: string;
4537
- is_default: boolean;
4538
- name: string;
4539
- salute: string;
4540
- phone_number: string;
4541
- constructor();
4542
- }
4543
- export interface IUser {
4544
- id: number;
4545
- /** Reference ID */
4546
- ref_id: string;
4547
- /** Image URL */
4548
- image_url: string;
4549
- /** Stripe Token */
4550
- stripe_token: string;
4551
- /** Stripe Customer ID */
4552
- stripe_customer_id: string;
4553
- /** User Name */
4554
- username: string;
4555
- /** Normalized User Name */
4556
- normalized_username: string;
4557
- /** Company */
4558
- company: string;
4559
- /** Identification Card */
4560
- ic: string;
4561
- /** Display Name */
4562
- display_name: string;
4563
- /** Full Name */
4564
- full_name: string;
4565
- /** Birth Date */
4566
- birth_date: string;
4567
- /** Gender */
4568
- gender: string;
4569
- /** Address */
4570
- address: string;
4571
- /** Postcode */
4572
- postcode: string;
4573
- /** Note */
4574
- note: string;
4575
- /** Language */
4576
- language: string;
4577
- /** Time Zone */
4578
- time_zone: string;
4579
- /** Created At */
4580
- created_at: Date;
4581
- /** Updated At */
4582
- updated_at: Date;
4583
- /** License IDs */
4584
- license_ids: string;
4585
- /** Security Stamp */
4586
- security_stamp: string;
4587
- /** Phone Number */
4588
- phone_number: string;
4589
- }
4590
- export class User implements IUser {
4591
- id: number;
4592
- ref_id: string;
4593
- image_url: string;
4594
- stripe_token: string;
4595
- stripe_customer_id: string;
4596
- username: string;
4597
- normalized_username: string;
4598
- company: string;
4599
- ic: string;
4600
- display_name: string;
4601
- full_name: string;
4602
- birth_date: string;
4603
- gender: string;
4604
- address: string;
4605
- postcode: string;
4606
- note: string;
4607
- language: string;
4608
- time_zone: string;
4609
- created_at: Date;
4610
- updated_at: Date;
4611
- license_ids: string;
4612
- security_stamp: string;
4613
- phone_number: string;
4614
- constructor();
4615
- }
4616
- export interface ICustomer extends IUser {
4617
- /** License ID */
4618
- license_id: number;
4619
- /** Credit */
4620
- credit: number;
4621
- /** Point */
4622
- point: number;
4623
- /** Transaction Total */
4624
- transaction_total: number;
4625
- /** Transaction Time */
4626
- transaction_time: number;
4627
- /** User Group ID */
4628
- user_group_id: number;
4629
- /** User Group Name */
4630
- user_group_name: string;
4631
- /** Group Expires At */
4632
- group_expires_at: Date | null;
4633
- /** Error */
4634
- error: string;
4635
- }
4636
- export class Customer extends User implements ICustomer {
4637
- license_id: number;
4638
- credit: number;
4639
- point: number;
4640
- transaction_total: number;
4641
- transaction_time: number;
4642
- user_group_id: number;
4643
- user_group_name: string;
4644
- group_expires_at: Date | null;
4645
- error: string;
4646
- constructor();
4647
- }
4648
-
4649
- }
4650
- declare module '@posx/core/utils/autoquery.utils' {
4651
- import { Operator, OperatorValueMap, SortOrder } from '@posx/core/types/auto.query.type';
4652
- export class QueryBuilder<T> {
4653
- private params;
4654
- addParam<K extends keyof T, O extends Operator<T[K]>>(property: K, operator: O, value: OperatorValueMap[O]): this;
4655
- addRawParam(key: string, value: string): this;
4656
- includeTotal(flag: boolean): this;
4657
- skip(skip: number): this;
4658
- take(take: number): this;
4659
- sortBy<K extends keyof T>(property: K, orderBy: SortOrder): this;
4660
- jsconfig(param: string): this;
4661
- /** @internal */
4662
- _build(): Record<string, string>;
4663
- }
4664
- export type QueryEtcParams = {
4665
- search_keywords: string | undefined;
4666
- };
4667
-
4668
- }
4669
- declare module '@posx/core/utils/http.utils' {
4670
- /**
4671
- * create a new instance of axios
4672
- * @param baseURL
4673
- * @param key
4674
- * @param uid
4675
- * @param token
4676
- * @returns
4677
- */
4678
- export function createInstance(baseURL: string, uid: string, token: string): import("axios").AxiosInstance;
4679
-
4680
- }
4681
- declare module '@posx/core/utils/misc.utils' {
4682
- export function humanizedData(date: Date): string;
4683
- export function normalizedDate(date: Date): string;
4684
-
4685
- }
4686
- declare module '@posx/core/utils/obj.utils' {
4687
- export function nameOf<T>(nameExtractor: (obj: T) => any): string;
4688
-
4689
- }
4690
- declare module '@posx/core' {
4691
- import main = require('@posx/core/index');
4692
- export = main;
4693
- }