jstaerk
2022-04-24 19:17:24 +02:00
parent 512e80c955
commit ef24a7f95d
6 changed files with 32 additions and 27 deletions

View File

@@ -33,10 +33,11 @@ public class CustomXMLProvider implements IXMLProvider {
public void setXML(byte[] newData) {
String zf = new String(newData, StandardCharsets.UTF_8);
/**
* rsm:CrossIndustry is ZF/FX/XR (CII 2016b) and rsm:SCRDMCCBDACIOMessageStructure is of course Order-X (CIO 2021)
* rsm:CrossIndustry is ZF/FX/XR (CII 2016b),rsm:SCRDMCCBDACIOMessageStructure is Order-X (CIO 2021) and
* SCRDMCCBDACIDAMessageStructure is Despatch Advice
*/
if ((!zf.contains("rsm:CrossIndustry")) && (!zf.contains("rsm:SCRDMCCBDACIOMessageStructure"))) {
throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry or <rsm:SCRDMCCBDACIOMessageStructure and can thus not be valid");
if ((!zf.contains("rsm:CrossIndustry")) && (!zf.contains("rsm:SCRDMCCBDACIOMessageStructure")) && (!zf.contains("SCRDMCCBDACIDAMessageStructure"))) {
throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry, <rsm:SCRDMCCBDACIOMessageStructure or SCRDMCCBDACIDAMessageStructure and can thus not be valid");
}
zugferdData = newData;

View File

@@ -44,7 +44,7 @@ public class DXExporterFromA1 extends DXExporterFromA3 implements IZUGFeRDExport
* @return the URN of the namespace
*/
public String getNamespaceForVersion(int ver) {
return "urn:factur-x:pdfa:CrossIndustryDocument:1p0#";
return "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#";
}
/***
* internal helper: returns the namespace prefix for the given order-x version number

View File

@@ -105,7 +105,7 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
* OrderX document type. As of version 1.0 it may be
* ORDER, ORDER_RESPONSE, or ORDER_CHANGE
*/
protected String orderXDocumentType = "ORDER";
protected String deliverXDocumentType = "DESPATCHADVICE";
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
@@ -396,15 +396,15 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
}
/**
* Sets the property orderXDocumentType.
* Sets the property for DocumentType.
*
* @param orderXDocumentType new value. Expected: ORDER, ORDER_RESPONSE, or ORDER_CHANGE
* @param
*
* @return this exporter
*/
public DXExporterFromA3 setOrderXDocumentType(String orderXDocumentType)
public DXExporterFromA3 setDocumentType(String DocumentType)
{
this.orderXDocumentType = orderXDocumentType;
this.deliverXDocumentType = DocumentType;
return this;
}
@@ -426,9 +426,9 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
if (attachZUGFeRDHeaders) {
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, 1, true, xmlProvider.getProfile(),
"urn:factur-x:pdfa:CrossIndustryDocument:1p0#", "fx",
"deliver-x.xml");
zf.setType(this.orderXDocumentType);
"urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#", "fx",
"cida.xml");
zf.setType(this.deliverXDocumentType);
metadata.addSchema(zf);
// also add the schema extensions...
@@ -457,9 +457,9 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
public IExporter prepare() throws IOException {
prepareDocument();
xmlProvider.generateXML(trans);
String filename = "deliver-x.xml";
String filename = "cida.xml";
PDFAttachGenericFile(doc, filename, "Alternative",
"Order metadata conforming to the Order-X standard (https://www.ferd-net.de/standards/order-x/index.html)",
"Delivery metadata",
"text/xml", xmlProvider.getXML());
for (FileAttachment attachment : fileAttachments) {

View File

@@ -51,11 +51,7 @@ public class Profiles {
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
static Map<String, Profile> dx1Map = Stream.of(new Object[][]{
{"BASIC", new Profile("BASIC", "urn:order-x.eu:1p0:basic")},
{"COMFORT", new Profile("COMFORT", "urn:order-x.eu:1p0:comfort")},
{"EXTENDED", new Profile("EXTENDED", "urn:order-x.eu:1p0:extended")},
{"PILOT", new Profile("PILOT", "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#")}
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));

View File

@@ -149,7 +149,7 @@ public class ZUGFeRDImporter {
/**
* filenames for invoice data (ZUGFeRD v1 and v2, Factur-X)
*/
if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("deliver-x.xml")) {
if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("cida.xml")) {
containsMeta = true;
final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();