Merge branch 'master' of github.com:ZUGFeRD/mustangproject
# Conflicts: # library/src/main/java/org/mustangproject/Allowance.java # library/src/main/java/org/mustangproject/Charge.java # library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package org.mustangproject;
|
package org.mustangproject;
|
||||||
|
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@@ -40,13 +39,14 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Charge setReason(String reason) {
|
|
||||||
this.reason = reason;
|
@Override
|
||||||
return this;
|
public String getReason() {
|
||||||
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Charge setCategoryCode(String categoryCode) {
|
public Charge setReason(String reason) {
|
||||||
this.categoryCode = categoryCode;
|
this.reason = reason;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,19 +56,15 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
return totalAmount;
|
return totalAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getReason() {
|
|
||||||
return reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal getTaxPercent() {
|
public BigDecimal getTaxPercent() {
|
||||||
return taxPercent;
|
return taxPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCategoryCode() {
|
|
||||||
return categoryCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public Charge setCategoryCode(String categoryCode) {
|
||||||
|
this.categoryCode = categoryCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ public class Invoice implements IExportableTransaction {
|
|||||||
protected BigDecimal totalPrepaidAmount = null;
|
protected BigDecimal totalPrepaidAmount = null;
|
||||||
protected IZUGFeRDExportableContact ownContact = null, recipient = null, deliveryAddress = null;
|
protected IZUGFeRDExportableContact ownContact = null, recipient = null, deliveryAddress = null;
|
||||||
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
|
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
|
||||||
|
protected String contractReferencedDocument = null;
|
||||||
|
|
||||||
protected IZUGFeRDAllowanceCharge[] ZFAllowances = null, ZFCharges = null, ZFLogisticsServiceCharges = null;
|
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
|
||||||
|
Charges = new ArrayList<IZUGFeRDAllowanceCharge>(), LogisticsServiceCharges = new ArrayList<IZUGFeRDAllowanceCharge>();
|
||||||
protected IZUGFeRDTradeSettlement[] getTradeSettlement = null;
|
protected IZUGFeRDTradeSettlement[] getTradeSettlement = null;
|
||||||
protected IZUGFeRDPaymentTerms paymentTerms = null;
|
protected IZUGFeRDPaymentTerms paymentTerms = null;
|
||||||
|
|
||||||
@@ -49,6 +51,8 @@ public class Invoice implements IExportableTransaction {
|
|||||||
return documentName;
|
return documentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getContractReferencedDocument() { return contractReferencedDocument; }
|
||||||
|
|
||||||
public Invoice setDocumentName(String documentName) {
|
public Invoice setDocumentName(String documentName) {
|
||||||
this.documentName = documentName;
|
this.documentName = documentName;
|
||||||
return this;
|
return this;
|
||||||
@@ -334,33 +338,30 @@ public class Invoice implements IExportableTransaction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
|
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
|
||||||
return ZFAllowances;
|
if (Allowances.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else
|
||||||
|
return Allowances.toArray(new IZUGFeRDAllowanceCharge[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setZFAllowances(IZUGFeRDAllowanceCharge[] ZFAllowances) {
|
|
||||||
this.ZFAllowances = ZFAllowances;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDAllowanceCharge[] getZFCharges() {
|
public IZUGFeRDAllowanceCharge[] getZFCharges() {
|
||||||
return ZFCharges;
|
if (Charges.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else
|
||||||
|
return Charges.toArray(new IZUGFeRDAllowanceCharge[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setZFCharges(IZUGFeRDAllowanceCharge[] ZFCharges) {
|
|
||||||
this.ZFCharges = ZFCharges;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
|
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
|
||||||
return ZFLogisticsServiceCharges;
|
if (LogisticsServiceCharges.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else
|
||||||
|
return LogisticsServiceCharges.toArray(new IZUGFeRDAllowanceCharge[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setZFLogisticsServiceCharges(IZUGFeRDAllowanceCharge[] ZFLogisticsServiceCharges) {
|
|
||||||
this.ZFLogisticsServiceCharges = ZFLogisticsServiceCharges;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDTradeSettlement[] getGetTradeSettlement() {
|
public IZUGFeRDTradeSettlement[] getGetTradeSettlement() {
|
||||||
return getTradeSettlement;
|
return getTradeSettlement;
|
||||||
@@ -403,16 +404,6 @@ public class Invoice implements IExportableTransaction {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Invoice addCharge(IZUGFeRDAllowanceCharge charge) {
|
|
||||||
//@todo
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Invoice addAllowance(IZUGFeRDAllowanceCharge allowance) {
|
|
||||||
//@todo
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* checks if all required items are set in order to be able to export it
|
* checks if all required items are set in order to be able to export it
|
||||||
@@ -429,4 +420,17 @@ public class Invoice implements IExportableTransaction {
|
|||||||
// this.country = country;
|
// this.country = country;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Invoice addCharge(IZUGFeRDAllowanceCharge izac) {
|
||||||
|
Charges.add(izac);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Invoice addAllowance(IZUGFeRDAllowanceCharge izac) {
|
||||||
|
Allowances.add(izac);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Invoice setContractReferencedDocument(String s) {
|
||||||
|
contractReferencedDocument=s;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
|||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Item implements IZUGFeRDExportableItem {
|
public class Item implements IZUGFeRDExportableItem {
|
||||||
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
|
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
|
||||||
protected String id;
|
protected String id;
|
||||||
protected Product product;
|
protected Product product;
|
||||||
|
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
|
||||||
|
Charges = new ArrayList<IZUGFeRDAllowanceCharge>();
|
||||||
|
|
||||||
public Item(Product product, BigDecimal price, BigDecimal quantity) {
|
public Item(Product product, BigDecimal price, BigDecimal quantity) {
|
||||||
this.price = price;
|
this.price = price;
|
||||||
@@ -25,16 +28,6 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item addCharge(IZUGFeRDAllowanceCharge charge) {
|
|
||||||
//@todo
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item addAllowance(IZUGFeRDAllowanceCharge allowance) {
|
|
||||||
//@todo
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getGrossPrice() {
|
public BigDecimal getGrossPrice() {
|
||||||
return grossPrice;
|
return grossPrice;
|
||||||
}
|
}
|
||||||
@@ -91,16 +84,32 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
||||||
|
if (Allowances.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
} else
|
||||||
|
return Allowances.toArray(new IZUGFeRDAllowanceCharge[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
||||||
|
if (Charges.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
} else
|
||||||
|
return Charges.toArray(new IZUGFeRDAllowanceCharge[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item setProduct(Product product) {
|
public Item setProduct(Product product) {
|
||||||
this.product = product;
|
this.product = product;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Item addCharge(IZUGFeRDAllowanceCharge izac) {
|
||||||
|
Charges.add(izac);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Item addAllowance(IZUGFeRDAllowanceCharge izac) {
|
||||||
|
Allowances.add(izac);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ public interface IExportableTransaction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String getContractReferencedDocument() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* who processed the order
|
* who processed the order
|
||||||
|
|||||||
@@ -208,6 +208,9 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
ensurePDFisUpgraded = false;
|
ensurePDFisUpgraded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void attachFile(String filename, byte[] data, String mimetype, String relation) {
|
||||||
|
//throw new RuntimeException("Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Perform the final export to a now ZUGFeRD-enriched PDF file
|
* Perform the final export to a now ZUGFeRD-enriched PDF file
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("DE19990815").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.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument("0815").setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("DE19990815").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());
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
ze.export(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
@@ -63,6 +63,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
|
||||||
assertTrue(zi.getUTF8().contains("EUR"));
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
assertTrue(zi.getUTF8().contains("0815"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(amountStr, zi.getAmount());
|
assertEquals(amountStr, zi.getAmount());
|
||||||
@@ -89,9 +90,12 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(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.setTransaction(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.attachFile("one.pdf");
|
|
||||||
ze.attachFile("two.pdf");
|
);
|
||||||
|
byte[] b={12,13};
|
||||||
|
ze.attachFile("one.pdf", b, "Application/PDF", "Alternative");
|
||||||
|
ze.attachFile("two.pdf", b, "Application/PDF", "Alternative");
|
||||||
String theXML = new String(ze.getProvider().getXML());
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
ze.export(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
@@ -102,7 +106,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
// now check the contents (like MustangReaderTest)
|
// now check the contents (like MustangReaderTest)
|
||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
|
||||||
assertFalse(zi.getUTF8().contains("EUR"));
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(amountStr, zi.getAmount());
|
assertEquals(amountStr, zi.getAmount());
|
||||||
@@ -121,7 +125,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
|
|
||||||
String orgname = "Test company";
|
String orgname = "Test company";
|
||||||
String number = "123";
|
String number = "123";
|
||||||
String amountStr = "1.00";
|
String amountStr = "3.00";
|
||||||
BigDecimal amount = new BigDecimal(amountStr);
|
BigDecimal amount = new BigDecimal(amountStr);
|
||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
|
||||||
@@ -131,9 +135,9 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(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)
|
ze.setTransaction(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)).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "", "K")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "", "K")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "", "K")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
|
||||||
|
|
||||||
);
|
);
|
||||||
String theXML = new String(ze.getProvider().getXML());
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
@@ -146,10 +150,10 @@ public class ZF2PushTest extends TestCase {
|
|||||||
// now check the contents (like MustangReaderTest)
|
// now check the contents (like MustangReaderTest)
|
||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
|
||||||
assertFalse(zi.getUTF8().contains("EUR"));
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(amountStr, zi.getAmount());
|
assertEquals("9.00", zi.getAmount());
|
||||||
assertEquals(zi.getHolder(), orgname);
|
assertEquals(zi.getHolder(), orgname);
|
||||||
assertEquals(zi.getForeignReference(), number);
|
assertEquals(zi.getForeignReference(), number);
|
||||||
try {
|
try {
|
||||||
@@ -165,7 +169,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
|
|
||||||
String orgname = "Test company";
|
String orgname = "Test company";
|
||||||
String number = "123";
|
String number = "123";
|
||||||
String amountStr = "1.00";
|
String amountStr = "3.00";
|
||||||
BigDecimal amount = new BigDecimal(amountStr);
|
BigDecimal amount = new BigDecimal(amountStr);
|
||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
|
||||||
@@ -174,12 +178,14 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(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)
|
ze.setTransaction(new Invoice().setCurrency("CHF").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)))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
.addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "", "K"))
|
.addCharge(new Charge(new BigDecimal(0.5),new BigDecimal(0), "","K"))
|
||||||
.addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "", "K")));
|
.addAllowance(new Allowance(new BigDecimal(0.2),new BigDecimal(0), "","K"))
|
||||||
|
|
||||||
|
);
|
||||||
String theXML = new String(ze.getProvider().getXML());
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
ze.export(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
@@ -193,7 +199,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
assertFalse(zi.getUTF8().contains("EUR"));
|
assertFalse(zi.getUTF8().contains("EUR"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(amountStr, zi.getAmount());
|
assertEquals("9.00", zi.getAmount());
|
||||||
assertEquals(zi.getHolder(), orgname);
|
assertEquals(zi.getHolder(), orgname);
|
||||||
assertEquals(zi.getForeignReference(), number);
|
assertEquals(zi.getForeignReference(), number);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user