A demo application that demonstrates how to call the fiskaltrust.Middleware from Java using gRPC.
In order to use this demo application, the following prerequisites are required:
- The demo application: Either clone and run locally, or download the latest binaries from Releases
- The fiskaltrust.Middleware running on your machine, which can be configured and downloaded via the fiskaltrust.Portal (AT, DE, FR). Start it (either by running it as a service, or with the
test.cmd
file), and let it run in the background to handle your requests. - Your Cashbox Id is visible in the portal. It is also displayed in the startup console log of the Middleware.
This example uses the .proto files of the fiskaltrust Middleware interface to automatically generate the client and the contracts at runtime via the officially suggested gRPC packages (a comprehensive tutorial and overview can be found here). The proto files are available in our interface-doc repository, and will automatically be downloaded in this sample (as described below).
To run the demo, a JDK version > 10 and Maven need to be installed. Follow the following steps:
After downloading the example zip file (middleware-demo-java-grpc.zip
), extract the .jar and the receipt-examples folder to a location on your machine and start the example via the following command:
java -jar middleware-demo-java-1.0-jar-with-dependencies.jar
- You will be prompted for the middleware URL and the cashbox ID.
- The demo will show up a list of available demo receipts, pulled from the receipt-examples folder. Before executing any receipt, make sure that the SCU is initialized, by calling the initial-operation-receipt.
- To execute a receipt against the middleware, select it by its leading number and press Enter.
- This will print the example to the command line and send it to the Sign endpoint of the Middleware. After the receipt is processed, the Middleware will return the result back to the demo app, which again prints it to the console.
- Alternatively, a Journal request can also be executed. This is used to export different types of data from the middleware - system information, processed receipts, etc.
- To go back to the command list, press enter
This demo app uses the build system Maven, which will pull the required dependencies in case of a local build. This also includes the .proto files, which will be pulled from the interface-doc repository and placed into src/main/proto
.
To pull all dependencies,compile the sample, and package it to a jar file, just run
mvn package
The fiskaltrust.Middleware is written in C# and uses some language-specific functionalities that a user needs to take care of when connecting via gRPC:
Due to the binary serialization in Protobuf, DateTime
and decimal
(which are native types in C#) need to be converted when used outside of .NET. Thus, the bcl.proto
is referenced in the IPOS.proto
file. An example how to deal with these types is shown in ProtoUtil.java.
The full documentation for the interface can be found on https://docs.fiskaltrust.cloud. It is activeliy maintained and developed in our interface-doc repository.
More information is also available after logging into the portal with a user that has the PosCreator role assigned.
The fiskaltrust.Middleware supports different communication protocols, effectively giving our customers the possibility to use it on all platforms. Hence, different protocols are recommended for different platforms. For non-windows environments, we recommend the usage of gRPC. Please have a look into our other demo repositories for alternatives, e.g. HTTP/REST or SOAP.
With the helper topology, it is possible to solve every scenario. Please contact our support if you required assistance for a special case scenario.
We welcome all kinds of contributions and feedback, e.g. via Issues or Pull Requests.
Our latest samples are available for the following programming languages and tools:
Additionally, other samples (including legacy ones) can be found in our demo repository.