corrected profile for order-x
This commit is contained in:
6
library/src/main/java/org/mustangproject/EStandard.java
Normal file
6
library/src/main/java/org/mustangproject/EStandard.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package org.mustangproject;
|
||||
|
||||
public enum EStandard {
|
||||
facturx, orderx, zugferd, cii, ubl
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.mustangproject.EStandard;
|
||||
import org.mustangproject.FileAttachment;
|
||||
import org.mustangproject.XMLTools;
|
||||
|
||||
@@ -48,10 +49,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
protected IExportableTransaction trans;
|
||||
protected TransactionCalculator calc;
|
||||
private String paymentTermsDescription;
|
||||
protected Profile profile = Profiles.getByName("EN16931");
|
||||
|
||||
|
||||
|
||||
protected Profile profile = Profiles.getByName(EStandard.orderx,"basic", 1);
|
||||
|
||||
|
||||
@Override
|
||||
@@ -124,6 +122,9 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
// + "
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
||||
//
|
||||
+ "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ "<ram:ID>A1</ram:ID>\n"
|
||||
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:ID>" + getProfile().getID() + "</ram:ID>\n"
|
||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
@@ -536,6 +537,11 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
profile = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Profile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
|
||||
final IZUGFeRDPaymentTerms paymentTerms = trans.getPaymentTerms();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
*/
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import org.mustangproject.EStandard;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -41,8 +43,28 @@ public class Profiles {
|
||||
|
||||
|
||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||
static Map<String, Profile> ox1Map = 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")},
|
||||
|
||||
|
||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||
|
||||
|
||||
public static Profile getByName(EStandard standard, String name, int version) {
|
||||
if (standard != EStandard.orderx) {
|
||||
return getByName(name, version);
|
||||
} else {
|
||||
Profile result = null;
|
||||
result = ox1Map.get(name.toUpperCase());
|
||||
if (result == null) {
|
||||
throw new RuntimeException("Profile not found");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static Profile getByName(String name, int version) {
|
||||
Profile result = null;
|
||||
if (version == 1) {
|
||||
@@ -50,9 +72,12 @@ public class Profiles {
|
||||
} else {
|
||||
result = zf2Map.get(name.toUpperCase());
|
||||
}
|
||||
if (result==null) { throw new RuntimeException("Profile not found"); }
|
||||
if (result == null) {
|
||||
throw new RuntimeException("Profile not found");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Profile getByName(String name) {
|
||||
return getByName(name, ZUGFeRDExporterFromA3.DefaultZUGFeRDVersion);
|
||||
}
|
||||
|
||||
@@ -288,11 +288,7 @@ public class OXTest extends MustangReaderTestCase implements IExportableTransact
|
||||
assertEquals("496.00", zi.getAmount());
|
||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||
assertEquals(zi.getForeignReference(), getNumber());
|
||||
try {
|
||||
assertEquals(zi.getVersion(), 2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user