Merge remote-tracking branch 'remotes/fork/master' into Improvements
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
2.0.3
|
2.0.3
|
||||||
=======
|
=======
|
||||||
|
2020-12-06
|
||||||
|
|
||||||
- #201 correct embedded files in XRechnung
|
- #201 correct embedded files in XRechnung
|
||||||
- transaction calculator getGrandTotal now public
|
- transaction calculator getGrandTotal now public
|
||||||
- corrected sample in docs thanks to tweimer PR #204
|
- corrected sample in docs thanks to tweimer PR #204
|
||||||
- don't write "null" as paymentDescription if no Bank account is specified
|
- don't write "null" as paymentDescription if no Bank account is specified
|
||||||
|
- generic and unitcode/categorycode improvements (thanks to weclapp-dev) PR #207
|
||||||
|
- programmatically switch to XRechnung 2.0 if invoked next year
|
||||||
|
- support Credit Notes (additionally to corrected invoices)
|
||||||
|
|
||||||
2.0.2
|
2.0.2
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>Mustang-CLI</artifactId>
|
<artifactId>Mustang-CLI</artifactId>
|
||||||
<name>Mustang commandline tool</name>
|
<name>Mustang commandline tool</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<!-- for jargs -->
|
<!-- for jargs -->
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>validator</artifactId>
|
<artifactId>validator</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
<!-- prototypes of new mustangproject versions can be installed by referring to them and installed to the local repo from a jar file with
|
<!-- prototypes of new mustangproject versions can be installed by referring to them and installed to the local repo from a jar file with
|
||||||
mvn install:install-file -Dfile=mustang-1.5.4-SNAPSHOT.jar -DgroupId=org.mustangproject.ZUGFeRD -DartifactId=mustang -Dversion=1.5.4 -Dpackaging=jar -DgeneratePom=true
|
mvn install:install-file -Dfile=mustang-1.5.4-SNAPSHOT.jar -DgroupId=org.mustangproject.ZUGFeRD -DartifactId=mustang -Dversion=1.5.4 -Dpackaging=jar -DgeneratePom=true
|
||||||
-->
|
-->
|
||||||
|
|||||||
Binary file not shown.
@@ -3,13 +3,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>library</artifactId>
|
<artifactId>library</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>Library to write and read FacturX and ZUGFeRD e-invoices. </name>
|
<name>Library to write and read FacturX and ZUGFeRD e-invoices. </name>
|
||||||
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML.
|
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML.
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ public class Invoice implements IExportableTransaction {
|
|||||||
documentCode = DocumentCodeTypeConstants.CORRECTEDINVOICE;
|
documentCode = DocumentCodeTypeConstants.CORRECTEDINVOICE;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public Invoice setCreditNote() {
|
||||||
|
documentCode = DocumentCodeTypeConstants.CREDITNOTE;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnOrganisationFullPlaintextInfo() {
|
public String getOwnOrganisationFullPlaintextInfo() {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import java.time.Year;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -31,7 +32,7 @@ public class Profiles {
|
|||||||
{"BASIC", new Profile("BASIC", "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic")},
|
{"BASIC", new Profile("BASIC", "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic")},
|
||||||
{"EN16931", new Profile("EN16931", "urn:cen.eu:en16931:2017")},
|
{"EN16931", new Profile("EN16931", "urn:cen.eu:en16931:2017")},
|
||||||
{"EXTENDED", new Profile("EXTENDED", "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended")},
|
{"EXTENDED", new Profile("EXTENDED", "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended")},
|
||||||
{"XRECHNUNG", new Profile("XRECHNUNG", "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0")}
|
{"XRECHNUNG", new Profile("XRECHNUNG", "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_"+((Year.now().getValue()<=2020)?"1.2":"2.0"))} //intentionally switch to XRechnung 2.0 on 01.01.2021
|
||||||
|
|
||||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||||
static Map<String, Profile> zf1Map = Stream.of(new Object[][]{
|
static Map<String, Profile> zf1Map = Stream.of(new Object[][]{
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import org.mustangproject.FileAttachment;
|
|||||||
import org.mustangproject.XMLTools;
|
import org.mustangproject.XMLTools;
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
||||||
|
|
||||||
|
import static org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants.CORRECTEDINVOICE;
|
||||||
|
|
||||||
public class ZUGFeRD2PullProvider implements IXMLProvider {
|
public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||||
|
|
||||||
//// MAIN CLASS
|
//// MAIN CLASS
|
||||||
@@ -229,7 +231,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
paymentTermsDescription = trans.getPaymentTermDescription();
|
paymentTermsDescription = trans.getPaymentTermDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((paymentTermsDescription == null) && (trans.getDocumentCode() != org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants.CORRECTEDINVOICE)) {
|
if ((paymentTermsDescription == null) && (trans.getDocumentCode() != CORRECTEDINVOICE)/* && (trans.getDocumentCode() != DocumentCodeTypeConstants.CREDITNOTE)*/) {
|
||||||
paymentTermsDescription = "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
|
paymentTermsDescription = "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -494,7 +496,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trans.getDocumentCode() == DocumentCodeTypeConstants.CORRECTEDINVOICE) {
|
if ((trans.getDocumentCode() == CORRECTEDINVOICE)/*||(trans.getDocumentCode() == DocumentCodeTypeConstants.CREDITNOTE)*/) {
|
||||||
hasDueDate = false;
|
hasDueDate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package org.mustangproject.ZUGFeRD.model;
|
|||||||
|
|
||||||
public class DocumentCodeTypeConstants {
|
public class DocumentCodeTypeConstants {
|
||||||
public static final String INVOICE = "380";
|
public static final String INVOICE = "380";
|
||||||
|
public static final String CREDITNOTE = "381";
|
||||||
public static final String DEBITNOTE = "84";
|
public static final String DEBITNOTE = "84";
|
||||||
public static final String CORRECTEDINVOICE = "384";
|
public static final String CORRECTEDINVOICE = "384";
|
||||||
public static final String CREDITNOTE = "389";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import junit.framework.TestCase;
|
|||||||
public class ZF2PushTest extends TestCase {
|
public class ZF2PushTest extends TestCase {
|
||||||
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20201121_508.pdf";
|
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20201121_508.pdf";
|
||||||
final String TARGET_ALLOWANCESPDF = "./target/testout-ZF2PushAllowances.pdf";
|
final String TARGET_ALLOWANCESPDF = "./target/testout-ZF2PushAllowances.pdf";
|
||||||
|
final String TARGET_CREDITNOTEPDF = "./target/testout-ZF2PushCreditNote.pdf";
|
||||||
final String TARGET_CORRECTIONPDF = "./target/testout-ZF2PushCorrection.pdf";
|
final String TARGET_CORRECTIONPDF = "./target/testout-ZF2PushCorrection.pdf";
|
||||||
final String TARGET_ITEMCHARGESALLOWANCESPDF = "./target/testout-ZF2PushItemChargesAllowances.pdf";
|
final String TARGET_ITEMCHARGESALLOWANCESPDF = "./target/testout-ZF2PushItemChargesAllowances.pdf";
|
||||||
final String TARGET_CHARGESALLOWANCESPDF = "./target/testout-ZF2PushChargesAllowances.pdf";
|
final String TARGET_CHARGESALLOWANCESPDF = "./target/testout-ZF2PushChargesAllowances.pdf";
|
||||||
@@ -501,6 +502,11 @@ public class ZF2PushTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* German Stornorechnung/Rechnungskorrektur:
|
||||||
|
* quantities have to be negative!
|
||||||
|
* official example: zugferd_2p1_EXTENDED_Rechnungskorrektur.pdf
|
||||||
|
*/
|
||||||
public void testCorrectionExport() {
|
public void testCorrectionExport() {
|
||||||
|
|
||||||
String orgname = "Test company";
|
String orgname = "Test company";
|
||||||
@@ -545,5 +551,54 @@ public class ZF2PushTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* UNTDID 1001 says 381 as typecode for credit notes and
|
||||||
|
* the Factur-X 1.0.50 has examples like Avoir_FR_type381_EN16931.pdf
|
||||||
|
* along with a documentation in chapter 7.1.6 (where they also tackle
|
||||||
|
* negative TypeCode 380 invoices)
|
||||||
|
*/
|
||||||
|
public void testCreditNoteExport() {
|
||||||
|
|
||||||
|
String orgname = "Test company";
|
||||||
|
String number = "123";
|
||||||
|
String priceStr = "1.00";
|
||||||
|
BigDecimal price = new BigDecimal(priceStr);
|
||||||
|
BigDecimal qty = new BigDecimal(1.0);
|
||||||
|
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)) {
|
||||||
|
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))
|
||||||
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty)).setCreditNote();
|
||||||
|
ze.setTransaction(i);
|
||||||
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
|
ze.export(TARGET_CREDITNOTEPDF);
|
||||||
|
} catch (IOException e) {
|
||||||
|
fail("IOException should not be raised in testEdgeExport");
|
||||||
|
}
|
||||||
|
|
||||||
|
// now check the contents (like MustangReaderTest)
|
||||||
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_CREDITNOTEPDF);
|
||||||
|
|
||||||
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
//totest: typecode 384, BuyerOrderReferencedDocument
|
||||||
|
// Reading ZUGFeRD
|
||||||
|
assertEquals("3.57", zi.getAmount());
|
||||||
|
assertEquals(zi.getHolder(), orgname);
|
||||||
|
assertEquals(zi.getForeignReference(), number);
|
||||||
|
try {
|
||||||
|
assertEquals(zi.getVersion(), 2);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Mustang</name>
|
<name>Mustang</name>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<name>Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)</name>
|
<name>Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)</name>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<!-- for jargs -->
|
<!-- for jargs -->
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>library</artifactId>
|
<artifactId>library</artifactId>
|
||||||
<version>2.0.3-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xmlunit</groupId>
|
<groupId>org.xmlunit</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user