Git Product home page Git Product logo

en16931-cii2ubl's Introduction

Hello world 👋

Profile views

en16931-cii2ubl's People

Contributors

cambid avatar lkumai avatar phax avatar rkottmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

en16931-cii2ubl's Issues

JAXB [fatal_error]

Attached invoice
Rechnung-202010076-10010.xml.zip looks like valid CII to me but raises the following error:

[main] INFO com.helger.en16931.cii2ubl.cli.CIIToUBLConverter - Starting CII to UBL Converter
[main] ERROR com.helger.jaxb.validation.LoggingValidationEventHandler - JAXB [fatal_error] in obj: [InvoiceTypeCodeType@0x4207609e: languageID=null; listAgencyID=null; listAgencyName=null; listID=null; listName=null; listSchemeURI=null; listURI=null; listVersionID=null; name=null; value=380] cvc-complex-type.2.4.a: Ungültiger Content wurde beginnend mit Element '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":InvoiceTypeCode}' gefunden. '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":CopyIndicator, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":UUID, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":IssueDate}' wird erwartet. (org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Ungültiger Content wurde beginnend mit Element '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":InvoiceTypeCode}' gefunden. '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":CopyIndicator, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":UUID, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":IssueDate}' wird erwartet.)
org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-complex-type.2.4.a: Ungültiger Content wurde beginnend mit Element '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":InvoiceTypeCode}' gefunden. '{"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":CopyIndicator, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":UUID, "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2":IssueDate}' wird erwartet.

This is either a coincidence or your library might be used in the german ZRE
vgl. https://www.zugferd-community.net/forum/viewtopic.php?p=318#p318

TypeCode missing after AdditionalReferencedDocument conversion

There seems to be a problem converting the AdditionalReferencedDocument field to cac:DocumentReference, the TypeCode is missing on the output xml.

// Input CII
<am:ApplicableHeaderTradeAgreement>
...
	<ram:AdditionalReferencedDocument>
		<ram:IssuerAssignedID schemeID="AAJ">18088852:20221215</ram:IssuerAssignedID>
		<ram:TypeCode>130</ram:TypeCode>
	</ram:AdditionalReferencedDocument>
...
</ram:ApplicableHeaderTradeAgreement>
// Output UBL
<cac:InvoiceLine>
...
  <cac:DocumentReference>
	  <cbc:ID>18088852:20221215</cbc:ID>
  </cac:DocumentReference>
...
</cac:InvoiceLine>

Bad convertion CalculationPercent to SpecifiedTradeAllowanceCharge

Hello Philip,

I'm using your CIIToUBL converter and it looks like there is a problem converting the CalculationPercent to MultiplierFactorNumeric.

    if (aAllowanceCharge.getCalculationPercent () != null)
    {
      // TODO calc is correct?
      aUBLAllowanceCharge.setMultiplierFactorNumeric (aAllowanceCharge.getCalculationPercentValue ().divide (CGlobal.BIGDEC_100));
    }

I think CalculationPercent should not be divided by 100

You can see the documentation of MultiplierFactorNumeric here

MultiplierFactorNumeric
Line level allowance or charge percentage
The percentage that may be used, in conjunction with the line level allowance base amount, to calculate the line level allowance or charge amount.
Example value: 20

PS: Thank you very much for all your work :)

Bei Payment TypeCode 59 (Lastschrift/SEPA direct debit) werden Gläubiger ID und IBAN falsch konvertiert

Hallo,

aus dem CII-Block:

        <ram:ApplicableHeaderTradeSettlement>
            <ram:CreditorReferenceID>asdfdsf</ram:CreditorReferenceID>
            <ram:PaymentReference>Verwendungszweck</ram:PaymentReference>
            <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
            <ram:SpecifiedTradeSettlementPaymentMeans>
                <ram:TypeCode>59</ram:TypeCode>
                <ram:PayerPartyDebtorFinancialAccount>
                    <ram:IBANID>DE8444010046023...</ram:IBANID>
                </ram:PayerPartyDebtorFinancialAccount>
            </ram:SpecifiedTradeSettlementPaymentMeans>...
        </ram:ApplicableHeaderTradeSettlement>

