@reservation-studio/electron-types 0.0.17 → 0.0.19
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.
|
@@ -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 { DeviceInfo,
|
|
4
|
+
import { DeviceInfo, FiscalDeviceResponse, 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.
|
|
@@ -85,12 +85,11 @@ export interface ApiInterface {
|
|
|
85
85
|
*/
|
|
86
86
|
fiscalDevices: {
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
89
|
-
* Automatically initializes fiscal devices if needed.
|
|
88
|
+
* Retrieves a list of fiscal devices.
|
|
90
89
|
*
|
|
91
|
-
* @return {Promise<
|
|
90
|
+
* @return {Promise<FiscalDeviceResponse[]>} A promise that resolves to an array of fiscal device responses.
|
|
92
91
|
*/
|
|
93
|
-
list(): Promise<
|
|
92
|
+
list(): Promise<FiscalDeviceResponse[]>;
|
|
94
93
|
/**
|
|
95
94
|
* Sets the active fiscal device.
|
|
96
95
|
*
|
|
@@ -102,94 +101,119 @@ export interface ApiInterface {
|
|
|
102
101
|
/**
|
|
103
102
|
* Gets the active fiscal device.
|
|
104
103
|
*
|
|
105
|
-
* @return {Promise<
|
|
104
|
+
* @return {Promise<FiscalDeviceResponse>} A promise that resolves to the active fiscal device information.
|
|
106
105
|
* @throws {Error} If no active device is set.
|
|
107
106
|
*/
|
|
108
|
-
getActiveDevice(): Promise<
|
|
107
|
+
getActiveDevice(): Promise<FiscalDeviceResponse>;
|
|
109
108
|
/**
|
|
110
|
-
* Gets detailed information about
|
|
109
|
+
* Gets detailed information about a fiscal device.
|
|
111
110
|
*
|
|
111
|
+
* @param {string} [serial] - Optional serial number of the device to get information for. If not provided, uses the active device.
|
|
112
112
|
* @return {Promise<DeviceInfo>} A promise that resolves to the detailed device information.
|
|
113
|
-
* @throws {Error} If no active device is set.
|
|
113
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
114
114
|
*/
|
|
115
|
-
getDeviceInfo(): Promise<DeviceInfo>;
|
|
115
|
+
getDeviceInfo(serial?: string): Promise<DeviceInfo>;
|
|
116
116
|
/**
|
|
117
|
-
* Prints a fiscal receipt using
|
|
117
|
+
* Prints a fiscal receipt using a fiscal device.
|
|
118
118
|
*
|
|
119
119
|
* @param {FiscalReceipt} receipt - The receipt to print.
|
|
120
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
120
121
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
122
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
121
123
|
*/
|
|
122
|
-
printReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
|
|
124
|
+
printReceipt(receipt: FiscalReceipt, serial?: string): Promise<FiscalResponse>;
|
|
123
125
|
/**
|
|
124
|
-
* Prints a
|
|
126
|
+
* Prints a non-fiscal receipt using a fiscal device.
|
|
125
127
|
*
|
|
126
|
-
* @param {
|
|
127
|
-
* @
|
|
128
|
+
* @param {FiscalReceipt} receipt - The receipt object containing details to be printed as a non-fiscal receipt.
|
|
129
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
130
|
+
* @return {Promise<FiscalResponse>} A promise that resolves to a FiscalResponse object indicating the result of the operation.
|
|
131
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
128
132
|
*/
|
|
129
|
-
|
|
133
|
+
printNonFiscalReceipt(receipt: FiscalReceipt, serial?: string): Promise<FiscalResponse>;
|
|
130
134
|
/**
|
|
131
|
-
* Prints a
|
|
135
|
+
* Prints a reversal receipt using a fiscal device.
|
|
132
136
|
*
|
|
133
|
-
* @param {
|
|
134
|
-
* @
|
|
137
|
+
* @param {ReversalReceipt} receipt - The reversal receipt to print.
|
|
138
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
139
|
+
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
140
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
135
141
|
*/
|
|
136
|
-
|
|
142
|
+
printReversalReceipt(receipt: ReversalReceipt, serial?: string): Promise<FiscalResponse>;
|
|
137
143
|
/**
|
|
138
|
-
* Gets the last fiscal memory record from
|
|
144
|
+
* Gets the last fiscal memory record from a fiscal device.
|
|
139
145
|
*
|
|
146
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
140
147
|
* @return {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record.
|
|
148
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
141
149
|
*/
|
|
142
|
-
getLastFiscalRecord(): Promise<FiscalMemoryRecord>;
|
|
150
|
+
getLastFiscalRecord(serial?: string): Promise<FiscalMemoryRecord>;
|
|
143
151
|
/**
|
|
144
|
-
* Gets the status of
|
|
152
|
+
* Gets the status of a fiscal device.
|
|
145
153
|
*
|
|
146
|
-
* @
|
|
154
|
+
* @param {string} [serial] - Optional serial number of the device to get status for. If not provided, uses the active device.
|
|
155
|
+
* @return {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the device.
|
|
156
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
147
157
|
*/
|
|
148
|
-
getStatus(): Promise<FiscalDeviceStatus>;
|
|
158
|
+
getStatus(serial?: string): Promise<FiscalDeviceStatus>;
|
|
149
159
|
/**
|
|
150
|
-
* Prints an X report (daily financial report without reset) using
|
|
160
|
+
* Prints an X report (daily financial report without reset) using a fiscal device.
|
|
151
161
|
*
|
|
162
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
152
163
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
164
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
153
165
|
*/
|
|
154
|
-
printXReport(): Promise<boolean>;
|
|
166
|
+
printXReport(serial?: string): Promise<boolean>;
|
|
155
167
|
/**
|
|
156
|
-
* Prints a Z report (daily financial report with reset) using
|
|
168
|
+
* Prints a Z report (daily financial report with reset) using a fiscal device.
|
|
157
169
|
*
|
|
170
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
158
171
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
172
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
159
173
|
*/
|
|
160
|
-
printZReport(): Promise<boolean>;
|
|
174
|
+
printZReport(serial?: string): Promise<boolean>;
|
|
161
175
|
/**
|
|
162
|
-
* Deposits money into the cash register using
|
|
176
|
+
* Deposits money into the cash register using a fiscal device.
|
|
163
177
|
*
|
|
164
178
|
* @param {number} amount - The amount to deposit.
|
|
179
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
165
180
|
* @return {Promise<boolean>} A promise that resolves to true if the deposit was successful.
|
|
181
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
166
182
|
*/
|
|
167
|
-
depositMoney(amount: number): Promise<boolean>;
|
|
183
|
+
depositMoney(amount: number, serial?: string): Promise<boolean>;
|
|
168
184
|
/**
|
|
169
|
-
* Withdraws money from the cash register using
|
|
185
|
+
* Withdraws money from the cash register using a fiscal device.
|
|
170
186
|
*
|
|
171
187
|
* @param {number} amount - The amount to withdraw.
|
|
188
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
172
189
|
* @return {Promise<boolean>} A promise that resolves to true if the withdrawal was successful.
|
|
190
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
173
191
|
*/
|
|
174
|
-
withdrawMoney(amount: number): Promise<boolean>;
|
|
192
|
+
withdrawMoney(amount: number, serial?: string): Promise<boolean>;
|
|
175
193
|
/**
|
|
176
|
-
* Gets the current cash amount in the register using
|
|
194
|
+
* Gets the current cash amount in the register using a fiscal device.
|
|
177
195
|
*
|
|
196
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
178
197
|
* @return {Promise<number>} A promise that resolves to the current cash amount.
|
|
198
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
179
199
|
*/
|
|
180
|
-
getCashAmount(): Promise<number>;
|
|
200
|
+
getCashAmount(serial?: string): Promise<number>;
|
|
181
201
|
/**
|
|
182
|
-
* Sets the date and time on
|
|
202
|
+
* Sets the date and time on a fiscal device.
|
|
183
203
|
*
|
|
184
204
|
* @param {Date} dateTime - The date and time to set.
|
|
205
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
185
206
|
* @return {Promise<boolean>} A promise that resolves to true if setting was successful.
|
|
207
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
186
208
|
*/
|
|
187
|
-
setDateTime(dateTime: Date): Promise<boolean>;
|
|
209
|
+
setDateTime(dateTime: Date, serial?: string): Promise<boolean>;
|
|
188
210
|
/**
|
|
189
|
-
* Prints a duplicate of the last receipt using
|
|
211
|
+
* Prints a duplicate of the last receipt using a fiscal device.
|
|
190
212
|
*
|
|
213
|
+
* @param {string} [serial] - Optional serial number of the device to use. If not provided, uses the active device.
|
|
191
214
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
215
|
+
* @throws {Error} If no active device is set and no serial is provided, or if the device with the specified serial is not found.
|
|
192
216
|
*/
|
|
193
|
-
printDuplicate(): Promise<boolean>;
|
|
217
|
+
printDuplicate(serial?: string): Promise<boolean>;
|
|
194
218
|
};
|
|
195
219
|
}
|
|
@@ -43,6 +43,13 @@ export interface FiscalDeviceInterface {
|
|
|
43
43
|
* @returns {Promise<FiscalResponse>} A promise that resolves to the fiscal response
|
|
44
44
|
*/
|
|
45
45
|
printReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Prints a non-fiscal receipt based on the provided receipt details.
|
|
48
|
+
*
|
|
49
|
+
* @param {FiscalReceipt} receipt - The receipt object containing all relevant data for generating the non-fiscal receipt.
|
|
50
|
+
* @return {Promise<FiscalResponse>} A promise that resolves to a FiscalResponse object containing the status and details of the print operation.
|
|
51
|
+
*/
|
|
52
|
+
printNonFiscalReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
|
|
46
53
|
/**
|
|
47
54
|
* Prints a reversal receipt
|
|
48
55
|
*
|
|
@@ -50,13 +57,6 @@ export interface FiscalDeviceInterface {
|
|
|
50
57
|
* @returns {Promise<FiscalResponse>} A promise that resolves to the fiscal response
|
|
51
58
|
*/
|
|
52
59
|
printReversalReceipt(receipt: ReversalReceipt): Promise<FiscalResponse>;
|
|
53
|
-
/**
|
|
54
|
-
* Prints a non-fiscal text
|
|
55
|
-
*
|
|
56
|
-
* @param {string} text - The text to print
|
|
57
|
-
* @returns {Promise<boolean>} A promise that resolves to true if printing was successful
|
|
58
|
-
*/
|
|
59
|
-
printText(text: string): Promise<boolean>;
|
|
60
60
|
/**
|
|
61
61
|
* Gets the last fiscal memory record
|
|
62
62
|
*
|
|
@@ -126,13 +126,21 @@ export interface FiscalDeviceInterface {
|
|
|
126
126
|
*/
|
|
127
127
|
export interface FiscalReceipt {
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
* An object representing various operator-related properties.
|
|
130
|
+
*/
|
|
131
|
+
operator: {
|
|
132
|
+
/**
|
|
133
|
+
* Represents a numerical value.
|
|
134
|
+
* This variable can store any valid number, including integers and floating-point values.
|
|
135
|
+
*/
|
|
136
|
+
number: number;
|
|
137
|
+
/**
|
|
138
|
+
* A string representing the password for authentication or security purposes.
|
|
139
|
+
* This variable typically holds sensitive information and should be handled securely.
|
|
140
|
+
* Ensure this value is kept private and not exposed in any logs or outputs.
|
|
141
|
+
*/
|
|
142
|
+
password: string;
|
|
143
|
+
};
|
|
136
144
|
/**
|
|
137
145
|
* The unique sale number
|
|
138
146
|
*/
|
|
@@ -158,10 +166,21 @@ export interface FiscalReceiptItem {
|
|
|
158
166
|
* The name of the item
|
|
159
167
|
*/
|
|
160
168
|
name: string;
|
|
169
|
+
/**
|
|
170
|
+
* Optional description providing additional information or context.
|
|
171
|
+
* This can be used to supply user-friendly details or explanations
|
|
172
|
+
* associated with a particular resource, item, or operation.
|
|
173
|
+
*/
|
|
174
|
+
description?: string;
|
|
161
175
|
/**
|
|
162
176
|
* The price of the item
|
|
163
177
|
*/
|
|
164
|
-
|
|
178
|
+
unitPrice: number;
|
|
179
|
+
/**
|
|
180
|
+
* Represents the currency code in ISO 4217 format (e.g., 'USD', 'EUR', 'JPY').
|
|
181
|
+
* Typically used to indicate the currency of a monetary value.
|
|
182
|
+
*/
|
|
183
|
+
currency: string;
|
|
165
184
|
/**
|
|
166
185
|
* The quantity of the item
|
|
167
186
|
*/
|
|
@@ -283,7 +302,7 @@ export interface FiscalDeviceStatus {
|
|
|
283
302
|
/**
|
|
284
303
|
* Interface for fiscal device information in list responses
|
|
285
304
|
*/
|
|
286
|
-
export interface
|
|
305
|
+
export interface FiscalDeviceResponse {
|
|
287
306
|
/**
|
|
288
307
|
* The manufacturer of the fiscal device
|
|
289
308
|
*/
|
|
@@ -301,10 +320,6 @@ export interface FiscalDeviceInfo {
|
|
|
301
320
|
* Interface for detailed device information
|
|
302
321
|
*/
|
|
303
322
|
export interface DeviceInfo {
|
|
304
|
-
/**
|
|
305
|
-
* The URI of the fiscal device
|
|
306
|
-
*/
|
|
307
|
-
uri: string;
|
|
308
323
|
/**
|
|
309
324
|
* The serial number of the fiscal device
|
|
310
325
|
*/
|
|
@@ -328,7 +343,7 @@ export interface DeviceInfo {
|
|
|
328
343
|
/**
|
|
329
344
|
* The current date and time of the fiscal device
|
|
330
345
|
*/
|
|
331
|
-
currentDateTime?:
|
|
346
|
+
currentDateTime?: string;
|
|
332
347
|
/**
|
|
333
348
|
* The maximum length of item text
|
|
334
349
|
*/
|
|
@@ -357,19 +372,31 @@ export interface FiscalResponse {
|
|
|
357
372
|
/**
|
|
358
373
|
* The receipt number (if applicable)
|
|
359
374
|
*/
|
|
360
|
-
|
|
375
|
+
number?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Represents a unique identifier for a receipt generated for a particular sale.
|
|
378
|
+
* This variable is used to ensure that each sale has a distinct and traceable number.
|
|
379
|
+
* It may be undefined if no sale has been processed or the number has not been generated yet.
|
|
380
|
+
*/
|
|
381
|
+
generatedUniqueSaleNumber?: string;
|
|
361
382
|
/**
|
|
362
383
|
* The receipt date and time (if applicable)
|
|
363
384
|
*/
|
|
364
|
-
|
|
385
|
+
datetime?: string;
|
|
365
386
|
/**
|
|
366
387
|
* The receipt amount (if applicable)
|
|
367
388
|
*/
|
|
368
|
-
|
|
389
|
+
amount?: number;
|
|
369
390
|
/**
|
|
370
|
-
*
|
|
391
|
+
* Represents an optional piece of information regarding a device.
|
|
392
|
+
* This variable can store details such as the device's specifications,
|
|
393
|
+
* status, or metadata, depending on the structure of the `DeviceInfo` type.
|
|
394
|
+
*
|
|
395
|
+
* The value of `deviceInfo` may be undefined if no device information is available.
|
|
396
|
+
*
|
|
397
|
+
* @type {DeviceInfo | undefined}
|
|
371
398
|
*/
|
|
372
|
-
|
|
399
|
+
deviceInfo?: DeviceInfo;
|
|
373
400
|
/**
|
|
374
401
|
* The messages returned by the fiscal device
|
|
375
402
|
*/
|
|
@@ -425,12 +452,12 @@ export declare enum ReversalReason {
|
|
|
425
452
|
* Enum for fiscal VAT groups
|
|
426
453
|
*/
|
|
427
454
|
export declare enum FiscalVATGroup {
|
|
428
|
-
A = "
|
|
429
|
-
B = "
|
|
430
|
-
C = "
|
|
431
|
-
D = "
|
|
432
|
-
E = "
|
|
433
|
-
F = "
|
|
434
|
-
G = "
|
|
435
|
-
H = "
|
|
455
|
+
A = "1",// 20%
|
|
456
|
+
B = "2",// 9%
|
|
457
|
+
C = "3",// 0%
|
|
458
|
+
D = "4",// Exempt
|
|
459
|
+
E = "5",// Special rate 1
|
|
460
|
+
F = "6",// Special rate 2
|
|
461
|
+
G = "7",// Special rate 3
|
|
462
|
+
H = "8"
|
|
436
463
|
}
|
|
@@ -25,12 +25,12 @@ var ReversalReason;
|
|
|
25
25
|
*/
|
|
26
26
|
var FiscalVATGroup;
|
|
27
27
|
(function (FiscalVATGroup) {
|
|
28
|
-
FiscalVATGroup["A"] = "
|
|
29
|
-
FiscalVATGroup["B"] = "
|
|
30
|
-
FiscalVATGroup["C"] = "
|
|
31
|
-
FiscalVATGroup["D"] = "
|
|
32
|
-
FiscalVATGroup["E"] = "
|
|
33
|
-
FiscalVATGroup["F"] = "
|
|
34
|
-
FiscalVATGroup["G"] = "
|
|
35
|
-
FiscalVATGroup["H"] = "
|
|
28
|
+
FiscalVATGroup["A"] = "1";
|
|
29
|
+
FiscalVATGroup["B"] = "2";
|
|
30
|
+
FiscalVATGroup["C"] = "3";
|
|
31
|
+
FiscalVATGroup["D"] = "4";
|
|
32
|
+
FiscalVATGroup["E"] = "5";
|
|
33
|
+
FiscalVATGroup["F"] = "6";
|
|
34
|
+
FiscalVATGroup["G"] = "7";
|
|
35
|
+
FiscalVATGroup["H"] = "8"; // Special rate 4
|
|
36
36
|
})(FiscalVATGroup || (exports.FiscalVATGroup = FiscalVATGroup = {}));
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reservation-studio/electron-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "TypeScript типове за ReservationStudioElectron",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.json",
|
|
7
7
|
"prebuild": "rimraf ./dist",
|
|
8
8
|
"release": "npm run build && npm publish --access public"
|
|
9
9
|
},
|
|
10
|
-
"main": "./dist/api/exports.
|
|
10
|
+
"main": "./dist/api/exports.js",
|
|
11
11
|
"types": "./dist/api/exports.d.ts",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"typescript",
|