@reservation-studio/electron-types 0.0.11 → 0.0.12

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 CHANGED
@@ -40,7 +40,10 @@ Methods for working with certificates:
40
40
  const certificates = await ReservationStudioElectron.certificates.list();
41
41
 
42
42
  // Validate a certificate PIN
43
- const isValid = await ReservationStudioElectron.certificates.isValidPin(slot, pin);
43
+ const isValid = await ReservationStudioElectron.certificates.isValidPin(
44
+ slot,
45
+ pin
46
+ );
44
47
  ```
45
48
 
46
49
  ### XML Signing
@@ -97,33 +100,36 @@ const devices = await ReservationStudioElectron.fiscalDevices.list();
97
100
  await ReservationStudioElectron.fiscalDevices.setActiveDevice(serialNumber);
98
101
 
99
102
  // Get the active fiscal device
100
- const activeDevice = await ReservationStudioElectron.fiscalDevices.getActiveDevice();
103
+ const activeDevice =
104
+ await ReservationStudioElectron.fiscalDevices.getActiveDevice();
101
105
 
102
106
  // Print a fiscal receipt
103
- const receiptNumber = await ReservationStudioElectron.fiscalDevices.printReceipt({
104
- operatorNumber: 1,
105
- operatorPassword: '1',
106
- items: [
107
- {
108
- name: 'Product 1',
109
- price: 10.00,
110
- quantity: 1,
111
- vatGroup: 'A'
112
- }
113
- ],
114
- payments: [
115
- {
116
- type: 'cash',
117
- amount: 10.00
118
- }
119
- ]
120
- });
107
+ const receiptNumber =
108
+ await ReservationStudioElectron.fiscalDevices.printReceipt({
109
+ operatorNumber: 1,
110
+ operatorPassword: '1',
111
+ items: [
112
+ {
113
+ name: 'Product 1',
114
+ price: 10.0,
115
+ quantity: 1,
116
+ vatGroup: 'A'
117
+ }
118
+ ],
119
+ payments: [
120
+ {
121
+ type: 'cash',
122
+ amount: 10.0
123
+ }
124
+ ]
125
+ });
121
126
 
122
127
  // Print non-fiscal text
123
128
  await ReservationStudioElectron.fiscalDevices.printText('Hello, World!');
124
129
 
125
130
  // Get the last fiscal memory record
126
- const lastRecord = await ReservationStudioElectron.fiscalDevices.getLastFiscalRecord();
131
+ const lastRecord =
132
+ await ReservationStudioElectron.fiscalDevices.getLastFiscalRecord();
127
133
 
128
134
  // Get the fiscal device status
129
135
  const status = await ReservationStudioElectron.fiscalDevices.getStatus();
@@ -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 { FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt } from './fiscal-device.interface';
4
+ import { FiscalDeviceInfo, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt } from './fiscal-device.interface';
5
5
  export interface ApiInterface {
6
6
  /**
7
7
  * An object representing operations related to certificates.
@@ -88,30 +88,24 @@ export interface ApiInterface {
88
88
  * Gets a list of all detected fiscal devices.
89
89
  * Automatically initializes fiscal devices if needed.
90
90
  *
91
- * @return {Promise<Array<{manufacturer: string, model: string, serialNumber: string}>>} A promise that resolves to an array of fiscal device information.
91
+ * @return {Promise<FiscalDeviceInfo[]>} A promise that resolves to an array of fiscal device information.
92
92
  */
93
- list(): Promise<Array<{
94
- manufacturer: string;
95
- model: string;
96
- serialNumber: string;
97
- }>>;
93
+ list(): Promise<FiscalDeviceInfo[]>;
98
94
  /**
99
95
  * Sets the active fiscal device.
100
96
  *
101
97
  * @param {string} serialNumber - The serial number of the device to set as active.
102
- * @return {Promise<boolean>} A promise that resolves to true if the device was found and set as active.
98
+ * @return {Promise<void>} A promise that resolves when the device is successfully set as active.
99
+ * @throws {Error} If the device with the specified serial number is not found.
103
100
  */
104
- setActiveDevice(serialNumber: string): Promise<boolean>;
101
+ setActiveDevice(serialNumber: string): Promise<void>;
105
102
  /**
106
103
  * Gets the active fiscal device.
107
104
  *
108
- * @return {Promise<{manufacturer: string, model: string, serialNumber: string} | null>} A promise that resolves to the active fiscal device information or null if no device is active.
105
+ * @return {Promise<FiscalDeviceInfo>} A promise that resolves to the active fiscal device information.
106
+ * @throws {Error} If no active device is set.
109
107
  */
110
- getActiveDevice(): Promise<{
111
- manufacturer: string;
112
- model: string;
113
- serialNumber: string;
114
- } | null>;
108
+ getActiveDevice(): Promise<FiscalDeviceInfo>;
115
109
  /**
116
110
  * Prints a fiscal receipt using the active device.
117
111
  *
@@ -202,3 +202,20 @@ export interface FiscalDeviceStatus {
202
202
  */
203
203
  errorMessage?: string;
204
204
  }
205
+ /**
206
+ * Interface for fiscal device information in list responses
207
+ */
208
+ export interface FiscalDeviceInfo {
209
+ /**
210
+ * The manufacturer of the fiscal device
211
+ */
212
+ manufacturer: string;
213
+ /**
214
+ * The model name of the fiscal device
215
+ */
216
+ model: string;
217
+ /**
218
+ * The serial number of the fiscal device
219
+ */
220
+ serialNumber: string;
221
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reservation-studio/electron-types",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "TypeScript типове за ReservationStudioElectron",
5
5
  "scripts": {
6
6
  "build": "tsc",