@reservation-studio/electron-types 0.0.19 → 0.0.29
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 +52 -21
- package/dist/interfaces/api.interface.d.ts +59 -52
- package/dist/interfaces/fiscal-device.interface.d.ts +106 -121
- 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,9 +203,12 @@ interface HttpOptions {
|
|
|
176
203
|
|
|
177
204
|
```typescript
|
|
178
205
|
interface FiscalReceipt {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
206
|
+
operator: {
|
|
207
|
+
number: number;
|
|
208
|
+
password: string;
|
|
209
|
+
code?: string;
|
|
210
|
+
};
|
|
211
|
+
uniqueSaleNumber: string;
|
|
182
212
|
items: FiscalReceiptItem[];
|
|
183
213
|
payments: FiscalPayment[];
|
|
184
214
|
client?: FiscalClient;
|
|
@@ -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,136 @@ 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>;
|
|
201
|
+
/**
|
|
202
|
+
* Gets the date and time from a fiscal device.
|
|
203
|
+
*
|
|
204
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
205
|
+
* @return {Promise<Date>} A promise that resolves to the device date/time.
|
|
206
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
207
|
+
*/
|
|
208
|
+
getDateTime(deviceId: string): Promise<Date>;
|
|
210
209
|
/**
|
|
211
210
|
* Prints a duplicate of the last receipt using a fiscal device.
|
|
212
211
|
*
|
|
213
|
-
* @param {string}
|
|
212
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
214
213
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
215
|
-
* @throws {Error} If
|
|
214
|
+
* @throws {Error} If the device with the specified deviceId is not found.
|
|
215
|
+
*/
|
|
216
|
+
printDuplicate(deviceId: string): Promise<boolean>;
|
|
217
|
+
/**
|
|
218
|
+
* Runs a device diagnostics sequence to verify core functionality.
|
|
219
|
+
*
|
|
220
|
+
* @param {string} deviceId - Device identifier from list/scan.
|
|
221
|
+
* @param {FiscalDeviceDiagnosticsOptions} options - Operator credentials and receipt parameters.
|
|
222
|
+
* @return {Promise<FiscalDeviceDiagnosticsResult>} A promise that resolves to the diagnostics report.
|
|
216
223
|
*/
|
|
217
|
-
|
|
224
|
+
runDiagnostics(deviceId: string, options: FiscalDeviceDiagnosticsOptions): Promise<FiscalDeviceDiagnosticsResult>;
|
|
218
225
|
};
|
|
219
226
|
}
|
|
@@ -1,125 +1,32 @@
|
|
|
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
|
+
getDateTime: boolean;
|
|
19
|
+
getLastFiscalRecord: boolean;
|
|
20
|
+
getStatus: boolean;
|
|
21
|
+
};
|
|
22
|
+
supportsInvoices: boolean;
|
|
23
|
+
supportsRefunds: boolean;
|
|
24
|
+
supportsCreditNotes: boolean;
|
|
25
|
+
maxItemTextLength: number;
|
|
26
|
+
maxCommentTextLength: number;
|
|
27
|
+
maxOperatorPasswordLength: number;
|
|
28
|
+
vatGroups: FiscalVATGroup[];
|
|
29
|
+
paymentTypes: FiscalPaymentType[];
|
|
123
30
|
}
|
|
124
31
|
/**
|
|
125
32
|
* Interface for fiscal receipt
|
|
@@ -134,6 +41,10 @@ export interface FiscalReceipt {
|
|
|
134
41
|
* This variable can store any valid number, including integers and floating-point values.
|
|
135
42
|
*/
|
|
136
43
|
number: number;
|
|
44
|
+
/**
|
|
45
|
+
* Optional operator code. If not provided, driver may derive it from operator number.
|
|
46
|
+
*/
|
|
47
|
+
code?: string;
|
|
137
48
|
/**
|
|
138
49
|
* A string representing the password for authentication or security purposes.
|
|
139
50
|
* This variable typically holds sensitive information and should be handled securely.
|
|
@@ -144,7 +55,7 @@ export interface FiscalReceipt {
|
|
|
144
55
|
/**
|
|
145
56
|
* The unique sale number
|
|
146
57
|
*/
|
|
147
|
-
uniqueSaleNumber
|
|
58
|
+
uniqueSaleNumber: string;
|
|
148
59
|
/**
|
|
149
60
|
* The items in the receipt
|
|
150
61
|
*/
|
|
@@ -298,11 +209,19 @@ export interface FiscalDeviceStatus {
|
|
|
298
209
|
* The messages returned by the fiscal device
|
|
299
210
|
*/
|
|
300
211
|
messages: FiscalResponseMessage[];
|
|
212
|
+
/**
|
|
213
|
+
* Raw status bytes, if available
|
|
214
|
+
*/
|
|
215
|
+
rawStatusBytes?: number[];
|
|
301
216
|
}
|
|
302
217
|
/**
|
|
303
218
|
* Interface for fiscal device information in list responses
|
|
304
219
|
*/
|
|
305
220
|
export interface FiscalDeviceResponse {
|
|
221
|
+
/**
|
|
222
|
+
* Device identifier (stable for the device model/serial)
|
|
223
|
+
*/
|
|
224
|
+
deviceId: DeviceId;
|
|
306
225
|
/**
|
|
307
226
|
* The manufacturer of the fiscal device
|
|
308
227
|
*/
|
|
@@ -315,11 +234,69 @@ export interface FiscalDeviceResponse {
|
|
|
315
234
|
* The serial number of the fiscal device
|
|
316
235
|
*/
|
|
317
236
|
serialNumber: string;
|
|
237
|
+
/**
|
|
238
|
+
* Transport type used to access the device
|
|
239
|
+
*/
|
|
240
|
+
transport?: TransportType;
|
|
241
|
+
/**
|
|
242
|
+
* Device capabilities
|
|
243
|
+
*/
|
|
244
|
+
capabilities?: DeviceCapabilities;
|
|
245
|
+
}
|
|
246
|
+
export type FiscalDeviceDiagnosticStepName = 'deviceInfo' | 'status' | 'lastFiscalRecord' | 'cashAmount' | 'nonFiscalReceipt';
|
|
247
|
+
export interface FiscalDeviceDiagnosticStepBase {
|
|
248
|
+
name: FiscalDeviceDiagnosticStepName;
|
|
249
|
+
ok: boolean;
|
|
250
|
+
startedAt: string;
|
|
251
|
+
finishedAt: string;
|
|
252
|
+
skipped?: boolean;
|
|
253
|
+
skipReason?: string;
|
|
254
|
+
error?: string;
|
|
255
|
+
}
|
|
256
|
+
export interface FiscalDeviceDiagnosticStepDeviceInfo extends FiscalDeviceDiagnosticStepBase {
|
|
257
|
+
name: 'deviceInfo';
|
|
258
|
+
data?: DeviceInfo;
|
|
259
|
+
}
|
|
260
|
+
export interface FiscalDeviceDiagnosticStepStatus extends FiscalDeviceDiagnosticStepBase {
|
|
261
|
+
name: 'status';
|
|
262
|
+
data?: FiscalDeviceStatus;
|
|
263
|
+
}
|
|
264
|
+
export interface FiscalDeviceDiagnosticStepLastFiscalRecord extends FiscalDeviceDiagnosticStepBase {
|
|
265
|
+
name: 'lastFiscalRecord';
|
|
266
|
+
data?: FiscalMemoryRecord;
|
|
267
|
+
}
|
|
268
|
+
export interface FiscalDeviceDiagnosticStepCashAmount extends FiscalDeviceDiagnosticStepBase {
|
|
269
|
+
name: 'cashAmount';
|
|
270
|
+
data?: number;
|
|
271
|
+
}
|
|
272
|
+
export interface FiscalDeviceDiagnosticStepNonFiscalReceipt extends FiscalDeviceDiagnosticStepBase {
|
|
273
|
+
name: 'nonFiscalReceipt';
|
|
274
|
+
data?: FiscalResponse;
|
|
275
|
+
}
|
|
276
|
+
export type FiscalDeviceDiagnosticStep = FiscalDeviceDiagnosticStepDeviceInfo | FiscalDeviceDiagnosticStepStatus | FiscalDeviceDiagnosticStepLastFiscalRecord | FiscalDeviceDiagnosticStepCashAmount | FiscalDeviceDiagnosticStepNonFiscalReceipt;
|
|
277
|
+
export interface FiscalDeviceDiagnosticsOptions {
|
|
278
|
+
operatorNumber: number;
|
|
279
|
+
operatorPassword: string;
|
|
280
|
+
amount?: number;
|
|
281
|
+
currency?: string;
|
|
282
|
+
vatGroup?: FiscalVATGroup;
|
|
283
|
+
itemName?: string;
|
|
284
|
+
}
|
|
285
|
+
export interface FiscalDeviceDiagnosticsResult {
|
|
286
|
+
deviceId: DeviceId;
|
|
287
|
+
ok: boolean;
|
|
288
|
+
startedAt: string;
|
|
289
|
+
finishedAt: string;
|
|
290
|
+
steps: FiscalDeviceDiagnosticStep[];
|
|
318
291
|
}
|
|
319
292
|
/**
|
|
320
293
|
* Interface for detailed device information
|
|
321
294
|
*/
|
|
322
295
|
export interface DeviceInfo {
|
|
296
|
+
/**
|
|
297
|
+
* Device identifier (stable for the device model/serial)
|
|
298
|
+
*/
|
|
299
|
+
deviceId: DeviceId;
|
|
323
300
|
/**
|
|
324
301
|
* The serial number of the fiscal device
|
|
325
302
|
*/
|
|
@@ -336,6 +313,14 @@ export interface DeviceInfo {
|
|
|
336
313
|
* The model name of the fiscal device
|
|
337
314
|
*/
|
|
338
315
|
model: string;
|
|
316
|
+
/**
|
|
317
|
+
* Driver identifier
|
|
318
|
+
*/
|
|
319
|
+
driverId?: string;
|
|
320
|
+
/**
|
|
321
|
+
* Transport type
|
|
322
|
+
*/
|
|
323
|
+
transport?: TransportType;
|
|
339
324
|
/**
|
|
340
325
|
* The firmware version of the fiscal device
|
|
341
326
|
*/
|
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.29",
|
|
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",
|