@reservation-studio/electron-types 0.0.18 → 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 +65 -48
- package/dist/interfaces/fiscal-device.interface.d.ts +104 -127
- 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,111 +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
|
-
|
|
98
|
+
scan(): Promise<FiscalDeviceResponse[]>;
|
|
101
99
|
/**
|
|
102
|
-
* Gets
|
|
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>;
|
|
108
|
-
/**
|
|
109
|
-
* Gets detailed information about the active device.
|
|
100
|
+
* Gets detailed information about a fiscal device.
|
|
110
101
|
*
|
|
102
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
111
103
|
* @return {Promise<DeviceInfo>} A promise that resolves to the detailed device information.
|
|
112
|
-
* @throws {Error} If
|
|
104
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
113
105
|
*/
|
|
114
|
-
getDeviceInfo(): Promise<DeviceInfo>;
|
|
106
|
+
getDeviceInfo(deviceId: string): Promise<DeviceInfo>;
|
|
115
107
|
/**
|
|
116
|
-
* Prints a fiscal receipt using
|
|
108
|
+
* Prints a fiscal receipt using a fiscal device.
|
|
117
109
|
*
|
|
118
110
|
* @param {FiscalReceipt} receipt - The receipt to print.
|
|
111
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
119
112
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
113
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
120
114
|
*/
|
|
121
|
-
printReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
|
|
115
|
+
printReceipt(receipt: FiscalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
122
116
|
/**
|
|
123
|
-
* Prints a non-fiscal receipt using
|
|
117
|
+
* Prints a non-fiscal receipt using a fiscal device.
|
|
124
118
|
*
|
|
125
119
|
* @param {FiscalReceipt} receipt - The receipt object containing details to be printed as a non-fiscal receipt.
|
|
120
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
126
121
|
* @return {Promise<FiscalResponse>} A promise that resolves to a FiscalResponse object indicating the result of the operation.
|
|
122
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
127
123
|
*/
|
|
128
|
-
printNonFiscalReceipt(receipt: FiscalReceipt): Promise<FiscalResponse>;
|
|
124
|
+
printNonFiscalReceipt(receipt: FiscalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
129
125
|
/**
|
|
130
|
-
* Prints a reversal receipt using
|
|
126
|
+
* Prints a reversal receipt using a fiscal device.
|
|
131
127
|
*
|
|
132
128
|
* @param {ReversalReceipt} receipt - The reversal receipt to print.
|
|
129
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
133
130
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
131
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
134
132
|
*/
|
|
135
|
-
printReversalReceipt(receipt: ReversalReceipt): Promise<FiscalResponse>;
|
|
136
|
-
/**
|
|
137
|
-
* Prints a non-fiscal text using the active device.
|
|
138
|
-
*
|
|
139
|
-
* @param {string} text - The text to print.
|
|
140
|
-
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
141
|
-
*/
|
|
142
|
-
printText(text: string): Promise<boolean>;
|
|
133
|
+
printReversalReceipt(receipt: ReversalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
143
134
|
/**
|
|
144
|
-
* Gets the last fiscal memory record from
|
|
135
|
+
* Gets the last fiscal memory record from a fiscal device.
|
|
145
136
|
*
|
|
137
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
146
138
|
* @return {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record.
|
|
139
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
147
140
|
*/
|
|
148
|
-
getLastFiscalRecord(): Promise<FiscalMemoryRecord>;
|
|
141
|
+
getLastFiscalRecord(deviceId: string): Promise<FiscalMemoryRecord>;
|
|
149
142
|
/**
|
|
150
|
-
* Gets the status of
|
|
143
|
+
* Gets the status of a fiscal device.
|
|
151
144
|
*
|
|
152
|
-
* @
|
|
145
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
146
|
+
* @return {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the device.
|
|
147
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
153
148
|
*/
|
|
154
|
-
getStatus(): Promise<FiscalDeviceStatus>;
|
|
149
|
+
getStatus(deviceId: string): Promise<FiscalDeviceStatus>;
|
|
155
150
|
/**
|
|
156
|
-
* Prints an X report (daily financial report without reset) using
|
|
151
|
+
* Prints an X report (daily financial report without reset) using a fiscal device.
|
|
157
152
|
*
|
|
153
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
158
154
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
155
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
159
156
|
*/
|
|
160
|
-
printXReport(): Promise<boolean>;
|
|
157
|
+
printXReport(deviceId: string): Promise<boolean>;
|
|
161
158
|
/**
|
|
162
|
-
* Prints a Z report (daily financial report with reset) using
|
|
159
|
+
* Prints a Z report (daily financial report with reset) using a fiscal device.
|
|
163
160
|
*
|
|
161
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
164
162
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
163
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
165
164
|
*/
|
|
166
|
-
printZReport(): Promise<boolean>;
|
|
165
|
+
printZReport(deviceId: string): Promise<boolean>;
|
|
167
166
|
/**
|
|
168
|
-
* Deposits money into the cash register using
|
|
167
|
+
* Deposits money into the cash register using a fiscal device.
|
|
169
168
|
*
|
|
170
169
|
* @param {number} amount - The amount to deposit.
|
|
170
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
171
171
|
* @return {Promise<boolean>} A promise that resolves to true if the deposit was successful.
|
|
172
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
172
173
|
*/
|
|
173
|
-
depositMoney(amount: number): Promise<boolean>;
|
|
174
|
+
depositMoney(amount: number, deviceId: string): Promise<boolean>;
|
|
174
175
|
/**
|
|
175
|
-
* Withdraws money from the cash register using
|
|
176
|
+
* Withdraws money from the cash register using a fiscal device.
|
|
176
177
|
*
|
|
177
178
|
* @param {number} amount - The amount to withdraw.
|
|
179
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
178
180
|
* @return {Promise<boolean>} A promise that resolves to true if the withdrawal was successful.
|
|
181
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
179
182
|
*/
|
|
180
|
-
withdrawMoney(amount: number): Promise<boolean>;
|
|
183
|
+
withdrawMoney(amount: number, deviceId: string): Promise<boolean>;
|
|
181
184
|
/**
|
|
182
|
-
* Gets the current cash amount in the register using
|
|
185
|
+
* Gets the current cash amount in the register using a fiscal device.
|
|
183
186
|
*
|
|
187
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
184
188
|
* @return {Promise<number>} A promise that resolves to the current cash amount.
|
|
189
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
185
190
|
*/
|
|
186
|
-
getCashAmount(): Promise<number>;
|
|
191
|
+
getCashAmount(deviceId: string): Promise<number>;
|
|
187
192
|
/**
|
|
188
|
-
* Sets the date and time on
|
|
193
|
+
* Sets the date and time on a fiscal device.
|
|
189
194
|
*
|
|
190
195
|
* @param {Date} dateTime - The date and time to set.
|
|
196
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
191
197
|
* @return {Promise<boolean>} A promise that resolves to true if setting was successful.
|
|
198
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
192
199
|
*/
|
|
193
|
-
setDateTime(dateTime: Date): Promise<boolean>;
|
|
200
|
+
setDateTime(dateTime: Date, deviceId: string): Promise<boolean>;
|
|
194
201
|
/**
|
|
195
|
-
* Prints a duplicate of the last receipt using
|
|
202
|
+
* Prints a duplicate of the last receipt using a fiscal device.
|
|
196
203
|
*
|
|
204
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
197
205
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
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.
|
|
198
215
|
*/
|
|
199
|
-
|
|
216
|
+
runDiagnostics(deviceId: string, options: FiscalDeviceDiagnosticsOptions): Promise<FiscalDeviceDiagnosticsResult>;
|
|
200
217
|
};
|
|
201
218
|
}
|
|
@@ -1,132 +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
|
-
* Prints a non-fiscal text
|
|
62
|
-
*
|
|
63
|
-
* @param {string} text - The text to print
|
|
64
|
-
* @returns {Promise<boolean>} A promise that resolves to true if printing was successful
|
|
65
|
-
*/
|
|
66
|
-
printText(text: string): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* Gets the last fiscal memory record
|
|
69
|
-
*
|
|
70
|
-
* @returns {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record
|
|
71
|
-
*/
|
|
72
|
-
getLastFiscalRecord(): Promise<FiscalMemoryRecord>;
|
|
73
|
-
/**
|
|
74
|
-
* Gets the status of the fiscal device
|
|
75
|
-
*
|
|
76
|
-
* @returns {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the fiscal device
|
|
77
|
-
*/
|
|
78
|
-
getStatus(): Promise<FiscalDeviceStatus>;
|
|
79
|
-
/**
|
|
80
|
-
* Prints an X report (daily financial report without reset)
|
|
81
|
-
*
|
|
82
|
-
* @returns {Promise<boolean>} A promise that resolves to true if printing was successful
|
|
83
|
-
*/
|
|
84
|
-
printXReport(): Promise<boolean>;
|
|
85
|
-
/**
|
|
86
|
-
* Prints a Z report (daily financial report with reset)
|
|
87
|
-
*
|
|
88
|
-
* @returns {Promise<boolean>} A promise that resolves to true if printing was successful
|
|
89
|
-
*/
|
|
90
|
-
printZReport(): Promise<boolean>;
|
|
91
|
-
/**
|
|
92
|
-
* Deposits money into the cash register
|
|
93
|
-
*
|
|
94
|
-
* @param {number} amount - The amount to deposit
|
|
95
|
-
* @returns {Promise<boolean>} A promise that resolves to true if the deposit was successful
|
|
96
|
-
*/
|
|
97
|
-
depositMoney(amount: number): Promise<boolean>;
|
|
98
|
-
/**
|
|
99
|
-
* Withdraws money from the cash register
|
|
100
|
-
*
|
|
101
|
-
* @param {number} amount - The amount to withdraw
|
|
102
|
-
* @returns {Promise<boolean>} A promise that resolves to true if the withdrawal was successful
|
|
103
|
-
*/
|
|
104
|
-
withdrawMoney(amount: number): Promise<boolean>;
|
|
105
|
-
/**
|
|
106
|
-
* Gets the current cash amount in the register
|
|
107
|
-
*
|
|
108
|
-
* @returns {Promise<number>} A promise that resolves to the current cash amount
|
|
109
|
-
*/
|
|
110
|
-
getCashAmount(): Promise<number>;
|
|
111
|
-
/**
|
|
112
|
-
* Sets the date and time on the fiscal device
|
|
113
|
-
*
|
|
114
|
-
* @param {Date} dateTime - The date and time to set
|
|
115
|
-
* @returns {Promise<boolean>} A promise that resolves to true if setting was successful
|
|
116
|
-
*/
|
|
117
|
-
setDateTime(dateTime: Date): Promise<boolean>;
|
|
118
|
-
/**
|
|
119
|
-
* Prints a duplicate of the last receipt
|
|
120
|
-
*
|
|
121
|
-
* @returns {Promise<boolean>} A promise that resolves to true if printing was successful
|
|
122
|
-
*/
|
|
123
|
-
printDuplicate(): Promise<boolean>;
|
|
124
|
-
/**
|
|
125
|
-
* Closes the connection to the fiscal device
|
|
126
|
-
*
|
|
127
|
-
* @returns {Promise<boolean>} A promise that resolves to true if closing was successful
|
|
128
|
-
*/
|
|
129
|
-
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[];
|
|
130
29
|
}
|
|
131
30
|
/**
|
|
132
31
|
* Interface for fiscal receipt
|
|
@@ -141,6 +40,10 @@ export interface FiscalReceipt {
|
|
|
141
40
|
* This variable can store any valid number, including integers and floating-point values.
|
|
142
41
|
*/
|
|
143
42
|
number: number;
|
|
43
|
+
/**
|
|
44
|
+
* Optional operator code. If not provided, driver may derive it from operator number.
|
|
45
|
+
*/
|
|
46
|
+
code?: string;
|
|
144
47
|
/**
|
|
145
48
|
* A string representing the password for authentication or security purposes.
|
|
146
49
|
* This variable typically holds sensitive information and should be handled securely.
|
|
@@ -305,11 +208,19 @@ export interface FiscalDeviceStatus {
|
|
|
305
208
|
* The messages returned by the fiscal device
|
|
306
209
|
*/
|
|
307
210
|
messages: FiscalResponseMessage[];
|
|
211
|
+
/**
|
|
212
|
+
* Raw status bytes, if available
|
|
213
|
+
*/
|
|
214
|
+
rawStatusBytes?: number[];
|
|
308
215
|
}
|
|
309
216
|
/**
|
|
310
217
|
* Interface for fiscal device information in list responses
|
|
311
218
|
*/
|
|
312
219
|
export interface FiscalDeviceResponse {
|
|
220
|
+
/**
|
|
221
|
+
* Device identifier (stable for the device model/serial)
|
|
222
|
+
*/
|
|
223
|
+
deviceId: DeviceId;
|
|
313
224
|
/**
|
|
314
225
|
* The manufacturer of the fiscal device
|
|
315
226
|
*/
|
|
@@ -322,11 +233,69 @@ export interface FiscalDeviceResponse {
|
|
|
322
233
|
* The serial number of the fiscal device
|
|
323
234
|
*/
|
|
324
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[];
|
|
325
290
|
}
|
|
326
291
|
/**
|
|
327
292
|
* Interface for detailed device information
|
|
328
293
|
*/
|
|
329
294
|
export interface DeviceInfo {
|
|
295
|
+
/**
|
|
296
|
+
* Device identifier (stable for the device model/serial)
|
|
297
|
+
*/
|
|
298
|
+
deviceId: DeviceId;
|
|
330
299
|
/**
|
|
331
300
|
* The serial number of the fiscal device
|
|
332
301
|
*/
|
|
@@ -343,6 +312,14 @@ export interface DeviceInfo {
|
|
|
343
312
|
* The model name of the fiscal device
|
|
344
313
|
*/
|
|
345
314
|
model: string;
|
|
315
|
+
/**
|
|
316
|
+
* Driver identifier
|
|
317
|
+
*/
|
|
318
|
+
driverId?: string;
|
|
319
|
+
/**
|
|
320
|
+
* Transport type
|
|
321
|
+
*/
|
|
322
|
+
transport?: TransportType;
|
|
346
323
|
/**
|
|
347
324
|
* The firmware version of the fiscal device
|
|
348
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",
|