@reservation-studio/electron-types 0.0.12 → 0.0.13

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.
@@ -10,8 +10,17 @@ export declare enum IpcActions {
10
10
  FISCAL_LIST = "fiscal:list",
11
11
  FISCAL_SET_ACTIVE = "fiscal:set-active",
12
12
  FISCAL_GET_ACTIVE = "fiscal:get-active",
13
+ FISCAL_GET_DEVICE_INFO = "fiscal:get-device-info",
13
14
  FISCAL_PRINT_RECEIPT = "fiscal:print-receipt",
15
+ FISCAL_PRINT_REVERSAL_RECEIPT = "fiscal:print-reversal-receipt",
14
16
  FISCAL_PRINT_TEXT = "fiscal:print-text",
15
17
  FISCAL_GET_LAST_RECORD = "fiscal:get-last-record",
16
- FISCAL_GET_STATUS = "fiscal:get-status"
18
+ FISCAL_GET_STATUS = "fiscal:get-status",
19
+ FISCAL_PRINT_X_REPORT = "fiscal:print-x-report",
20
+ FISCAL_PRINT_Z_REPORT = "fiscal:print-z-report",
21
+ FISCAL_DEPOSIT_MONEY = "fiscal:deposit-money",
22
+ FISCAL_WITHDRAW_MONEY = "fiscal:withdraw-money",
23
+ FISCAL_GET_CASH_AMOUNT = "fiscal:get-cash-amount",
24
+ FISCAL_SET_DATE_TIME = "fiscal:set-date-time",
25
+ FISCAL_PRINT_DUPLICATE = "fiscal:print-duplicate"
17
26
  }
@@ -1,7 +1,7 @@
1
1
  import { CertificateInfo } from './certificate-info.interface';
2
2
  import { HttpOptions, HttpResponse } from './http.interface';
3
3
  import { EnvironmentEnum } from '../enums/envirovment.enum';
4
- import { FiscalDeviceInfo, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt } from './fiscal-device.interface';
4
+ import { DeviceInfo, FiscalDeviceInfo, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt, FiscalResponse, ReversalReceipt } from './fiscal-device.interface';
5
5
  export interface ApiInterface {
6
6
  /**
7
7
  * An object representing operations related to certificates.
@@ -106,13 +106,27 @@ export interface ApiInterface {
106
106
  * @throws {Error} If no active device is set.
107
107
  */
108
108
  getActiveDevice(): Promise<FiscalDeviceInfo>;
109
+ /**
110
+ * Gets detailed information about the active device.
111
+ *
112
+ * @return {Promise<DeviceInfo>} A promise that resolves to the detailed device information.
113
+ * @throws {Error} If no active device is set.
114
+ */
115
+ getDeviceInfo(): Promise<DeviceInfo>;
109
116
  /**
110
117
  * Prints a fiscal receipt using the active device.
111
118
  *
112
119
  * @param {FiscalReceipt} receipt - The receipt to print.
113
- * @return {Promise<string>} A promise that resolves to the receipt number.
120
+ * @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
114
121
  */
115
- printReceipt(receipt: FiscalReceipt): Promise<string>;
122
+ printReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
123
+ /**
124
+ * Prints a reversal receipt using the active device.
125
+ *
126
+ * @param {ReversalReceipt} receipt - The reversal receipt to print.
127
+ * @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
128
+ */
129
+ printReversalReceipt(receipt: ReversalReceipt): Promise<FiscalResponse>;
116
130
  /**
117
131
  * Prints a non-fiscal text using the active device.
118
132
  *
@@ -132,5 +146,50 @@ export interface ApiInterface {
132
146
  * @return {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the active device.
133
147
  */
134
148
  getStatus(): Promise<FiscalDeviceStatus>;
149
+ /**
150
+ * Prints an X report (daily financial report without reset) using the active device.
151
+ *
152
+ * @return {Promise<boolean>} A promise that resolves to true if printing was successful.
153
+ */
154
+ printXReport(): Promise<boolean>;
155
+ /**
156
+ * Prints a Z report (daily financial report with reset) using the active device.
157
+ *
158
+ * @return {Promise<boolean>} A promise that resolves to true if printing was successful.
159
+ */
160
+ printZReport(): Promise<boolean>;
161
+ /**
162
+ * Deposits money into the cash register using the active device.
163
+ *
164
+ * @param {number} amount - The amount to deposit.
165
+ * @return {Promise<boolean>} A promise that resolves to true if the deposit was successful.
166
+ */
167
+ depositMoney(amount: number): Promise<boolean>;
168
+ /**
169
+ * Withdraws money from the cash register using the active device.
170
+ *
171
+ * @param {number} amount - The amount to withdraw.
172
+ * @return {Promise<boolean>} A promise that resolves to true if the withdrawal was successful.
173
+ */
174
+ withdrawMoney(amount: number): Promise<boolean>;
175
+ /**
176
+ * Gets the current cash amount in the register using the active device.
177
+ *
178
+ * @return {Promise<number>} A promise that resolves to the current cash amount.
179
+ */
180
+ getCashAmount(): Promise<number>;
181
+ /**
182
+ * Sets the date and time on the active device.
183
+ *
184
+ * @param {Date} dateTime - The date and time to set.
185
+ * @return {Promise<boolean>} A promise that resolves to true if setting was successful.
186
+ */
187
+ setDateTime(dateTime: Date): Promise<boolean>;
188
+ /**
189
+ * Prints a duplicate of the last receipt using the active device.
190
+ *
191
+ * @return {Promise<boolean>} A promise that resolves to true if printing was successful.
192
+ */
193
+ printDuplicate(): Promise<boolean>;
135
194
  };
