1.1.502 • Published 4 years ago

fiskaly-sdk-node-dev v1.1.502

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

fiskaly SDK for Node.js

The fiskaly SDK includes an HTTP client that is needed1 for accessing the kassensichv.io API that implements a cloud-based, virtual CTSS (Certified Technical Security System) / TSE (Technische Sicherheitseinrichtung) as defined by the German KassenSichV (Kassen­sich­er­ungsver­ord­nung).

Supported Versions

  • Node 8.0+

Features

  • Automatic authentication handling (fetch/refresh JWT and re-authenticate upon 401 errors).
  • Automatic retries on failures (server errors or network timeouts/issues).
  • Automatic JSON parsing and serialization of request and response bodies.
  • Future: 1 compliance regarding BSI CC-PP-0105-2019 which mandates a locally executed SMA component for creating signed log messages.
  • Future: Automatic offline-handling (collection and documentation according to Anwendungserlass zu § 146a AO)

Integration

NPM

The Node.js SDK is available for a download via NPM.

Package Repository.

Simply execute this command from the shell in your project directory:

$ npm install fiskaly/fiskaly-sdk-node --save

Or you can manually add the package to your package.json file:

"dependencies": {
    "fiskaly/fiskaly-sdk-node": "*"
}

then run

$ npm install 

Finally, be sure to include the sdk in your code:

const { FiskalyClient } = require('fiskaly-sdk-node');

Service

Additionally, to the SDK, you'll also need the fiskaly service. Follow these steps to integrate it into your project:

  1. Go to https://developer.fiskaly.com/downloads#service
  2. Download the appropriate service build for your platform
  3. Start the service

Usage

Demo

 // Environment variables
  const { FISKALY_SERVICE_URL, FISKALY_API_KEY, FISKALY_API_SECRET, FISKALY_BASE_URL } = process.env;
 
  try {
    // Client Setup
    const client = new FiskalyClient(FISKALY_SERVICE_URL);
    await client.createContext(FISKALY_API_KEY, FISKALY_API_SECRET, FISKALY_BASE_URL);

    const version = await client.getVersion();
    console.log("Version", version);
  } catch (e) {
  	// Handle Error
    console.error(e);
  }

Client Configuration

The SDK is built on the fiskaly Client which can be configured through the SDK.

A reason why you would do this, is to enable the debug mode.

Enabling the debug mode

The following code snippet demonstrates how to enable the debug mode in the client.

try {
 const configParams = {
    debug_level: 4,
    debug_file: __dirname + '/../fiskaly.log',
    client_timeout: 5000,
    smaers_timeout: 2000,
}
const newConfig = await client.configure(configParams);
} catch (e) {
	// Handle Error
    console.error(e);
}

Related

1.1.502

4 years ago

1.1.501

4 years ago

1.1.500

4 years ago