Client for Czech Fiscal Registry - EET
C#
Latest commit 4c47114 Jan 18, 2017 @jirihelmich jirihelmich committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
src Goods and deposits fixed. Dec 30, 2016
.gitignore v0.1.0 Nov 9, 2016
.travis.yml Update .travis.yml Nov 16, 2016
LICENSE Initial commit Oct 7, 2016
README.md Update README.md Jan 18, 2017

README.md

Build Status

EET

EET stands for Elektronická Evidence Tržeb, which is Czech version of Fiscal Printers. It's an online API provided by the Ministry of Finance in a form of a SOAP Web Service.

Key features

  • No Czech abbreviations.
  • Early data validation.
  • Intuitive immutable DTOs.
  • SOAP communication (including WS-Security signing).
  • PKP and BKP security code computation.
  • Support for parallel async requests.
  • Logging support

Known issues

  • 8: As the communication is done fully via HTTPS, we postponed the implementation of response signature verification. It's a potential security risk that will be addressed in upcoming releases.

Usage

We tend to use immutable DTOs wherever possible, especially to ensure data validity. We want the library to throw an error as soon as possible, i.e. when constructing corresponding data structures. That is why we even introduce wrappers for simple datatypes. Various usages are demonstrated in our test cases.

Simplest usage example

var certificate = new Certificate(
    password: "certificatePassword",
    data: certificateContentsByteArray
);

var record = new RevenueRecord(
    identification: new Identification(
        taxPayerIdentifier: new TaxIdentifier("CZ1234567890"),
        registryIdentifier: new RegistryIdentifier("01"),
        premisesIdentifier: new PremisesIdentifier(1),
        certificate: certificate
    ),
    revenue: new Revenue(
        gross: new CurrencyValue(1234.00m)
    ),
    billNumber: new BillNumber("2016-321")
);

var client = new EetClient(certificate);
var response = await client.SendRevenueAsync(record);
if (response.IsSuccess)
{
    var fiscalCode = response.Success.FiscalCode;
}

Verification mode

var response = await client.SendRevenueAsync(record, EetMode.Verification);

Using playground

var client = new EetClient(certificate, EetEnvironment.Playground);

Logging

  • Catchall logger:
Action<string, object> logHandler = (message, detailsObject) => { ... };
var client = new EetClient(
    certificate,
    logger: logHandler
);
  • Selective logger:
Action<string, object> logHandler = (message, detailsObject) => { ... };
var client = new EetClient(
    certificate,
    logger: new EetLogger(onError: logHandler, onInfo: logHandler, onDebug: null)
);

Events

  • HTTP request duration
var client = new EetClient(certificate);
client.HttpRequestFinished += (sender, args) =>
{
    var duration = args.Duration;
};
  • Catching XML message sent to EET
var client = new EetClient(certificate);
client.XmlMessageSerialized += (sender, args) =>
{
    var xmlString = args.XmlElement.OuterXml;
};

Tests

Test are not currently running on Travis CI, as their network infrastructure is blocking HTTPS traffic directed into Europe, where the EET servers are located.

Otherwise, a xUnit test suite is a part of the library, it contains end-to-end tests that communicates with Playground EET servers to verify the lib is really working against the current EET version.

NuGet

We have published the library as Mews.Eet.

Alternatively, the NuGet package can be generated by running the following command:

src\Mews.Eet> nuget pack .\Mews.Eet.csproj -IncludeReferencedProjects

Authors

Development: @jirihelmich Code review: @siroky, @onashackem

Who uses the library in production?

  • Mews Systems - Property Management Solution for the 21st century.
  • Hlídač EET - Watchdog of the EET API endpoint and related services.

We would like to hear your story and know who users of the lib are. Please, thank us for providing the library by sharing with us, who you are and letting us add you into this list.

The time to implement this was kindly provided by Mews Systems.

Donate

There is no need to donate the project, but thanks for considering it! Instead, if you like the project, star it here on GitHub :-)! Thanks!

Related projects

Credits