136
195
  }
@@ -30,13 +30,26 @@ export interface FiscalDeviceInterface {
30
30
  * @returns {Promise<boolean>} A promise that resolves to true if the device is connected
31
31
  */
32
32
  isConnected(): Promise<boolean>;
33
+ /**
34
+ * Gets detailed information about the device
35
+ *
36
+ * @returns {Promise<DeviceInfo>} A promise that resolves to the device information
37
+ */
38
+ getDeviceInfo(): Promise<DeviceInfo>;
33
39
  /**
34
40
  * Prints a fiscal receipt
35
41
  *
36
42
  * @param {FiscalReceipt} receipt - The receipt to print
37
- * @returns {Promise<string>} A promise that resolves to the receipt number
43
+ * @returns {Promise<FiscalResponse>} A promise that resolves to the fiscal response
38
44
  */
39
- printReceipt(receipt: FiscalReceipt): Promise<string>;
45
+ printReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
46
+ /**
47
+ * Prints a reversal receipt
48
+ *
49
+ * @param {ReversalReceipt} receipt - The reversal receipt to print
50
+ * @returns {Promise<FiscalResponse>} A promise that resolves to the fiscal response
51
+ */
52
+ printReversalReceipt(receipt: ReversalReceipt): Promise<FiscalResponse>;
40
53
  /**
41
54
  * Prints a non-fiscal text
42
55
  *
@@ -56,6 +69,51 @@ export interface FiscalDeviceInterface {
56
69
  * @returns {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the fiscal device
57
70
  */
58
71
  getStatus(): Promise<FiscalDeviceStatus>;
72
+ /**
73
+ * Prints an X report (daily financial report without reset)
74
+ *
75
+ * @returns {Promise<boolean>} A promise that resolves to true if printing was successful
76
+ */
77
+ printXReport(): Promise<boolean>;
78
+ /**
79
+ * Prints a Z report (daily financial report with reset)
80
+ *
81
+ * @returns {Promise<boolean>} A promise that resolves to true if printing was successful
82
+ */
83
+ printZReport(): Promise<boolean>;
84
+ /**
85
+ * Deposits money into the cash register
86
+ *
87
+ * @param {number} amount - The amount to deposit
88
+ * @returns {Promise<boolean>} A promise that resolves to true if the deposit was successful
89
+ */
90
+ depositMoney(amount: number): Promise<boolean>;
91
+ /**
92
+ * Withdraws money from the cash register
93
+ *
94
+ * @param {number} amount - The amount to withdraw
95
+ * @returns {Promise<boolean>} A promise that resolves to true if the withdrawal was successful
96
+ */
97
+ withdrawMoney(amount: number): Promise<boolean>;
98
+ /**
99
+ * Gets the current cash amount in the register
100
+ *
101
+ * @returns {Promise<number>} A promise that resolves to the current cash amount
102
+ */
103
+ getCashAmount(): Promise<number>;
104
+ /**
105
+ * Sets the date and time on the fiscal device
106
+ *
107
+ * @param {Date} dateTime - The date and time to set
108
+ * @returns {Promise<boolean>} A promise that resolves to true if setting was successful
109
+ */
110
+ setDateTime(dateTime: Date): Promise<boolean>;
111
+ /**
112
+ * Prints a duplicate of the last receipt
113
+ *
114
+ * @returns {Promise<boolean>} A promise that resolves to true if printing was successful
115
+ */
116
+ printDuplicate(): Promise<boolean>;
59
117
  /**
60
118
  * Closes the connection to the fiscal device
61
119
  *
@@ -181,18 +239,34 @@ export interface FiscalMemoryRecord {
181
239
  * Interface for fiscal device status
182
240
  */
183
241
  export interface FiscalDeviceStatus {
242
+ /**
243
+ * Whether the operation was successful
244
+ */
245
+ ok: boolean;
184
246
  /**
185
247
  * Whether the device is connected
186
248
  */
187
- connected: boolean;
249
+ connected?: boolean;
188
250
  /**
189
251
  * Whether the device has paper
190
252
  */
191
- hasPaper: boolean;
253
+ hasPaper?: boolean;
192
254
  /**
193
255
  * Whether the fiscal memory is full
194
256
  */
195
- fiscalMemoryFull: boolean;
257
+ fiscalMemoryFull?: boolean;
258
+ /**
259
+ * Whether a fiscal receipt is currently open
260
+ */
261
+ fiscalReceiptOpen?: boolean;
262
+ /**
263
+ * Whether a non-fiscal receipt is currently open
264
+ */
265
+ nonFiscalReceiptOpen?: boolean;
266
+ /**
267
+ * Whether printing is allowed
268
+ */
269
+ printingAllowed?: boolean;
196
270
  /**
197
271
  * The error code if any
198
272
  */
@@ -201,6 +275,10 @@ export interface FiscalDeviceStatus {
201
275
  * The error message if any
202
276
  */
203
277
  errorMessage?: string;
278
+ /**
279
+ * The messages returned by the fiscal device
280
+ */
281
+ messages: FiscalResponseMessage[];
204
282
  }
205
283
  /**
206
284
  * Interface for fiscal device information in list responses
@@ -219,3 +297,140 @@ export interface FiscalDeviceInfo {
219
297
  */
220
298
  serialNumber: string;
221
299
  }
300
+ /**
301
+ * Interface for detailed device information
302
+ */
303
+ export interface DeviceInfo {
304
+ /**
305
+ * The URI of the fiscal device
306
+ */
307
+ uri: string;
308
+ /**
309
+ * The serial number of the fiscal device
310
+ */
311
+ serialNumber: string;
312
+ /**
313
+ * The fiscal memory serial number
314
+ */
315
+ fiscalMemorySerialNumber: string;
316
+ /**
317
+ * The manufacturer of the fiscal device
318
+ */
319
+ manufacturer: string;
320
+ /**
321
+ * The model name of the fiscal device
322
+ */
323
+ model: string;
324
+ /**
325
+ * The firmware version of the fiscal device
326
+ */
327
+ firmwareVersion: string;
328
+ /**
329
+ * The current date and time of the fiscal device
330
+ */
331
+ currentDateTime?: Date;
332
+ /**
333
+ * The maximum length of item text
334
+ */
335
+ itemTextMaxLength: number;
336
+ /**
337
+ * The maximum length of comment text
338
+ */
339
+ commentTextMaxLength: number;
340
+ /**
341
+ * The maximum length of operator password
342
+ */
343
+ operatorPasswordMaxLength: number;
344
+ /**
345
+ * The supported payment types
346
+ */
347
+ supportedPaymentTypes: string[];
348
+ }
349
+ /**
350
+ * Interface for fiscal response
351
+ */
352
+ export interface FiscalResponse {
353
+ /**
354
+ * Whether the operation was successful
355
+ */
356
+ ok: boolean;
357
+ /**
358
+ * The receipt number (if applicable)
359
+ */
360
+ receiptNumber?: string;
361
+ /**
362
+ * The receipt date and time (if applicable)
363
+ */
364
+ receiptDateTime?: Date;
365
+ /**
366
+ * The receipt amount (if applicable)
367
+ */
368
+ receiptAmount?: number;
369
+ /**
370
+ * The fiscal memory serial number (if applicable)
371
+ */
372
+ fiscalMemorySerialNumber?: string;
373
+ /**
374
+ * The messages returned by the fiscal device
375
+ */
376
+ messages: FiscalResponseMessage[];
377
+ }
378
+ /**
379
+ * Interface for fiscal response message
380
+ */
381
+ export interface FiscalResponseMessage {
382
+ /**
383
+ * The type of the message
384
+ */
385
+ type: 'info' | 'warning' | 'error';
386
+ /**
387
+ * The code of the message (if applicable)
388
+ */
389
+ code?: string;
390
+ /**
391
+ * The text of the message
392
+ */
393
+ text: string;
394
+ }
395
+ /**
396
+ * Interface for reversal receipt
397
+ */
398
+ export interface ReversalReceipt extends FiscalReceipt {
399
+ /**
400
+ * The reason for the reversal
401
+ */
402
+ reason: ReversalReason;
403
+ /**
404
+ * The original receipt number
405
+ */
406
+ originalReceiptNumber: string;
407
+ /**
408
+ * The original receipt date and time
409
+ */
410
+ originalReceiptDateTime: Date;
411
+ /**
412
+ * The original fiscal memory serial number
413
+ */
414
+ originalFiscalMemorySerialNumber: string;
415
+ }
416
+ /**
417
+ * Enum for reversal reasons
418
+ */
419
+ export declare enum ReversalReason {
420
+ OPERATOR_ERROR = "operator-error",
421
+ REFUND = "refund",
422
+ TAX_BASE_REDUCTION = "tax-base-reduction"
423
+ }
424
+ /**
425
+ * Enum for fiscal VAT groups
426
+ */
427
+ export declare enum FiscalVATGroup {
428
+ A = "\u0410",// 20%
429
+ B = "\u0411",// 9%
430
+ C = "\u0412",// 0%
431
+ D = "\u0413",// Exempt
432
+ E = "\u0414",// Special rate 1
433
+ F = "\u0415",// Special rate 2
434
+ G = "\u0416",// Special rate 3
435
+ H = "\u0417"
436
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reservation-studio/electron-types",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "TypeScript типове за ReservationStudioElectron",
5
5
  "scripts": {
6
6
  "build": "tsc",