Mews.Fiscalizations.Germany 10.0.1

Prefix Reserved
dotnet add package Mews.Fiscalizations.Germany --version 10.0.1                
NuGet\Install-Package Mews.Fiscalizations.Germany -Version 10.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mews.Fiscalizations.Germany" Version="10.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mews.Fiscalizations.Germany --version 10.0.1                
#r "nuget: Mews.Fiscalizations.Germany, 10.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mews.Fiscalizations.Germany as a Cake Addin
#addin nuget:?package=Mews.Fiscalizations.Germany&version=10.0.1

// Install Mews.Fiscalizations.Germany as a Cake Tool
#tool nuget:?package=Mews.Fiscalizations.Germany&version=10.0.1                

<p align="center"> <a href="https://mews.com"> <img alt="Mews" src="https://user-images.githubusercontent.com/51375082/120493257-16938780-c3bb-11eb-8cb5-0b56fd08240d.png"> </a> <br><br> <b>Mews.Fiscalizations.Germany</b> is a .NET library that was built to help reporting of e-invoices to the German authorities (BSI - Bundesamt fΓΌr Sicherheit in der Informationstechnik) using <a href="https://developer.fiskaly.com/api/kassensichv/v2/">Fiskaly KassenSichV API V2-certified</a>. <br><br> <a href="https://www.nuget.org/packages/Mews.Fiscalizations.Germany/"> <img src="https://img.shields.io/nuget/v/Mews.Fiscalizations.Germany"> </a> <a href="https://github.com/MewsSystems/fiscalizations/blob/master/LICENSE"> <img src="https://img.shields.io/github/license/MewsSystems/fiscalizations"> </a> <a href="https://github.com/MewsSystems/fiscalizations/actions/workflows/publish-germany.yml"> <img src="https://img.shields.io/github/actions/workflow/status/MewsSystems/fiscalizations/publish-germany.yml?branch=master&label=publish"> </a> <a href="https://developer.fiskaly.com/api/kassensichv/v1/"> <img src="https://img.shields.io/badge/v2-Fiskaly-lightgrey"> </a> </p>

πŸ“ƒ Description

The library uses Fiskaly API to report the invoices, for more information, please check their Documentation.

βš™οΈ Installation

The library can be installed through NuGet packages or the command line as mentioned below:

Install-Package Mews.Fiscalizations.Germany

🎯 Features

  • Functional approach via FuncSharp.
  • No German abbreviations.
  • Early data validation.
  • Asynchronous I/O.
  • All endpoints are covered with tests.
  • Intuitive immutable DTOs.
  • Pipelines that run on both Windows and Linux operating systems.
  • Cross platform (uses .NET 6).

πŸ“¦ NuGet

We have published the library as Mews.Fiscalizations.Germany.

πŸ‘€ Code Examples

P.S Please note that we keep files of the older API versions, but we run the tests on the latest supported API version and not older ones.

Listed below are some of the common examples. If you want to see more code examples, please check the Tests.

Fiskaly Client can be created using the ApiKey and ApiSecret which can be created through Fiskaly dashboard.

var client = new FiskalyClient(ApiKey, ApiSecret);

All endpoints require providing a valid accessToken

var accessToken = await client.GetAccessTokenAsync();

In order to report an invoice to the German authorities, we would have to start a transaction and then finish it (change the state to FINISHED and provide the invoice to be reported.).

Creation of a new invoice

There are 3 required properties for creating an invoice:

  1. Invoice type (invoice or receipt).
  2. Payments which is a list of the amounts paid, type of payment, and the currency.
  3. Items which is a list of the item amounts and the VAT rate ("NORMAL" "REDUCED_1" "SPECIAL_RATE_1" "SPECIAL_RATE_2" "NULL") β†’ ("19" "7" "10.7" "5.5" "0").
var bill = new Bill(
    type: BillType.Receipt,
    payments: new List<Payment>() { new Payment(25, PaymentType.Cash, "EUR") },
    items: new List<Item>() { new Item(25, VatRateType.Normal) }
);
  1. To start a transaction, we would need to provide valid ClientId and TssId which can be created through fiskaly dashboard or by calling CreateClientAsync for creating the client and CreateTssAsync for creating the TSS which will be described below, and a unique id for the transaction.
  2. To finish a transaction, we would need to provide the ClientId, TssId, and the invoice to be reported and the transaction id that we specified in the step above.

Example:

var transactionId = Guid.NewGuid();
var startedTransaction = await client.StartTransactionAsync(accessToken, clientId, tssId, transactionId);
var endedTransaction = await client.FinishTransactionAsync(accessToken, clientId, tssId, InvoiceToReport, transactionId);

Creation of a new client id

var client = await client.CreateClientAsync(accessToken, TssId);
var clientId = client.SuccessResult.Id;

Creation of a new Tss id

var tss = await client.CreateTssAsync(accessToken);
var tssId = tss.SuccessResult.Id;
var puk = tss.SuccessResult.AdminPuk; // Store it. It's needed for setting or changing admin Pin.

Since the created above TSS will be created with state = "Created", it cannot be used yet, so we should update the state to Uninitialized.

Updating Tss state

var tss = await client.UpdateTssAsync(accessToken, tssToUpdateId, TssState.Uninitialized);

After updating the TSS state to Uninitialized, It will be possible to change the admin PIN using the PUK code we recieved in the response above.

Changing admin PIN

await client.ChangeAdminPinAsync(accessToken, tssId, tss.AdminPuk, newAdminPin: "123123");

Authenticate using the PIN created above

await client.AdminLoginAsync(accessToken, tssId, "123123");

After authenticating with the admin PIN, we can update the state of the TSS from Uninitialized to Initialized (using the update as described above).

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
10.0.1 92 6/26/2024
10.0.0 333 1/29/2024
9.0.0 666 8/27/2023
8.0.2 739 8/2/2023
8.0.1 697 7/26/2023
8.0.0 756 7/24/2023
7.0.3 922 10/24/2022
7.0.2 935 10/21/2022
7.0.1 933 10/17/2022
7.0.0 959 9/6/2022
6.0.2 973 7/4/2022
6.0.1 1,015 3/16/2022
6.0.0 927 11/8/2021
5.0.0 882 11/5/2021
4.2.2 872 11/5/2021
4.2.1 884 11/4/2021
4.2.0 912 10/11/2021
4.1.0 872 10/7/2021
4.0.0 846 9/24/2021
3.0.0 923 7/21/2021
2.0.4 929 7/19/2021
2.0.3 929 7/14/2021
2.0.2 898 7/13/2021
2.0.1 873 7/8/2021
2.0.0 1,511 5/24/2021