type LocalizationField = { arabic: string; english: string; }; type LabelField = { label: LocalizationField; value: T; }; type NameField = { name: LocalizationField; id: T; }; type TransactionData = { receipts?: TransactionReceipt[]; isNewTransaction?: boolean; }; type TransactionReceipt = { receipt_id: string; merchant: Merchant; start_date: string; start_time: string; card_scheme_sponsor: string; tid: string; system_trace_audit_number: string; pos_software_version_number: string; retrieval_reference_number: string; card_scheme: NameField; transaction_type: NameField; pan: string; card_expiration: string; amount_authorized: LabelField; amount_other: LabelField; currency: LocalizationField; status_message: LocalizationField; is_approved: boolean; is_refunded: boolean; is_reversed: boolean; approval_code?: LabelField; verification_method: LocalizationField; end_date: string; end_time: string; receipt_line_one: LocalizationField; receipt_line_two: LocalizationField; thanks_message: LocalizationField; save_receipt_message: LocalizationField; entry_mode: string; action_code: string; application_identifier: string; terminal_verification_result: string; transaction_state_information: string; cardholader_verfication_result: string; cryptogram_information_data: string; application_cryptogram: string; kernel_id: string; payment_account_reference?: string; pan_suffix?: string; created_at: string; updated_at: string; qr_code: string; transaction_uuid: string; }; type Merchant = { id: string; name: LocalizationField; address: LocalizationField; category_code: string; }; declare enum TransactionType { UNDEFINED = "-1", PURCHASE = "00", CASH = "01", CASH_DISBURSEMENT = "17", PURCHASE_WITH_CASHBACK = "09", REFUND = "20" } type TransactionBannerList = { total: number; transactions: TransactionBanner[]; }; type TransactionBanner = { uuid: string; scheme: string; pan: string; amount_authorized: string; currency: LocalizationField; transaction_type: TransactionType; is_approved: Boolean; is_reversed: Boolean; start_date: string; start_time: string; customer_reference_number?: string; }; type SessionData = { id: string; status: string; type: string; client_id: string; amount: string; expired_at: string; reference_id?: string; created_at: string; updated_at: string; transaction?: SessionTransaction; }; type SessionTransaction = { id?: string; uuid?: string; amount_authorized?: string; transaction_currency_code?: string; cardholder_verification_result?: string; lat?: string; lon?: string; transaction_type?: string; card_scheme_id?: string; system_trace_audit_number?: string; is_approved?: boolean; is_reversed?: boolean; is_reconcilied?: boolean; device_id?: string; user_id?: string; merchant_id?: string; customer_reference_number?: string; pos_confirmed?: boolean; created_at?: string; updated_at?: string; receipts: TransactionReceipt[]; card_scheme: LocalizationField; type: LocalizationField; verification_method: LocalizationField; }; type ReconciliationBannerList = { total: number; reconciliations: ReconciliationBanner[]; }; type ReconciliationBanner = { id: String; date: String; time: String; is_balanced: LabelField; total: String; currency: LocalizationField; }; type ReconciliationReceipt = { id: string; date: string; time: string; is_balanced: LabelField; details: ReconciliationDetailsType; schemes: ReconciliationSchemesType[]; currency: LocalizationField; qr_code: string; merchant: Merchant; tid: string; system_trace_audit_number: string; pos_software_version_number: string; }; type ReconciliationDetailsType = { purchase: ReconciliationLabelField; refund: ReconciliationLabelField; purchase_reversal: ReconciliationLabelField; refund_reversal: ReconciliationLabelField; total: ReconciliationLabelField; }; type ReconciliationSchemesType = { name: LabelField; pos: ReconciliationSchemesDetailsType; host: ReconciliationSchemesDetailsType; }; type ReconciliationSchemesDetailsType = { debit: ReconciliationLabelField; credit: ReconciliationLabelField; total: ReconciliationLabelField; }; type ReconciliationLabelField = { label: LocalizationField; total: String; count: number; }; type PayloadMetaDataType = { platform: string; device_id: string; device_user: string; os_version: string; sdk_version: string; payment_plugin_version: string; }; type RemoteJobRequest = { jobId: string; messageId: string; commandType: JOB_COMMANDTYPE; metaData: PayloadMetaDataType; payload: { payloadType: 0; command: JOB_COMMAND; } & PayloadType; }; type RemoteQuerySingleTransactionPayload = { transactionUuid: string; }; type RemoteQuerySingleReconciliationPayload = { reconciliationUuid: string; }; type RemoteSwitchTerminalPayload = { terminal_uuid: string; }; type RemoteJobResponse = { jobId: string; messageId: string; commandType: JOB_COMMANDTYPE; metaData: PayloadMetaDataType; payload: { payloadType: 1; command: JOB_COMMAND; } & PayloadType; }; declare enum JOB_COMMAND { PURCHASE = 0, REFUND = 1, RECONCILE = 2, REVERSE = 3, TRANSACTIONS_LIST = 4, SINGLE_TRANSACTION = 5, RECONCILIATIONS_LIST = 6, SINGLE_RECONCILIATION = 7, CANCEL = 8, GET_TERMINAL_INFO = 9, SWITCH_TERMINAL = 10, DELETE_ROOM = 11, CHECK_JOB = 12, LOGOUT = 13 } declare enum JOB_COMMANDTYPE { CREATE = 0, CANCEL = 1, UPDATE = 2, OUTCOME = 3, CANCEL_REVERSE = 4, BUSY = 5, PAUSED = 6 } type ProxyJobBody = { id: string; data: RemoteJobRequest; requireAck: boolean; replyTo: string | null; }; type ProxyAckBody = { replyTo: string; }; type ProxyEventBody = ({ name: PROXY_EVENT_NAME.CONNECTION_SUCCESS; } & {}) | ({ name: PROXY_EVENT_NAME.UPDATE_CASHIER; } & { id: string; }) | ({ name: PROXY_EVENT_NAME.TERMINAL_INFO; } & {}) | ({ name: PROXY_EVENT_NAME.TRANSACTION_STATE; } & { state: TRANSACTION_STATE; job_id: string; }) | { name: Exclude; }; type ProxyMessageBodyMap = { [PROXY_MESSAGE_TYPE.JOB]: ProxyJobBody; [PROXY_MESSAGE_TYPE.ACK]: ProxyAckBody; [PROXY_MESSAGE_TYPE.EVENT]: ProxyEventBody; [PROXY_MESSAGE_TYPE.PING]: {}; [PROXY_MESSAGE_TYPE.PONG]: {}; }; type ProxyMessage = { type: T; } & ProxyMessageBodyMap[T]; declare enum PROXY_EVENT_NAME { CONNECTION_SUCCESS = "connection_success", PAIRING_STATUS = "pairing_status", CLEAR_DATA = "clear_data", UPDATE_CASHIER = "update_cashier", UPDATE_TERMINAL = "update_terminal", TERMINAL_INFO = "terminal_info", CASHIER_INFO = "cashier_info", UNAUTHORIZED = "unauthorized", SESSION_NOT_FOUND = "session_not_found", TRANSACTION_STATE = "transaction_state", CANCEL_TRANSACTION = "cancel", FORGET_CONNECTION = "forget" } declare enum TRANSACTION_STATE { JOB_INITIALIZED = "JobInitialized", JOB_STARTED = "JobStarted", JOB_ENDED = "JobEnded", READER_WAITING = "Reader.Waiting", READER_READING = "Reader.Reading", READER_RETRY = "Reader.Retry", READER_ERROR = "Reader.Error", READER_FINISHED = "Reader.Finished", PIN_ENTERING = "Pin.Entering", ONLINE_PROCESSING = "Online.Processing", ONLINE_ERROR = "Online.Error", ONLINE_RESULT = "Online.Result" } declare enum PROXY_MESSAGE_TYPE { JOB = "job", ACK = "ack", EVENT = "event", PING = "ping", PONG = "pong" } type ConnectionManagerConstructor = { environment: Environments; connectors_implementations: CONNECTORS_IMPLEMENTATIONS; }; type ConnectionDispatcher = (toSend: ProxyMessage) => Promise; type ConnectionReciever = (message: ProxyMessage) => Promise; /** * connector is an object that is responsable of connecting to the terminal * and specefing how the messages should be sent * * every method of connecting should override the given methods to be able to * send and receive data * * connector should send the given message as blackbox, not knowing its content, * its just a tunnel to terminal * * the shape of the data and handling it should be the ressponsability of broker */ declare abstract class Connector { abstract get type(): T; protected info: ConnectionParams; protected environment: Environments; constructor(data: ConnectorConstuctor); /** * return a string on error indicating the error, or * else it will return undefined if it success */ abstract connect(): Promise>; /** */ abstract disconnect(options: ConnectorDisconnectOptions | undefined): Promise; abstract reconnect(): Promise>; abstract isConnected(): boolean; abstract dispatch(toSend: ProxyMessage): Promise; protected _onDisconnectCallback: (options: ConnectorDisconnectOptions) => void; protected _onMessageCallback: ConnectionReciever; setOnDisconnectHandler(handler: (options: ConnectorDisconnectOptions) => void): void; set receiver(callback: ConnectionReciever); } type RemoteConnectionWithParingCodeSettings = { pairing_code: string; }; type RemoteConnectionWithJwtSettings = { jwt_token: string; }; type RemoteConnectionWithAccessCodeSettings = { room_id: string; access_token: string; }; type UsbConnectionWithSerialNumber = { serial_number: string; }; type ConnectorConstuctor = { info: ConnectionParams; environment: Environments; }; declare enum CONNECTOR_TYPE { REMOTE = "Remote", USB = "USB" } type ConnectorGenerator = (data: ConnectorConstuctor) => Connector; type CONNECTORS_IMPLEMENTATIONS = Partial<{ [TYPE in CONNECTOR_TYPE]: ConnectorGenerator; }>; type ConnectionSettingsMap = { [CONNECTOR_TYPE.REMOTE]: { param: RemoteConnectionWithParingCodeSettings | RemoteConnectionWithJwtSettings | RemoteConnectionWithAccessCodeSettings; return: RemoteConnectionWithAccessCodeSettings; }; [CONNECTOR_TYPE.USB]: { param: UsbConnectionWithSerialNumber | {}; return: UsbConnectionWithSerialNumber; }; }; type ConnectionParams = { type: T; } & ConnectionSettingsMap[T]["param"]; type ConnectionReturn = { type: T; } & ConnectionSettingsMap[T]["return"]; type ConnectorInfo = { name: string; type: CONNECTOR_TYPE; available: boolean; }; declare enum CONNECTION_STATE { CONNECTED = "connected", CONNECTING = "connecting", DISCONNECTED = "disconnected", LOGGED_OUT = "logged_out" } declare enum TERMINAL_STATE { CONNECTED = "connected", DISCONNECTED = "disconnected" } type ConnectorDisconnectOptions = { type: "force" | "unexpected" | "forget" | "silent"; }; declare enum Environments { sandbox = "sandbox", production = "production" } type CoreConstructor = { environment: Environments; connectors_implentaiotns: CONNECTORS_IMPLEMENTATIONS; }; interface INiceError { code_text: string; code: number; error: { arabic: string; english: string; }; solution: { arabic: string; english: string; }; level: NiceErrorLevels; source: NiceErrorSource; statusCode: number; } declare enum NiceErrorLevels { HIGH = "HIGH", MEDIUM = "MEDIUM", LOW = "LOW" } type NiceErrorSource = { arabic: string; english: string; color: "#000000"; }; declare function isINiceError(e: any): e is INiceError; declare class NearpayError extends Error { readonly niceError: INiceError; static cast(e: any): NearpayError; private constructor(); } type BrokerAckPolicy = { timeout: number; repeat_count: number; }; type MessageStatus = "Queued" | "Pending" | "Deleted" | "Sent" | "Delivered" | "Processing"; type BrokerMessage = { id: string; status: MessageStatus; data: ProxyMessage; }; type BrokerBox = { messages: BrokerMessage[]; }; type BrokerEventListener = (evt: ProxyMessage) => void; /** * Broker is a class responsible for handling the protocol of sending and receiving * * Broker doesn't know the tunnel the messages should be sent through, it just have general dispatcher method * for sending and receive method for receiving * * note the incoming and outgoing boxes arent tested very well, so dont bother with them */ declare class Protocol { private onChangeCallback?; private eventListeners; private pingPong; constructor(props: { onChange?: (data: { incoming?: Partial; outgoing?: Partial; }) => void; ackPolicy: BrokerAckPolicy; }); private dispatcher; setDispatcher(disp: ConnectionDispatcher): void; private onTerminalStateChange; set terminalStateListener(callback: (state: TERMINAL_STATE) => void); private ackPolicy; private ackListenerInbox; private asyncMessageInbox; /** * send notification with all changed messagea * note: we dont use it in practice, it needs review and test */ notifyChanges(data: { incoming?: Partial; outgoing?: Partial; }): void; /** * send the first pending message in the queue * * will resolve if the reply message came, will reject if timeout happened (60 seconds for now) * we can determine the resolve by inspecting new incoming messages and * see if there is new message with replyTo that hold same id of the request message * * we save every sent message in the inbox with its resolve and reject methods, later we * can use these methods to solve or reject the message */ dispatch(_message: ProxyMessage): Promise | undefined>; /** * wrapper for dispatching some event with the (dispatcher) */ dispatchEvent(event: ProxyMessage): Promise; /** * reaceive a message to the broker * message could be: * - JOB * - EVENT * - ACK * - PING * - PONG */ receive({ message, }: { message: ProxyMessage; }): Promise; /** * receive a message * * if the message is reply to original operation then it will resolve the promise from * the async box * * will dispatch ack if the received message require ack */ private receiveMessage; /** * removes the ack repeater */ private receiveAck; /** * receive event and trigger all assosiated listeners */ private receiveEvent; /** * starts ping pong * */ startPingPong(): void; /** * stops the current ping pong */ stopPingPong(): void; /** * adds an event listener * * @returns the listener remover */ addEventListener(listener: BrokerEventListener): () => void; /** * repeats a message according to ackPolicy until it gets a response * if no responce in the ackPolicy time then we will throw timeout error */ private addAckRepeater; /** * add message to async queue, so it will be resolved later * * if not resolved in speceified time then it will be rejected */ private addMessageToSyncInbox; /** * stops the ack repeater */ private removeAckRepeater; } /** * ConnectionManager is responsable for orchestrating between general connector and broker * its the common interface that will hide the details of each one * * some responsibilities is: * - assiging the broker listeners from new connector * - starting the ping-pong * - stopping ping-pong when needed * - disconnecting a connector * - reconnecting a connector */ declare class ConnectionManager { private connector; private eventTarget; private environment; private connector_implentations; private _state; private _terminal_state; get state(): CONNECTION_STATE; get terminal_state(): TERMINAL_STATE; protocol: Protocol; constructor(data: ConnectionManagerConstructor); /** * will return undefined when connection success, or else it will return a string * with the error message */ connect(connectionInfo: ConnectionParams): Promise>; reconnect(): Promise>; /** * get avalible connectors * @returns avalible connectors info */ getAvaliableConnectors(): Promise; logout(): Promise; forgetDevice(): Promise; send(data: RemoteJobRequest): Promise>; sendEvent(event: ProxyMessage): Promise; stateListener(callback: (state: CONNECTION_STATE) => void): () => void; terminalStateListener(callback: (state: TERMINAL_STATE) => void): () => void; isConnected(): boolean; private releaseConnector; private init_new_connector; private connect_with_connector; private connectorOnDisconnectCallback; } type PurchaseOptions = { job_id?: string; amount: number; reference_id?: string; enable_receipt_ui?: boolean; enable_reversal?: boolean; finish_timeout?: number; enable_ui_dismiss?: boolean; }; type RefundOptions = { job_id?: string; amount: number; original_transaction_uuid: string; enable_ui_dismiss?: boolean; reference_id?: string; enable_receipt_ui?: boolean; enable_reversal?: boolean; enable_editable_refund_amount_ui?: boolean; finish_timeout?: number; }; type ReversalOptions = { jobId?: string; original_transaction_uuid: string; enable_receipt_ui?: boolean; finish_timeout?: number; }; type ReconcileOptions = { job_id?: string; enable_receipt_ui?: boolean; finish_timeout?: number; }; type GetTransactionOptions = { transaction_uuid: string; }; type GetTransactionsListOptions = { page: number; page_size: number; start_date?: Date; end_date?: Date; }; type GetReconciliationOptions = { reconciliation_uuid: string; }; type GetReconciliationsListOptions = { page: number; page_size: number; start_date?: Date; end_date?: Date; }; type SwitchTerminlOptions = { terminal_uuid: string; }; type TransactionResponse = { jobId: string; message: string | null; status: TRANSACTION_STATUS; transactionReceipts: TransactionReceipt[] | null; type: string; isNewTransaction: boolean; }; type ReversalResponse = { jobId: string; message: string | null; status: REVERSAL_STATUS; transactionReceipts: TransactionReceipt[] | null; }; type ReconciliationResponse = { jobId: string; message: string | null; status: RECONCILIATION_STATUS; reconcileReceipt: ReconciliationReceipt | null; }; type QueryListTransactionResponse = { jobId: string; message: string | null; status: TRANSACTIONS_LIST_QUERY_STATUS; transactionList: TransactionBannerList; }; type QuerySingleTransactionResponse = { jobId: string; message: string | null; status: TRANSACTIONS_SINGLE_QUERY_STATUS; transactionReceipts: TransactionReceipt[]; }; type QueryListReconciliationResponse = { jobId: string; message: string | null; status: RECONCILIATIONS_LIST_QUERY_STATUS; reconciliationList: ReconciliationBannerList; }; type QuerySingleReconciliationResponse = { jobId: string; message: string | null; status: RECONCILIATIONS_SINGLE_QUERY_STATUS; reconcileReceipt: ReconciliationReceipt | null; }; type GetTerminalInfoResponse = { tid: string; id: string; }; type SwitchTerminalResponse = { status: SWITCH_TERMINAL_STATUS; }; type CancelResponse = { status: CANCEL_STATUS; }; type DeteleteRoomResponse = {}; type LogoutResponse = {}; declare enum TRANSACTION_STATUS { APPROVED = 1, DECLINED = 2, REJECTED = 3, AUTHENTICATION_FAILED = 4, INVALID_DEVICE_STATUS = 5, GENERAL_FAILURE = 6, CANCEL = 7 } declare enum REVERSAL_STATUS { FINISHED = 1, REJECTED = 2, AUTHENTICATION_FAILED = 3, INVALID_DEVICE_STATUS = 4, GENERAL_FAILURE = 5 } declare enum RECONCILIATION_STATUS { BALANCED = 1, NOT_BALANCED = 2, REJECTED = 3, AUTHENTICATION_FAILED = 4, INVALID_DEVICE_STATUS = 5, GENERAL_FAILURE = 6 } declare enum TRANSACTIONS_LIST_QUERY_STATUS { FINISHED = 1, AUTHENTICATION_FAILED = 2, INVALID_DEVICE_STATUS = 3, GENERAL_FAILURE = 4 } declare enum TRANSACTIONS_SINGLE_QUERY_STATUS { FINISHED = 1, AUTHENTICATION_FAILED = 2, INVALID_DEVICE_STATUS = 3, GENERAL_FAILURE = 4 } declare enum RECONCILIATIONS_LIST_QUERY_STATUS { FINISHED = 1, AUTHENTICATION_FAILED = 2, INVALID_DEVICE_STATUS = 3, GENERAL_FAILURE = 4 } declare enum RECONCILIATIONS_SINGLE_QUERY_STATUS { FINISHED = 1, AUTHENTICATION_FAILED = 2, INVALID_DEVICE_STATUS = 3, GENERAL_FAILURE = 4 } declare enum CANCEL_STATUS { SUCCESS = 1, FAILED = 2 } declare enum SWITCH_TERMINAL_STATUS { SUCCESS = 1, FAILED = 2 } declare class EndPoint { private connectionManager; constructor(connectionManager: ConnectionManager); /** * do a purchase transaction and return a transaction object * @param amount the purcahse amount * @param reference_id optional, customer referance id * @param enable_receipt_ui optional, enable ui receipt * @param enable_reversal optional, enable reversal of transaction * @param finish_timeout optional, timeout in seconds * @returns a purchase response */ purchase({ job_id, amount, enable_ui_dismiss, reference_id, enable_receipt_ui, enable_reversal, finish_timeout, }: PurchaseOptions): Promise; /** * do a refund reansaction and return a transaction object * * @param amount the refund amount * @param original_transaction_uuid the original transaction id of the refunded transaction * @param reference_id optional, customer referance id * @param enable_receipt_ui optional, enable ui receipt * @param enable_editable_refund_amount_ui optional, enable editing refund amount from ui * @param enable_reversal optional, enable reversal of transaction * @param finish_timeout optional, timeout in seconds * @returns a refund response */ refund({ job_id, amount, original_transaction_uuid, enable_ui_dismiss, reference_id, enable_receipt_ui, enable_reversal, enable_editable_refund_amount_ui, finish_timeout, }: RefundOptions): Promise; /** * do a reversal reansaction and return a transaction object * * @param original_transaction_uuid the original transaction id of the refunded transaction * @param enable_receipt_ui optional, enable ui receipt * @param finish_timeout optional, timeout in seconds * @returns a reversal response */ reversal({ jobId, original_transaction_uuid, enable_receipt_ui, finish_timeout, }: ReversalOptions): Promise; /** * do a reconcilation using ui * * @param enable_receipt_ui optional, enable ui receipt * @param finish_timeout optional, timeout in seconds * @returns a reconciliation response */ reconcile({ job_id: jobId, enable_receipt_ui, finish_timeout, }: ReconcileOptions): Promise; /** * return all transactions that happend between two dates */ getTransactionsList(options: { page: number; pageSize: number; startDate?: Date; endDate?: Date; }): Promise; /** * get all reconciliations objects */ getReconciliationList(options: { page: number; pageSize: number; startDate?: Date; endDate?: Date; }): Promise; /** * return all transactions that happend between two dates */ getTransactionsByUuid(options: RemoteQuerySingleTransactionPayload): Promise; /** * get all reconciliations objects */ getReconciliationByUuid(options: RemoteQuerySingleReconciliationPayload): Promise; getTerminalInfo(): Promise; switchTerminal(options: RemoteSwitchTerminalPayload): Promise; cancel(): Promise; deleteRoom(): Promise; logout(): Promise; private sendToDevice; } declare class Core { readonly connection_manager: ConnectionManager; readonly endpoint: EndPoint; constructor({ environment, connectors_implentaiotns: supported_connectors, }: CoreConstructor); stateListener(callback: (state: CONNECTION_STATE) => void): () => void; terminalStateListener(callback: (state: TERMINAL_STATE) => void): () => void; } type error_list = "default" | "unsupported_connector" | "browser_doesnt_support_usb" | "usb_device_not_compatible" | "terminal_disconnected" | "terminal_busy" | "terminal_paused" | "unknow_response" | "unauthorized" | "session_not_found" | "unable_to_connect" | "request_timeout" | "no_connection" | "invalid_token" | "no_device_found"; declare const NiceErrors: Record; declare function v4(): string; declare abstract class ITransactionJob { protected core: Core; protected options: PurchaseOptions | RefundOptions; protected type: "purchase" | "refund"; protected terminal: ITerminal; protected _is_closed: boolean; get is_closed(): boolean; private transactionResultPromise; private resultResolver; private listeners; constructor(data: TransactionJobConstructor); start(): Promise; cancel(): Promise; close(): Promise; stateListener(callback: (state: TRANSACTION_STATE) => void): () => void; } type TransactionJobConstructor = { core: Core; options: PurchaseOptions | RefundOptions; type: "purchase" | "refund"; terminal: ITerminal; }; declare abstract class ITerminal { protected core: Core; protected readonly session: ISession; protected transactionJob: ITransactionJob | undefined; private _state; get state(): TERMINAL_STATE; constructor(data: TerminalConstructor); abstract purchase(data: PurchaseOptions): Promise; abstract refund(data: RefundOptions): Promise; switchTerminal(data: SwitchTerminlOptions): Promise; getInfo(): Promise; reversal(data: ReversalOptions): Promise; reconcile(data: ReconcileOptions): Promise; getTransaction(data: GetTransactionOptions): Promise; getTransactionsList(data: GetTransactionsListOptions): Promise; getReconciliation(data: GetReconciliationOptions): Promise; getReconciliationsList(data: GetReconciliationsListOptions): Promise; stateListener(callback: (state: TERMINAL_STATE) => void): () => void; } type TerminalConstructor = { core: Core; session: ISession; }; declare abstract class ISession { readonly token: string; protected pos: IPos; protected terminal: ITerminal | undefined; protected core: Core; constructor(data: SessionConstructor); reconnect(): Promise; abstract getTerminal(): Promise; logout(): Promise; } type SessionConstructor = { token: string; core: Core; pos: IPos; }; type SessionImplementation = (new (data: SessionConstructor) => ISession) & Pick; declare abstract class IPos { session?: ISession; protected core: Core; private _state; get state(): CONNECTION_STATE; constructor(data: PosConstructor); createSession(data: object): Promise; getSession(data: { token: string; }): Promise; stateListener(callback: (state: CONNECTION_STATE) => void): () => void; protected parseToken(token: string): ConnectionReturn; protected tokenize(data: ConnectionReturn): string; protected abstract connectToNewSession(data: object): Promise>; protected abstract validateToken(data: { tokenParsed: ConnectionReturn; }): Promise; protected abstract get SessionType(): SessionImplementation; } type PosConstructor = { core: Core; }; declare class USBTransactionJob extends ITransactionJob { constructor(data: TransactionJobConstructor); } declare class USBTerminal extends ITerminal { constructor(data: TerminalConstructor); purchase(data: PurchaseOptions): Promise; refund(data: RefundOptions): Promise; } declare class USBSession extends ISession { constructor(data: SessionConstructor); getTerminal(): Promise; } declare class USBPos$1 extends IPos { createSession(): Promise; protected connectToNewSession(): Promise>; protected get SessionType(): SessionImplementation; protected validateToken(data: { tokenParsed: ConnectionReturn; }): Promise; } type RemoteCreateSessionParams = RemoteCreateSessionWithPairingCodeParams | RemoteCreateSessionWithJwtTokenParams; type RemoteCreateSessionWithPairingCodeParams = { pairing_code: string; }; type RemoteCreateSessionWithJwtTokenParams = { jwt_token: string; }; declare class RemoteTransactionJob extends ITransactionJob { constructor(data: TransactionJobConstructor); } declare class RemoteTerminal extends ITerminal { readonly core: Core; constructor(data: TerminalConstructor); purchase(data: PurchaseOptions): Promise; refund(data: RefundOptions): Promise; } declare class RemoteSession extends ISession { constructor(data: SessionConstructor); getTerminal(): Promise; } declare class RemotePos$1 extends IPos { createSession(data: RemoteCreateSessionParams): Promise; protected connectToNewSession(data: RemoteCreateSessionParams): Promise>; protected get SessionType(): SessionImplementation; protected validateToken(data: { tokenParsed: ConnectionReturn; }): Promise; } declare class RemotePos extends RemotePos$1 { constructor(data: { environment: Environments; }); } declare class USBPos extends USBPos$1 { constructor(data: { environment: Environments; }); } export { CONNECTION_STATE, Environments, type GetReconciliationOptions, type GetReconciliationsListOptions, type GetTerminalInfoResponse, type GetTransactionOptions, type GetTransactionsListOptions, type INiceError, IPos, ISession, ITerminal, ITransactionJob, type LabelField, type LocalizationField, type Merchant, type NameField, NearpayError, NiceErrorLevels, type NiceErrorSource, NiceErrors, type PurchaseOptions, type QueryListReconciliationResponse, type QueryListTransactionResponse, type QuerySingleReconciliationResponse, type QuerySingleTransactionResponse, RECONCILIATIONS_LIST_QUERY_STATUS, RECONCILIATIONS_SINGLE_QUERY_STATUS, RECONCILIATION_STATUS, REVERSAL_STATUS, type ReconcileOptions, type ReconciliationBanner, type ReconciliationBannerList, type ReconciliationDetailsType, type ReconciliationLabelField, type ReconciliationReceipt, type ReconciliationResponse, type ReconciliationSchemesDetailsType, type ReconciliationSchemesType, type RefundOptions, RemotePos, type ReversalOptions, type ReversalResponse, type SessionData, type SessionTransaction, TERMINAL_STATE, TRANSACTIONS_LIST_QUERY_STATUS, TRANSACTIONS_SINGLE_QUERY_STATUS, TRANSACTION_STATE, TRANSACTION_STATUS, type TransactionBanner, type TransactionBannerList, type TransactionData, type TransactionReceipt, type TransactionResponse, TransactionType, USBPos, isINiceError, v4 };