klst-de / e-invoice

create xml invoice conforming to CIUS XRechnung or €uropean standard EN16931
Apache License 2.0
12 stars 6 forks source link

Invoice namespace seems to be changed on KoSIT Validation config #20

Closed PDesire closed 3 years ago

PDesire commented 3 years ago

Depending on https://github.com/itplr-kosit/validator-configuration-xrechnung/blob/ac36c5066a791178ffa32ac7f0ba86a452859200/scenarios.xml#L47

Seems like the namespace of Invoice has changed from ubl:Invoice to invoice:Invoice. The e-invoice library seems to generate still ubl:Invoice namespaces like this one:

<ubl:Invoice xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">

Does that in general happen because I use the cast (GenericInvoice<InvoiceType>) to the CoreInvoice (which is a Type of CoreInvoice anyway) ? Or is that related to your library ?

Thanks !

homebeaver commented 3 years ago

Hi Tristan , @PDesire

yes, I see: the namespace definition in validator-configuration-xrechnung is

grafik

grafik

In e-invoice I did not change the ns mapping since the origin - like it was in UBL and CII sources, resp. the kosit examples (see xrechnung-testsuite)

See mapper classes UblNamespacePrefixMapper and CiiNamespacePrefixMapper:

public class CiiNamespacePrefixMapper extends NamespacePrefixMapper {

    private Map<String, String> namespaceMap = new HashMap<>();

    /**
     * Create mappings.
     */
    public CiiNamespacePrefixMapper() {
        namespaceMap.put("urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100", "rsm");  // <=====
        namespaceMap.put("urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100", "ram");
        namespaceMap.put("urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100", "udt");
        namespaceMap.put("urn:un:unece:uncefact:data:standard:QualifiedDataType:100", "qdt");
    }

But anyway, in the generated xml you can read the used mapping. See ubl-xml generated by README example:

INFORMATION: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ubl:Invoice 
    xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"      <!-- used mapping -->
    xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" 
    xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" 
    xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
    <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
    <cbc:ID>123456XX</cbc:ID>
    <cbc:IssueDate>2016-12-04</cbc:IssueDate>
    <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
    <cbc:Note>#ADU#Es gelten unsere Allgem. Geschäftsbedingungen, die Sie unter […] finden.</cbc:Note>
...

regards EUGen PS: your e-invoice clone is 327 commits behind klst-de:master.

homebeaver commented 3 years ago

So the answer is: It relates to the library

PDesire commented 3 years ago

Thankyou, then I'll gonna ask the KoSIT people about this !