mit Gläubiger-ID asdfdsf wird unter UBL:

	<cac:PaymentMeans>
		<cbc:PaymentMeansCode>59</cbc:PaymentMeansCode>
		<cbc:PaymentID>Verwendungszweck</cbc:PaymentID>
		<cac:PayeeFinancialAccount>
			<cbc:ID>DE8444010046023...</cbc:ID>
		</cac:PayeeFinancialAccount>
		<cac:PaymentMandate>
			<cbc:ID>1400000007</cbc:ID>
			<cac:PayerFinancialAccount>
				<cbc:ID>asdfdsf</cbc:ID>
			</cac:PayerFinancialAccount>
		</cac:PaymentMandate>
	</cac:PaymentMeans>

Die Gläubiger-ID steht unter der IBAN des Zahlers. Dorthin gehört aber die IBAN DE8444010046023..., die fälschlicherweise als IBAN des Zahlungsempfängers ausgewiesen wird. Die Gläubiger-ID gehört unter PartyIdentification mit der schemaID "SEPA".

mfG
Michael Schneider

URIID of an AdditionalDocumentReference is not converted

Hi,

CII:

           <ram:AdditionalReferencedDocument>
               <ram:IssuerAssignedID>2300000013.PDF</ram:IssuerAssignedID>
               <ram:TypeCode>916</ram:TypeCode>
               <ram:Name>PDF</ram:Name>
               <ram:AttachmentBinaryObject mimeCode="application/pdf" filename="2300000013.PDF">JVBER...</ram:AttachmentBinaryObject>
           </ram:AdditionalReferencedDocument>
           <ram:AdditionalReferencedDocument>
               <ram:IssuerAssignedID>test.pdf</ram:IssuerAssignedID>
               <ram:URIID>https://test.xrechnung-bdr.de/attachments/api/v1/File/...</ram:URIID>
               <ram:TypeCode>916</ram:TypeCode>
               <ram:Name>ein Test Link</ram:Name>
           </ram:AdditionalReferencedDocument>

UBL:

  <cac:AdditionalDocumentReference>
    <cbc:ID>2300000013.PDF</cbc:ID>
    <cbc:DocumentDescription>PDF</cbc:DocumentDescription>
    <cac:Attachment>
      <cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf" filename="2300000013.PDF">JVBER...</cbc:EmbeddedDocumentBinaryObject>
    </cac:Attachment>
  </cac:AdditionalDocumentReference>
  <cac:AdditionalDocumentReference>
    <cbc:ID>test.pdf</cbc:ID>
    <cbc:DocumentDescription>ein Test Link</cbc:DocumentDescription>
  </cac:AdditionalDocumentReference>

Also the TypeCode is missing. The CII invoice has been successfully validated.

en16931-cii2ubl-cli-1.2.2-full.jar throws NoClassDefFoundError

Hi

I just downloaded en16931-cii2ubl-cli-1.2.2-full.jar and tried to convert a file using the CLI. I'm getting the following error:

