diff --git a/library/src/main/java/org/mustangproject/Contact.java b/library/src/main/java/org/mustangproject/Contact.java
index 5dafc75b..dbe470fb 100644
--- a/library/src/main/java/org/mustangproject/Contact.java
+++ b/library/src/main/java/org/mustangproject/Contact.java
@@ -1,4 +1,6 @@
-package org.mustangproject.ZUGFeRD;
+package library.src.main.java.org.mustangproject;
+
+import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
public class Contact implements IZUGFeRDExportableContact {
diff --git a/library/src/main/java/org/mustangproject/Invoice.java b/library/src/main/java/org/mustangproject/Invoice.java
index 4d47c89d..7c9f2c36 100644
--- a/library/src/main/java/org/mustangproject/Invoice.java
+++ b/library/src/main/java/org/mustangproject/Invoice.java
@@ -18,13 +18,15 @@
*
* **********************************************************************
*/
-package org.mustangproject.ZUGFeRD;
+package library.src.main.java.org.mustangproject;
+
+import org.mustangproject.ZUGFeRD.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
-public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
+public class Invoice implements IZUGFeRDExportableTransaction {
protected String documentName = null, documentCode = null, number = null, ownOrganisationFullPlaintextInfo = null, referenceNumber = null, shipToOrganisationID = null, shipToOrganisationName = null, shipToStreet = null, shipToZIP = null, shipToLocation = null, shipToCountry = null, buyerOrderReferencedDocumentID = null, buyerOrderReferencedDocumentIssueDateTime = null, ownTaxID = null, ownVATID = null, ownForeignOrganisationID = null, ownOrganisationName = null, ownStreet = null, ownZIP = null, ownLocation = null, ownCountry = null, currency = null, paymentTermDescription = null;
protected Date issueDate = null, dueDate = null, deliveryDate = null;
@@ -37,7 +39,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
protected IZUGFeRDPaymentTerms paymentTerms = null;
- public ZUGFeRD2PushProvider() {
+ public Invoice() {
ZFItems = new ArrayList();
}
@@ -46,7 +48,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return documentName;
}
- public ZUGFeRD2PushProvider setDocumentName(String documentName) {
+ public Invoice setDocumentName(String documentName) {
this.documentName = documentName;
return this;
}
@@ -56,7 +58,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return documentCode;
}
- public ZUGFeRD2PushProvider setDocumentCode(String documentCode) {
+ public Invoice setDocumentCode(String documentCode) {
this.documentCode = documentCode;
return this;
}
@@ -66,7 +68,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return number;
}
- public ZUGFeRD2PushProvider setNumber(String number) {
+ public Invoice setNumber(String number) {
this.number = number;
return this;
}
@@ -76,7 +78,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownOrganisationFullPlaintextInfo;
}
- public ZUGFeRD2PushProvider setOwnOrganisationFullPlaintextInfo(String ownOrganisationFullPlaintextInfo) {
+ public Invoice setOwnOrganisationFullPlaintextInfo(String ownOrganisationFullPlaintextInfo) {
this.ownOrganisationFullPlaintextInfo = ownOrganisationFullPlaintextInfo;
return this;
}
@@ -86,7 +88,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return referenceNumber;
}
- public ZUGFeRD2PushProvider setReferenceNumber(String referenceNumber) {
+ public Invoice setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber;
return this;
}
@@ -96,7 +98,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return shipToOrganisationID;
}
- public ZUGFeRD2PushProvider setShipToOrganisationID(String shipToOrganisationID) {
+ public Invoice setShipToOrganisationID(String shipToOrganisationID) {
this.shipToOrganisationID = shipToOrganisationID;
return this;
}
@@ -106,7 +108,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return shipToOrganisationName;
}
- public ZUGFeRD2PushProvider setShipToOrganisationName(String shipToOrganisationName) {
+ public Invoice setShipToOrganisationName(String shipToOrganisationName) {
this.shipToOrganisationName = shipToOrganisationName;
return this;
}
@@ -116,7 +118,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return shipToStreet;
}
- public ZUGFeRD2PushProvider setShipToStreet(String shipToStreet) {
+ public Invoice setShipToStreet(String shipToStreet) {
this.shipToStreet = shipToStreet;
return this;
}
@@ -126,7 +128,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return shipToZIP;
}
- public ZUGFeRD2PushProvider setShipToZIP(String shipToZIP) {
+ public Invoice setShipToZIP(String shipToZIP) {
this.shipToZIP = shipToZIP;
return this;
}
@@ -136,7 +138,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return shipToLocation;
}
- public ZUGFeRD2PushProvider setShipToLocation(String shipToLocation) {
+ public Invoice setShipToLocation(String shipToLocation) {
this.shipToLocation = shipToLocation;
return this;
}
@@ -146,7 +148,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return shipToCountry;
}
- public ZUGFeRD2PushProvider setShipToCountry(String shipToCountry) {
+ public Invoice setShipToCountry(String shipToCountry) {
this.shipToCountry = shipToCountry;
return this;
}
@@ -156,7 +158,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return buyerOrderReferencedDocumentID;
}
- public ZUGFeRD2PushProvider setBuyerOrderReferencedDocumentID(String buyerOrderReferencedDocumentID) {
+ public Invoice setBuyerOrderReferencedDocumentID(String buyerOrderReferencedDocumentID) {
this.buyerOrderReferencedDocumentID = buyerOrderReferencedDocumentID;
return this;
}
@@ -166,7 +168,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return buyerOrderReferencedDocumentIssueDateTime;
}
- public ZUGFeRD2PushProvider setBuyerOrderReferencedDocumentIssueDateTime(String buyerOrderReferencedDocumentIssueDateTime) {
+ public Invoice setBuyerOrderReferencedDocumentIssueDateTime(String buyerOrderReferencedDocumentIssueDateTime) {
this.buyerOrderReferencedDocumentIssueDateTime = buyerOrderReferencedDocumentIssueDateTime;
return this;
}
@@ -176,7 +178,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownTaxID;
}
- public ZUGFeRD2PushProvider setOwnTaxID(String ownTaxID) {
+ public Invoice setOwnTaxID(String ownTaxID) {
this.ownTaxID = ownTaxID;
return this;
}
@@ -186,7 +188,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownVATID;
}
- public ZUGFeRD2PushProvider setOwnVATID(String ownVATID) {
+ public Invoice setOwnVATID(String ownVATID) {
this.ownVATID = ownVATID;
return this;
}
@@ -196,7 +198,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownForeignOrganisationID;
}
- public ZUGFeRD2PushProvider setOwnForeignOrganisationID(String ownForeignOrganisationID) {
+ public Invoice setOwnForeignOrganisationID(String ownForeignOrganisationID) {
this.ownForeignOrganisationID = ownForeignOrganisationID;
return this;
}
@@ -206,7 +208,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownOrganisationName;
}
- public ZUGFeRD2PushProvider setOwnOrganisationName(String ownOrganisationName) {
+ public Invoice setOwnOrganisationName(String ownOrganisationName) {
this.ownOrganisationName = ownOrganisationName;
return this;
}
@@ -216,7 +218,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownStreet;
}
- public ZUGFeRD2PushProvider setOwnStreet(String ownStreet) {
+ public Invoice setOwnStreet(String ownStreet) {
this.ownStreet = ownStreet;
return this;
}
@@ -226,7 +228,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownZIP;
}
- public ZUGFeRD2PushProvider setOwnZIP(String ownZIP) {
+ public Invoice setOwnZIP(String ownZIP) {
this.ownZIP = ownZIP;
return this;
}
@@ -235,7 +237,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownLocation;
}
- public ZUGFeRD2PushProvider setOwnLocation(String getOwnLocation) {
+ public Invoice setOwnLocation(String getOwnLocation) {
this.ownLocation = getOwnLocation;
return this;
}
@@ -244,7 +246,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownCountry;
}
- public ZUGFeRD2PushProvider setOwnCountry(String getOwnCountry) {
+ public Invoice setOwnCountry(String getOwnCountry) {
this.ownCountry = getOwnCountry;
return this;
}
@@ -254,7 +256,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return currency;
}
- public ZUGFeRD2PushProvider setCurrency(String currency) {
+ public Invoice setCurrency(String currency) {
this.currency = currency;
return this;
}
@@ -264,7 +266,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return paymentTermDescription;
}
- public ZUGFeRD2PushProvider setPaymentTermDescription(String paymentTermDescription) {
+ public Invoice setPaymentTermDescription(String paymentTermDescription) {
this.paymentTermDescription = paymentTermDescription;
return this;
}
@@ -274,7 +276,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return issueDate;
}
- public ZUGFeRD2PushProvider setIssueDate(Date issueDate) {
+ public Invoice setIssueDate(Date issueDate) {
this.issueDate = issueDate;
return this;
}
@@ -284,7 +286,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return dueDate;
}
- public ZUGFeRD2PushProvider setDueDate(Date dueDate) {
+ public Invoice setDueDate(Date dueDate) {
this.dueDate = dueDate;
return this;
}
@@ -294,7 +296,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return deliveryDate;
}
- public ZUGFeRD2PushProvider setDeliveryDate(Date deliveryDate) {
+ public Invoice setDeliveryDate(Date deliveryDate) {
this.deliveryDate = deliveryDate;
return this;
}
@@ -304,7 +306,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return totalPrepaidAmount;
}
- public ZUGFeRD2PushProvider setTotalPrepaidAmount(BigDecimal totalPrepaidAmount) {
+ public Invoice setTotalPrepaidAmount(BigDecimal totalPrepaidAmount) {
this.totalPrepaidAmount = totalPrepaidAmount;
return this;
}
@@ -314,7 +316,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ownContact;
}
- public ZUGFeRD2PushProvider setOwnContact(IZUGFeRDExportableContact ownContact) {
+ public Invoice setOwnContact(IZUGFeRDExportableContact ownContact) {
this.ownContact = ownContact;
return this;
}
@@ -324,7 +326,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return recipient;
}
- public ZUGFeRD2PushProvider setRecipient(IZUGFeRDExportableContact recipient) {
+ public Invoice setRecipient(IZUGFeRDExportableContact recipient) {
this.recipient = recipient;
return this;
}
@@ -334,7 +336,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ZFAllowances;
}
- public ZUGFeRD2PushProvider setZFAllowances(IZUGFeRDAllowanceCharge[] ZFAllowances) {
+ public Invoice setZFAllowances(IZUGFeRDAllowanceCharge[] ZFAllowances) {
this.ZFAllowances = ZFAllowances;
return this;
}
@@ -344,7 +346,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ZFCharges;
}
- public ZUGFeRD2PushProvider setZFCharges(IZUGFeRDAllowanceCharge[] ZFCharges) {
+ public Invoice setZFCharges(IZUGFeRDAllowanceCharge[] ZFCharges) {
this.ZFCharges = ZFCharges;
return this;
}
@@ -354,7 +356,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ZFLogisticsServiceCharges;
}
- public ZUGFeRD2PushProvider setZFLogisticsServiceCharges(IZUGFeRDAllowanceCharge[] ZFLogisticsServiceCharges) {
+ public Invoice setZFLogisticsServiceCharges(IZUGFeRDAllowanceCharge[] ZFLogisticsServiceCharges) {
this.ZFLogisticsServiceCharges = ZFLogisticsServiceCharges;
return this;
}
@@ -363,7 +365,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return getTradeSettlement;
}
- public ZUGFeRD2PushProvider setGetTradeSettlement(IZUGFeRDTradeSettlement[] getTradeSettlement) {
+ public Invoice setGetTradeSettlement(IZUGFeRDTradeSettlement[] getTradeSettlement) {
this.getTradeSettlement = getTradeSettlement;
return this;
}
@@ -373,7 +375,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return paymentTerms;
}
- public ZUGFeRD2PushProvider setPaymentTerms(IZUGFeRDPaymentTerms paymentTerms) {
+ public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerms) {
this.paymentTerms = paymentTerms;
return this;
}
@@ -383,7 +385,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return deliveryAddress;
}
- public ZUGFeRD2PushProvider setDeliveryAddress(IZUGFeRDExportableContact deliveryAddress) {
+ public Invoice setDeliveryAddress(IZUGFeRDExportableContact deliveryAddress) {
this.deliveryAddress = deliveryAddress;
return this;
}
@@ -393,7 +395,7 @@ public class ZUGFeRD2PushProvider implements IZUGFeRDExportableTransaction {
return ZFItems.toArray(new IZUGFeRDExportableItem[0]);
}
- public ZUGFeRD2PushProvider addItem(IZUGFeRDExportableItem item) {
+ public Invoice addItem(IZUGFeRDExportableItem item) {
ZFItems.add(item);
return this;
}
diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java
index e6424456..4e291287 100644
--- a/library/src/main/java/org/mustangproject/Item.java
+++ b/library/src/main/java/org/mustangproject/Item.java
@@ -1,8 +1,7 @@
-package org.mustangproject.ZUGFeRD;
+package library.src.main.java.org.mustangproject;
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
-import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
import java.math.BigDecimal;
diff --git a/library/src/main/java/org/mustangproject/Product.java b/library/src/main/java/org/mustangproject/Product.java
index 8fcf1c06..4e2af2fd 100644
--- a/library/src/main/java/org/mustangproject/Product.java
+++ b/library/src/main/java/org/mustangproject/Product.java
@@ -1,4 +1,4 @@
-package org.mustangproject.ZUGFeRD;
+package library.src.main.java.org.mustangproject;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
index 7c049045..aff207d1 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
@@ -30,6 +30,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.*;
+import library.src.main.java.org.mustangproject.Item;
+import library.src.main.java.org.mustangproject.Product;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
@@ -809,13 +811,13 @@ public class ZUGFeRDImporter {
* returns a list of LineItems
* @return a List of LineItem instances
*/
- public List- getLineItemList() {
+ public List getLineItemList() {
List nodeList = getLineItemNodes();
- List
- lineItemList = new ArrayList<>();
+ List lineItemList = new ArrayList<>();
for (Node n: nodeList
) {
- Item lineItem = new Item(null, null, null);
+ library.src.main.java.org.mustangproject.Item lineItem = new Item(null, null, null);
lineItem.setProduct(new Product(null,null,null,null));
NodeList nl = n.getChildNodes();
@@ -848,16 +850,16 @@ public class ZUGFeRDImporter {
case "ram:SpecifiedTradeProduct":
node = getNodeByName(nn.getChildNodes(), "ram:SellerAssignedID");
- lineItem.product.setSellerAssignedID(getNodeValue(node));
+ lineItem.getProduct().setSellerAssignedID(getNodeValue(node));
node = getNodeByName(nn.getChildNodes(), "ram:BuyerAssignedID");
- lineItem.product.setBuyerAssignedID(getNodeValue(node));
+ lineItem.getProduct().setBuyerAssignedID(getNodeValue(node));
node = getNodeByName(nn.getChildNodes(), "ram:Name");
- lineItem.product.setName(getNodeValue(node));
+ lineItem.getProduct().setName(getNodeValue(node));
node = getNodeByName(nn.getChildNodes(), "ram:Description");
- lineItem.product.setDescription(getNodeValue(node));
+ lineItem.getProduct().setDescription(getNodeValue(node));
break;
case "ram:SpecifiedLineTradeDelivery":
@@ -871,7 +873,7 @@ public class ZUGFeRDImporter {
node = getNodeByName(nn.getChildNodes(), "ram:ApplicableTradeTax");
if (node != null) {
node = getNodeByName(node.getChildNodes(), "ram:RateApplicablePercent");
- lineItem.product.setVATPercent(tryBigDecimal(getNodeValue(node)));
+ lineItem.getProduct().setVATPercent(tryBigDecimal(getNodeValue(node)));
}
node = getNodeByName(nn.getChildNodes(), "ram:ApplicableTradeTax");
@@ -892,7 +894,7 @@ public class ZUGFeRDImporter {
node = getNodeByName(nn.getChildNodes(), "ram:ApplicableTradeTax");
if (node != null) {
node = getNodeByName(node.getChildNodes(), "ram:ApplicablePercent");
- lineItem.product.setVATPercent(tryBigDecimal(getNodeValue(node)));
+ lineItem.getProduct().setVATPercent(tryBigDecimal(getNodeValue(node)));
}
node = getNodeByName(nn.getChildNodes(), "ram:ApplicableTradeTax");
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
index 7960e9ce..3337dc82 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
@@ -1,23 +1,24 @@
package org.mustangproject.ZUGFeRD;
-import org.w3c.dom.Document;
+import library.src.main.java.org.mustangproject.Contact;
+import library.src.main.java.org.mustangproject.Invoice;
+import library.src.main.java.org.mustangproject.Item;
+import library.src.main.java.org.mustangproject.Product;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.xpath.*;
import java.math.BigDecimal;
import java.util.Date;
-import java.util.logging.Level;
-import java.util.logging.Logger;
public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
public ZUGFeRDInvoiceImporter(String filename) {
super(filename);
}
- public ZUGFeRD2PushProvider extractInvoice() {
+ public Invoice extractInvoice() {
String number="AB123";
- ZUGFeRD2PushProvider zpp=new ZUGFeRD2PushProvider().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number);
+ Invoice zpp=new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number);
//.addItem(new Item(new Product("Testprodukt","","C62",new BigDecimal(0)),amount,new BigDecimal(1.0)))
zpp.setOwnOrganisationName(extractString("//SellerTradeParty/Name"));
diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/XRTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/XRTest.java
index babff567..95c72b92 100644
--- a/library/src/test/java/org/mustangproject/ZUGFeRD/XRTest.java
+++ b/library/src/test/java/org/mustangproject/ZUGFeRD/XRTest.java
@@ -1,83 +1,80 @@
-/** **********************************************************************
- *
+/**
+ * *********************************************************************
+ *
* Copyright 2019 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.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.Date;
+ *
+ * **********************************************************************
+ */
+package library.src.test.java.org.mustangproject.ZUGFeRD;
+import junit.framework.TestCase;
import library.src.main.java.org.mustangproject.Contact;
import library.src.main.java.org.mustangproject.Invoice;
import library.src.main.java.org.mustangproject.Item;
import library.src.main.java.org.mustangproject.Product;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+import org.mustangproject.ZUGFeRD.ZUGFeRD2PullProvider;
+import org.mustangproject.ZUGFeRD.ZUGFeRDExporter;
+import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA3Factory;
+import org.mustangproject.ZUGFeRD.ZUGFeRDImporter;
-import junit.framework.TestCase;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.xmlunit.builder.Input;
+import org.xmlunit.xpath.JAXPXPathEngine;
+import org.xmlunit.xpath.XPathEngine;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import static org.xmlunit.assertj.XmlAssert.assertThat;
+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ZF2PushTest extends TestCase {
- final String TARGET_PDF = "./target/testout-ZF2Push.pdf";
+public class XRTest extends TestCase {
public void testPushExport() {
// the writing part
- String orgname="Test company";
- String number="123";
- String amountStr="1.00";
- BigDecimal amount=new BigDecimal(amountStr);
- try (InputStream SOURCE_PDF = this.getClass()
- .getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
+ String orgname = "Test company";
+ String number = "123";
+ String amountStr = "1.00";
+ BigDecimal amount = new BigDecimal(amountStr);
- ZUGFeRDExporter ze = new ZUGFeRDExporterFromA3Factory().setProducer("My Application")
- .setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
- .load(SOURCE_PDF)) {
+ Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)));
- ze.PDFattachZugferdFile(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt","","C62",new BigDecimal(0)),amount,new BigDecimal(1.0))));
- String theXML = new String(ze.getProvider().getXML());
- assertTrue(theXML.contains(" li = zi.getLineItemList();
+ List li = zi.getLineItemList();
assertEquals(zi.getLineItemList().get(0).getId().toString(), "1");
- assertEquals(zi.getLineItemList().get(0).product.getBuyerAssignedID(), "");
- assertEquals(zi.getLineItemList().get(0).product.getSellerAssignedID(), "");
+ assertEquals(zi.getLineItemList().get(0).getProduct().getBuyerAssignedID(), "");
+ assertEquals(zi.getLineItemList().get(0).getProduct().getSellerAssignedID(), "");
assertEquals(zi.getLineItemList().get(0).getLineTotalAmount().toString(), "160.00");
assertEquals(zi.getLineItemList().get(0).getQuantity().toString(), "1.0000");
assertEquals(zi.getLineItemList().get(0).getGrossPrice().toString(), "160.0000");
- assertEquals(zi.getLineItemList().get(0).product.getVATPercent().toString(), "7.00");
- assertEquals(zi.getLineItemList().get(0).product.getName(), "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung");
- assertEquals(zi.getLineItemList().get(0).product.getDescription(), "");
+ assertEquals(zi.getLineItemList().get(0).getProduct().getVATPercent().toString(), "7.00");
+ assertEquals(zi.getLineItemList().get(0).getProduct().getName(), "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung");
+ assertEquals(zi.getLineItemList().get(0).getProduct().getDescription(), "");
try {
assertEquals(zi.getVersion(), 2);
diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
index e8ef1f7c..ebc0de80 100644
--- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
+++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
@@ -19,15 +19,7 @@
*********************************************************************** */
package org.mustangproject.ZUGFeRD;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
+import library.src.main.java.org.mustangproject.Invoice;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
@@ -47,7 +39,7 @@ public class ZF2ZInvoiceImporterTest extends TestCase {
ZUGFeRDInvoiceImporter zii=new ZUGFeRDInvoiceImporter(TARGET_PDF);
- ZUGFeRD2PushProvider invoice=zii.extractInvoice();
+ Invoice invoice=zii.extractInvoice();
// Reading ZUGFeRD
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
assertEquals(3, invoice.getZFItems().length);
diff --git a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
index 4a3909ea..59ebdbc1 100644
--- a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
+++ b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
@@ -285,7 +285,7 @@ public class XMLValidator extends Validator {
context.addCustomXML("" + ((context.getVersion() != null) ? context.getVersion() : "invalid")
+ "" + ((context.getProfile() != null) ? context.getProfile() : "invalid") +
- "" + firedRules + "" + failedRules + "" + "" + (endTime - startXMLTime) + "");
+ "" + firedRules + "" + failedRules + "" + "" + (endTime - startXMLTime) + "");
}