UNPKG

@reservation-studio/electron-types

Version:

TypeScript типове за ReservationStudioElectron

231 lines (230 loc) 5.77 kB
import { DeviceId, TransportType } from './shared.types'; import { FiscalPaymentType, FiscalVATGroup } from './receipts.types'; export interface DeviceCapabilities { supportedOperations: { printFiscalReceipt: boolean; printNonFiscalReceipt: boolean; printReversalReceipt: boolean; printXReport: boolean; printZReport: boolean; printDuplicate: boolean; depositMoney: boolean; withdrawMoney: boolean; getCashAmount: boolean; setDateTime: boolean; getDateTime: boolean; getLastFiscalRecord: boolean; getStatus: boolean; printBarcode: boolean; }; supportsInvoices: boolean; supportsRefunds: boolean; supportsCreditNotes: boolean; maxItemTextLength: number; maxCommentTextLength: number; maxOperatorPasswordLength: number; vatGroups: FiscalVATGroup[]; paymentTypes: FiscalPaymentType[]; } /** * Interface for fiscal memory record */ export interface FiscalMemoryRecord { /** * The number of the record */ number: string; /** * The date of the record */ date: Date; /** * The total amount of the record */ total: number; } /** * Interface for fiscal device status */ export declare enum PaperStatus { Ok = "ok", Low = "low", Out = "out" } export interface FiscalDeviceStatus { /** * High-level paper status derived from device flags. */ paperStatus: PaperStatus; /** * Whether the device is connected */ connected: boolean; /** * Whether the fiscal memory is full */ fiscalMemoryFull: boolean; /** * Whether a fiscal receipt is currently open */ fiscalReceiptOpen: boolean; /** * Whether a non-fiscal receipt is currently open */ nonFiscalReceiptOpen: boolean; /** * Whether the device is ready to accept print commands. */ readyToPrint: boolean; /** * The messages returned by the fiscal device */ messages: FiscalResponseMessage[]; /** * Raw status bytes, if available */ rawStatusBytes?: number[]; } /** * Interface for fiscal device information in list responses */ export interface FiscalDeviceResponse { /** * Device identifier (stable for the device model/serial) */ deviceId: DeviceId; /** * The manufacturer of the fiscal device */ manufacturer: string; /** * The model name of the fiscal device */ model: string; /** * The serial number of the fiscal device */ serialNumber: string; /** * Transport type used to access the device */ transport?: TransportType; /** * Device capabilities */ capabilities?: DeviceCapabilities; } /** * Interface for detailed device information */ export interface DeviceInfo { /** * Device identifier (stable for the device model/serial) */ deviceId: DeviceId; /** * The serial number of the fiscal device */ serialNumber: string; /** * The fiscal memory serial number */ fiscalMemorySerialNumber: string; /** * The manufacturer of the fiscal device */ manufacturer: string; /** * The model name of the fiscal device */ model: string; /** * Driver identifier */ driverId?: string; /** * Transport type */ transport?: TransportType; /** * The firmware version of the fiscal device */ firmwareVersion: string; /** * The current date and time of the fiscal device */ currentDateTime?: string; /** * The maximum length of item text */ itemTextMaxLength: number; /** * The maximum length of comment text */ commentTextMaxLength: number; /** * The maximum length of operator password */ operatorPasswordMaxLength: number; /** * The supported payment types */ supportedPaymentTypes: FiscalPaymentType[]; } /** * Interface for fiscal response */ export interface FiscalResponse { /** * The receipt number (if applicable) */ number?: string; /** * Represents a unique identifier for a receipt generated for a particular sale. * This variable is used to ensure that each sale has a distinct and traceable number. * It may be undefined if no sale has been processed or the number has not been generated yet. */ generatedUniqueSaleNumber?: string; /** * The receipt date and time (if applicable). * Must be returned in device-local ISO format: YYYY-MM-DDTHH:mm:ss * (without timezone) to match the printed receipt time. */ datetime?: string; /** * The receipt amount (if applicable) */ amount?: number; /** * Represents an optional piece of information regarding a device. * This variable can store details such as the device's specifications, * status, or metadata, depending on the structure of the `DeviceInfo` type. * * The value of `deviceInfo` may be undefined if no device information is available. * * @type {DeviceInfo | undefined} */ deviceInfo?: DeviceInfo; /** * The messages returned by the fiscal device */ messages: FiscalResponseMessage[]; } /** * Interface for fiscal response message */ export interface FiscalResponseMessage { /** * The type of the message */ type: 'info' | 'warning' | 'error'; /** * The code of the message (if applicable). * Daisy example codes: E301 (out of paper), W301/W302 (paper low), E999 (general error). */ code?: string; /** * The text of the message */ text: string; }