@reservation-studio/electron-types 0.0.31 → 0.0.32
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/dist/api/exports.d.ts +2 -5
- package/dist/api/exports.js +1 -4
- package/dist/interfaces/{api.interface.d.ts → public/api.interface.d.ts} +17 -16
- package/dist/interfaces/public/fiscal-device/device.types.d.ts +222 -0
- package/dist/interfaces/public/fiscal-device/diagnostics.types.d.ts +47 -0
- package/dist/interfaces/public/fiscal-device/diagnostics.types.js +2 -0
- package/dist/interfaces/public/fiscal-device/errors.types.d.ts +78 -0
- package/dist/interfaces/public/fiscal-device/errors.types.js +50 -0
- package/dist/interfaces/public/fiscal-device/index.d.ts +5 -0
- package/dist/interfaces/public/fiscal-device/index.js +21 -0
- package/dist/interfaces/public/fiscal-device/receipts.types.d.ts +170 -0
- package/dist/interfaces/{fiscal-device.interface.js → public/fiscal-device/receipts.types.js} +1 -8
- package/dist/interfaces/public/fiscal-device/shared.types.d.ts +36 -0
- package/dist/interfaces/public/fiscal-device/shared.types.js +10 -0
- package/dist/interfaces/public/http.interface.js +2 -0
- package/dist/interfaces/public/index.d.ts +4 -0
- package/dist/interfaces/public/index.js +20 -0
- package/package.json +1 -1
- package/dist/interfaces/fiscal-device.interface.d.ts +0 -469
- /package/dist/interfaces/{api.interface.js → public/api.interface.js} +0 -0
- /package/dist/interfaces/{certificate-info.interface.d.ts → public/certificate-info.interface.d.ts} +0 -0
- /package/dist/interfaces/{certificate-info.interface.js → public/certificate-info.interface.js} +0 -0
- /package/dist/interfaces/{http.interface.js → public/fiscal-device/device.types.js} +0 -0
- /package/dist/interfaces/{http.interface.d.ts → public/http.interface.d.ts} +0 -0
package/dist/api/exports.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { ApiInterface } from '../interfaces/
|
|
1
|
+
import { ApiInterface } from '../interfaces/public';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
ReservationStudioElectron: ApiInterface;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
export * from '../interfaces/
|
|
8
|
-
export * from '../interfaces/fiscal-device.interface';
|
|
9
|
-
export * from '../interfaces/certificate-info.interface';
|
|
10
|
-
export * from '../interfaces/http.interface';
|
|
7
|
+
export * from '../interfaces/public';
|
package/dist/api/exports.js
CHANGED
|
@@ -14,7 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("../interfaces/
|
|
18
|
-
__exportStar(require("../interfaces/fiscal-device.interface"), exports);
|
|
19
|
-
__exportStar(require("../interfaces/certificate-info.interface"), exports);
|
|
20
|
-
__exportStar(require("../interfaces/http.interface"), exports);
|
|
17
|
+
__exportStar(require("../interfaces/public"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CertificateInfo } from './certificate-info.interface';
|
|
2
2
|
import { HttpOptions, HttpResponse } from './http.interface';
|
|
3
|
-
import { EnvironmentEnum } from '
|
|
4
|
-
import { DeviceInfo, FiscalDeviceDiagnosticsOptions, FiscalDeviceDiagnosticsResult, FiscalDeviceResponse, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt, FiscalResponse, NonFiscalReceipt, ReversalReceipt } from './fiscal-device
|
|
3
|
+
import { EnvironmentEnum } from '../../enums/envirovment.enum';
|
|
4
|
+
import { DeviceInfo, FiscalDeviceDiagnosticsOptions, FiscalDeviceDiagnosticsResult, FiscalDeviceResponse, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt, FiscalResponse, NonFiscalReceipt, ReversalReceipt } from './fiscal-device';
|
|
5
5
|
export interface ApiInterface {
|
|
6
6
|
/**
|
|
7
7
|
* An object representing operations related to certificates.
|
|
@@ -82,6 +82,7 @@ export interface ApiInterface {
|
|
|
82
82
|
/**
|
|
83
83
|
* An object representing operations related to fiscal devices.
|
|
84
84
|
* All methods automatically initialize fiscal devices when needed.
|
|
85
|
+
* All methods can throw a FiscalDeviceErrorPayload on failure.
|
|
85
86
|
*/
|
|
86
87
|
fiscalDevices: {
|
|
87
88
|
/**
|
|
@@ -101,7 +102,7 @@ export interface ApiInterface {
|
|
|
101
102
|
*
|
|
102
103
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
103
104
|
* @return {Promise<DeviceInfo>} A promise that resolves to the detailed device information.
|
|
104
|
-
* @throws {
|
|
105
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
105
106
|
*/
|
|
106
107
|
getDeviceInfo(deviceId: string): Promise<DeviceInfo>;
|
|
107
108
|
/**
|
|
@@ -110,7 +111,7 @@ export interface ApiInterface {
|
|
|
110
111
|
* @param {FiscalReceipt} receipt - The receipt to print.
|
|
111
112
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
112
113
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
113
|
-
* @throws {
|
|
114
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
114
115
|
*/
|
|
115
116
|
printReceipt(receipt: FiscalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
116
117
|
/**
|
|
@@ -119,7 +120,7 @@ export interface ApiInterface {
|
|
|
119
120
|
* @param {NonFiscalReceipt} receipt - The receipt object containing details to be printed as a non-fiscal receipt.
|
|
120
121
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
121
122
|
* @return {Promise<FiscalResponse>} A promise that resolves to a FiscalResponse object indicating the result of the operation.
|
|
122
|
-
* @throws {
|
|
123
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
123
124
|
*/
|
|
124
125
|
printNonFiscalReceipt(receipt: NonFiscalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
125
126
|
/**
|
|
@@ -128,7 +129,7 @@ export interface ApiInterface {
|
|
|
128
129
|
* @param {ReversalReceipt} receipt - The reversal receipt to print.
|
|
129
130
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
130
131
|
* @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
|
|
131
|
-
* @throws {
|
|
132
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
132
133
|
*/
|
|
133
134
|
printReversalReceipt(receipt: ReversalReceipt, deviceId: string): Promise<FiscalResponse>;
|
|
134
135
|
/**
|
|
@@ -136,7 +137,7 @@ export interface ApiInterface {
|
|
|
136
137
|
*
|
|
137
138
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
138
139
|
* @return {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record.
|
|
139
|
-
* @throws {
|
|
140
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
140
141
|
*/
|
|
141
142
|
getLastFiscalRecord(deviceId: string): Promise<FiscalMemoryRecord>;
|
|
142
143
|
/**
|
|
@@ -144,7 +145,7 @@ export interface ApiInterface {
|
|
|
144
145
|
*
|
|
145
146
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
146
147
|
* @return {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the device.
|
|
147
|
-
* @throws {
|
|
148
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
148
149
|
*/
|
|
149
150
|
getStatus(deviceId: string): Promise<FiscalDeviceStatus>;
|
|
150
151
|
/**
|
|
@@ -152,7 +153,7 @@ export interface ApiInterface {
|
|
|
152
153
|
*
|
|
153
154
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
154
155
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
155
|
-
* @throws {
|
|
156
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
156
157
|
*/
|
|
157
158
|
printXReport(deviceId: string): Promise<boolean>;
|
|
158
159
|
/**
|
|
@@ -160,7 +161,7 @@ export interface ApiInterface {
|
|
|
160
161
|
*
|
|
161
162
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
162
163
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
163
|
-
* @throws {
|
|
164
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
164
165
|
*/
|
|
165
166
|
printZReport(deviceId: string): Promise<boolean>;
|
|
166
167
|
/**
|
|
@@ -169,7 +170,7 @@ export interface ApiInterface {
|
|
|
169
170
|
* @param {number} amount - The amount to deposit.
|
|
170
171
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
171
172
|
* @return {Promise<boolean>} A promise that resolves to true if the deposit was successful.
|
|
172
|
-
* @throws {
|
|
173
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
173
174
|
*/
|
|
174
175
|
depositMoney(amount: number, deviceId: string): Promise<boolean>;
|
|
175
176
|
/**
|
|
@@ -178,7 +179,7 @@ export interface ApiInterface {
|
|
|
178
179
|
* @param {number} amount - The amount to withdraw.
|
|
179
180
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
180
181
|
* @return {Promise<boolean>} A promise that resolves to true if the withdrawal was successful.
|
|
181
|
-
* @throws {
|
|
182
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
182
183
|
*/
|
|
183
184
|
withdrawMoney(amount: number, deviceId: string): Promise<boolean>;
|
|
184
185
|
/**
|
|
@@ -186,7 +187,7 @@ export interface ApiInterface {
|
|
|
186
187
|
*
|
|
187
188
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
188
189
|
* @return {Promise<number>} A promise that resolves to the current cash amount.
|
|
189
|
-
* @throws {
|
|
190
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
190
191
|
*/
|
|
191
192
|
getCashAmount(deviceId: string): Promise<number>;
|
|
192
193
|
/**
|
|
@@ -195,7 +196,7 @@ export interface ApiInterface {
|
|
|
195
196
|
* @param {Date} dateTime - The date and time to set.
|
|
196
197
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
197
198
|
* @return {Promise<boolean>} A promise that resolves to true if setting was successful.
|
|
198
|
-
* @throws {
|
|
199
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
199
200
|
*/
|
|
200
201
|
setDateTime(dateTime: Date, deviceId: string): Promise<boolean>;
|
|
201
202
|
/**
|
|
@@ -203,7 +204,7 @@ export interface ApiInterface {
|
|
|
203
204
|
*
|
|
204
205
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
205
206
|
* @return {Promise<Date>} A promise that resolves to the device date/time.
|
|
206
|
-
* @throws {
|
|
207
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
207
208
|
*/
|
|
208
209
|
getDateTime(deviceId: string): Promise<Date>;
|
|
209
210
|
/**
|
|
@@ -211,7 +212,7 @@ export interface ApiInterface {
|
|
|
211
212
|
*
|
|
212
213
|
* @param {string} deviceId - Device identifier from list/scan.
|
|
213
214
|
* @return {Promise<boolean>} A promise that resolves to true if printing was successful.
|
|
214
|
-
* @throws {
|
|
215
|
+
* @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
|
|
215
216
|
*/
|
|
216
217
|
printDuplicate(deviceId: string): Promise<boolean>;
|
|
217
218
|
/**
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { DeviceId, TransportType } from './shared.types';
|
|
2
|
+
import { FiscalPaymentType, FiscalVATGroup } from './receipts.types';
|
|
3
|
+
export interface DeviceCapabilities {
|
|
4
|
+
supportedOperations: {
|
|
5
|
+
printFiscalReceipt: boolean;
|
|
6
|
+
printNonFiscalReceipt: boolean;
|
|
7
|
+
printReversalReceipt: boolean;
|
|
8
|
+
printXReport: boolean;
|
|
9
|
+
printZReport: boolean;
|
|
10
|
+
printDuplicate: boolean;
|
|
11
|
+
depositMoney: boolean;
|
|
12
|
+
withdrawMoney: boolean;
|
|
13
|
+
getCashAmount: boolean;
|
|
14
|
+
setDateTime: boolean;
|
|
15
|
+
getDateTime: boolean;
|
|
16
|
+
getLastFiscalRecord: boolean;
|
|
17
|
+
getStatus: boolean;
|
|
18
|
+
printBarcode: boolean;
|
|
19
|
+
};
|
|
20
|
+
supportsInvoices: boolean;
|
|
21
|
+
supportsRefunds: boolean;
|
|
22
|
+
supportsCreditNotes: boolean;
|
|
23
|
+
maxItemTextLength: number;
|
|
24
|
+
maxCommentTextLength: number;
|
|
25
|
+
maxOperatorPasswordLength: number;
|
|
26
|
+
vatGroups: FiscalVATGroup[];
|
|
27
|
+
paymentTypes: FiscalPaymentType[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Interface for fiscal memory record
|
|
31
|
+
*/
|
|
32
|
+
export interface FiscalMemoryRecord {
|
|
33
|
+
/**
|
|
34
|
+
* The number of the record
|
|
35
|
+
*/
|
|
36
|
+
number: string;
|
|
37
|
+
/**
|
|
38
|
+
* The date of the record
|
|
39
|
+
*/
|
|
40
|
+
date: Date;
|
|
41
|
+
/**
|
|
42
|
+
* The total amount of the record
|
|
43
|
+
*/
|
|
44
|
+
total: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Interface for fiscal device status
|
|
48
|
+
*/
|
|
49
|
+
export interface FiscalDeviceStatus {
|
|
50
|
+
/**
|
|
51
|
+
* Whether the device is connected
|
|
52
|
+
*/
|
|
53
|
+
connected?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the device has paper
|
|
56
|
+
*/
|
|
57
|
+
hasPaper?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the fiscal memory is full
|
|
60
|
+
*/
|
|
61
|
+
fiscalMemoryFull?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether a fiscal receipt is currently open
|
|
64
|
+
*/
|
|
65
|
+
fiscalReceiptOpen?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether a non-fiscal receipt is currently open
|
|
68
|
+
*/
|
|
69
|
+
nonFiscalReceiptOpen?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether printing is allowed
|
|
72
|
+
*/
|
|
73
|
+
printingAllowed?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The messages returned by the fiscal device
|
|
76
|
+
*/
|
|
77
|
+
messages: FiscalResponseMessage[];
|
|
78
|
+
/**
|
|
79
|
+
* Raw status bytes, if available
|
|
80
|
+
*/
|
|
81
|
+
rawStatusBytes?: number[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Interface for fiscal device information in list responses
|
|
85
|
+
*/
|
|
86
|
+
export interface FiscalDeviceResponse {
|
|
87
|
+
/**
|
|
88
|
+
* Device identifier (stable for the device model/serial)
|
|
89
|
+
*/
|
|
90
|
+
deviceId: DeviceId;
|
|
91
|
+
/**
|
|
92
|
+
* The manufacturer of the fiscal device
|
|
93
|
+
*/
|
|
94
|
+
manufacturer: string;
|
|
95
|
+
/**
|
|
96
|
+
* The model name of the fiscal device
|
|
97
|
+
*/
|
|
98
|
+
model: string;
|
|
99
|
+
/**
|
|
100
|
+
* The serial number of the fiscal device
|
|
101
|
+
*/
|
|
102
|
+
serialNumber: string;
|
|
103
|
+
/**
|
|
104
|
+
* Transport type used to access the device
|
|
105
|
+
*/
|
|
106
|
+
transport?: TransportType;
|
|
107
|
+
/**
|
|
108
|
+
* Device capabilities
|
|
109
|
+
*/
|
|
110
|
+
capabilities?: DeviceCapabilities;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Interface for detailed device information
|
|
114
|
+
*/
|
|
115
|
+
export interface DeviceInfo {
|
|
116
|
+
/**
|
|
117
|
+
* Device identifier (stable for the device model/serial)
|
|
118
|
+
*/
|
|
119
|
+
deviceId: DeviceId;
|
|
120
|
+
/**
|
|
121
|
+
* The serial number of the fiscal device
|
|
122
|
+
*/
|
|
123
|
+
serialNumber: string;
|
|
124
|
+
/**
|
|
125
|
+
* The fiscal memory serial number
|
|
126
|
+
*/
|
|
127
|
+
fiscalMemorySerialNumber: string;
|
|
128
|
+
/**
|
|
129
|
+
* The manufacturer of the fiscal device
|
|
130
|
+
*/
|
|
131
|
+
manufacturer: string;
|
|
132
|
+
/**
|
|
133
|
+
* The model name of the fiscal device
|
|
134
|
+
*/
|
|
135
|
+
model: string;
|
|
136
|
+
/**
|
|
137
|
+
* Driver identifier
|
|
138
|
+
*/
|
|
139
|
+
driverId?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Transport type
|
|
142
|
+
*/
|
|
143
|
+
transport?: TransportType;
|
|
144
|
+
/**
|
|
145
|
+
* The firmware version of the fiscal device
|
|
146
|
+
*/
|
|
147
|
+
firmwareVersion: string;
|
|
148
|
+
/**
|
|
149
|
+
* The current date and time of the fiscal device
|
|
150
|
+
*/
|
|
151
|
+
currentDateTime?: string;
|
|
152
|
+
/**
|
|
153
|
+
* The maximum length of item text
|
|
154
|
+
*/
|
|
155
|
+
itemTextMaxLength: number;
|
|
156
|
+
/**
|
|
157
|
+
* The maximum length of comment text
|
|
158
|
+
*/
|
|
159
|
+
commentTextMaxLength: number;
|
|
160
|
+
/**
|
|
161
|
+
* The maximum length of operator password
|
|
162
|
+
*/
|
|
163
|
+
operatorPasswordMaxLength: number;
|
|
164
|
+
/**
|
|
165
|
+
* The supported payment types
|
|
166
|
+
*/
|
|
167
|
+
supportedPaymentTypes: FiscalPaymentType[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Interface for fiscal response
|
|
171
|
+
*/
|
|
172
|
+
export interface FiscalResponse {
|
|
173
|
+
/**
|
|
174
|
+
* The receipt number (if applicable)
|
|
175
|
+
*/
|
|
176
|
+
number?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Represents a unique identifier for a receipt generated for a particular sale.
|
|
179
|
+
* This variable is used to ensure that each sale has a distinct and traceable number.
|
|
180
|
+
* It may be undefined if no sale has been processed or the number has not been generated yet.
|
|
181
|
+
*/
|
|
182
|
+
generatedUniqueSaleNumber?: string;
|
|
183
|
+
/**
|
|
184
|
+
* The receipt date and time (if applicable)
|
|
185
|
+
*/
|
|
186
|
+
datetime?: string;
|
|
187
|
+
/**
|
|
188
|
+
* The receipt amount (if applicable)
|
|
189
|
+
*/
|
|
190
|
+
amount?: number;
|
|
191
|
+
/**
|
|
192
|
+
* Represents an optional piece of information regarding a device.
|
|
193
|
+
* This variable can store details such as the device's specifications,
|
|
194
|
+
* status, or metadata, depending on the structure of the `DeviceInfo` type.
|
|
195
|
+
*
|
|
196
|
+
* The value of `deviceInfo` may be undefined if no device information is available.
|
|
197
|
+
*
|
|
198
|
+
* @type {DeviceInfo | undefined}
|
|
199
|
+
*/
|
|
200
|
+
deviceInfo?: DeviceInfo;
|
|
201
|
+
/**
|
|
202
|
+
* The messages returned by the fiscal device
|
|
203
|
+
*/
|
|
204
|
+
messages: FiscalResponseMessage[];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Interface for fiscal response message
|
|
208
|
+
*/
|
|
209
|
+
export interface FiscalResponseMessage {
|
|
210
|
+
/**
|
|
211
|
+
* The type of the message
|
|
212
|
+
*/
|
|
213
|
+
type: 'info' | 'warning' | 'error';
|
|
214
|
+
/**
|
|
215
|
+
* The code of the message (if applicable)
|
|
216
|
+
*/
|
|
217
|
+
code?: string;
|
|
218
|
+
/**
|
|
219
|
+
* The text of the message
|
|
220
|
+
*/
|
|
221
|
+
text: string;
|
|
222
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DeviceId, OperatorInfo } from './shared.types';
|
|
2
|
+
import { FiscalVATGroup } from './receipts.types';
|
|
3
|
+
import { DeviceInfo, FiscalDeviceStatus, FiscalMemoryRecord, FiscalResponse } from './device.types';
|
|
4
|
+
export type FiscalDeviceDiagnosticStepName = 'deviceInfo' | 'status' | 'lastFiscalRecord' | 'cashAmount' | 'nonFiscalReceipt';
|
|
5
|
+
export interface FiscalDeviceDiagnosticStepBase {
|
|
6
|
+
name: FiscalDeviceDiagnosticStepName;
|
|
7
|
+
ok: boolean;
|
|
8
|
+
startedAt: string;
|
|
9
|
+
finishedAt: string;
|
|
10
|
+
skipped?: boolean;
|
|
11
|
+
skipReason?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FiscalDeviceDiagnosticStepDeviceInfo extends FiscalDeviceDiagnosticStepBase {
|
|
15
|
+
name: 'deviceInfo';
|
|
16
|
+
data?: DeviceInfo;
|
|
17
|
+
}
|
|
18
|
+
export interface FiscalDeviceDiagnosticStepStatus extends FiscalDeviceDiagnosticStepBase {
|
|
19
|
+
name: 'status';
|
|
20
|
+
data?: FiscalDeviceStatus;
|
|
21
|
+
}
|
|
22
|
+
export interface FiscalDeviceDiagnosticStepLastFiscalRecord extends FiscalDeviceDiagnosticStepBase {
|
|
23
|
+
name: 'lastFiscalRecord';
|
|
24
|
+
data?: FiscalMemoryRecord;
|
|
25
|
+
}
|
|
26
|
+
export interface FiscalDeviceDiagnosticStepCashAmount extends FiscalDeviceDiagnosticStepBase {
|
|
27
|
+
name: 'cashAmount';
|
|
28
|
+
data?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface FiscalDeviceDiagnosticStepNonFiscalReceipt extends FiscalDeviceDiagnosticStepBase {
|
|
31
|
+
name: 'nonFiscalReceipt';
|
|
32
|
+
data?: FiscalResponse;
|
|
33
|
+
}
|
|
34
|
+
export type FiscalDeviceDiagnosticStep = FiscalDeviceDiagnosticStepDeviceInfo | FiscalDeviceDiagnosticStepStatus | FiscalDeviceDiagnosticStepLastFiscalRecord | FiscalDeviceDiagnosticStepCashAmount | FiscalDeviceDiagnosticStepNonFiscalReceipt;
|
|
35
|
+
export interface FiscalDeviceDiagnosticsOptions {
|
|
36
|
+
operator: OperatorInfo;
|
|
37
|
+
amount?: number;
|
|
38
|
+
vatGroup?: FiscalVATGroup;
|
|
39
|
+
itemName?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface FiscalDeviceDiagnosticsResult {
|
|
42
|
+
deviceId: DeviceId;
|
|
43
|
+
ok: boolean;
|
|
44
|
+
startedAt: string;
|
|
45
|
+
finishedAt: string;
|
|
46
|
+
steps: FiscalDeviceDiagnosticStep[];
|
|
47
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { DeviceId, TransportType } from './shared.types';
|
|
2
|
+
import { FiscalDeviceStatus } from './device.types';
|
|
3
|
+
/**
|
|
4
|
+
* Enum for fiscal device error codes
|
|
5
|
+
*/
|
|
6
|
+
export declare enum FiscalErrorCode {
|
|
7
|
+
CONNECTION_ERROR = "CONNECTION_ERROR",
|
|
8
|
+
DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
|
|
9
|
+
COMMUNICATION_ERROR = "COMMUNICATION_ERROR",
|
|
10
|
+
TIMEOUT_ERROR = "TIMEOUT_ERROR",
|
|
11
|
+
OPERATION_FAILED = "OPERATION_FAILED",
|
|
12
|
+
INVALID_COMMAND = "INVALID_COMMAND",
|
|
13
|
+
UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION",
|
|
14
|
+
DEVICE_BUSY = "DEVICE_BUSY",
|
|
15
|
+
DEVICE_OFFLINE = "DEVICE_OFFLINE",
|
|
16
|
+
DEVICE_ERROR = "DEVICE_ERROR",
|
|
17
|
+
DEVICE_STATUS_ERROR = "DEVICE_STATUS_ERROR",
|
|
18
|
+
FISCAL_MEMORY_FULL = "FISCAL_MEMORY_FULL",
|
|
19
|
+
FISCAL_MEMORY_ERROR = "FISCAL_MEMORY_ERROR",
|
|
20
|
+
OUT_OF_PAPER = "OUT_OF_PAPER",
|
|
21
|
+
PRINTER_ERROR = "PRINTER_ERROR",
|
|
22
|
+
AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
|
|
23
|
+
INVALID_OPERATOR = "INVALID_OPERATOR",
|
|
24
|
+
WRONG_PASSWORD = "WRONG_PASSWORD",
|
|
25
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
26
|
+
INVALID_DATA = "INVALID_DATA",
|
|
27
|
+
REQUIRED_FIELD_MISSING = "REQUIRED_FIELD_MISSING",
|
|
28
|
+
RECEIPT_ERROR = "RECEIPT_ERROR",
|
|
29
|
+
RECEIPT_OPEN_ERROR = "RECEIPT_OPEN_ERROR",
|
|
30
|
+
PAYMENT_ERROR = "PAYMENT_ERROR",
|
|
31
|
+
REPORT_ERROR = "REPORT_ERROR",
|
|
32
|
+
REPORT_GENERATION_ERROR = "REPORT_GENERATION_ERROR",
|
|
33
|
+
CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
|
|
34
|
+
INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
|
|
35
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
36
|
+
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
37
|
+
}
|
|
38
|
+
export type FiscalDeviceErrorName = 'FiscalDeviceError' | 'FiscalDeviceOperationError' | 'FiscalDeviceConnectionError' | 'FiscalDeviceStatusError' | 'FiscalDeviceTimeoutError' | 'FiscalDeviceValidationError';
|
|
39
|
+
/**
|
|
40
|
+
* Context attached to fiscal device errors to help external integrations.
|
|
41
|
+
*/
|
|
42
|
+
export interface FiscalDeviceErrorContext {
|
|
43
|
+
/**
|
|
44
|
+
* Device identifier from list/scan.
|
|
45
|
+
*/
|
|
46
|
+
deviceId?: DeviceId;
|
|
47
|
+
/**
|
|
48
|
+
* IPC action or higher-level operation label.
|
|
49
|
+
*/
|
|
50
|
+
action?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Driver identifier, if known.
|
|
53
|
+
*/
|
|
54
|
+
driverId?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Transport type used for the connection.
|
|
57
|
+
*/
|
|
58
|
+
transport?: TransportType;
|
|
59
|
+
/**
|
|
60
|
+
* Driver-level operation name (e.g. printReceipt, getStatus).
|
|
61
|
+
*/
|
|
62
|
+
operation?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Standardized error payload for fiscal device operations.
|
|
66
|
+
* This is the shape exposed to external systems over IPC.
|
|
67
|
+
*/
|
|
68
|
+
export interface FiscalDeviceErrorPayload {
|
|
69
|
+
name: FiscalDeviceErrorName;
|
|
70
|
+
message: string;
|
|
71
|
+
code: FiscalErrorCode;
|
|
72
|
+
retryable: boolean;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
context?: FiscalDeviceErrorContext;
|
|
75
|
+
validationErrors?: string[];
|
|
76
|
+
status?: FiscalDeviceStatus;
|
|
77
|
+
details?: Record<string, unknown>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FiscalErrorCode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enum for fiscal device error codes
|
|
6
|
+
*/
|
|
7
|
+
var FiscalErrorCode;
|
|
8
|
+
(function (FiscalErrorCode) {
|
|
9
|
+
// Connection errors
|
|
10
|
+
FiscalErrorCode["CONNECTION_ERROR"] = "CONNECTION_ERROR";
|
|
11
|
+
FiscalErrorCode["DEVICE_NOT_FOUND"] = "DEVICE_NOT_FOUND";
|
|
12
|
+
FiscalErrorCode["COMMUNICATION_ERROR"] = "COMMUNICATION_ERROR";
|
|
13
|
+
FiscalErrorCode["TIMEOUT_ERROR"] = "TIMEOUT_ERROR";
|
|
14
|
+
// Operation errors
|
|
15
|
+
FiscalErrorCode["OPERATION_FAILED"] = "OPERATION_FAILED";
|
|
16
|
+
FiscalErrorCode["INVALID_COMMAND"] = "INVALID_COMMAND";
|
|
17
|
+
FiscalErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
|
|
18
|
+
// Device status errors
|
|
19
|
+
FiscalErrorCode["DEVICE_BUSY"] = "DEVICE_BUSY";
|
|
20
|
+
FiscalErrorCode["DEVICE_OFFLINE"] = "DEVICE_OFFLINE";
|
|
21
|
+
FiscalErrorCode["DEVICE_ERROR"] = "DEVICE_ERROR";
|
|
22
|
+
FiscalErrorCode["DEVICE_STATUS_ERROR"] = "DEVICE_STATUS_ERROR";
|
|
23
|
+
// Fiscal memory errors
|
|
24
|
+
FiscalErrorCode["FISCAL_MEMORY_FULL"] = "FISCAL_MEMORY_FULL";
|
|
25
|
+
FiscalErrorCode["FISCAL_MEMORY_ERROR"] = "FISCAL_MEMORY_ERROR";
|
|
26
|
+
// Paper errors
|
|
27
|
+
FiscalErrorCode["OUT_OF_PAPER"] = "OUT_OF_PAPER";
|
|
28
|
+
FiscalErrorCode["PRINTER_ERROR"] = "PRINTER_ERROR";
|
|
29
|
+
// Authentication errors
|
|
30
|
+
FiscalErrorCode["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED";
|
|
31
|
+
FiscalErrorCode["INVALID_OPERATOR"] = "INVALID_OPERATOR";
|
|
32
|
+
FiscalErrorCode["WRONG_PASSWORD"] = "WRONG_PASSWORD";
|
|
33
|
+
// Validation errors
|
|
34
|
+
FiscalErrorCode["VALIDATION_ERROR"] = "VALIDATION_ERROR";
|
|
35
|
+
FiscalErrorCode["INVALID_DATA"] = "INVALID_DATA";
|
|
36
|
+
FiscalErrorCode["REQUIRED_FIELD_MISSING"] = "REQUIRED_FIELD_MISSING";
|
|
37
|
+
// Fiscal receipt errors
|
|
38
|
+
FiscalErrorCode["RECEIPT_ERROR"] = "RECEIPT_ERROR";
|
|
39
|
+
FiscalErrorCode["RECEIPT_OPEN_ERROR"] = "RECEIPT_OPEN_ERROR";
|
|
40
|
+
FiscalErrorCode["PAYMENT_ERROR"] = "PAYMENT_ERROR";
|
|
41
|
+
// Report errors
|
|
42
|
+
FiscalErrorCode["REPORT_ERROR"] = "REPORT_ERROR";
|
|
43
|
+
FiscalErrorCode["REPORT_GENERATION_ERROR"] = "REPORT_GENERATION_ERROR";
|
|
44
|
+
// Configuration errors
|
|
45
|
+
FiscalErrorCode["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
|
|
46
|
+
FiscalErrorCode["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
|
|
47
|
+
// Generic errors
|
|
48
|
+
FiscalErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
49
|
+
FiscalErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
50
|
+
})(FiscalErrorCode || (exports.FiscalErrorCode = FiscalErrorCode = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./shared.types"), exports);
|
|
18
|
+
__exportStar(require("./receipts.types"), exports);
|
|
19
|
+
__exportStar(require("./device.types"), exports);
|
|
20
|
+
__exportStar(require("./diagnostics.types"), exports);
|
|
21
|
+
__exportStar(require("./errors.types"), exports);
|