Mews.Fiscalizations.Hungary 6.0.2.7
Mews.Fiscalizations.Hungary is a .NET library that was built to help reporting of e-invoices to the Hungarian authorities (Online Szamla - Nemzeti Adó- és Vámhivatal).
Current supported version is 3.0.
📃 Description
This library uses the NAV Online Invoice System to report e-invoices, please check their Documentation.
Useful links: API documentation Test environment Production environment
⚙️ Installation
The library can be installed through NuGet packages or the command line as mentioned below:
Install-Package Mews.Fiscalizations.Hungary
🎯 Features
- Functional approach via FuncSharp.
- No Hungarian 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 Standard).
📦 NuGet
We have published the library as Mews.Fiscalizations.Hungary.
👀 Code Examples
Listed below are some of the common examples. If you want to see more code examples, please check the Tests.
Creating NAV client There are 3 required properties that need to be provided when creating the NAV client
- Technical user: technical user credentials can be obtained from the NAV website dashboard
- Software identification: Contains information regarding the software performing data reporting
- NAV Environment: (Test/Production)
var technicalUser = new TechnicalUser(
login: Login,
password: Password,
signingKey: SigningKey,
taxId: TaxPayerId,
encryptionKey: EncryptionKey
);
var softwareIdentification = new SoftwareIdentification(
id: "123456789123456789",
name: "Test",
type: SoftwareType.LocalSoftware,
mainVersion: "1.0",
developerName: "Test",
developerContact: "test@test.com"
);
var navClient = new NavClient(technicalUser, softwareIdentification, NavEnvironment.Test);
Obtaining the Exchange token which is required for each request
var exchangeToken = await client.GetExchangeTokenAsync();
Creating the supplier info
var supplierInfo = new SupplierInfo(
taxpayerId: supplierTaxpayerId,
vatCode: VatCode.Create("2").Success.Get() // check the documentation for more information about each VatCode.,
name: Name.Create("supplier name").Success.Get(),
address: supplierAddress
);
Creating invoice items
var itemAmount = new Amount(net: new AmountValue(1694.92m), gross: new AmountValue(2000), tax: new AmountValue(305.08m));
var unitAmount = new ItemAmounts(itemAmount, itemAmount, 0.18m);
var items = new[]
{
new InvoiceItem(
consumptionDate: DateTime.UtcNow.Date,
totalAmounts: new ItemAmounts(itemAmount, itemAmount, 0.18m),
description: Description.Create("Item 1 description").Success.Get(),
measurementUnit: MeasurementUnit.Night,
quantity: 1,
unitAmounts: unitAmount,
exchangeRate: ExchangeRate.Create(1).Success.Get()
)
};
Creating an invoice
var invoice = new Invoice(
number: invoiceNumber ?? InvoiceNumber.Create($"INVOICE-{Guid.NewGuid()}").Success.Get(),
issueDate: nowUtc,
supplierInfo: supplierInfo,
receiver: receiver,
items: Sequence.FromPreordered(items, startIndex: 1).Get(),
paymentDate: nowUtc,
currencyCode: CurrencyCode.Create("EUR").Success.Get(),
paymentMethod: PaymentMethod.Card
);
Reporting invoices
return await client.SendInvoicesAsync(
token: exchangeToken.SuccessResult,
invoices: Sequence.FromPreordered(new[] { invoice }, startIndex: 1).Get()
);
In case of rebating/modifying/changing an invoice
It is possible to report the modified invoice through SendModificationDocumentsAsync API.
No packages depend on Mews.Fiscalizations.Hungary.
.NET Standard 2.0
- Mews.Fiscalizations.Core (>= 4.0.2)
- BouncyCastle.NetCore (>= 1.9.0)
- FuncSharp (>= 4.2.0)
- System.Net.Http (>= 4.3.4)