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
240 stars 136 forks source link

NullPointerException for TradeParties without street in address #222

Closed sernet-admin closed 3 years ago

sernet-admin commented 3 years ago

If a TradeParty has no street in de address, then a NullPointerException is thrown when generating the XRechnung. Addresses with a postal code but without a street are valid in Germany.

Stacktrace:

java.lang.NullPointerException
    at org.mustangproject.XMLTools.encodeXML(XMLTools.java:48)
    at org.mustangproject.ZUGFeRD.ZUGFeRD2PullProvider.getTradePartyAsXML(ZUGFeRD2PullProvider.java:159)
    at org.mustangproject.ZUGFeRD.ZUGFeRD2PullProvider.generateXML(ZUGFeRD2PullProvider.java:420)
    at org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA3.prepare(ZUGFeRDExporterFromA3.java:526)
    at org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA3.setTransaction(ZUGFeRDExporterFromA3.java:521)
    at com.sernet.faktura2.core.zugferd.InvoiceCreator.addInvoiceToPDF(InvoiceCreator.java:62)
        ...
jstaerk commented 3 years ago

Apparently there was a bit of a legal back-and-forth in the past, the BGF ruled that Street was required in AZ VR 23/14 (https://www.handwerksblatt.de/themen-specials/rechnungen-darauf-kommt-es-an/strenge-anforderungen-an-die-rechnungsanschrift) but was overruled by the EuGH https://www.haufe.de/steuern/rechtsprechung/kein-vorsteuerabzug-bei-rechnungen-mit-postfachadresse_166_325834.html