first attempt to remove jaxb from zfv1
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Library to write and read FacturX 1.0 and ZUGFeRD 1.0 and 2.1 e-invoices. A PDF/A file is required, the XML can be generated or provided. </name>
|
||||
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs
|
||||
<name>Library to write and read FacturX and ZUGFeRD e-invoices. </name>
|
||||
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML.
|
||||
</description>
|
||||
<url>http://www.mustangproject.org/</url>
|
||||
<scm>
|
||||
@@ -56,26 +56,6 @@
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
<version>9.8.0-11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.2.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.2.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.2.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
@@ -246,18 +226,6 @@
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>com.sun.xml.bind:jaxb-impl</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>com.sun.xml.bind:jaxb-core</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
<executions>
|
||||
@@ -291,26 +259,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>jaxb2-maven-plugin</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>xjc</id>
|
||||
<goals>
|
||||
<goal>xjc</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<target>2.1</target>
|
||||
<packageName>org.mustangproject.ZUGFeRD.model</packageName>
|
||||
<sources>
|
||||
<source>src/main/resources/schema/ZUGFeRD1p0.xsd</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<mailingLists>
|
||||
|
||||
@@ -18,102 +18,629 @@
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterTypeConstants;
|
||||
import org.mustangproject.ZUGFeRD.model.ZFNamespacePrefixMapper;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.mustangproject.XMLTools;
|
||||
import org.mustangproject.ZUGFeRD.*;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
||||
|
||||
private class LineCalc {
|
||||
private BigDecimal totalGross;
|
||||
private BigDecimal priceGross;
|
||||
private BigDecimal itemTotalNetAmount;
|
||||
private BigDecimal itemTotalVATAmount;
|
||||
|
||||
public LineCalc(IZUGFeRDExportableItem currentItem) {
|
||||
BigDecimal multiplicator = currentItem.getProduct().getVATPercent().divide(new BigDecimal(100))
|
||||
.add(new BigDecimal(1));
|
||||
priceGross = currentItem.getPrice().multiply(multiplicator);
|
||||
totalGross = currentItem.getQuantity().multiply(currentItem.getPrice()).divide(currentItem.getBasisQuantity())
|
||||
.multiply(multiplicator);
|
||||
itemTotalNetAmount = currentItem.getQuantity().multiply(currentItem.getPrice()).divide(currentItem.getBasisQuantity())
|
||||
.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
itemTotalVATAmount = totalGross.subtract(itemTotalNetAmount);
|
||||
}
|
||||
|
||||
public BigDecimal getItemTotalNetAmount() {
|
||||
return itemTotalNetAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getItemTotalVATAmount() {
|
||||
return itemTotalVATAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getItemTotalGrossAmount() {
|
||||
return itemTotalVATAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getPriceGross() {
|
||||
return priceGross;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//// MAIN CLASS
|
||||
|
||||
protected byte[] zugferdData;
|
||||
private Marshaller marshaller;
|
||||
|
||||
private boolean isTest;
|
||||
private IZUGFeRDExportableTransaction trans;
|
||||
private ZUGFeRDConformanceLevel level;
|
||||
private String paymentTermsDescription;
|
||||
|
||||
|
||||
@Override
|
||||
public void setProfile(ZUGFeRDConformanceLevel level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getProfile() {
|
||||
switch (level) {
|
||||
case BASIC: return DocumentContextParameterTypeConstants.BASIC;
|
||||
case COMFORT: return DocumentContextParameterTypeConstants.COMFORT;
|
||||
default: return DocumentContextParameterTypeConstants.EXTENDED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* enables the flag to indicate a test invoice in the XML structure
|
||||
*/
|
||||
@Override
|
||||
public void setTest() {
|
||||
isTest = true;
|
||||
}
|
||||
|
||||
public ZUGFeRD1PullProvider() {
|
||||
// TODO Auto-generated constructor stub
|
||||
try {
|
||||
marshaller = JAXBContext.newInstance("org.mustangproject.ZUGFeRD.model").createMarshaller();
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
|
||||
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new ZFNamespacePrefixMapper());
|
||||
} catch (JAXBException e) {
|
||||
throw new ZUGFeRDExportException("Could not initialize JAXB", e);
|
||||
}
|
||||
public static String nDigitFormat(BigDecimal value, int scale) {
|
||||
/*
|
||||
* I needed 123,45, locale independent.I tried
|
||||
* NumberFormat.getCurrencyInstance().format( 12345.6789 ); but that is locale
|
||||
* specific.I also tried DecimalFormat df = new DecimalFormat( "0,00" );
|
||||
* df.setDecimalSeparatorAlwaysShown(true); df.setGroupingUsed(false);
|
||||
* DecimalFormatSymbols symbols = new DecimalFormatSymbols();
|
||||
* symbols.setDecimalSeparator(','); symbols.setGroupingSeparator(' ');
|
||||
* df.setDecimalFormatSymbols(symbols);
|
||||
*
|
||||
* but that would not switch off grouping. Although I liked very much the
|
||||
* (incomplete) "BNF diagram" in
|
||||
* http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html in the
|
||||
* end I decided to calculate myself and take eur+sparator+cents
|
||||
*
|
||||
*/
|
||||
return value.setScale(scale, RoundingMode.HALF_UP).toPlainString();
|
||||
|
||||
}
|
||||
|
||||
private String createZugferdXMLForTransaction(IZUGFeRDExportableTransaction trans) {
|
||||
|
||||
JAXBElement<CrossIndustryDocumentType> jaxElement =
|
||||
new ZUGFeRDTransactionModelConverter(trans).withTest(isTest).withProfile(getProfile()).convertToModel();
|
||||
|
||||
try {
|
||||
return marshalJaxToXMLString(jaxElement);
|
||||
} catch (JAXBException e) {
|
||||
throw new ZUGFeRDExportException("Could not marshal ZUGFeRD transaction to XML", e);
|
||||
}
|
||||
private String vatFormat(BigDecimal value) {
|
||||
return ZUGFeRD1PullProvider.nDigitFormat(value, 2);
|
||||
}
|
||||
|
||||
private String marshalJaxToXMLString(Object jaxElement) throws JAXBException {
|
||||
ByteArrayOutputStream outputXml = new ByteArrayOutputStream();
|
||||
marshaller.marshal(jaxElement, outputXml);
|
||||
return outputXml.toString();
|
||||
private String currencyFormat(BigDecimal value) {
|
||||
return ZUGFeRD1PullProvider.nDigitFormat(value, 2);
|
||||
}
|
||||
|
||||
private String priceFormat(BigDecimal value) {
|
||||
return ZUGFeRD1PullProvider.nDigitFormat(value, 4);
|
||||
}
|
||||
|
||||
private String quantityFormat(BigDecimal value) {
|
||||
return ZUGFeRD1PullProvider.nDigitFormat(value, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getXML() {
|
||||
return zugferdData;
|
||||
|
||||
byte[] res = zugferdData;
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentHelper.parseText(new String(zugferdData));
|
||||
} catch (DocumentException e1) {
|
||||
Logger.getLogger(ZUGFeRD1PullProvider.class.getName()).log(Level.SEVERE, null, e1);
|
||||
}
|
||||
try {
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
XMLWriter writer = new XMLWriter(sw, format);
|
||||
writer.write(document);
|
||||
res = sw.toString().getBytes("UTF-8");
|
||||
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(ZUGFeRD1PullProvider.class.getName()).log(Level.SEVERE, null, e);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateXML(IZUGFeRDExportableTransaction trans) {
|
||||
// create a dummy file stream, this would probably normally be a
|
||||
// FileInputStream
|
||||
|
||||
byte[] zugferdRaw = createZugferdXMLForTransaction(trans).getBytes(); //$NON-NLS-1$
|
||||
|
||||
if ((zugferdRaw[0] == (byte) 0xEF)
|
||||
&& (zugferdRaw[1] == (byte) 0xBB)
|
||||
&& (zugferdRaw[2] == (byte) 0xBF)) {
|
||||
// I don't like BOMs, lets remove it
|
||||
zugferdData = new byte[zugferdRaw.length - 3];
|
||||
System.arraycopy(zugferdRaw, 3, zugferdData, 0,
|
||||
zugferdRaw.length - 3);
|
||||
private BigDecimal getTotalPrepaid() {
|
||||
if (trans.getTotalPrepaidAmount() == null) {
|
||||
return new BigDecimal(0);
|
||||
} else {
|
||||
zugferdData = zugferdRaw;
|
||||
return trans.getTotalPrepaidAmount();
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal getTotalGross() {
|
||||
|
||||
BigDecimal res = getTotal();
|
||||
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap();
|
||||
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
|
||||
res = res.add(amount.getCalculated());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private BigDecimal getTotal() {
|
||||
BigDecimal res = new BigDecimal(0);
|
||||
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||
LineCalc lc = new LineCalc(currentItem);
|
||||
res = res.add(lc.getItemTotalNetAmount());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* which taxes have been used with which amounts in this transaction, empty for
|
||||
* no taxes, or e.g. 19=>190 and 7=>14 if 1000 Eur were applicable to 19% VAT
|
||||
* (=>190 EUR VAT) and 200 EUR were applicable to 7% (=>14 EUR VAT) 190 Eur
|
||||
*
|
||||
* @return which taxes have been used with which amounts in this invoice
|
||||
*/
|
||||
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
|
||||
HashMap<BigDecimal, VATAmount> hm = new HashMap<>();
|
||||
|
||||
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||
BigDecimal percent = currentItem.getProduct().getVATPercent();
|
||||
LineCalc lc = new LineCalc(currentItem);
|
||||
VATAmount itemVATAmount = new VATAmount(lc.getItemTotalNetAmount(), lc.getItemTotalVATAmount(),
|
||||
trans.getDocumentCode());
|
||||
VATAmount current = hm.get(percent);
|
||||
if (current == null) {
|
||||
hm.put(percent, itemVATAmount);
|
||||
} else {
|
||||
hm.put(percent, current.add(itemVATAmount));
|
||||
}
|
||||
}
|
||||
return hm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfile() {
|
||||
return "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort";
|
||||
}
|
||||
|
||||
protected String getContactAsXML(IZUGFeRDExportableContact contact) {
|
||||
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
||||
// + " <DefinedTradeContact>\n"
|
||||
// + " <PersonName>xxx</PersonName>\n"
|
||||
// + " </DefinedTradeContact>\n"
|
||||
+ " <ram:PostalTradeAddress>\n"
|
||||
+ " <ram:PostcodeCode>" + XMLTools.encodeXML(contact.getZIP())
|
||||
+ "</ram:PostcodeCode>\n"
|
||||
+ " <ram:LineOne>" + XMLTools.encodeXML(contact.getStreet())
|
||||
+ "</ram:LineOne>\n";
|
||||
if (trans.getRecipient().getAdditionalAddress() != null) {
|
||||
xml += " <ram:LineTwo>" + XMLTools.encodeXML(contact.getAdditionalAddress())
|
||||
+ "</ram:LineTwo>\n";
|
||||
}
|
||||
xml += " <ram:CityName>" + XMLTools.encodeXML(contact.getLocation())
|
||||
+ "</ram:CityName>\n"
|
||||
+ " <ram:CountryID>" + XMLTools.encodeXML(contact.getCountry())
|
||||
+ "</ram:CountryID>\n"
|
||||
+ " </ram:PostalTradeAddress>\n";
|
||||
if (contact.getVATID() != null) {
|
||||
xml += " <ram:SpecifiedTaxRegistration>\n"
|
||||
+ " <ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(contact.getVATID())
|
||||
+ "</ram:ID>\n"
|
||||
+ " </ram:SpecifiedTaxRegistration>\n";
|
||||
}
|
||||
return xml;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(IZUGFeRDExportableTransaction trans) {
|
||||
this.trans = trans;
|
||||
|
||||
boolean hasDueDate=false;
|
||||
String taxCategoryCode="";
|
||||
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
String exemptionReason="";
|
||||
|
||||
if (trans.getPaymentTermDescription()!=null) {
|
||||
paymentTermsDescription=trans.getPaymentTermDescription();
|
||||
}
|
||||
|
||||
if (paymentTermsDescription==null) {
|
||||
paymentTermsDescription= "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
|
||||
|
||||
}
|
||||
|
||||
String senderReg = "";
|
||||
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
||||
senderReg = "" + "<ram:IncludedNote>\n" + " <ram:Content>\n"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + " </ram:Content>\n"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
|
||||
}
|
||||
|
||||
String rebateAgreement = "";
|
||||
if (trans.rebateAgreementExists()) {
|
||||
rebateAgreement = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>\n"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
}
|
||||
|
||||
String subjectNote = "";
|
||||
if (trans.getSubjectNote()!=null) {
|
||||
subjectNote = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote())+ "</ram:Content>\n"
|
||||
+ "</ram:IncludedNote>\n";
|
||||
}
|
||||
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
|
||||
+ "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\""
|
||||
// + "
|
||||
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
||||
// ../Schema/ZUGFeRD1p0.xsd\""
|
||||
+ " xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\""
|
||||
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\">\n"
|
||||
+ " <rsm:SpecifiedExchangedDocumentContext>\n"
|
||||
// + "
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
||||
//
|
||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:ID>" + getProfile() + "</ram:ID>\n"
|
||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " </rsm:SpecifiedExchangedDocumentContext>\n"
|
||||
+ " <rsm:HeaderExchangedDocument>\n"
|
||||
+ " <ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>\n" //$NON-NLS-2$
|
||||
+ " <ram:Name>RECHNUNG</ram:Name>\n"
|
||||
+ " <ram:TypeCode>380</ram:TypeCode>\n"
|
||||
+ " <ram:IssueDateTime><udt:DateTimeString format=\"102\">"
|
||||
+ zugferdDateFormat.format(trans.getIssueDate()) + "</udt:DateTimeString></ram:IssueDateTime>\n" // date
|
||||
// format
|
||||
// was
|
||||
// 20130605
|
||||
+ subjectNote
|
||||
+ rebateAgreement
|
||||
+ senderReg
|
||||
|
||||
+ " </rsm:HeaderExchangedDocument>\n"
|
||||
+ " <rsm:SpecifiedSupplyChainTradeTransaction>\n";
|
||||
int lineID = 0;
|
||||
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||
lineID++;
|
||||
taxCategoryCode=currentItem.getProduct().getTaxCategoryCode();
|
||||
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
||||
exemptionReason="<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||
}
|
||||
|
||||
LineCalc lc = new LineCalc(currentItem);
|
||||
xml = xml + " <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n"
|
||||
+ " <ram:LineID>" + lineID + "</ram:LineID>\n" //$NON-NLS-2$
|
||||
+ " </ram:AssociatedDocumentLineDocument>\n"
|
||||
+ " <ram:SpecifiedSupplyChainTradeAgreement>\n"
|
||||
+ " <ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount currencyID=\""+trans.getCurrency()+"\">" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>\n"
|
||||
+ " <ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) +"</ram:BasisQuantity>\n"
|
||||
// + " <AppliedTradeAllowanceCharge>\n"
|
||||
// + " <ChargeIndicator>false</ChargeIndicator>\n"
|
||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>\n"
|
||||
// + " <Reason>Rabatt</Reason>\n"
|
||||
// + " </AppliedTradeAllowanceCharge>\n"
|
||||
+ " </ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:NetPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount currencyID=\""+trans.getCurrency()+"\">" + priceFormat(currentItem.getPrice())
|
||||
+ "</ram:ChargeAmount>\n"
|
||||
+ " <ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) +"</ram:BasisQuantity>\n"
|
||||
+ " </ram:NetPriceProductTradePrice>\n"
|
||||
+ " </ram:SpecifiedSupplyChainTradeAgreement>\n"
|
||||
|
||||
|
||||
+ " <ram:SpecifiedSupplyChainTradeDelivery>\n"
|
||||
+ " <ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">" //$NON-NLS-2$
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>\n"
|
||||
+ " </ram:SpecifiedSupplyChainTradeDelivery>\n"
|
||||
+ " <ram:SpecifiedSupplyChainTradeSettlement>\n"
|
||||
+ " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
+ exemptionReason
|
||||
+ " <ram:CategoryCode>"+currentItem.getProduct().getTaxCategoryCode()+"</ram:CategoryCode>\n"
|
||||
|
||||
+ " <ram:ApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:ApplicablePercent>\n"
|
||||
+ " </ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount currencyID=\""+trans.getCurrency()+"\">" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>\n"
|
||||
+ " </ram:SpecifiedTradeSettlementMonetarySummation>\n";
|
||||
if (currentItem.getAdditionalReferencedDocumentID()!=null) {
|
||||
xml=xml + " <ram:AdditionalReferencedDocument><ram:ID>"+currentItem.getAdditionalReferencedDocumentID()+"</ram:ID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>\n";
|
||||
|
||||
}
|
||||
xml=xml + " </ram:SpecifiedSupplyChainTradeSettlement>\n"
|
||||
+ " <ram:SpecifiedTradeProduct>\n";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>\n"
|
||||
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
||||
xml = xml + " <ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>\n";
|
||||
}
|
||||
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
||||
xml = xml + " <ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>\n";
|
||||
}
|
||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
||||
+ " <ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>\n"
|
||||
+ " </ram:SpecifiedTradeProduct>\n"
|
||||
|
||||
+ " </ram:IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:ApplicableSupplyChainTradeAgreement>\n";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n";
|
||||
if (trans.getOwnForeignOrganisationID()!=null) {
|
||||
xml = xml + " <ram:ID>" + XMLTools.encodeXML(trans.getOwnForeignOrganisationID()) + "</ram:ID>\n";
|
||||
}
|
||||
|
||||
if ((trans.getOwnContact()!=null)&&(trans.getOwnContact().getGlobalID()!=null)&&(trans.getOwnContact().getGlobalIDScheme()!=null)) {
|
||||
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(trans.getOwnContact().getGlobalIDScheme()) + "\">"
|
||||
+ XMLTools.encodeXML(trans.getOwnContact().getGlobalID()) + "</ram:GlobalID>\n";
|
||||
}
|
||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(trans.getOwnOrganisationName()) + "</ram:Name>\n"; //$NON-NLS-2$
|
||||
|
||||
if ((trans.getOwnVATID()!=null)&&(trans.getOwnOrganisationName()!=null)) {
|
||||
|
||||
xml = xml + " <ram:SpecifiedTaxRegistration>\n" + " <ram:ID schemeID=\"VA\">"
|
||||
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n"
|
||||
+ " </ram:SpecifiedTaxRegistration>";
|
||||
}
|
||||
|
||||
if (trans.getOwnContact() != null) {
|
||||
xml = xml + "<ram:DefinedTradeContact>\n" + " <ram:PersonName>" + XMLTools.encodeXML(trans.getOwnContact().getName())
|
||||
+ "</ram:PersonName>\n";
|
||||
if (trans.getOwnContact().getPhone() != null) {
|
||||
|
||||
xml = xml + " <ram:TelephoneUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(trans.getOwnContact().getPhone()) + "</ram:CompleteNumber>\n"
|
||||
+ " </ram:TelephoneUniversalCommunication>\n";
|
||||
}
|
||||
if (trans.getOwnContact().getEMail() != null) {
|
||||
|
||||
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
||||
+ XMLTools.encodeXML(trans.getOwnContact().getEMail()) + "</ram:URIID>\n"
|
||||
+ " </ram:EmailURIUniversalCommunication>\n";
|
||||
}
|
||||
xml = xml + " </ram:DefinedTradeContact>";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:PostalTradeAddress>\n" + " <ram:PostcodeCode>"
|
||||
+ XMLTools.encodeXML(trans.getOwnZIP()) + "</ram:PostcodeCode>\n" + " <ram:LineOne>"
|
||||
+ XMLTools.encodeXML(trans.getOwnStreet()) + "</ram:LineOne>\n" + " <ram:CityName>" + XMLTools.encodeXML(trans.getOwnLocation())
|
||||
+ "</ram:CityName>\n" + " <ram:CountryID>" + XMLTools.encodeXML(trans.getOwnCountry())
|
||||
+ "</ram:CountryID>\n" + " </ram:PostalTradeAddress>\n"
|
||||
+ " <ram:SpecifiedTaxRegistration>\n"
|
||||
+ " <ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(trans.getOwnTaxID()) + "</ram:ID>\n" //$NON-NLS-2$
|
||||
+ " </ram:SpecifiedTaxRegistration>\n"
|
||||
+ " <ram:SpecifiedTaxRegistration>\n"
|
||||
+ " <ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n" //$NON-NLS-2$
|
||||
+ " </ram:SpecifiedTaxRegistration>\n"
|
||||
+ " </ram:SellerTradeParty>\n"
|
||||
+ " <ram:BuyerTradeParty>\n";
|
||||
// + " <ID>GE2020211</ID>\n"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||
|
||||
xml+=getContactAsXML(trans.getRecipient());
|
||||
xml += " </ram:BuyerTradeParty>\n";
|
||||
|
||||
if (trans.getBuyerOrderReferencedDocumentID()!=null) {
|
||||
xml = xml + " <ram:BuyerOrderReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||
}
|
||||
xml = xml + " </ram:ApplicableSupplyChainTradeAgreement>\n"
|
||||
+ " <ram:ApplicableSupplyChainTradeDelivery>\n" ;
|
||||
if (this.trans.getDeliveryAddress()!=null) {
|
||||
xml += "<ram:ShipToTradeParty>"+
|
||||
getContactAsXML(this.trans.getDeliveryAddress())+
|
||||
"</ram:ShipToTradeParty>";
|
||||
}
|
||||
|
||||
xml+= " <ram:ActualDeliverySupplyChainEvent>\n"
|
||||
+ " <ram:OccurrenceDateTime>";
|
||||
|
||||
if (trans.getZFDeliveryDate() != null) {
|
||||
ZUGFeRDDateFormat dateFormat = trans.getZFDeliveryDate().getFormat();
|
||||
Date date = trans.getZFDeliveryDate().getDate();
|
||||
xml += "<udt:DateTimeString format=\"" + dateFormat.getDateTimeType() + "\">"
|
||||
+ dateFormat.getFormatter().format(date) + "</udt:DateTimeString>";
|
||||
} else if (trans.getDeliveryDate() != null) {
|
||||
xml += "<udt:DateTimeString format=\"102\">" + zugferdDateFormat.format(trans.getDeliveryDate())
|
||||
+ "</udt:DateTimeString>";
|
||||
} else {
|
||||
throw new IllegalStateException("No delivery date provided");
|
||||
}
|
||||
xml += "</ram:OccurrenceDateTime>\n";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>\n"
|
||||
/*
|
||||
* + " <DeliveryNoteReferencedDocument>\n" +
|
||||
* " <IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
|
||||
* " <ID>2013-51112</ID>\n" +
|
||||
* " </DeliveryNoteReferencedDocument>\n"
|
||||
*/
|
||||
+ " </ram:ApplicableSupplyChainTradeDelivery>\n" + " <ram:ApplicableSupplyChainTradeSettlement>\n" //$NON-NLS-2$
|
||||
+ " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>\n" //$NON-NLS-2$
|
||||
+ " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>\n";
|
||||
|
||||
if (trans.getTradeSettlementPayment()!=null) {
|
||||
for (IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||
if(payment!=null) {
|
||||
hasDueDate=true;
|
||||
xml+=payment.getSettlementXML();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (trans.getTradeSettlement()!=null) {
|
||||
for (IZUGFeRDTradeSettlement payment : trans.getTradeSettlement()) {
|
||||
if(payment!=null) {
|
||||
if (payment instanceof IZUGFeRDTradeSettlementPayment) {
|
||||
hasDueDate=true;
|
||||
}
|
||||
xml+=payment.getSettlementXML();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap();
|
||||
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
|
||||
if (amount != null) {
|
||||
xml += " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:CalculatedAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
+ exemptionReason
|
||||
+ " <ram:BasisAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:CategoryCode>"+taxCategoryCode+"</ram:CategoryCode>\n"
|
||||
+ " <ram:ApplicablePercent>" + vatFormat(currentTaxPercent)
|
||||
+ "</ram:ApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-2$
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (trans.getPaymentTerms() == null) {
|
||||
xml = xml + " <ram:SpecifiedTradePaymentTerms>\n"
|
||||
+ " <ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
for (IZUGFeRDTradeSettlement payment : trans.getTradeSettlement()) {
|
||||
if ((payment != null) && (payment instanceof IZUGFeRDTradeSettlementDebit)) {
|
||||
xml += payment.getPaymentXML();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDueDate && (trans.getDueDate()!=null)) {
|
||||
xml = xml + " <ram:DueDateDateTime><udt:DateTimeString format=\"102\">" // $NON-NLS-2$
|
||||
+ zugferdDateFormat.format(trans.getDueDate())
|
||||
+ "</udt:DateTimeString></ram:DueDateDateTime>\n";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
} else {
|
||||
xml = xml + buildPaymentTermsXml();
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount currencyID=\""+trans.getCurrency()+"\">" + currencyFormat(getTotal()) + "</ram:LineTotalAmount>\n" //$NON-NLS-2$
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:ChargeTotalAmount currencyID=\"" + trans.getCurrency() + "\">0.00</ram:ChargeTotalAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:AllowanceTotalAmount currencyID=\"" + trans.getCurrency() + "\">0.00</ram:AllowanceTotalAmount>\n" //
|
||||
// currencyID=\"EUR\"
|
||||
// + " <ChargeTotalAmount currencyID=\"EUR\">5.80</ChargeTotalAmount>\n"
|
||||
// + " <AllowanceTotalAmount currencyID=\"EUR\">14.73</AllowanceTotalAmount>\n"
|
||||
+ " <ram:TaxBasisTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(getTotal()) + "</ram:TaxBasisTotalAmount>\n" //$NON-NLS-2$
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(getTotalGross().subtract(getTotal())) + "</ram:TaxTotalAmount>\n"
|
||||
+ " <ram:GrandTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(getTotalGross()) + "</ram:GrandTotalAmount>\n" //$NON-NLS-2$
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TotalPrepaidAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(getTotalPrepaid()) + "</ram:TotalPrepaidAmount>\n"
|
||||
+ " <ram:DuePayableAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(getTotalGross().subtract(getTotalPrepaid())) + "</ram:DuePayableAmount>\n" //$NON-NLS-2$
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " </ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " </ram:ApplicableSupplyChainTradeSettlement>\n";
|
||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
||||
// + " <AssociatedDocumentLineDocument>\n"
|
||||
// + " <IncludedNote>\n"
|
||||
// + " <Content>Wir erlauben uns Ihnen folgende Positionen aus der Lieferung Nr.
|
||||
// 2013-51112 in Rechnung zu stellen:</Content>\n"
|
||||
// + " </IncludedNote>\n"
|
||||
// + " </AssociatedDocumentLineDocument>\n"
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml = xml + " </rsm:SpecifiedSupplyChainTradeTransaction>\n"
|
||||
+ "</rsm:CrossIndustryDocument>";
|
||||
|
||||
byte[] zugferdRaw;
|
||||
try {
|
||||
zugferdRaw = xml.getBytes("UTF-8");
|
||||
|
||||
if ((zugferdRaw[0] == (byte) 0xEF) && (zugferdRaw[1] == (byte) 0xBB) && (zugferdRaw[2] == (byte) 0xBF)) {
|
||||
// I don't like BOMs, lets remove it
|
||||
zugferdData = new byte[zugferdRaw.length - 3];
|
||||
System.arraycopy(zugferdRaw, 3, zugferdData, 0, zugferdRaw.length - 3);
|
||||
} else {
|
||||
zugferdData = zugferdRaw;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Logger.getLogger(ZUGFeRD1PullProvider.class.getName()).log(Level.SEVERE, null, e);
|
||||
} // $NON-NLS-1$
|
||||
}
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
IZUGFeRDPaymentTerms paymentTerms = trans.getPaymentTerms();
|
||||
IZUGFeRDPaymentDiscountTerms discountTerms = paymentTerms.getDiscountTerms();
|
||||
IZUGFeRDDate dueDate = paymentTerms.getDueDate();
|
||||
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {
|
||||
throw new IllegalStateException(
|
||||
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
||||
}
|
||||
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
|
||||
if (dueDate != null) {
|
||||
paymentTermsXml += "<ram:DueDateDateTime>";
|
||||
paymentTermsXml += "<udt:DateTimeString format=\"" + dueDate.getFormat().getDateTimeType() + "\">"
|
||||
+ dueDate.getFormat().getFormatter().format(dueDate.getDate()) + "</udt:DateTimeString>";
|
||||
paymentTermsXml += "</ram:DueDateDateTime>";
|
||||
}
|
||||
|
||||
if (discountTerms != null) {
|
||||
paymentTermsXml += "<ram:ApplicableTradePaymentDiscountTerms>";
|
||||
String currency = trans.getCurrency();
|
||||
String basisAmount = currencyFormat(getTotalGross());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
|
||||
if (discountTerms.getBaseDate() != null) {
|
||||
Date baseDate = discountTerms.getBaseDate().getDate();
|
||||
ZUGFeRDDateFormat baseDateFormat = discountTerms.getBaseDate().getFormat();
|
||||
paymentTermsXml += "<ram:BasisDateTime>";
|
||||
paymentTermsXml += "<udt:DateTimeString format=\"" + baseDateFormat.getDateTimeType() + "\">" + baseDateFormat.getFormatter().format(baseDate) + "</udt:DateTimeString>";
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
return paymentTermsXml;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
public void setZUGFeRDVersion(int ver) {
|
||||
if (ver == 1) {
|
||||
ZUGFeRD1PullProvider z1p = new ZUGFeRD1PullProvider();
|
||||
disableFacturX();
|
||||
this.xmlProvider = z1p;
|
||||
} else if (ver == 2) {
|
||||
ZUGFeRD2PullProvider z2p = new ZUGFeRD2PullProvider();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD.model;
|
||||
|
||||
public class NoteTypeConstants {
|
||||
public static final String GENERAL = "";
|
||||
public static final String REGULARINFO = "REG";
|
||||
public static final String PRICECONDITION = "AAK";
|
||||
public static final String CONDITIONS = "AAJ";
|
||||
public static final String PAYMENTINFO = "PMT";
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD.model;
|
||||
|
||||
public class PaymentMeansCodeTypeConstants {
|
||||
public static final String BANKACCOUNT = "42";
|
||||
public static final String NOTSPECIFIED = "1";
|
||||
public static final String AUTOMATICCLEARING = "3";
|
||||
public static final String CASH = "10";
|
||||
public static final String CHECK = "20";
|
||||
public static final String DEBITADVICE = "31";
|
||||
public static final String CREDITCARD = "48";
|
||||
public static final String DEBIT = "49";
|
||||
public static final String COMPENSATION = "97";
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD.model;
|
||||
|
||||
public class QuantityTypeConstants {
|
||||
public static final String PIECE = "C62";
|
||||
public static final String DAY = "DAY";
|
||||
public static final String HECTARE = "HAR";
|
||||
public static final String HOUR = "HUR";
|
||||
public static final String KILOGRAM = "KGM";
|
||||
public static final String KILOMETER = "KTM";
|
||||
public static final String KILOWATTHOUR = "KWH";
|
||||
public static final String FIXEDRATE = "LS";
|
||||
public static final String LITRE = "LTR";
|
||||
public static final String MINUTE = "MIN";
|
||||
public static final String SQUAREMILLIMETER = "MMK";
|
||||
public static final String MILLIMETER = "MMT";
|
||||
public static final String SQUAREMETER = "MTK";
|
||||
public static final String CUBICMETER = "MTQ";
|
||||
public static final String METER = "MTR";
|
||||
public static final String PRODUCTCOUNT = "NAR";
|
||||
public static final String PRODUCTPAIR = "NPR";
|
||||
public static final String PERCENT = "P1";
|
||||
public static final String SET = "SET";
|
||||
public static final String TON = "TNE";
|
||||
public static final String WEEK = "WEE";
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD.model;
|
||||
|
||||
public class TaxRegistrationTypeConstants {
|
||||
public static final String USTID = "VA";
|
||||
public static final String TAXID = "FC";
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD.model;
|
||||
|
||||
public class TaxTypeCodeTypeConstants {
|
||||
public static final String SALESTAX = "VAT";
|
||||
public static final String INSURANCETAX = "ZF_INSURANCE_TAX";
|
||||
public static final String OLDPART = "AAJ";
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD.model;
|
||||
|
||||
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ZFNamespacePrefixMapper extends NamespacePrefixMapper {
|
||||
|
||||
private Map<String, String> namespaceMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Create mappings.
|
||||
*/
|
||||
public ZFNamespacePrefixMapper() {
|
||||
|
||||
namespaceMap.put("urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12", "ram");
|
||||
namespaceMap.put("urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15", "udt");
|
||||
namespaceMap.put("urn:ferd:CrossIndustryDocument:invoice:1p0", "rsm");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Returning null when not found based on spec.
|
||||
* @see com.sun.xml.bind.marshaller.NamespacePrefixMapper#getPreferredPrefix(java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
|
||||
return namespaceMap.getOrDefault(namespaceUri, suggestion);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:rsm="urn:ferd:CrossIndustryDocument:invoice:1p0"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
|
||||
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
|
||||
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
targetNamespace="urn:ferd:CrossIndustryDocument:invoice:1p0"
|
||||
elementFormDefault="qualified">
|
||||
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
|
||||
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/>
|
||||
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
|
||||
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_12.xsd"/>
|
||||
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
|
||||
<xs:element name="CrossIndustryDocument" type="rsm:CrossIndustryDocumentType"/>
|
||||
<xs:complexType name="CrossIndustryDocumentType">
|
||||
<xs:sequence>
|
||||
<xs:element name="SpecifiedExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
|
||||
<xs:element name="HeaderExchangedDocument" type="ram:ExchangedDocumentType"/>
|
||||
<xs:element name="SpecifiedSupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
|
||||
elementFormDefault="qualified"
|
||||
version="12.0">
|
||||
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
|
||||
<xs:simpleType name="AllowanceChargeReasonCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="AllowanceChargeReasonCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:AllowanceChargeReasonCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="CountryIDContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="CountryIDType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:CountryIDContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="DateMandatoryDateTimeType">
|
||||
<xs:union memberTypes="xs:dateTime xs:date"/>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="DeliveryTermsCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="DeliveryTermsCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:DeliveryTermsCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="DocumentCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="DocumentCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:DocumentCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="PaymentMeansCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="PaymentMeansCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:PaymentMeansCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="ReferenceCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="ReferenceCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:ReferenceCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="TaxCategoryCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="TaxCategoryCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:TaxCategoryCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="TaxTypeCodeContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="TaxTypeCodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="qdt:TaxTypeCodeContentType"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -1,391 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
|
||||
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
|
||||
elementFormDefault="qualified"
|
||||
version="12.0">
|
||||
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
|
||||
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/>
|
||||
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
|
||||
<xs:complexType name="CreditorFinancialAccountType">
|
||||
<xs:sequence>
|
||||
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="AccountName" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="CreditorFinancialInstitutionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="BICID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="GermanBankleitzahlID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="DebtorFinancialAccountType">
|
||||
<xs:sequence>
|
||||
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="DebtorFinancialInstitutionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="BICID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="GermanBankleitzahlID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="DocumentContextParameterType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="DocumentLineDocumentType">
|
||||
<xs:sequence>
|
||||
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ExchangedDocumentContextType">
|
||||
<xs:sequence>
|
||||
<xs:element name="TestIndicator" type="udt:IndicatorType" minOccurs="0"/>
|
||||
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ExchangedDocumentType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
|
||||
<xs:element name="IssueDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
<xs:element name="CopyIndicator" type="udt:IndicatorType" minOccurs="0"/>
|
||||
<xs:element name="LanguageID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="EffectiveSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="LogisticsServiceChargeType">
|
||||
<xs:sequence>
|
||||
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="AppliedAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="AppliedTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="LogisticsTransportMovementType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ModeCode" type="udt:CodeType" minOccurs="0"/>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="NoteType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ContentCode" type="udt:CodeType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="Content" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ProductCharacteristicType">
|
||||
<xs:sequence>
|
||||
<xs:element name="TypeCode" type="udt:CodeType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ValueMeasure" type="udt:MeasureType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="Value" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ProductClassificationType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ClassCode" type="udt:CodeType" minOccurs="0"/>
|
||||
<xs:element name="ClassName" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ReferencedDocumentType">
|
||||
<xs:sequence>
|
||||
<xs:element name="IssueDateTime" type="qdt:DateMandatoryDateTimeType" minOccurs="0"/>
|
||||
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ReferenceTypeCode" type="qdt:ReferenceCodeType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ReferencedProductType">
|
||||
<xs:sequence>
|
||||
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="UnitQuantity" type="udt:QuantityType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SpecifiedPeriodType">
|
||||
<xs:sequence>
|
||||
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
<xs:element name="CompleteDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainConsignmentType">
|
||||
<xs:sequence>
|
||||
<xs:element name="SpecifiedLogisticsTransportMovement" type="ram:LogisticsTransportMovementType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainEventType">
|
||||
<xs:sequence>
|
||||
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainTradeAgreementType">
|
||||
<xs:sequence>
|
||||
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="SellerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="BuyerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="ProductEndUserTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="ApplicableTradeDeliveryTerms" type="ram:TradeDeliveryTermsType" minOccurs="0"/>
|
||||
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="CustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainTradeDeliveryType">
|
||||
<xs:sequence>
|
||||
<xs:element name="BilledQuantity" type="udt:QuantityType" minOccurs="0"/>
|
||||
<xs:element name="ChargeFreeQuantity" type="udt:QuantityType" minOccurs="0"/>
|
||||
<xs:element name="PackageQuantity" type="udt:QuantityType" minOccurs="0"/>
|
||||
<xs:element name="RelatedSupplyChainConsignment" type="ram:SupplyChainConsignmentType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="ShipFromTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
|
||||
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainTradeLineItemType">
|
||||
<xs:sequence>
|
||||
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType" minOccurs="0"/>
|
||||
<xs:element name="SpecifiedSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="SpecifiedSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType" minOccurs="0"/>
|
||||
<xs:element name="SpecifiedSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainTradeSettlementType">
|
||||
<xs:sequence>
|
||||
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="InvoiceCurrencyCode" type="udt:CodeType" minOccurs="0"/>
|
||||
<xs:element name="InvoiceeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
|
||||
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="SpecifiedLogisticsServiceCharge" type="ram:LogisticsServiceChargeType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="SpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="SpecifiedTradeSettlementMonetarySummation" type="ram:TradeSettlementMonetarySummationType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="SupplyChainTradeTransactionType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ApplicableSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ApplicableSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="ApplicableSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TaxRegistrationType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeAccountingAccountType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeAddressType">
|
||||
<xs:sequence>
|
||||
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="CountryID" type="qdt:CountryIDType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeAllowanceChargeType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ChargeIndicator" type="udt:IndicatorType" minOccurs="0"/>
|
||||
<xs:element name="SequenceNumeric" type="udt:NumericType" minOccurs="0"/>
|
||||
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
|
||||
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
|
||||
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
|
||||
<xs:element name="ActualAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
|
||||
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeContactType">
|
||||
<xs:sequence>
|
||||
<xs:element name="PersonName" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="FaxUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeCountryType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ID" type="qdt:CountryIDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeDeliveryTermsType">
|
||||
<xs:sequence>
|
||||
<xs:element name="DeliveryTypeCode" type="qdt:DeliveryTermsCodeType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradePartyType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
|
||||
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradePaymentDiscountTermsType">
|
||||
<xs:sequence>
|
||||
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
|
||||
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
|
||||
<xs:element name="ActualDiscountAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradePaymentPenaltyTermsType">
|
||||
<xs:sequence>
|
||||
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
|
||||
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
|
||||
<xs:element name="ActualPenaltyAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradePaymentTermsType">
|
||||
<xs:sequence>
|
||||
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
|
||||
<xs:element name="PartialPaymentAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ApplicableTradePaymentPenaltyTerms" type="ram:TradePaymentPenaltyTermsType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="ApplicableTradePaymentDiscountTerms" type="ram:TradePaymentDiscountTermsType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradePriceType">
|
||||
<xs:sequence>
|
||||
<xs:element name="ChargeAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
|
||||
<xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeProductType">
|
||||
<xs:sequence>
|
||||
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
<xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="IncludedReferencedProduct" type="ram:ReferencedProductType" minOccurs="0"
|
||||
maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeSettlementMonetarySummationType">
|
||||
<xs:sequence>
|
||||
<xs:element name="LineTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="GrandTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="TotalAllowanceChargeAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="DuePayableAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeSettlementPaymentMeansType">
|
||||
<xs:sequence>
|
||||
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType" minOccurs="0"/>
|
||||
<xs:element name="Information" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
|
||||
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="PayerSpecifiedDebtorFinancialInstitution" type="ram:DebtorFinancialInstitutionType"
|
||||
minOccurs="0"/>
|
||||
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType"
|
||||
minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="TradeTaxType">
|
||||
<xs:sequence>
|
||||
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType" minOccurs="0"/>
|
||||
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
|
||||
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="LineTotalBasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="AllowanceChargeBasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType" minOccurs="0"/>
|
||||
<xs:element name="ApplicablePercent" type="udt:PercentType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="UniversalCommunicationType">
|
||||
<xs:sequence>
|
||||
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
|
||||
<xs:element name="CompleteNumber" type="udt:TextType" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -1,95 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
|
||||
elementFormDefault="qualified"
|
||||
version="15.0">
|
||||
<xs:complexType name="AmountType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:decimal">
|
||||
<xs:attribute name="currencyID" type="udt:AmountTypeCurrencyIDContentType"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="AmountTypeCurrencyIDContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="CodeType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:token">
|
||||
<xs:attribute name="listID" type="xs:token"/>
|
||||
<xs:attribute name="listVersionID" type="xs:token"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="DateTimeType">
|
||||
<xs:choice>
|
||||
<xs:element name="DateTimeString">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="format" type="xs:string"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="IDType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:token">
|
||||
<xs:attribute name="schemeID" type="xs:token"/>
|
||||
<xs:attribute name="schemeAgencyID" type="udt:IDTypeSchemeAgencyIDContentType"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="IDTypeSchemeAgencyIDContentType">
|
||||
<xs:restriction base="xs:token"/>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="IndicatorType">
|
||||
<xs:choice>
|
||||
<xs:element name="Indicator" type="xs:boolean"/>
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="MeasureType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:decimal">
|
||||
<xs:attribute name="unitCode" type="udt:MeasureTypeUnitCodeContentType"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="MeasureTypeUnitCodeContentType">
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:minLength value="1"/>
|
||||
<xs:maxLength value="3"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="NumericType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:decimal"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="PercentType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:decimal"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="QuantityType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:decimal">
|
||||
<xs:attribute name="unitCode" type="udt:QuantityTypeUnitCodeContentType"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="QuantityTypeUnitCodeContentType">
|
||||
<xs:restriction base="xs:token">
|
||||
<xs:minLength value="1"/>
|
||||
<xs:maxLength value="3"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="TextType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string"/>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ import java.util.logging.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* This test utility class is providing usability functions for test file resources
|
||||
* This test utility class is providing usability functions to test file resources
|
||||
*/
|
||||
public class ResourceUtilities {
|
||||
private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName());
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import javax.xml.bind.JAXBElement;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
|
||||
|
||||
public class ZUGFeRDTransactionModelConverterTest {
|
||||
@Test
|
||||
public void convertToModel_convertsMinimalTransactionToValidXml() throws Exception {
|
||||
// setup
|
||||
IZUGFeRDExportableTransaction transaction = new IZUGFeRDExportableTransactionImpl()
|
||||
.setIssueDate(createDate(2000, 1, 1))
|
||||
.setDeliveryDate(createDate(2000, 1, 2))
|
||||
.setDueDate(createDate(2000, 1, 3))
|
||||
.setNumber("num")
|
||||
.setRecipient(new IZUGFeRDExportableContactImpl()
|
||||
.setName("recipient name")
|
||||
.setStreet("recipient street")
|
||||
.setLocation("recipient city")
|
||||
.setCountry("recipient country")
|
||||
)
|
||||
.setOwnOrganisationName("own org")
|
||||
.setOwnStreet("own street")
|
||||
.setOwnCountry("own country")
|
||||
.setOwnLocation("own city")
|
||||
.setTradeSettlementPayment(new IZUGFeRDTradeSettlementPaymentImpl().setOwnBankName("own bank"))
|
||||
.setZFItems(
|
||||
new IZUGFeRDExportableItemImpl()
|
||||
.setProduct(new IZUGFeRDExportableProductImpl()
|
||||
.setVatPercent(new BigDecimal("1.19"))
|
||||
.setName("product name")
|
||||
.setDescription("product description")
|
||||
.setUnit("product unit")
|
||||
)
|
||||
.setQuantity(BigDecimal.ONE)
|
||||
.setPrice(BigDecimal.TEN)
|
||||
);
|
||||
|
||||
// execution
|
||||
final JAXBElement<CrossIndustryDocumentType> actual =
|
||||
new ZUGFeRDTransactionModelConverter(transaction).convertToModel();
|
||||
|
||||
// evaluation
|
||||
ZUGFeRDXMLAssert.assertValidZugferd(actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertToModel_convertsWithDateFormatToValidXml() throws Exception {
|
||||
// setup
|
||||
IZUGFeRDExportableTransaction transaction = new IZUGFeRDExportableTransactionImpl()
|
||||
.setIssueDate(createDate(2000, 1, 1))
|
||||
.setZfDeliveryDate(createZfDate(2000, 1, 2, ZUGFeRDDateFormat.DATE)).setDueDate(createDate(2000, 1, 3))
|
||||
.setNumber("num")
|
||||
.setRecipient(new IZUGFeRDExportableContactImpl().setName("recipient name")
|
||||
.setStreet("recipient street").setLocation("recipient city").setCountry("recipient country"))
|
||||
.setOwnOrganisationName("own org").setOwnStreet("own street").setOwnCountry("own country")
|
||||
.setOwnLocation("own city")
|
||||
.setTradeSettlementPayment(new IZUGFeRDTradeSettlementPaymentImpl().setOwnBankName("own bank"))
|
||||
.setZFItems(new IZUGFeRDExportableItemImpl()
|
||||
.setProduct(new IZUGFeRDExportableProductImpl().setVatPercent(new BigDecimal("1.19"))
|
||||
.setName("product name").setDescription("product description").setUnit("product unit"))
|
||||
.setQuantity(BigDecimal.ONE).setPrice(BigDecimal.TEN));
|
||||
|
||||
// execution
|
||||
final JAXBElement<CrossIndustryDocumentType> actual = new ZUGFeRDTransactionModelConverter(transaction)
|
||||
.convertToModel();
|
||||
|
||||
// evaluation
|
||||
ZUGFeRDXMLAssert.assertValidZugferd(actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertToModel_convertsWithWeekFormatToValidXml() throws Exception {
|
||||
// setup
|
||||
IZUGFeRDExportableTransaction transaction = new IZUGFeRDExportableTransactionImpl()
|
||||
.setIssueDate(createDate(2000, 1, 1))
|
||||
.setZfDeliveryDate(createZfDate(2000, 1, 2, ZUGFeRDDateFormat.WEEK_OF_YEAR))
|
||||
.setDueDate(createDate(2000, 1, 3)).setNumber("num")
|
||||
.setRecipient(new IZUGFeRDExportableContactImpl().setName("recipient name")
|
||||
.setStreet("recipient street").setLocation("recipient city").setCountry("recipient country"))
|
||||
.setOwnOrganisationName("own org").setOwnStreet("own street").setOwnCountry("own country")
|
||||
.setOwnLocation("own city")
|
||||
.setTradeSettlementPayment(new IZUGFeRDTradeSettlementPaymentImpl().setOwnBankName("own bank"))
|
||||
.setZFItems(new IZUGFeRDExportableItemImpl()
|
||||
.setProduct(new IZUGFeRDExportableProductImpl().setVatPercent(new BigDecimal("1.19"))
|
||||
.setName("product name").setDescription("product description").setUnit("product unit"))
|
||||
.setQuantity(BigDecimal.ONE).setPrice(BigDecimal.TEN));
|
||||
|
||||
// execution
|
||||
final JAXBElement<CrossIndustryDocumentType> actual = new ZUGFeRDTransactionModelConverter(transaction)
|
||||
.convertToModel();
|
||||
|
||||
// evaluation
|
||||
ZUGFeRDXMLAssert.assertValidZugferd(actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertToModel_convertsWithMonthFormatToValidXml() throws Exception {
|
||||
// setup
|
||||
IZUGFeRDExportableTransaction transaction = new IZUGFeRDExportableTransactionImpl()
|
||||
.setIssueDate(createDate(2000, 1, 1))
|
||||
.setZfDeliveryDate(createZfDate(2000, 1, 2, ZUGFeRDDateFormat.MONTH_OF_YEAR))
|
||||
.setDueDate(createDate(2000, 1, 3))
|
||||
.setNumber("num")
|
||||
.setRecipient(new IZUGFeRDExportableContactImpl()
|
||||
.setName("recipient name")
|
||||
.setStreet("recipient street")
|
||||
.setLocation("recipient city")
|
||||
.setCountry("recipient country")
|
||||
)
|
||||
.setOwnOrganisationName("own org")
|
||||
.setOwnStreet("own street")
|
||||
.setOwnCountry("own country")
|
||||
.setOwnLocation("own city")
|
||||
.setTradeSettlementPayment(new IZUGFeRDTradeSettlementPaymentImpl().setOwnBankName("own bank"))
|
||||
.setZFItems(
|
||||
new IZUGFeRDExportableItemImpl()
|
||||
.setProduct(new IZUGFeRDExportableProductImpl()
|
||||
.setVatPercent(new BigDecimal("1.19"))
|
||||
.setName("product name")
|
||||
.setDescription("product description")
|
||||
.setUnit("product unit")
|
||||
)
|
||||
.setQuantity(BigDecimal.ONE)
|
||||
.setPrice(BigDecimal.TEN)
|
||||
);
|
||||
|
||||
// execution
|
||||
final JAXBElement<CrossIndustryDocumentType> actual =
|
||||
new ZUGFeRDTransactionModelConverter(transaction).convertToModel();
|
||||
|
||||
// evaluation
|
||||
ZUGFeRDXMLAssert.assertValidZugferd(actual);
|
||||
}
|
||||
|
||||
private static Date createDate(int year, int month, int day) {
|
||||
final GregorianCalendar calendar = new GregorianCalendar();
|
||||
calendar.set(year, month - 1, day);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
private static IZUGFeRDDate createZfDate(int year, int month, int day, ZUGFeRDDateFormat format) {
|
||||
final GregorianCalendar calendar = new GregorianCalendar();
|
||||
calendar.set(year, month - 1, day);
|
||||
IZUGFeRDDateImpl date = new IZUGFeRDDateImpl();
|
||||
date.setDate(calendar.getTime());
|
||||
date.setFormat(format);
|
||||
return date;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/** **********************************************************************
|
||||
*
|
||||
* Copyright 2018 Jochen Staerk
|
||||
*
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import com.helger.schematron.ISchematronResource;
|
||||
import com.helger.schematron.pure.SchematronResourcePure;
|
||||
import org.junit.Assert;
|
||||
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
public class ZUGFeRDXMLAssert {
|
||||
private static final ISchematronResource SCHEMATRON = loadSchematron();
|
||||
|
||||
public static void assertValidZugferd(JAXBElement<CrossIndustryDocumentType> xml) throws Exception {
|
||||
assertValidZugferd(toDocument(xml));
|
||||
}
|
||||
|
||||
public static void assertValidZugferd(Node xml) throws Exception {
|
||||
Assert.assertTrue("schema valid", SCHEMATRON.getSchematronValidity(xml, null).isValid());
|
||||
}
|
||||
|
||||
private static Document toDocument(Object jaxbElement) throws Exception {
|
||||
final Document result = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||
JAXBContext.newInstance("org.mustangproject.ZUGFeRD.model").createMarshaller().marshal(jaxbElement, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static SchematronResourcePure loadSchematron() {
|
||||
final SchematronResourcePure result = SchematronResourcePure.fromClassPath("/ZUGFeRD_1p0.scmt");
|
||||
if (!result.isValidSchematron()) {
|
||||
throw new IllegalArgumentException("Invalid Schematron!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user