MAES.Fiskal
1.1.3
dotnet add package MAES.Fiskal --version 1.1.3
NuGet\Install-Package MAES.Fiskal -Version 1.1.3
<PackageReference Include="MAES.Fiskal" Version="1.1.3" />
<PackageVersion Include="MAES.Fiskal" Version="1.1.3" />
<PackageReference Include="MAES.Fiskal" />
paket add MAES.Fiskal --version 1.1.3
#r "nuget: MAES.Fiskal, 1.1.3"
#:package MAES.Fiskal@1.1.3
#addin nuget:?package=MAES.Fiskal&version=1.1.3
#tool nuget:?package=MAES.Fiskal&version=1.1.3
MAES.Fiskal
MAES.Fiskal is a fiscalization tool for invoices developed in C# using .NET 8. It enables automatic generation and submission of fiscal data according to current regulations.
Reequirements
- .NET 8+
- Fiscalization WSDL ver. 2.6
Features
- ZKI Generation
- Invoice fiscalization
- Tip fiscalization
- Free and open source
Installation
Nuget: https://www.nuget.org/packages/MAES.Fiskal
or
git clone https://github.com/MAES-Software/MAES.Fiskal.git
Define endpoint address (Url)
- Demo endpoint
string url = "https://cistest.apis-it.hr:8449/FiskalizacijaServiceTest";
- Poduction endpoint
string url = "https://cis.porezna-uprava.hr:8449/FiskalizacijaService";
Load X509Certificate2
- From file (You can use relative path eg. "./cert.p12")
var certificate = new X509Certificate2("filename");
- From some data stream with byte[] bytes
var certificate = new X509Certificate2(bytes);
You must also supply password for given certificate if it has one (by default certificates given from goverment are locked but they can be repackaged)
var certificate = new X509Certificate2("filename", "password");
Usage Example
Define using MAES.Fiskal to get all classes for fiscalization
using MAES.Fiskal;
Sending invoice
- Create invoice
var invoice = new RacunType { BrRac = new BrojRacunaType { BrOznRac = "1", // Invoice number (incremental for each receipt) OznPosPr = "POSL_1", // Workspace code OznNapUr = "1" // Cash reegister number }, DatVrijeme = DateTime.Now.ToString("dd.MM.yyyyTHH:mm:ss"), // DateTime of invoice IznosUkupno = "12.50", // Total amount (must be format 0.00) NakDost = false, Oib = "51560545524", // Identification number of company OibOper = "51560545524", // Odentitfication numer of person operating POS OznSlijed = OznakaSlijednostiType.N, Pdv = [ // Taxes list new () { Stopa = "25.00", // Tax percentage (must be format 0.00) Osnovica = "10.00", // Tax base (must be format 0.00) Iznos = "2.50" // Tax amount (must be format 0.00) } ], Pnp = [], // Fill tax on spending if nececary :S USustPdv = true, // Does company falls under tax obligation laws NacPlac = NacinPlacanjaType.G // Type of payment (G - Cash, K - Cards, etc...) };
- Send invoice
// Call to service var res = await invoice.SendAsync(certificate, url); // Check if there are errors if(res.Greske.Length != 0) Console.WriteLine(res.Greske.Join(',')); // Get jir to store string jir = res.Jir;
Sending invoice tip
Create RacunNapojnicaType from RacunType with NapojnicaTypee as parameter
RacunNapojnicaType invoiceTip = invoice.ToInvoiceTipAsnyc(new () { iznosNapojnice = "1.00", // Tip amount nacinPlacanjaNapojnice = NacinPlacanjaType.G // Tip type of payment (G - Cash, K - Cards, etc...) });
Send RacunNapojnicaType
// Call to service var res = await invoiceTip.SendAsync(certificate, url); // Check if there are errors if(res.Greske.Length != 0) Console.WriteLine(res.Greske.Join(','));
Generate ZKI
string zki = invoice.ZKI(certificate);
Both invoice and invoiceTip have .ZKI(certificate) methods
Disabling SSL Certificate Validation (Not Recommended)
If you encounter issues with SSL certificate validation, you can disable certificate checks as follows:
ReferenceTypeExtensions.SslCertificateAuthentication = new()
{
CertificateValidationMode = X509CertificateValidationMode.None,
RevocationMode = X509RevocationMode.NoCheck
};
Warning: Disabling SSL certificate validation is not recommended for production environments, as it reduces security and exposes your application to potential risks. Use this option only for testing or troubleshooting purposes.
Development
Example tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "dotnet build",
"args": [
"${workspaceFolder}/MAES.Fiskal.csproj",
"--configuration",
"Release"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
},
{
"label": "Pack",
"type": "shell",
"command": "dotnet pack",
"args": [
"${workspaceFolder}/MAES.Fiskal.csproj",
"--configuration",
"Release"
],
"dependsOn": "Build",
"problemMatcher": "$msCompile"
},
{
"label": "Push",
"type": "shell",
"command": "dotnet nuget push",
"args": [
"${workspaceFolder}/bin/Release/*.nupkg",
"--api-key",
"${input:nugetApiKey}",
"--source",
"https://api.nuget.org/v3/index.json"
],
"dependsOn": "Pack",
"problemMatcher": []
}
],
"inputs": [
{
"id": "nugetApiKey",
"type": "promptString",
"description": "Enter your NuGet API Key",
"password": true
}
]
}
Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- System.ServiceModel.Duplex (>= 6.0.0)
- System.ServiceModel.Http (>= 6.0.0)
- System.ServiceModel.Primitives (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.