@reservation-studio/electron-types 0.0.19 → 0.0.28
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/README.md +51 -20
- package/dist/interfaces/api.interface.d.ts +51 -52
- package/dist/interfaces/fiscal-device.interface.d.ts +104 -120
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -96,24 +96,24 @@ Methods for working with fiscal devices:
|
|
|
96
96
|
// List all available fiscal devices
|
|
97
97
|
const devices = await ReservationStudioElectron.fiscalDevices.list();
|
|
98
98
|
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// Get the active fiscal device
|
|
103
|
-
const activeDevice =
|
|
104
|
-
await ReservationStudioElectron.fiscalDevices.getActiveDevice();
|
|
99
|
+
// Select a deviceId for each call
|
|
100
|
+
const deviceId = devices[0].deviceId;
|
|
105
101
|
|
|
106
102
|
// Print a fiscal receipt
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
const response = await ReservationStudioElectron.fiscalDevices.printReceipt(
|
|
104
|
+
{
|
|
105
|
+
operator: {
|
|
106
|
+
number: 1,
|
|
107
|
+
password: '1'
|
|
108
|
+
},
|
|
109
|
+
uniqueSaleNumber: '1',
|
|
111
110
|
items: [
|
|
112
111
|
{
|
|
113
112
|
name: 'Product 1',
|
|
114
|
-
|
|
113
|
+
unitPrice: 10.0,
|
|
115
114
|
quantity: 1,
|
|
116
|
-
vatGroup: '
|
|
115
|
+
vatGroup: '1',
|
|
116
|
+
currency: 'BGN'
|
|
117
117
|
}
|
|
118
118
|
],
|
|
119
119
|
payments: [
|
|
@@ -122,17 +122,44 @@ const receiptNumber =
|
|
|
122
122
|
amount: 10.0
|
|
123
123
|
}
|
|
124
124
|
]
|
|
125
|
-
}
|
|
125
|
+
},
|
|
126
|
+
deviceId
|
|
127
|
+
);
|
|
126
128
|
|
|
127
|
-
// Print non-fiscal
|
|
128
|
-
await ReservationStudioElectron.fiscalDevices.
|
|
129
|
+
// Print non-fiscal receipt
|
|
130
|
+
await ReservationStudioElectron.fiscalDevices.printNonFiscalReceipt(
|
|
131
|
+
{
|
|
132
|
+
operator: {
|
|
133
|
+
number: 1,
|
|
134
|
+
password: '1'
|
|
135
|
+
},
|
|
136
|
+
uniqueSaleNumber: '1',
|
|
137
|
+
items: [
|
|
138
|
+
{
|
|
139
|
+
name: 'Service',
|
|
140
|
+
unitPrice: 5.0,
|
|
141
|
+
quantity: 1,
|
|
142
|
+
vatGroup: '1',
|
|
143
|
+
currency: 'BGN'
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
payments: [
|
|
147
|
+
{
|
|
148
|
+
type: 'cash',
|
|
149
|
+
amount: 5.0
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
deviceId
|
|
154
|
+
);
|
|
129
155
|
|
|
130
156
|
// Get the last fiscal memory record
|
|
131
157
|
const lastRecord =
|
|
132
|
-
await ReservationStudioElectron.fiscalDevices.getLastFiscalRecord();
|
|
158
|
+
await ReservationStudioElectron.fiscalDevices.getLastFiscalRecord(deviceId);
|
|
133
159
|
|
|
134
160
|
// Get the fiscal device status
|
|
135
|
-
const status =
|
|
161
|
+
const status =
|
|
162
|
+
await ReservationStudioElectron.fiscalDevices.getStatus(deviceId);
|
|
136
163
|
```
|
|
137
164
|
|
|
138
165
|
## Interfaces
|
|
@@ -176,8 +203,11 @@ interface HttpOptions {
|
|
|
176
203
|
|
|
177
204
|
```typescript
|
|
178
205
|
interface FiscalReceipt {
|
|
179
|
-
|
|
180
|
-
|
|
206
|
+
operator: {
|
|
207
|
+
number: number;
|
|
208
|
+
password: string;
|
|
209
|
+
code?: string;
|
|
210
|
+
};
|
|
181
211
|
uniqueSaleNumber?: string;
|
|
182
212
|
items: FiscalReceiptItem[];
|
|
183
213
|
payments: FiscalPayment[];
|
|
@@ -190,7 +220,8 @@ interface FiscalReceipt {
|
|
|
190
220
|
```typescript
|
|
191
221
|
interface FiscalReceiptItem {
|
|
192
222
|
name: string;
|
|
193
|
-
|
|
223
|
+
unitPrice: number;
|
|
224
|
+
currency: string;
|
|
194
225
|
quantity: number;
|
|
195
226
|
vatGroup: string;
|
|
196
227
|
discount?: number;
|
|
@@ -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, FiscalDeviceResponse, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt, FiscalResponse, ReversalReceipt } from './fiscal-device.interface';
|
|
4
|
+
import { DeviceInfo, FiscalDeviceDiagnosticsOptions, FiscalDeviceDiagnosticsResult, 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.
|
|
@@ -91,129 +91,128 @@ export interface ApiInterface {
|
|
|
91
91
|
*/
|
|
92
92
|
list(): Promise<FiscalDeviceResponse[]>;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Scans for fiscal devices and refreshes the device list.
|
|
95
95
|
*
|
|
96
|
-
* @
|
|
97
|
-
* @return {Promise<void>} A promise that resolves when the device is successfully set as active.
|
|
98
|
-
* @throws {Error} If the device with the specified serial number is not found.
|
|
96
|
+
* @return {Promise<FiscalDeviceResponse[]>} A promise that resolves to an updated device list.
|
|
99
97
|
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Gets the active fiscal device.
|
|
103
|
-
*
|
|
104
|
-
* @return {Promise<FiscalDeviceResponse>} A promise that resolves to the active fiscal device information.
|
|
105
|
-
* @throws {Error} If no active device is set.
|
|
106
|
-
*/
|
|
107
|
-
getActiveDevice(): Promise<FiscalDeviceResponse>;
|
|
98
|
+
scan(): Promise<FiscalDeviceResponse[]>;
|
|
108
99
|
/**
|
|
109
100
|
* Gets detailed information about a fiscal device.
|
|
110
101
|
*
|
|
111
|
-
* @param {string}
|
|
102
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
112
103
|
* @return {Promise<DeviceInfo>} A promise that resolves to the detailed device information.
|
|
113
|
-
* @throws {Error} If
|
|
104
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
114
105
|
*/
|
|
115
|
-
getDeviceInfo(
|
|
106
|
+
getDeviceInfo(deviceId: string): Promise<DeviceInfo>;
|
|
116
107
|
/**
|
|
117
108
|
* Prints a fiscal receipt using a fiscal device.
|
|
118
109
|
*
|
|
119
110
|
* @param {FiscalReceipt} receipt - The receipt to print.
|
|
120
|
-
* @param {string}
|
|
111
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
121
112
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
122
|
-
* @throws {Error} If
|
|
113
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
123
114
|
*/
|
|
124
|
-
printReceipt(receipt: FiscalReceipt,
|
|
115
|
+
printReceipt(receipt: FiscalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
125
116
|
/**
|
|
126
117
|
* Prints a non-fiscal receipt using a fiscal device.
|
|
127
118
|
*
|
|
128
119
|
* @param {FiscalReceipt} receipt - The receipt object containing details to be printed as a non-fiscal receipt.
|
|
129
|
-
* @param {string}
|
|
120
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
130
121
|
* @return {Promise<FiscalResponse>} A promise that resolves to a FiscalResponse object indicating the result of the operation.
|
|
131
|
-
* @throws {Error} If
|
|
122
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
132
123
|
*/
|
|
133
|
-
printNonFiscalReceipt(receipt: FiscalReceipt,
|
|
124
|
+
printNonFiscalReceipt(receipt: FiscalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
134
125
|
/**
|
|
135
126
|
* Prints a reversal receipt using a fiscal device.
|
|
136
127
|
*
|
|
137
128
|
* @param {ReversalReceipt} receipt - The reversal receipt to print.
|
|
138
|
-
* @param {string}
|
|
129
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
139
130
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
140
|
-
* @throws {Error} If
|
|
131
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
141
132
|
*/
|
|
142
|
-
printReversalReceipt(receipt: ReversalReceipt,
|
|
133
|
+
printReversalReceipt(receipt: ReversalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
143
134
|
/**
|
|
144
135
|
* Gets the last fiscal memory record from a fiscal device.
|
|
145
136
|
*
|
|
146
|
-
* @param {string}
|
|
137
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
147
138
|
* @return {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record.
|
|
148
|
-
* @throws {Error} If
|
|
139
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
149
140
|
*/
|
|
150
|
-
getLastFiscalRecord(
|
|
141
|
+
getLastFiscalRecord(deviceId: string): Promise<FiscalMemoryRecord>;
|
|
151
142
|
/**
|
|
152
143
|
* Gets the status of a fiscal device.
|
|
153
144
|
*
|
|
154
|
-
* @param {string}
|
|
145
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
155
146
|
* @return {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the device.
|
|
156
|
-
* @throws {Error} If
|
|
147
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
157
148
|
*/
|
|
158
|
-
getStatus(
|
|
149
|
+
getStatus(deviceId: string): Promise<FiscalDeviceStatus>;
|
|
159
150
|
/**
|
|
160
151
|
* Prints an X report (daily financial report without reset) using a fiscal device.
|
|
161
152
|
*
|
|
162
|
-
* @param {string}
|
|
153
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
163
154
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
164
|
-
* @throws {Error} If
|
|
155
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
165
156
|
*/
|
|
166
|
-
printXReport(
|
|
157
|
+
printXReport(deviceId: string): Promise<boolean>;
|
|
167
158
|
/**
|
|
168
159
|
* Prints a Z report (daily financial report with reset) using a fiscal device.
|
|
169
160
|
*
|
|
170
|
-
* @param {string}
|
|
161
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
171
162
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
172
|
-
* @throws {Error} If
|
|
163
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
173
164
|
*/
|
|
174
|
-
printZReport(
|
|
165
|
+
printZReport(deviceId: string): Promise<boolean>;
|
|
175
166
|
/**
|
|
176
167
|
* Deposits money into the cash register using a fiscal device.
|
|
177
168
|
*
|
|
178
169
|
* @param {number} amount - The amount to deposit.
|
|
179
|
-
* @param {string}
|
|
170
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
180
171
|
* @return {Promise<boolean>} A promise that resolves to true if the deposit was successful.
|
|
181
|
-
* @throws {Error} If
|
|
172
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
182
173
|
*/
|
|
183
|
-
depositMoney(amount: number,
|
|
174
|
+
depositMoney(amount: number, deviceId: string): Promise<boolean>;
|
|
184
175
|
/**
|
|
185
176
|
* Withdraws money from the cash register using a fiscal device.
|
|
186
177
|
*
|
|
187
178
|
* @param {number} amount - The amount to withdraw.
|
|
188
|
-
* @param {string}
|
|
179
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
189
180
|
* @return {Promise<boolean>} A promise that resolves to true if the withdrawal was successful.
|
|
190
|
-
* @throws {Error} If
|
|
181
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
191
182
|
*/
|
|
192
|
-
withdrawMoney(amount: number,
|
|
183
|
+
withdrawMoney(amount: number, deviceId: string): Promise<boolean>;
|
|
193
184
|
/**
|
|
194
185
|
* Gets the current cash amount in the register using a fiscal device.
|
|
195
186
|
*
|
|
196
|
-
* @param {string}
|
|
187
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
197
188
|
* @return {Promise<number>} A promise that resolves to the current cash amount.
|
|
198
|
-
* @throws {Error} If
|
|
189
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
199
190
|
*/
|
|
200
|
-
getCashAmount(
|
|
191
|
+
getCashAmount(deviceId: string): Promise<number>;
|
|
201
192
|
/**
|
|
202
193
|
* Sets the date and time on a fiscal device.
|
|
203
194
|
*
|
|
204
195
|
* @param {Date} dateTime - The date and time to set.
|
|
205
|
-
* @param {string}
|
|
196
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
206
197
|
* @return {Promise<boolean>} A promise that resolves to true if setting was successful.
|
|
207
|
-
* @throws {Error} If
|
|
198
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
208
199
|
*/
|
|
209
|
-
setDateTime(dateTime: Date,
|
|
200
|
+
setDateTime(dateTime: Date, deviceId: string): Promise<boolean>;
|
|
210
201
|
/**
|
|
211
202
|
* Prints a duplicate of the last receipt using a fiscal device.
|
|
212
203
|
*
|
|
213
|
-
* @param {string}
|
|
204
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
214
205
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
215
|
-
* @throws {Error} If
|
|
206
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
207
|
+
*/
|
|
208
|
+
printDuplicate(deviceId: string): Promise<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Runs a device diagnostics sequence to verify core functionality.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
213
|
+
* @param {FiscalDeviceDiagnosticsOptions} options - Operator credentials and receipt parameters.
|
|
214
|
+
* @return {Promise<FiscalDeviceDiagnosticsResult>} A promise that resolves to the diagnostics report.
|
|
216
215
|
*/
|
|
217
|
-
|
|
216
|
+
runDiagnostics(deviceId: string, options: FiscalDeviceDiagnosticsOptions): Promise<FiscalDeviceDiagnosticsResult>;
|
|
218
217
|
};
|
|
219
218
|
}
|
|
@@ -1,125 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Types for fiscal device communication between renderer and main process.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
* @returns {Promise<boolean>} A promise that resolves to true if the device is connected
|
|
31
|
-
*/
|
|
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>;
|
|
39
|
-
/**
|
|
40
|
-
* Prints a fiscal receipt
|
|
41
|
-
*
|
|
42
|
-
* @param {FiscalReceipt} receipt - The receipt to print
|
|
43
|
-
* @returns {Promise<FiscalResponse>} A promise that resolves to the fiscal response
|
|
44
|
-
*/
|
|
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>;
|
|
53
|
-
/**
|
|
54
|
-
* Prints a reversal receipt
|
|
55
|
-
*
|
|
56
|
-
* @param {ReversalReceipt} receipt - The reversal receipt to print
|
|
57
|
-
* @returns {Promise<FiscalResponse>} A promise that resolves to the fiscal response
|
|
58
|
-
*/
|
|
59
|
-
printReversalReceipt(receipt: ReversalReceipt): Promise<FiscalResponse>;
|
|
60
|
-
/**
|
|
61
|
-
* Gets the last fiscal memory record
|
|
62
|
-
*
|
|
63
|
-
* @returns {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record
|
|
64
|
-
*/
|
|
65
|
-
getLastFiscalRecord(): Promise<FiscalMemoryRecord>;
|
|
66
|
-
/**
|
|
67
|
-
* Gets the status of the fiscal device
|
|
68
|
-
*
|
|
69
|
-
* @returns {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the fiscal device
|
|
70
|
-
*/
|
|
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>;
|
|
117
|
-
/**
|
|
118
|
-
* Closes the connection to the fiscal device
|
|
119
|
-
*
|
|
120
|
-
* @returns {Promise<boolean>} A promise that resolves to true if closing was successful
|
|
121
|
-
*/
|
|
122
|
-
close(): Promise<boolean>;
|
|
4
|
+
export type DeviceId = string;
|
|
5
|
+
export type TransportType = 'serial' | 'tcp' | 'bluetooth-spp' | 'bluetooth-ble' | 'hid' | 'sdk';
|
|
6
|
+
export interface DeviceCapabilities {
|
|
7
|
+
supportedOperations: {
|
|
8
|
+
printFiscalReceipt: boolean;
|
|
9
|
+
printNonFiscalReceipt: boolean;
|
|
10
|
+
printReversalReceipt: boolean;
|
|
11
|
+
printXReport: boolean;
|
|
12
|
+
printZReport: boolean;
|
|
13
|
+
printDuplicate: boolean;
|
|
14
|
+
depositMoney: boolean;
|
|
15
|
+
withdrawMoney: boolean;
|
|
16
|
+
getCashAmount: boolean;
|
|
17
|
+
setDateTime: boolean;
|
|
18
|
+
getLastFiscalRecord: boolean;
|
|
19
|
+
getStatus: boolean;
|
|
20
|
+
};
|
|
21
|
+
supportsInvoices: boolean;
|
|
22
|
+
supportsRefunds: boolean;
|
|
23
|
+
supportsCreditNotes: boolean;
|
|
24
|
+
maxItemTextLength: number;
|
|
25
|
+
maxCommentTextLength: number;
|
|
26
|
+
maxOperatorPasswordLength: number;
|
|
27
|
+
vatGroups: FiscalVATGroup[];
|
|
28
|
+
paymentTypes: FiscalPaymentType[];
|
|
123
29
|
}
|
|
124
30
|
/**
|
|
125
31
|
* Interface for fiscal receipt
|
|
@@ -134,6 +40,10 @@ export interface FiscalReceipt {
|
|
|
134
40
|
* This variable can store any valid number, including integers and floating-point values.
|
|
135
41
|
*/
|
|
136
42
|
number: number;
|
|
43
|
+
/**
|
|
44
|
+
* Optional operator code. If not provided, driver may derive it from operator number.
|
|
45
|
+
*/
|
|
46
|
+
code?: string;
|
|
137
47
|
/**
|
|
138
48
|
* A string representing the password for authentication or security purposes.
|
|
139
49
|
* This variable typically holds sensitive information and should be handled securely.
|
|
@@ -298,11 +208,19 @@ export interface FiscalDeviceStatus {
|
|
|
298
208
|
* The messages returned by the fiscal device
|
|
299
209
|
*/
|
|
300
210
|
messages: FiscalResponseMessage[];
|
|
211
|
+
/**
|
|
212
|
+
* Raw status bytes, if available
|
|
213
|
+
*/
|
|
214
|
+
rawStatusBytes?: number[];
|
|
301
215
|
}
|
|
302
216
|
/**
|
|
303
217
|
* Interface for fiscal device information in list responses
|
|
304
218
|
*/
|
|
305
219
|
export interface FiscalDeviceResponse {
|
|
220
|
+
/**
|
|
221
|
+
* Device identifier (stable for the device model/serial)
|
|
222
|
+
*/
|
|
223
|
+
deviceId: DeviceId;
|
|
306
224
|
/**
|
|
307
225
|
* The manufacturer of the fiscal device
|
|
308
226
|
*/
|
|
@@ -315,11 +233,69 @@ export interface FiscalDeviceResponse {
|
|
|
315
233
|
* The serial number of the fiscal device
|
|
316
234
|
*/
|
|
317
235
|
serialNumber: string;
|
|
236
|
+
/**
|
|
237
|
+
* Transport type used to access the device
|
|
238
|
+
*/
|
|
239
|
+
transport?: TransportType;
|
|
240
|
+
/**
|
|
241
|
+
* Device capabilities
|
|
242
|
+
*/
|
|
243
|
+
capabilities?: DeviceCapabilities;
|
|
244
|
+
}
|
|
245
|
+
export type FiscalDeviceDiagnosticStepName = 'deviceInfo' | 'status' | 'lastFiscalRecord' | 'cashAmount' | 'nonFiscalReceipt';
|
|
246
|
+
export interface FiscalDeviceDiagnosticStepBase {
|
|
247
|
+
name: FiscalDeviceDiagnosticStepName;
|
|
248
|
+
ok: boolean;
|
|
249
|
+
startedAt: string;
|
|
250
|
+
finishedAt: string;
|
|
251
|
+
skipped?: boolean;
|
|
252
|
+
skipReason?: string;
|
|
253
|
+
error?: string;
|
|
254
|
+
}
|
|
255
|
+
export interface FiscalDeviceDiagnosticStepDeviceInfo extends FiscalDeviceDiagnosticStepBase {
|
|
256
|
+
name: 'deviceInfo';
|
|
257
|
+
data?: DeviceInfo;
|
|
258
|
+
}
|
|
259
|
+
export interface FiscalDeviceDiagnosticStepStatus extends FiscalDeviceDiagnosticStepBase {
|
|
260
|
+
name: 'status';
|
|
261
|
+
data?: FiscalDeviceStatus;
|
|
262
|
+
}
|
|
263
|
+
export interface FiscalDeviceDiagnosticStepLastFiscalRecord extends FiscalDeviceDiagnosticStepBase {
|
|
264
|
+
name: 'lastFiscalRecord';
|
|
265
|
+
data?: FiscalMemoryRecord;
|
|
266
|
+
}
|
|
267
|
+
export interface FiscalDeviceDiagnosticStepCashAmount extends FiscalDeviceDiagnosticStepBase {
|
|
268
|
+
name: 'cashAmount';
|
|
269
|
+
data?: number;
|
|
270
|
+
}
|
|
271
|
+
export interface FiscalDeviceDiagnosticStepNonFiscalReceipt extends FiscalDeviceDiagnosticStepBase {
|
|
272
|
+
name: 'nonFiscalReceipt';
|
|
273
|
+
data?: FiscalResponse;
|
|
274
|
+
}
|
|
275
|
+
export type FiscalDeviceDiagnosticStep = FiscalDeviceDiagnosticStepDeviceInfo | FiscalDeviceDiagnosticStepStatus | FiscalDeviceDiagnosticStepLastFiscalRecord | FiscalDeviceDiagnosticStepCashAmount | FiscalDeviceDiagnosticStepNonFiscalReceipt;
|
|
276
|
+
export interface FiscalDeviceDiagnosticsOptions {
|
|
277
|
+
operatorNumber: number;
|
|
278
|
+
operatorPassword: string;
|
|
279
|
+
amount?: number;
|
|
280
|
+
currency?: string;
|
|
281
|
+
vatGroup?: FiscalVATGroup;
|
|
282
|
+
itemName?: string;
|
|
283
|
+
}
|
|
284
|
+
export interface FiscalDeviceDiagnosticsResult {
|
|
285
|
+
deviceId: DeviceId;
|
|
286
|
+
ok: boolean;
|
|
287
|
+
startedAt: string;
|
|
288
|
+
finishedAt: string;
|
|
289
|
+
steps: FiscalDeviceDiagnosticStep[];
|
|
318
290
|
}
|
|
319
291
|
/**
|
|
320
292
|
* Interface for detailed device information
|
|
321
293
|
*/
|
|
322
294
|
export interface DeviceInfo {
|
|
295
|
+
/**
|
|
296
|
+
* Device identifier (stable for the device model/serial)
|
|
297
|
+
*/
|
|
298
|
+
deviceId: DeviceId;
|
|
323
299
|
/**
|
|
324
300
|
* The serial number of the fiscal device
|
|
325
301
|
*/
|
|
@@ -336,6 +312,14 @@ export interface DeviceInfo {
|
|
|
336
312
|
* The model name of the fiscal device
|
|
337
313
|
*/
|
|
338
314
|
model: string;
|
|
315
|
+
/**
|
|
316
|
+
* Driver identifier
|
|
317
|
+
*/
|
|
318
|
+
driverId?: string;
|
|
319
|
+
/**
|
|
320
|
+
* Transport type
|
|
321
|
+
*/
|
|
322
|
+
transport?: TransportType;
|
|
339
323
|
/**
|
|
340
324
|
* The firmware version of the fiscal device
|
|
341
325
|
*/
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reservation-studio/electron-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "TypeScript типове за ReservationStudioElectron",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.json",
|
|
7
|
-
"prebuild": "
|
|
7
|
+
"prebuild": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
8
8
|
"release": "npm run build && npm publish --access public"
|
|
9
9
|
},
|
|
10
10
|
"main": "./dist/api/exports.js",
|