Home

Awesome

en16931-cii2ubl

Maven Central javadoc

Converter for unidirectional EN16931 invoices from CII D16B to UBL 2.1, 2.2, 2.3 or 2.4.

This is a Java 11+ library that converts a Cross Industry Invoice (CII) into a Universal Business Language (UBL) document following the rules of the European Norm (EN) 16931 that defines a common semantic data model for electronic invoices in Europe.

Special care was given to XRechnung invoices - all the CII examples of them translate to UBL that is valid according to the EN 16931 validation rules.

See https://peppol.helger.com/public/locale-en_US/menuitem-tools-rest-api#cii2ubl for a service implementation using this library.

This library is licensed under the Apache License Version 2.0.

The binary releases are available on Maven Central at https://repo1.maven.org/maven2/com/helger/en16931-cii2ubl/ and below.

Usage

This is a pure Java library and not a self-contained conversion tool. You can convert CII D16B invoices following the EN 16931 rules to different UBL versions. The entrance classes are:

The main conversion method is called convertCIItoUBL and takes either a File as input or a pre-parsed un.unece.uncefact.data.standard.crossindustryinvoice._100.CrossIndustryInvoiceType object (that reading is done with class com.helger.cii.d16b.CIID16BCrossIndustryInvoiceTypeMarshaller from ph-cii). Additionally an ErrorList object must be provided as a container for all the errors that occur.

The conversion is deemed successful, if a non-null object is returned and if the error list contains no error (errorList.containsNoError ()).

Maven usage

Replace x.y.z with the effective version you want to use:

<dependency>
  <groupId>com.helger</groupId>
  <artifactId>en16931-cii2ubl</artifactId>
  <version>x.y.z</version>
</dependency>

Commandline usage

Call it via java -jar en16931-cii2ubl-cli-full.jar followed by the options and parameters.

[INFO] CII to UBL Converter v2.2.2 (build 2024-04-12T15:26:48Z)
Missing required parameter: 'source files'
Usage: CIItoUBLConverter [-hV] [--disable-wildcard-expansion] [--verbose]
                         [--mode mode] [--output-suffix filename part] [-t
                         directory] [--ubl version] [--ubl-cardaccountnetworkid
                         ID] [--ubl-customizationid ID]
                         [--ubl-defaultorderrefid ID] [--ubl-profileid ID]
                         [--ubl-vatscheme vat scheme] source files...
CII to UBL Converter for EN 16931 invoices
      source files...      One or more CII file(s)
      --disable-wildcard-expansion
                           Disable wildcard expansion of filenames
  -h, --help               Show this help message and exit.
      --mode mode          Allowed values: AUTOMATIC, INVOICE, CREDIT_NOTE
                             (default: 'AUTOMATIC')
      --output-suffix filename part
                           The suffix added to the output filename (default:
                             '-ubl')
  -t, --target directory   The target directory for result output (default: '.')
      --ubl version        Version of the target UBL Format: '2.1', '2.2',
                             '2.3' or '2.4' (default: '2.1')
      --ubl-cardaccountnetworkid ID
                           The UBL CardAccount network ID to be used (default:
                             'mapped-from-cii')
      --ubl-customizationid ID
                           The UBL customization ID to be used (default: 'urn:
                             cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:
                             2017:poacc:billing:3.0')
      --ubl-defaultorderrefid ID
                           The UBL default order reference ID to be used
                             (default: '')
      --ubl-profileid ID   The UBL profile ID to be used (default: 'urn:fdc:
                             peppol.eu:2017:poacc:billing:01:1.0')
      --ubl-vatscheme vat scheme
                           The UBL VAT scheme to be used (default: 'VAT')
  -V, --version            Print version information and exit.
      --verbose            Enable debug logging (default: 'false')

Open issues

News and noteworthy


My personal Coding Styleguide | It is appreciated if you star the GitHub project if you like it.