ZUGFeRD / mustangproject

Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)
http://www.mustangproject.org
Apache License 2.0
198 stars 112 forks source link

How to create EN16931 with UBL XML file? #277

Closed Kukulkano closed 2 years ago

Kukulkano commented 2 years ago

Hi,

if I try to use -version 1 and -profile e for EN16931, the following error comes up:

11:39:15.444 [main] ERROR o.mustangproject.validator.Validator - ZUGFeRD XML does not contain <rsm:CrossIndustry, <rsm:SCRDMCCBDACIOMessageStructure or SCRDMCCBDACIDAMessageStructure and can thus not be valid

The thing is that my XML is contains UBL format for Peppol compatibility and not ZUGFeRD CII format.

Due to the documentation the EN16931 standard is supported for version v2. But if I set -version 2 and -profile e, it complains

Factur-X is only available in version 1 (roughly corresponding to ZF2)

I'm confused now. Is EN16931 with UBL format supported? And how to set these params?

If I validate my XML file here (https://www.itb.ec.europa.eu/invoice/upload), it is happy and showing no errors. But mustang complains about missing <rsm:CrossIndustry, <rsm:SCRDMCCBDACIOMessageStructure or SCRDMCCBDACIDAMessageStructure?

I create the XML using https://github.com/josemmo/einvoicing PHP class. But I do not see any reference to these values there...

Can you help?

Kukulkano commented 2 years ago

This is my XML content:

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
  <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
  <cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
  <cbc:ID>202206-buyerCompany-1157</cbc:ID>
  <cbc:IssueDate>2022-07-01</cbc:IssueDate>
  <cbc:DueDate>2022-07-01</cbc:DueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cac:PartyName>
        <cbc:Name>myCompany GmbH</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>Testtrasse 39</cbc:StreetName>
        <cbc:CityName>Teststadt</cbc:CityName>
        <cbc:PostalZone>12345</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>DE12345678</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>myCompany GmbH</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:Contact>
        <cbc:ElectronicMail>info@myCompany.com</cbc:ElectronicMail>
      </cac:Contact>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cac:PostalAddress>
        <cbc:StreetName>29, boulevard Test</cbc:StreetName>
        <cbc:AdditionalStreetName/>
        <cbc:CityName>Luxembourg</cbc:CityName>
        <cbc:PostalZone>L-1331</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>LU</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>LU12345678</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>buyerCompany S.A.</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:Contact>
        <cbc:ElectronicMail>j@buyerCompany.com</cbc:ElectronicMail>
      </cac:Contact>
    </cac:Party>
  </cac:AccountingCustomerParty>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="EUR">550</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>AE</cbc:ID>
        <cbc:Percent>0</cbc:Percent>
        <cbc:TaxExemptionReasonCode>VATEX-EU-AE</cbc:TaxExemptionReasonCode>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="EUR">550</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="EUR">550</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="EUR">550</cbc:TaxInclusiveAmount>
    <cbc:PayableAmount currencyID="EUR">550</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="C62">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">550</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Minimum provider fee (multiple products)</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>AE</cbc:ID>
        <cbc:Percent>0</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="EUR">550</cbc:PriceAmount>
    </cac:Price>
  </cac:InvoiceLine>
</Invoice>

It validates at https://www.itb.ec.europa.eu/invoice/upload with no issues.

jstaerk commented 2 years ago

Neither ZUGFeRD nor Factur-X (nor Order-X) support UBL, only XRechnung supports both, in which case you don't need a XML file. As a matter of fact even the Factur-X/ZUGFeRD Referenzprofil XRechnung is CII only by spec, albeit very hidden.