From fe08c4d74d88af38c54ce9950b955d1b1592a57a Mon Sep 17 00:00:00 2001 From: jstaerk Date: Tue, 22 Dec 2020 16:52:04 +0100 Subject: [PATCH] Corrected intra community supply tax exemption category code --- History.md | 6 +++ Mustang-CLI/pom.xml | 3 +- library/pom.xml | 18 ++++++- .../java/org/mustangproject/CII/CIIToUBL.java | 50 +++++++++++++++++++ .../model/TaxCategoryCodeTypeConstants.java | 2 +- 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 library/src/main/java/org/mustangproject/CII/CIIToUBL.java diff --git a/History.md b/History.md index 97088002..789221f7 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,9 @@ +2.1.0 +======= + + +- Corrected intra community supply tax exemption category code + 2.0.3 ======= 2020-12-06 diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 274d1f1c..c7f94c3d 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -8,7 +8,7 @@ 4.0.0 org.mustangproject Mustang-CLI - Mustang commandline tool + e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation should also work for XRechnung/CII. jar 2.0.4-SNAPSHOT @@ -53,7 +53,6 @@ 4.13.1 test - org.xmlunit diff --git a/library/pom.xml b/library/pom.xml index d1c0b4bf..6686b648 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -11,8 +11,8 @@ library 2.0.4-SNAPSHOT jar - Library to write and read FacturX and ZUGFeRD e-invoices. - The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML. + Library to write, read and validate e-invoices (Factur-X, ZUGFeRD and to a limited extend XRechnung/CII). + The Mustang project is a java library to read, write and validate Factur-X/ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML. http://www.mustangproject.org/ @@ -83,6 +83,14 @@ 4.13.1 test + + + + com.helger + en16931-cii2ubl + 1.2.5 + + com.helger ph-schematron @@ -101,6 +109,12 @@ xmlunit-assertj 2.6.3 + + com.helger + ph-commons + 9.1.1 + compile + diff --git a/library/src/main/java/org/mustangproject/CII/CIIToUBL.java b/library/src/main/java/org/mustangproject/CII/CIIToUBL.java new file mode 100644 index 00000000..8b2a28e3 --- /dev/null +++ b/library/src/main/java/org/mustangproject/CII/CIIToUBL.java @@ -0,0 +1,50 @@ +package org.mustangproject.CII; +import com.helger.commons.error.list.ErrorList; +import com.helger.en16931.cii2ubl.CIIToUBL22Converter; +import com.helger.ubl21.UBL21Writer; +import com.helger.ubl22.UBL22Writer; + +import java.io.File; +import java.io.Serializable; + +public class CIIToUBL { + /*** + * converts a CII XML file to a UBL XML file + * thanks to Philip Helger for his library + * @param input + * @param output + */ + public void convert(File input, File output) { + ErrorList occurred=new ErrorList(); + CIIToUBL22Converter cc=new CIIToUBL22Converter(); + Serializable aUBL = cc.convertCIItoUBL(input, occurred); + if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType) + { + UBL21Writer.invoice () + .setFormattedOutput (true) + .write ((oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType) aUBL, output); + } + else + if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_21.CreditNoteType) + { + UBL21Writer.creditNote () + .setFormattedOutput (true) + .write ((oasis.names.specification.ubl.schema.xsd.creditnote_21.CreditNoteType) aUBL, output); + } + else + if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_22.InvoiceType) + { + UBL22Writer.invoice () + .setFormattedOutput (true) + .write ((oasis.names.specification.ubl.schema.xsd.invoice_22.InvoiceType) aUBL, output); + } + else + if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_22.CreditNoteType) + { + UBL22Writer.creditNote () + .setFormattedOutput (true) + .write ((oasis.names.specification.ubl.schema.xsd.creditnote_22.CreditNoteType) aUBL, output); + } + } + +} diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/model/TaxCategoryCodeTypeConstants.java b/library/src/main/java/org/mustangproject/ZUGFeRD/model/TaxCategoryCodeTypeConstants.java index 979207c8..b7669ba0 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/model/TaxCategoryCodeTypeConstants.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/model/TaxCategoryCodeTypeConstants.java @@ -24,5 +24,5 @@ public class TaxCategoryCodeTypeConstants { public static final String TAXEXEMPT = "E"; public static final String ZEROTAXPRODUCTS = "Z"; public static final String UNTAXEDSERVICE = "O"; - public static final String INTRACOMMUNITY = "IC"; + public static final String INTRACOMMUNITY = "K"; }