[main] INFO com.helger.en16931.cii2ubl.cli.CIIToUBLConverter - Starting CII to UBL Converter
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
	at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:470)
	at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:63)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:128)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:84)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:162)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:92)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:444)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:292)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1138)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:286)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:350)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
	at com.helger.jaxb.JAXBContextCacheKey._createFromPackageAndClassLoader(JAXBContextCacheKey.java:155)
	at com.helger.jaxb.JAXBContextCacheKey.createJAXBContext(JAXBContextCacheKey.java:202)
	at com.helger.jaxb.JAXBContextCache.lambda$new$3fed5817$1(JAXBContextCache.java:81)
	at com.helger.commons.cache.MappedCache.getFromCache(MappedCache.java:336)
	at com.helger.jaxb.JAXBContextCache.getFromCache(JAXBContextCache.java:124)
	at com.helger.jaxb.JAXBContextCache.getFromCache(JAXBContextCache.java:166)
	at com.helger.jaxb.builder.AbstractJAXBBuilder.getJAXBContext(AbstractJAXBBuilder.java:164)
	at com.helger.jaxb.builder.JAXBReaderBuilder.createUnmarshaller(JAXBReaderBuilder.java:134)
	at com.helger.jaxb.builder.JAXBReaderBuilder.read(JAXBReaderBuilder.java:165)
	at com.helger.jaxb.IJAXBReader.read(IJAXBReader.java:326)
	at com.helger.jaxb.IJAXBReader.read(IJAXBReader.java:127)
	at com.helger.jaxb.IJAXBReader.read(IJAXBReader.java:97)
	at com.helger.jaxb.IJAXBReader.read(IJAXBReader.java:184)
	at com.helger.en16931.cii2ubl.AbstractCIIToUBLConverter.convertCIItoUBL(AbstractCIIToUBLConverter.java:314)
	at com.helger.en16931.cii2ubl.cli.CIIToUBLConverter.call(CIIToUBLConverter.java:180)
	at com.helger.en16931.cii2ubl.cli.CIIToUBLConverter.call(CIIToUBLConverter.java:55)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
	at picocli.CommandLine.access$1100(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
	at picocli.CommandLine.execute(CommandLine.java:2058)
	at com.helger.en16931.cii2ubl.cli.CIIToUBLConverter.main(CIIToUBLConverter.java:228)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 45 more

BT-41 conversion incomplete

BT-41 is not converted from CII to UBL if CII path is /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact/ram:DepartmentName

image

source:

image

ubl:

image

image

BT-8 codes not transformed

BT-8 "Value added tax point date code" is restricted to UNTDID 2005 in EN 16931-1, but there
is a restriction to UNTDID 2475 on the respective element in CII. Thus, the transformation should include a mapping of the respective codes (see chapter 4.3 in EN 16931-3-3) to prevent violation of BR-CL-06 in transformed UBL files:

CII UBL
5 3
29 35
72 432

Todos

  • Avoid empty cbc:StreetName

  • Avoid empty cbc:CityName

  • Avoid empty cbc:PostalZone

  • Avoid empty InvoiceLine/Item/Description

  • Avoid constructs like this (eg. empty SalesOrderID):

  <cac:OrderReference>
    <cbc:ID></cbc:ID>
  </cac:OrderReference>
  • Consider removing 0 values:
      <cbc:AllowanceTotalAmount currencyID="EUR">0.00</cbc:AllowanceTotalAmount>
      <cbc:ChargeTotalAmount currencyID="EUR">0.00</cbc:ChargeTotalAmount>
      <cbc:PrepaidAmount currencyID="EUR">0.00</cbc:PrepaidAmount>
  • In AllowanceCharge to be ignored:
<cbc:BaseAmount currencyID="EUR">0.00</cbc:BaseAmount>
  • Support for multiple SellerTradeParty/ID elements

  • Try to avoid unnecessary trailing zeros in decimal numbers

  • The SubjectCode from IncludedNote needs to be copied

<ram:IncludedNote>
  <ram:Content>Die Lieferung erfolgt aufgrund der AGB […] erhältlich unter […]. Auf Wunsch senden wir sie auch zu.</ram:Content>
  <ram:SubjectCode>ADU</ram:SubjectCode>
</ram:IncludedNote>

add test cases for XRechnung 2.0.0

You should add test cases for XRechnung 2.0.0 as it is the required e-invoicing standard for germany now.
I cannot push / make PRs, so here's my example (used for searching my bugs) :)

/**
 * Copyright (C) 2019-2021 Philip Helger
 * http://www.helger.com
 * philip[at]helger[dot]com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.helger.en16931.cii2ubl;

import java.io.File;

import javax.annotation.Nonnull;

import com.helger.commons.annotation.Nonempty;
import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.collection.impl.CommonsArrayList;
import com.helger.commons.collection.impl.ICommonsList;
import com.helger.phive.api.executorset.ValidationExecutorSetRegistry;
import com.helger.phive.en16931.EN16931Validation;
import com.helger.phive.engine.source.IValidationSourceXML;

final class MockSettings
{
  private static final String BASE_TEST_DIR = "src/test/resources/cii/";
  private static final String[] TEST_FILES_EN16931 = {
          "CII_business_example_01.xml",
          "CII_business_example_02.xml",
          "CII_example1.xml",
          "CII_example2.xml",
          "CII_example3.xml",
          "CII_example4.xml",
          "CII_example5.xml",
          "CII_example6.xml",
          "CII_example7.xml",
          "CII_example8.xml",
          "CII_example9.xml"
  };

  private static final String[] TEST_FILES_XRECHNUNG_122 = {
          "01.01a-INVOICE_uncefact.xml",
          "01.02a-INVOICE_uncefact.xml",
          "01.03a-INVOICE_uncefact.xml",
          "01.04a-INVOICE_uncefact.xml",
          "01.05a-INVOICE_uncefact.xml",
          "01.06a-INVOICE_uncefact.xml",
          "01.07a-INVOICE_uncefact.xml",
          "01.08a-INVOICE_uncefact.xml",
          "01.09a-INVOICE_uncefact.xml",
          "01.10a-INVOICE_uncefact.xml",
          "01.11a-INVOICE_uncefact.xml",
          "01.12a-INVOICE_uncefact.xml",
          "01.13a-INVOICE_uncefact.xml",
          "01.14a-INVOICE_uncefact.xml",
          "01.15a-INVOICE_uncefact.xml",
          "02.01a-INVOICE_uncefact.xml",
          "02.02a-INVOICE_uncefact.xml",
          "02.03a-INVOICE_uncefact.xml",
          "02.04a-INVOICE_uncefact.xml",
          // "03.01a-INVOICE_uncefact.xml",
          "03.02a-INVOICE_uncefact.xml"
  };

  private static final String[] TEST_FILES_XRECHNUNG_200 = {
          "01.01a-INVOICE_uncefact.xml"
  };

  static final ValidationExecutorSetRegistry <IValidationSourceXML> VES_REGISTRY = new ValidationExecutorSetRegistry <> ();
  static
  {
    EN16931Validation.initEN16931 (VES_REGISTRY);
  }

  @Nonnull
  @Nonempty
  @ReturnsMutableCopy
  public static ICommonsList <File> getAllTestFiles ()
  {
    final ICommonsList <File> ret = new CommonsArrayList <> ();
    for (final String sFile : TEST_FILES_EN16931)
      ret.add (new File (BASE_TEST_DIR, sFile));
    for (final String sFile : TEST_FILES_XRECHNUNG_122)
      ret.add (new File (BASE_TEST_DIR + "xrechnung/1.2.2", sFile));
    for (final String sFile : TEST_FILES_XRECHNUNG_200)
      ret.add (new File (BASE_TEST_DIR + "xrechnung/2.0.0", sFile));
    return ret;
  }
}

Konvertierung schlägt fehl wenn 'SellerAssignedID' leer ist, obwohl Datei eigentlich valide ist

Hallo, ich habe eine beispielhafte XRechnung von der Seite https://xr-viewer.nortal.com/:

homepage.txt

Mit der neusten Version des Validators (https://github.com/itplr-kosit/validator-configuration-xrechnung), sowie mit der GUI-Implementation: (https://github.com/jcthiele/OpenXRechnungToolbox) kann ich die Datei prüfen und sie wird in beiden Fällen als valide ausgegeben. Wenn ich nun aber versuche diesen Converter mit der Datei zu verwenden, dann schlägt die Konvertierung fehl und die Datei wird nur bis zum Element SellersItemIdentification geschrieben. Hier der Stacktrace: stacktrace.txt

Das Problem tritt nicht mehr auf, wenn ich in der Orignaldatei den Wert SellerAssignedID befülle, wie im Screenshot rechts:
issue

Ist es möglich, das zu beheben? Oder kann es sein, das meine Datei doch keine valide XRechnung ist und ich den Validator falsch konfiguiert habe?

mapping of AppliedTradeAllowanceCharge from NetPriceProductTradePrice instead of GrossPriceProductTradePrice

Thanks for the very great toolset to convert CII to UBL.

I think I've found a bug in the conversation.

According to the [mapping-cii-ubl.xlsx] in the docs-folder the AppliedTradeAllowanceCharge should be fetched from the GrossPriceProductTradePrice and not from the NetPriceProductTradePrice.

I've tested with the actual HEAD and a minimal example. In the attached files.zip there are three versions of the same invoice:

  1. 12119719.xml Invoice in CII-format
  2. 12119719-ubl-orig.xml in UBL-format converted with the actual HEAD.
  3. 12119719-ubl.xml in UBL-format after doing a minimal change in the CIIToUBL21Converter.java in Line 1337
aLineAgreement.getNetPriceProductTradePrice
aLineAgreement.getGrossPriceProductTradePrice

In the second version the allowance of 4.69 is missing completely.

files.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.