Merge branch 'master' of github.com:ZUGFeRD/mustangproject
This commit is contained in:
@@ -320,7 +320,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
NodeList SellerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList SellerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
XPathExpression shipEx = xpath.compile("//*[local-name()=\"ShipToTradeParty\"]");
|
XPathExpression shipEx = xpath.compile("//*[local-name()=\"ShipToTradeParty\"]");
|
||||||
NodeList deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
if (deliveryNodes != null) {
|
if (deliveryNodes.getLength() > 0) {
|
||||||
zpp.setDeliveryAddress(new TradeParty(deliveryNodes));
|
zpp.setDeliveryAddress(new TradeParty(deliveryNodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
//UBL...
|
//UBL...
|
||||||
XPathExpression UBLNotesEx = xpath.compile("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"Note\"]");
|
XPathExpression UBLNotesEx = xpath.compile("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"Note\"]");
|
||||||
NodeList UBLNotesNd = (NodeList) UBLNotesEx.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList UBLNotesNd = (NodeList) UBLNotesEx.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
if ((UBLNotesNd != null) && (UBLNotesNd.getLength() > 0)) {
|
if (UBLNotesNd.getLength() > 0) {
|
||||||
for (int nodeIndex = 0; nodeIndex < UBLNotesNd.getLength(); nodeIndex++) {
|
for (int nodeIndex = 0; nodeIndex < UBLNotesNd.getLength(); nodeIndex++) {
|
||||||
includedNotes.add(IncludedNote.generalNote(UBLNotesNd.item(nodeIndex).getTextContent()));
|
includedNotes.add(IncludedNote.generalNote(UBLNotesNd.item(nodeIndex).getTextContent()));
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,9 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
//NodeList UBLpayeeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
//NodeList UBLpayeeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
|
if (ublPayeeNodes.getLength() > 0) {
|
||||||
zpp.setPayee(new TradeParty(ublPayeeNodes));
|
zpp.setPayee(new TradeParty(ublPayeeNodes));
|
||||||
|
}
|
||||||
// TradeParty payee =new TradeParty();
|
// TradeParty payee =new TradeParty();
|
||||||
// NodeMap payeeID = new NodeMap(UBLpayeeNodes).getAsNodeMap("PartyIdentification").get();
|
// NodeMap payeeID = new NodeMap(UBLpayeeNodes).getAsNodeMap("PartyIdentification").get();
|
||||||
// if (payeeID !=null) {
|
// if (payeeID !=null) {
|
||||||
@@ -583,15 +585,15 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
|
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
|
||||||
typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
|
typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
|
||||||
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
|
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
|
||||||
if (issueDateStr.length() > 0) {
|
if (!issueDateStr.isEmpty()) {
|
||||||
issueDate = new SimpleDateFormat("yyyy-MM-dd").parse(issueDateStr);
|
issueDate = new SimpleDateFormat("yyyy-MM-dd").parse(issueDateStr);
|
||||||
}
|
}
|
||||||
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
|
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
|
||||||
if (dueDt.length() > 0) {
|
if (!dueDt.isEmpty()) {
|
||||||
dueDate = new SimpleDateFormat("yyyy-MM-dd").parse(dueDt);
|
dueDate = new SimpleDateFormat("yyyy-MM-dd").parse(dueDt);
|
||||||
}
|
}
|
||||||
String deliveryDt = extractString("//*[local-name()=\"Delivery\"]/*[local-name()=\"ActualDeliveryDate\"]").trim();
|
String deliveryDt = extractString("//*[local-name()=\"Delivery\"]/*[local-name()=\"ActualDeliveryDate\"]").trim();
|
||||||
if (deliveryDt.length() > 0) {
|
if (!deliveryDt.isEmpty()) {
|
||||||
deliveryDate = new SimpleDateFormat("yyyy-MM-dd").parse(deliveryDt);
|
deliveryDate = new SimpleDateFormat("yyyy-MM-dd").parse(deliveryDt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -672,7 +674,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
zpp.setCurrency(currency);
|
zpp.setCurrency(currency);
|
||||||
|
|
||||||
String paymentTermsDescription = extractString("//*[local-name()=\"SpecifiedTradePaymentTerms\"]/*[local-name()=\"Description\"]|//*[local-name()=\"PaymentTerms\"]/*[local-name()=\"Note\"]");
|
String paymentTermsDescription = extractString("//*[local-name()=\"SpecifiedTradePaymentTerms\"]/*[local-name()=\"Description\"]|//*[local-name()=\"PaymentTerms\"]/*[local-name()=\"Note\"]");
|
||||||
if ((paymentTermsDescription != null) && (!paymentTermsDescription.isEmpty())) {
|
if (!paymentTermsDescription.isEmpty()) {
|
||||||
zpp.setPaymentTermDescription(paymentTermsDescription);
|
zpp.setPaymentTermDescription(paymentTermsDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -883,19 +885,31 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
if (buyerOrderIssuerAssignedID != null) {
|
if (buyerOrderIssuerAssignedID != null) {
|
||||||
zpp.setBuyerOrderReferencedDocumentID(buyerOrderIssuerAssignedID);
|
zpp.setBuyerOrderReferencedDocumentID(buyerOrderIssuerAssignedID);
|
||||||
} else {
|
} else {
|
||||||
zpp.setBuyerOrderReferencedDocumentID(extractString("//*[local-name()=\"OrderReference\"]/*[local-name()=\"ID\"]"));
|
String s = extractString("//*[local-name()=\"OrderReference\"]/*[local-name()=\"ID\"]");
|
||||||
|
if (!s.isEmpty()) {
|
||||||
|
zpp.setBuyerOrderReferencedDocumentID(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sellerOrderIssuerAssignedID != null) {
|
if (sellerOrderIssuerAssignedID != null) {
|
||||||
zpp.setSellerOrderReferencedDocumentID(sellerOrderIssuerAssignedID);
|
zpp.setSellerOrderReferencedDocumentID(sellerOrderIssuerAssignedID);
|
||||||
} else {
|
} else {
|
||||||
zpp.setSellerOrderReferencedDocumentID(extractString("//*[local-name()=\"OrderReference\"]/*[local-name()=\"SalesOrderID\"]"));
|
String s = extractString("//*[local-name()=\"OrderReference\"]/*[local-name()=\"SalesOrderID\"]");
|
||||||
|
if (!s.isEmpty()) {
|
||||||
|
zpp.setSellerOrderReferencedDocumentID(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (despatchAdviceReferencedDocument != null) {
|
if (despatchAdviceReferencedDocument != null) {
|
||||||
zpp.setDespatchAdviceReferencedDocumentID(despatchAdviceReferencedDocument);
|
zpp.setDespatchAdviceReferencedDocumentID(despatchAdviceReferencedDocument);
|
||||||
} else {
|
} else {
|
||||||
zpp.setDespatchAdviceReferencedDocumentID(extractString("//*[local-name()=\"DespatchDocumentReference\"]/*[local-name()=\"ID\"]"));
|
String s = extractString("//*[local-name()=\"DespatchDocumentReference\"]/*[local-name()=\"ID\"]");
|
||||||
|
if (!s.isEmpty()) {
|
||||||
|
zpp.setDespatchAdviceReferencedDocumentID(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String invoiceReferencedDocumentID = extractString("//*[local-name()=\"InvoiceReferencedDocument\"]/*[local-name()=\"IssuerAssignedID\"]|//*[local-name()=\"BillingReference\"]/*[local-name()=\"InvoiceDocumentReference\"]/*[local-name()=\"ID\"]");
|
||||||
|
if (!invoiceReferencedDocumentID.isEmpty()) {
|
||||||
|
zpp.setInvoiceReferencedDocumentID(invoiceReferencedDocumentID);
|
||||||
}
|
}
|
||||||
zpp.setInvoiceReferencedDocumentID(extractString("//*[local-name()=\"InvoiceReferencedDocument\"]/*[local-name()=\"IssuerAssignedID\"]|//*[local-name()=\"BillingReference\"]/*[local-name()=\"InvoiceDocumentReference\"]/*[local-name()=\"ID\"]"));
|
|
||||||
|
|
||||||
xpr = xpath.compile("//*[local-name()=\"InvoiceReferencedDocument\"]");
|
xpr = xpath.compile("//*[local-name()=\"InvoiceReferencedDocument\"]");
|
||||||
NodeList nodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList nodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
@@ -913,10 +927,8 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim());
|
|
||||||
|
|
||||||
String rounding = extractString("//*[local-name()=\"SpecifiedTradeSettlementHeaderMonetarySummation\"]/*[local-name()=\"RoundingAmount\"]|//*[local-name()=\"LegalMonetaryTotal\"]/*[local-name()=\"Party\"]/*[local-name()=\"PayableRoundingAmount\"]");
|
String rounding = extractString("//*[local-name()=\"SpecifiedTradeSettlementHeaderMonetarySummation\"]/*[local-name()=\"RoundingAmount\"]|//*[local-name()=\"LegalMonetaryTotal\"]/*[local-name()=\"Party\"]/*[local-name()=\"PayableRoundingAmount\"]");
|
||||||
if ((rounding != null) && (!rounding.isEmpty())) {
|
if (!rounding.isEmpty()) {
|
||||||
zpp.setRoundingAmount(new BigDecimal(rounding.trim()));
|
zpp.setRoundingAmount(new BigDecimal(rounding.trim()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ import javax.xml.transform.stream.StreamResult;
|
|||||||
import javax.xml.transform.stream.StreamSource;
|
import javax.xml.transform.stream.StreamSource;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -77,7 +79,7 @@ public class ZUGFeRDVisualizer {
|
|||||||
private Templates mXsltXRTemplate = null;
|
private Templates mXsltXRTemplate = null;
|
||||||
private Templates mXsltUBLTemplate = null;
|
private Templates mXsltUBLTemplate = null;
|
||||||
private Templates mXsltCIOTemplate = null;
|
private Templates mXsltCIOTemplate = null;
|
||||||
private Templates mXsltHTMLTemplate = null;
|
private Map<Language, Templates> mXsltHTMLTemplates = null;
|
||||||
private Templates mXsltPDFTemplate = null;
|
private Templates mXsltPDFTemplate = null;
|
||||||
private Templates mXsltZF1HTMLTemplate = null;
|
private Templates mXsltZF1HTMLTemplate = null;
|
||||||
|
|
||||||
@@ -179,7 +181,7 @@ public class ZUGFeRDVisualizer {
|
|||||||
Optional<InputStream> in = copyStream(htmlOutput);
|
Optional<InputStream> in = copyStream(htmlOutput);
|
||||||
ByteArrayOutputStream htmlOutStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream htmlOutStream = new ByteArrayOutputStream();
|
||||||
if (in.isPresent()) {
|
if (in.isPresent()) {
|
||||||
applyXSLTToHTML(in.get(), htmlOutStream);
|
applyXSLTToHTML(in.get(), htmlOutStream, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
return htmlOutStream.toString(StandardCharsets.UTF_8);
|
return htmlOutStream.toString(StandardCharsets.UTF_8);
|
||||||
@@ -222,9 +224,12 @@ public class ZUGFeRDVisualizer {
|
|||||||
new StreamSource(CLASS_LOADER.getResourceAsStream(RESOURCE_PATH + "stylesheets/cii-xr.xsl")));
|
new StreamSource(CLASS_LOADER.getResourceAsStream(RESOURCE_PATH + "stylesheets/cii-xr.xsl")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mXsltHTMLTemplate == null) {
|
if (mXsltHTMLTemplates == null) {
|
||||||
mXsltHTMLTemplate = mFactory.newTemplates(new StreamSource(
|
mXsltHTMLTemplates = new HashMap<>();
|
||||||
CLASS_LOADER.getResourceAsStream(RESOURCE_PATH + "stylesheets/xrechnung-html." + lang.name().toLowerCase() + ".xsl")));
|
if (mXsltHTMLTemplates.get(lang) == null) {
|
||||||
|
Templates mXsltHTMLTemplate = mFactory.newTemplates(new StreamSource(CLASS_LOADER.getResourceAsStream(RESOURCE_PATH + "stylesheets/xrechnung-html." + lang.name().toLowerCase() + ".xsl")));
|
||||||
|
mXsltHTMLTemplates.put(lang, mXsltHTMLTemplate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mXsltZF1HTMLTemplate == null) {
|
if (mXsltZF1HTMLTemplate == null) {
|
||||||
mXsltZF1HTMLTemplate = mFactory.newTemplates(new StreamSource(
|
mXsltZF1HTMLTemplate = mFactory.newTemplates(new StreamSource(
|
||||||
@@ -442,9 +447,9 @@ public class ZUGFeRDVisualizer {
|
|||||||
transformer.transform(new StreamSource(xmlFile), new StreamResult(htmlOutStream));
|
transformer.transform(new StreamSource(xmlFile), new StreamResult(htmlOutStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyXSLTToHTML(final InputStream xmlFile, final OutputStream htmlOutStream)
|
protected void applyXSLTToHTML(final InputStream xmlFile, final OutputStream htmlOutStream, Language lang)
|
||||||
throws TransformerException, IOException {
|
throws TransformerException, IOException {
|
||||||
Transformer transformer = mXsltHTMLTemplate.newTransformer();
|
Transformer transformer = mXsltHTMLTemplates.get(lang).newTransformer();
|
||||||
|
|
||||||
transformer.transform(new StreamSource(xmlFile), new StreamResult(htmlOutStream));
|
transformer.transform(new StreamSource(xmlFile), new StreamResult(htmlOutStream));
|
||||||
xmlFile.close();
|
xmlFile.close();
|
||||||
|
|||||||
@@ -276,7 +276,9 @@
|
|||||||
<fo:block color="{$msg_color}"
|
<fo:block color="{$msg_color}"
|
||||||
margin="0mm"
|
margin="0mm"
|
||||||
padding="1mm">
|
padding="1mm">
|
||||||
<xsl:value-of select="$msg_text"/>
|
<xsl:call-template name="IntersperseWithZeroSpaces">
|
||||||
|
<xsl:with-param name="str" select="$msg_text"/>
|
||||||
|
</xsl:call-template>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
</fo:table-row>
|
</fo:table-row>
|
||||||
@@ -349,4 +351,27 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
<xsl:template name="IntersperseWithZeroSpaces">
|
||||||
|
<xsl:param name="str"/>
|
||||||
|
<xsl:variable name="spacechars">
|
||||||
|
	

|
||||||
|
      
|
||||||
|
     ​
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:if test="string-length($str) > 0">
|
||||||
|
<xsl:variable name="c1" select="substring($str, 1, 1)"/>
|
||||||
|
<xsl:variable name="c2" select="substring($str, 2, 1)"/>
|
||||||
|
|
||||||
|
<xsl:value-of select="$c1"/>
|
||||||
|
<xsl:if test="$c2 != '' and
|
||||||
|
not(contains($spacechars, $c1) or
|
||||||
|
contains($spacechars, $c2))">
|
||||||
|
<xsl:text>​</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:call-template name="IntersperseWithZeroSpaces">
|
||||||
|
<xsl:with-param name="str" select="substring($str, 2)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
@@ -20,10 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.StringUtils;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mustangproject.*;
|
import org.mustangproject.*;
|
||||||
|
|
||||||
@@ -66,7 +64,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
}
|
}
|
||||||
assertFalse(hasExceptions);
|
assertFalse(hasExceptions);
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
|
assertEquals("Bei Spiel GmbH", invoice.getSender().getName());
|
||||||
assertEquals(3, invoice.getZFItems().length);
|
assertEquals(3, invoice.getZFItems().length);
|
||||||
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
|
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
|
||||||
|
|
||||||
@@ -124,7 +122,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
}
|
}
|
||||||
assertFalse(hasExceptions);
|
assertFalse(hasExceptions);
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
|
assertEquals("Bei Spiel GmbH", invoice.getSender().getName());
|
||||||
assertEquals(3, invoice.getZFItems().length);
|
assertEquals(3, invoice.getZFItems().length);
|
||||||
assertEquals(invoice.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(),"Something");
|
assertEquals(invoice.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(),"Something");
|
||||||
assertEquals(invoice.getZFItems()[0].getNotesWithSubjectCode().size(),1);
|
assertEquals(invoice.getZFItems()[0].getNotesWithSubjectCode().size(),1);
|
||||||
@@ -200,7 +198,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
}
|
}
|
||||||
assertFalse(hasExceptions);
|
assertFalse(hasExceptions);
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
|
assertEquals("Bei Spiel GmbH", invoice.getSender().getName());
|
||||||
assertEquals(3, invoice.getZFItems().length);
|
assertEquals(3, invoice.getZFItems().length);
|
||||||
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
|
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
|
||||||
|
|
||||||
@@ -617,4 +615,22 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
assertEquals(3, invoice.getZFItems().length);
|
assertEquals(3, invoice.getZFItems().length);
|
||||||
assertEquals("BUYER_ACCOUNTING_REF", invoice.getZFItems()[0].getAccountingReference());
|
assertEquals("BUYER_ACCOUNTING_REF", invoice.getZFItems()[0].getAccountingReference());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testImportExport() throws FileNotFoundException, XPathExpressionException, ParseException {
|
||||||
|
File inputFile = getResourceAsFile("cii/Factur-X_basic.xml");
|
||||||
|
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
||||||
|
zii.setInputStream(new FileInputStream(inputFile));
|
||||||
|
|
||||||
|
Invoice invoice = zii.extractInvoice();
|
||||||
|
assertTrue(invoice.isValid());
|
||||||
|
|
||||||
|
assertNull(invoice.getDeliveryAddress());
|
||||||
|
assertNull(invoice.getPayee());
|
||||||
|
|
||||||
|
assertNull(invoice.getBuyerOrderReferencedDocumentID());
|
||||||
|
assertNull(invoice.getSellerOrderReferencedDocumentID());
|
||||||
|
assertNull(invoice.getDespatchAdviceReferencedDocumentID());
|
||||||
|
assertNull(invoice.getInvoiceReferencedDocumentID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
130
library/src/test/resources/cii/Factur-X_basic.xml
Normal file
130
library/src/test/resources/cii/Factur-X_basic.xml
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100">
|
||||||
|
<!-- generated by: mustangproject.org vnull-->
|
||||||
|
<rsm:ExchangedDocumentContext>
|
||||||
|
|
||||||
|
<ram:GuidelineSpecifiedDocumentContextParameter>
|
||||||
|
<ram:ID>urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic</ram:ID>
|
||||||
|
</ram:GuidelineSpecifiedDocumentContextParameter>
|
||||||
|
</rsm:ExchangedDocumentContext>
|
||||||
|
<rsm:ExchangedDocument>
|
||||||
|
<ram:ID>471102</ram:ID>
|
||||||
|
<ram:TypeCode>380</ram:TypeCode>
|
||||||
|
<ram:IssueDateTime>
|
||||||
|
<udt:DateTimeString format="102">20241115</udt:DateTimeString>
|
||||||
|
</ram:IssueDateTime>
|
||||||
|
<ram:IncludedNote>
|
||||||
|
<ram:Content>Rechnung gemäß Bestellung vom 01.11.2024.</ram:Content>
|
||||||
|
</ram:IncludedNote>
|
||||||
|
<ram:IncludedNote>
|
||||||
|
<ram:Content>Lieferant GmbH
|
||||||
|
Lieferantenstraße 20
|
||||||
|
80333 München
|
||||||
|
Deutschland
|
||||||
|
Geschäftsführer: Hans Muster
|
||||||
|
Handelsregisternummer: H A 123</ram:Content>
|
||||||
|
</ram:IncludedNote>
|
||||||
|
<ram:IncludedNote>
|
||||||
|
<ram:Content>Unsere GLN: 4000001123452
|
||||||
|
Ihre GLN: 4000001987658
|
||||||
|
Ihre Kundennummer: GE2020211
|
||||||
|
|
||||||
|
|
||||||
|
Zahlbar innerhalb 30 Tagen netto bis 25.12.2024, 3% Skonto innerhalb 10 Tagen bis 25.11.2024.</ram:Content>
|
||||||
|
</ram:IncludedNote>
|
||||||
|
</rsm:ExchangedDocument>
|
||||||
|
<rsm:SupplyChainTradeTransaction>
|
||||||
|
<ram:IncludedSupplyChainTradeLineItem>
|
||||||
|
<ram:AssociatedDocumentLineDocument>
|
||||||
|
<ram:LineID>1</ram:LineID>
|
||||||
|
</ram:AssociatedDocumentLineDocument>
|
||||||
|
<ram:SpecifiedTradeProduct>
|
||||||
|
<ram:GlobalID schemeID="0160">4012345001235</ram:GlobalID>
|
||||||
|
<ram:Name>GTIN: 4012345001235
|
||||||
|
Unsere Art.-Nr.: TB100A4
|
||||||
|
Trennblätter A4
|
||||||
|
</ram:Name>
|
||||||
|
</ram:SpecifiedTradeProduct>
|
||||||
|
<ram:SpecifiedLineTradeAgreement>
|
||||||
|
<ram:NetPriceProductTradePrice>
|
||||||
|
<ram:ChargeAmount>9.9000</ram:ChargeAmount>
|
||||||
|
<ram:BasisQuantity unitCode="H87">1.0000</ram:BasisQuantity>
|
||||||
|
</ram:NetPriceProductTradePrice>
|
||||||
|
</ram:SpecifiedLineTradeAgreement>
|
||||||
|
<ram:SpecifiedLineTradeDelivery>
|
||||||
|
<ram:BilledQuantity unitCode="H87">20.0000</ram:BilledQuantity>
|
||||||
|
</ram:SpecifiedLineTradeDelivery>
|
||||||
|
<ram:SpecifiedLineTradeSettlement>
|
||||||
|
<ram:ApplicableTradeTax>
|
||||||
|
<ram:TypeCode>VAT</ram:TypeCode>
|
||||||
|
<ram:CategoryCode>S</ram:CategoryCode>
|
||||||
|
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||||
|
</ram:ApplicableTradeTax>
|
||||||
|
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||||
|
<ram:LineTotalAmount>198.00</ram:LineTotalAmount>
|
||||||
|
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||||
|
</ram:SpecifiedLineTradeSettlement>
|
||||||
|
</ram:IncludedSupplyChainTradeLineItem>
|
||||||
|
<ram:ApplicableHeaderTradeAgreement>
|
||||||
|
<ram:SellerTradeParty>
|
||||||
|
<ram:Name>Lieferant GmbH</ram:Name>
|
||||||
|
<ram:PostalTradeAddress>
|
||||||
|
<ram:PostcodeCode>80333</ram:PostcodeCode>
|
||||||
|
<ram:LineOne>Lieferantenstraße 20</ram:LineOne>
|
||||||
|
<ram:CityName>München</ram:CityName>
|
||||||
|
<ram:CountryID>DE</ram:CountryID>
|
||||||
|
</ram:PostalTradeAddress>
|
||||||
|
<ram:SpecifiedTaxRegistration>
|
||||||
|
<ram:ID schemeID="VA">DE123456789</ram:ID>
|
||||||
|
</ram:SpecifiedTaxRegistration>
|
||||||
|
<ram:SpecifiedTaxRegistration>
|
||||||
|
<ram:ID schemeID="FC">201/113/40209</ram:ID>
|
||||||
|
</ram:SpecifiedTaxRegistration>
|
||||||
|
</ram:SellerTradeParty>
|
||||||
|
<ram:BuyerTradeParty>
|
||||||
|
<ram:Name>Kunden AG Mitte</ram:Name>
|
||||||
|
<ram:PostalTradeAddress>
|
||||||
|
<ram:PostcodeCode>69876</ram:PostcodeCode>
|
||||||
|
<ram:LineOne>Hans Muster</ram:LineOne>
|
||||||
|
<ram:LineTwo>Kundenstraße 15</ram:LineTwo>
|
||||||
|
<ram:CityName>Frankfurt</ram:CityName>
|
||||||
|
<ram:CountryID>DE</ram:CountryID>
|
||||||
|
</ram:PostalTradeAddress>
|
||||||
|
</ram:BuyerTradeParty>
|
||||||
|
</ram:ApplicableHeaderTradeAgreement>
|
||||||
|
<ram:ApplicableHeaderTradeDelivery>
|
||||||
|
<ram:ActualDeliverySupplyChainEvent>
|
||||||
|
<ram:OccurrenceDateTime>
|
||||||
|
<udt:DateTimeString format="102">20241114</udt:DateTimeString>
|
||||||
|
</ram:OccurrenceDateTime>
|
||||||
|
</ram:ActualDeliverySupplyChainEvent>
|
||||||
|
</ram:ApplicableHeaderTradeDelivery>
|
||||||
|
<ram:ApplicableHeaderTradeSettlement>
|
||||||
|
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
|
||||||
|
<ram:ApplicableTradeTax>
|
||||||
|
<ram:CalculatedAmount>37.62</ram:CalculatedAmount>
|
||||||
|
<ram:TypeCode>VAT</ram:TypeCode>
|
||||||
|
<ram:BasisAmount>198.00</ram:BasisAmount>
|
||||||
|
<ram:CategoryCode>S</ram:CategoryCode>
|
||||||
|
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||||
|
</ram:ApplicableTradeTax>
|
||||||
|
<ram:SpecifiedTradePaymentTerms>
|
||||||
|
<ram:Description>Zahlbar innerhalb 30 Tagen netto bis 25.12.2024, 3% Skonto innerhalb 10 Tagen bis 25.11.2024.</ram:Description>
|
||||||
|
<ram:DueDateDateTime>
|
||||||
|
<udt:DateTimeString format="102">20241215</udt:DateTimeString>
|
||||||
|
</ram:DueDateDateTime>
|
||||||
|
</ram:SpecifiedTradePaymentTerms>
|
||||||
|
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||||
|
<ram:LineTotalAmount>198.00</ram:LineTotalAmount>
|
||||||
|
<ram:ChargeTotalAmount>0.00</ram:ChargeTotalAmount>
|
||||||
|
<ram:AllowanceTotalAmount>0.00</ram:AllowanceTotalAmount>
|
||||||
|
<ram:TaxBasisTotalAmount>198.00</ram:TaxBasisTotalAmount>
|
||||||
|
<ram:TaxTotalAmount currencyID="EUR">37.62</ram:TaxTotalAmount>
|
||||||
|
<ram:GrandTotalAmount>235.62</ram:GrandTotalAmount>
|
||||||
|
<ram:TotalPrepaidAmount>0.00</ram:TotalPrepaidAmount>
|
||||||
|
<ram:DuePayableAmount>235.62</ram:DuePayableAmount>
|
||||||
|
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||||
|
</ram:ApplicableHeaderTradeSettlement>
|
||||||
|
</rsm:SupplyChainTradeTransaction>
|
||||||
|
</rsm:CrossIndustryInvoice>
|
||||||
Reference in New Issue
Block a user