From 1bd17ff8c5bdb601a9181b98b07903aeabe8f753 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Thu, 12 Jan 2023 09:08:31 +0100 Subject: [PATCH] additional minimum test, require toolchains.xml only for release, not for any build --- History.md | 1 + Mustang-CLI/pom.xml | 57 +++++++++++------- library/pom.xml | 55 +++++++++++------- .../ZUGFeRD/ProfilesMinimumBasicWLTest.java | 56 +++++++++++++++++- validator/pom.xml | 58 ++++++++++++------- 5 files changed, 165 insertions(+), 62 deletions(-) diff --git a/History.md b/History.md index e3d71ef6..b24bb656 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ - allow Bank credentials without BIC - allow minimum profile without delivery date - allow prepaid amount in invoice class +- toolchain.xml now only required on `mvn release:release` not already on `mvn package` 2.6.0 "Joyeux Noël" ======= diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 951e6007..896390f9 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -100,26 +100,6 @@ - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 8 - adopt - - - - org.apache.maven.plugins maven-compiler-plugin @@ -199,6 +179,43 @@ + + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 8 + adopt + + + + + + + + Apache License, Version 2.0 diff --git a/library/pom.xml b/library/pom.xml index bfcec3e8..212fb079 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -155,26 +155,6 @@ 8 - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 8 - adopt - - - - org.apache.maven.plugins maven-shade-plugin @@ -241,6 +221,41 @@ + + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 8 + adopt + + + + + + + + User List diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ProfilesMinimumBasicWLTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ProfilesMinimumBasicWLTest.java index b58a1e30..e4533064 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ProfilesMinimumBasicWLTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ProfilesMinimumBasicWLTest.java @@ -41,7 +41,7 @@ public class ProfilesMinimumBasicWLTest extends TestCase { final String TARGET_PDF_FX_MINIMUM = "./target/testout-Minimum.pdf"; - public void testMinimumExport() { + public void testMinimumCreditNote() { String ownNumber = "NUMFACTURE"; String ownBIC = "COBADEFFXXX"; String ownIBAN = "DE88200800000970375700"; @@ -95,4 +95,58 @@ public class ProfilesMinimumBasicWLTest extends TestCase { } + public void testMinimumInvoice() { + String ownNumber = "NUMFACTURE"; + String ownBIC = "COBADEFFXXX"; + String ownIBAN = "DE88200800000970375700"; + String ownOrgName = "ME"; + + // the writing part + try (InputStream SOURCE_PDF = this.getClass() + .getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf"); + IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile("Minimum").load(SOURCE_PDF)) { + /*** + * this is a classical example of a french invoice (very low profile, siret number) and an attempt to answer stackoverflow (!) + * https://stackoverflow.com/questions/72450066/creating-a-min-basic-and-basic-wl-factur-x-using-mustang + */ + + TradeParty recipient = new TradeParty().setName("Client").setCountry("FR"); + String siret="0815"; + String sirenTypeCode="0002"; + recipient.setLegalOrganisation(new LegalOrganisation(siret,sirenTypeCode)); + Invoice i = new Invoice() + .setIssueDate(new Date()) + .setDueDate(new Date()) + .setSender( + new TradeParty().setName(ownOrgName).setCountry("FR") + .addBankDetails(new BankDetails(ownIBAN))) + .setRecipient(recipient) + .setNumber(ownNumber).setTotalPrepaidAmount(new BigDecimal("1")) + .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), new BigDecimal(123), new BigDecimal(1))); + ze.setTransaction(i); + ze.export(TARGET_PDF_FX_MINIMUM); + + // check for pdf-a schema extension +// assertFalse(pdfContent.indexOf("EN 16931") == -1); +// assertFalse(pdfContent.indexOf("zf") == -1); +// assertFalse(pdfContent.indexOf("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#") == -1); + + } catch (IOException e) { + fail("IOException should not happen in testMinimumExport"); + } + + // now check the contents (like MustangReaderTest) + ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF_FX_MINIMUM); + + // Reading ZUGFeRD + assertEquals("145.37",zi.getAmount()); +// assertEquals(zi.getBIC(), ownBIC); +// assertEquals(zi.getIBAN(), ownIBAN); + assertEquals(ownOrgName, zi.getHolder()); +// assertEquals(zi.getForeignReference(), ownNumber); + + + } + + } diff --git a/validator/pom.xml b/validator/pom.xml index 58e8cd11..3ad1fffa 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -165,26 +165,6 @@ - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 8 - adopt - - - - org.apache.maven.plugins maven-compiler-plugin @@ -299,7 +279,43 @@ - + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 8 + adopt + + + + + + + + generateXSLTFromSchematron false