|
|
|
|
@@ -72,14 +72,15 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20201121_508blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors();
|
|
|
|
|
ze.load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
|
|
|
|
|
ze.setTransaction(new Invoice().setDueDate(sdf.parse("2020-12-12")).setIssueDate(sdf.parse("2020-11-21")).setDeliveryDate(sdf.parse("2020-11-10"))
|
|
|
|
|
.setSender(new TradeParty(orgname, "Ecke 12", "12345", "Stadthausen", "DE").addBankDetails(new BankDetails("DE88200800000970375700", "COBADEFFXXX").setAccountName("Max Mustermann")).addVATID("DE136695976"))
|
|
|
|
|
.setRecipient(new TradeParty("Theodor Est", "Bahnstr. 42", "88802", "Spielkreis", "DE")
|
|
|
|
|
@@ -125,12 +126,14 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String priceStr = "1.00";
|
|
|
|
|
String taxID = "9990815";
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors();
|
|
|
|
|
ze.load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application").setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
|
|
|
|
|
|
|
|
|
|
byte[] b = {12, 13};
|
|
|
|
|
ze.attachFile("one.pdf", b, "application/pdf", "Alternative");
|
|
|
|
|
@@ -163,6 +166,7 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBankTransferExport() {
|
|
|
|
|
|
|
|
|
|
String orgname = "Test company";
|
|
|
|
|
@@ -170,12 +174,14 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String priceStr = "1.00";
|
|
|
|
|
String taxID = "9990815";
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors().load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
|
|
|
|
|
|
|
|
|
|
String IBAN = "DE999888777";
|
|
|
|
|
String BIC = "COBADEFXXX";
|
|
|
|
|
@@ -208,12 +214,14 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String number = "123";
|
|
|
|
|
String amountStr = "3.00";
|
|
|
|
|
BigDecimal amount = new BigDecimal(amountStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("extended").ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors().load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("extended");
|
|
|
|
|
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
|
|
|
|
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
|
|
|
|
|
|
|
|
|
@@ -259,12 +267,14 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String number = "123";
|
|
|
|
|
String amountStr = "3.00";
|
|
|
|
|
BigDecimal amount = new BigDecimal(amountStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("extended").ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors().load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("extended");
|
|
|
|
|
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
|
|
|
|
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
|
|
|
|
|
|
|
|
|
@@ -312,12 +322,15 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String number = "123";
|
|
|
|
|
String amountStr = "3.00";
|
|
|
|
|
BigDecimal amount = new BigDecimal(amountStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("extended").ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors().load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("extended");
|
|
|
|
|
|
|
|
|
|
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
|
|
|
|
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
|
|
|
|
|
|
|
|
|
@@ -354,18 +367,22 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testChargesAllowancesExport() {
|
|
|
|
|
|
|
|
|
|
String orgname = "Test company";
|
|
|
|
|
String number = "123";
|
|
|
|
|
String amountStr = "3.00";
|
|
|
|
|
BigDecimal amount = new BigDecimal(amountStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("en16931")).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("en16931"));
|
|
|
|
|
|
|
|
|
|
ze.setTransaction(new Invoice().setCurrency("CHF").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
|
|
|
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)))
|
|
|
|
|
@@ -413,12 +430,16 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String priceStr = "1.00";
|
|
|
|
|
String taxID = "9990815";
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("extended")).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF);
|
|
|
|
|
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("extended"));
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
try {
|
|
|
|
|
@@ -496,7 +517,6 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testAllowancesExport() {
|
|
|
|
|
@@ -504,12 +524,16 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String orgname = "Test company";
|
|
|
|
|
String number = "123";
|
|
|
|
|
BigDecimal qty = new BigDecimal("20");
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("en16931")).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors().load(SOURCE_PDF);
|
|
|
|
|
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("en16931"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
|
|
|
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), new BigDecimal(500.0), qty).addAllowance(new Allowance(new BigDecimal(300)).setTaxPercent(new BigDecimal(19))))
|
|
|
|
|
@@ -547,12 +571,16 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String number = "123";
|
|
|
|
|
String priceStr = "3.00";
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("extended")).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF);
|
|
|
|
|
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("extended"));
|
|
|
|
|
|
|
|
|
|
ze.setTransaction(new Invoice().setCurrency("CHF").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
|
|
|
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, new BigDecimal(1.0)))
|
|
|
|
|
@@ -599,12 +627,15 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String priceStr = "1.00";
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
BigDecimal qty = new BigDecimal(-1.0);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF);
|
|
|
|
|
ze.setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
|
|
|
|
|
// no due date, since we are not expecting money
|
|
|
|
|
Invoice i = new Invoice().setIssueDate(new Date()).setDetailedDeliveryPeriod(new Date(), new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815")).setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE0815")).setNumber(number)
|
|
|
|
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
|
|
|
|
|
@@ -649,12 +680,16 @@ public class ZF2PushTest extends TestCase {
|
|
|
|
|
String priceStr = "1.00";
|
|
|
|
|
BigDecimal price = new BigDecimal(priceStr);
|
|
|
|
|
BigDecimal qty = new BigDecimal(1.0);
|
|
|
|
|
try (InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
try {
|
|
|
|
|
InputStream SOURCE_PDF = this.getClass()
|
|
|
|
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
|
|
|
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF)) {
|
|
|
|
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
|
|
|
|
|
ze.ignorePDFAErrors()
|
|
|
|
|
.load(SOURCE_PDF);
|
|
|
|
|
ze.
|
|
|
|
|
setProducer("My Application")
|
|
|
|
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
|
|
|
|
|
Invoice i = new Invoice().setIssueDate(new Date()).setDueDate(new Date()).setDetailedDeliveryPeriod(new Date(), new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815").addBankDetails(new BankDetails("DE88200800000970375700", "COBADEFFXXX"))).setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE0815")).setNumber(number)
|
|
|
|
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
|
|
|
|
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
|
|
|
|
|
|