pax.XRechnung.NET 0.2.1

dotnet add package pax.XRechnung.NET --version 0.2.1
                    
NuGet\Install-Package pax.XRechnung.NET -Version 0.2.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="pax.XRechnung.NET" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="pax.XRechnung.NET" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="pax.XRechnung.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add pax.XRechnung.NET --version 0.2.1
                    
#r "nuget: pax.XRechnung.NET, 0.2.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.
#addin nuget:?package=pax.XRechnung.NET&version=0.2.1
                    
Install pax.XRechnung.NET as a Cake Addin
#tool nuget:?package=pax.XRechnung.NET&version=0.2.1
                    
Install pax.XRechnung.NET as a Cake Tool

NuGet Version .NET

Introduction

pax.XRechnung.NET is a .NET library for validating and mapping XRechnung XML invoices based on specification 3.0.2.

Features

  • Validate XRechnung XML invoices
  • Map XML invoices to DTOs for easier manipulation
  • Generate compliant XML invoices from structured DTOs

Getting started

Installation

dotnet add package pax.XRechnung.NET

Usage

Handle Sample Invoice

    public static InvoiceBaseDto GetInvoiceBaseDto()
    {
        return new()
        {
            GlobalTaxCategory = "S",
            GlobalTaxScheme = "VAT",
            GlobalTax = 19.0,
            Id = "1",
            IssueDate = DateTime.UtcNow,
            InvoiceTypeCode = "380",
            DocumentCurrencyCode = "EUR",
            BuyerReference = "04011000-12345-34",
            SellerParty = new()
            {
                Name = "Seller Name",
                StreetName = "Test Street",
                City = "Test City",
                PostCode = "123456",
                CountryCode = "DE",
                Telefone = "1234/54321",
                Email = "seller@example.com",
                RegistrationName = "Seller Name",
                TaxId = "DE12345678"
            },
            BuyerParty = new()
            {
                Name = "Buyer Name",
                StreetName = "Test Street",
                City = "Test City",
                PostCode = "123456",
                CountryCode = "DE",
                Telefone = "1234/54321",
                Email = "buyer@example.com",
                RegistrationName = "Buyer Name",
            },
            PaymentMeans = new()
            {
                Iban = "DE12 1234 1234 1234 1234 12",
                Bic = "BICABCDE",
                Name = "Bank Name"
            },
            PaymentMeansTypeCode = "30",
            PaymentTermsNote = "Zahlbar innerhalb 14 Tagen nach Erhalt der Rechnung.",
            PayableAmount = 119.0,
            InvoiceLines = [
                new()
                {
                    Id = "1",
                    Quantity = 1.0,
                    QuantityCode = "HUR",
                    UnitPrice = 100.0,
                    Name = "Test Job"
                }
            ]
        };
    }

Validate xml schema

    var invoiceBaseDto = GetInvoiceBaseDto();
    var mapper = new InvoiceMapper<InvoiceBaseDto>();
    var xmlInvoice = mapper.ToXml(invoiceBaseDto);
    var result = XmlInvoiceValidator.Validate(xmlInvoice);
    Assert.IsTrue(result.IsValid);

Validate schematron - requires Kosit validator

    var invoiceBaseDto = GetInvoiceBaseDto();
    InvoiceMapper<InvoiceBaseDto> invoiceMapper = new();
    XmlInvoice xmlInvoice = invoiceMapper.ToXml(invoiceBaseDto);
    var result = await XmlInvoiceValidator.ValidateSchematron(xmlInvoice);
    var resultText = string.Join(Environment.NewLine, result.Validations.Select(s => $"{s.Severity}:\t{s.Message}"));
    Assert.IsTrue(result.Validations.Count == 0, resultText);
    Assert.IsTrue(result.IsValid, resultText);

The InvoiceBaseDto is designed to be easily extended see BaseDtoExtensionTests

Java Schematron Validator

Requires a running Kosit validation server. Setup: xrechnung usage

Server start: java -jar .\validationtool-1.5.0-standalone.jar -s .\scenarios.xml -r ${PWD} -D

ChangeLog

<details open="open"><summary>v0.2.0</summary>

  • Breaking Changes
  • Fixed/Renamed XmlInvoice properties and dependencies. All existing properties are now xml schema conform.
  • Added Kosit schematron validation. See Java Schematron Validator
  • Replaced all DTOs with InvoiceBaseDto

</details>

<details><summary>v0.1.0</summary>

  • Breaking Changes
  • Added FinancialInstitutionBranch to FinancialAccountType (XmlPaymentInstructions)
  • Seller/Buyer cleanup and reference XmlParty
  • Changed XmlAdditionalDocumentReference to XmlAdditionalDocumentReferences as list

</details>

<details><summary>v0.0.1</summary>

  • Initial release
  • Support for invoice validation and serialization
  • Partial DTO implementation

</details>

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.  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. 
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
0.2.1 38 4/22/2025
0.2.0 50 4/22/2025 0.2.0 is deprecated because it has critical bugs.
0.1.0 97 3/2/2025
0.0.1 133 12/22/2024