Merge branch 'master' of github.com:ZUGFeRD/mustangproject

# Conflicts:
#	Mustang-CLI/pom.xml
#	library/pom.xml
#	validator/pom.xml
This commit is contained in:
jstaerk
2024-08-05 10:06:30 +02:00
15 changed files with 261 additions and 158 deletions

View File

@@ -1,3 +1,8 @@
- #420
- Enhance Charges/Allowances with reasonCode. #432
- Fix build warnings from editing and building. #415
- ZUGFeRDVisualizer.toPDF(): generate PDF/A-3b. #400
2.12.0 2.12.0
======= =======
2024-07-20 2024-07-20

View File

@@ -6,16 +6,13 @@
<version>2.13.0-SNAPSHOT</version> <version>2.13.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
<artifactId>Mustang-CLI</artifactId> <artifactId>Mustang-CLI</artifactId>
<name>e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation <name>e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation
should also work for XRechnung/CII. should also work for XRechnung/CII.
</name> </name>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.13.0-SNAPSHOT</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
</properties> </properties>
@@ -110,18 +107,6 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.3.2</version>
<configuration> <configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.mustangproject.commandline.main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
mvn clean compile assembly:single -->
<!-- or whatever version you use -->
<source>11</source> <source>11</source>
<target>11</target> <target>11</target>
</configuration> </configuration>
@@ -148,24 +133,12 @@
<exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.RSA</exclude>
</excludes> </excludes>
</filter> </filter>
<filter>
<artifact>log4j:log4j</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter> <filter>
<artifact>commons-logging:commons-logging</artifact> <artifact>commons-logging:commons-logging</artifact>
<includes> <includes>
<include>**</include> <include>**</include>
</includes> </includes>
</filter> </filter>
<filter>
<artifact>com.sun.xml.bind:jaxb-impl</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters> </filters>
</configuration> </configuration>
<executions> <executions>

View File

@@ -127,14 +127,10 @@ The whole settings.xml then looks e.g. like this
<offline/> <offline/>
<pluginGroups/> <pluginGroups/>
<servers> <servers>
<server>
      <id>github</id>
      <password>TOKEN</password>
    </server>
    <server>     <server>
      <id>ossrh</id>       <id>ossrh</id>
      <username>jstaerk</username>       <username>SONATYPE TOKEN USER</username>
      <password>JIRA-PASSWORD</password>       <password>SONATYPE TOKEN PASSWORD</password>
    </server>     </server>
</servers> </servers>

View File

@@ -7,9 +7,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
<artifactId>library</artifactId> <artifactId>library</artifactId>
<version>2.13.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)</name> <name>Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)</name>
<description>FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT <description>FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT
@@ -46,11 +44,9 @@
<github.global.server>github</github.global.server> <github.global.server>github</github.global.server>
<additionalparam>-Xdoclint:none</additionalparam> <additionalparam>-Xdoclint:none</additionalparam>
<!-- Skip error check for javadoc --> <!-- Skip error check for javadoc -->
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<maven.deploy.skip>true <maven.deploy.skip>true</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
</properties> </properties>
<dependencies> <dependencies>
@@ -169,12 +165,6 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version> <version>3.13.0</version>
<configuration> <configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
mvn clean compile assembly:single -->
<!-- or whatever version you use -->
<source>11</source> <source>11</source>
<target>11</target> <target>11</target>
</configuration> </configuration>
@@ -233,10 +223,8 @@
<version>3.5.3</version> <version>3.5.3</version>
<configuration> <configuration>
<shadedArtifactAttached>true</shadedArtifactAttached> <shadedArtifactAttached>true</shadedArtifactAttached>
<minimizeJar>false <minimizeJar>false</minimizeJar><!-- no longer java 11 compatible if set to true because it removes e.g. javax/xml/bind/annotation/XmlSchema-->
</minimizeJar><!-- no longer java 11 compatible if set to true because it removes e.g. javax/xml/bind/annotation/XmlSchema-->
<filters> <filters>
<filter> <filter>
<artifact>*:*</artifact> <artifact>*:*</artifact>
<excludes> <excludes>
@@ -245,12 +233,6 @@
<exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.RSA</exclude>
</excludes> </excludes>
</filter> </filter>
<filter>
<artifact>log4j:log4j</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter> <filter>
<artifact>commons-logging:commons-logging</artifact> <artifact>commons-logging:commons-logging</artifact>
<includes> <includes>
@@ -268,9 +250,6 @@
<configuration> <configuration>
<artifactSet> <artifactSet>
<excludes> <excludes>
<!--exclude>classworlds:classworlds</exclude> <exclude>junit:junit</exclude>
<exclude>jmock:*</exclude> <exclude>*:xml-apis</exclude> <exclude>org.apache.maven:lib:tests</exclude>
<exclude>log4j:log4j:jar:</exclude -->
</excludes> </excludes>
</artifactSet> </artifactSet>
</configuration> </configuration>

View File

@@ -26,6 +26,10 @@ public class Charge implements IZUGFeRDAllowanceCharge {
* a simple human readable description * a simple human readable description
*/ */
protected String reason; protected String reason;
/**
* Code from list UNTDID 5189
*/
protected String reasonCode;
/** /**
* the category ID why this charge has been applied * the category ID why this charge has been applied
*/ */
@@ -94,6 +98,22 @@ public class Charge implements IZUGFeRDAllowanceCharge {
} }
@Override
public String getReasonCode() {
return reasonCode;
}
/***
* Reason code for the charge
* @param reasonCode from list UNTDID 5189
* @return fluid setter
*/
public Charge setReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
@Override @Override
public BigDecimal getTotalAmount(IAbsoluteValueProvider currentItem) { public BigDecimal getTotalAmount(IAbsoluteValueProvider currentItem) {
if (totalAmount!=null) { if (totalAmount!=null) {
@@ -137,7 +157,7 @@ public class Charge implements IZUGFeRDAllowanceCharge {
/*** /***
* machine readable reason for this allowance/charge * the category ID why this has been applied
* @param categoryCode usually S * @param categoryCode usually S
* @return fluid setter * @return fluid setter
*/ */

View File

@@ -60,6 +60,7 @@ public class Item implements IZUGFeRDExportableItem {
String vatPercent = null; String vatPercent = null;
String lineTotal = "0"; String lineTotal = "0";
String unitCode = "0"; String unitCode = "0";
String referencedLineID = null;
ArrayList<ReferencedDocument> rdocs = null; ArrayList<ReferencedDocument> rdocs = null;
@@ -142,6 +143,16 @@ public class Item implements IZUGFeRDExportableItem {
} }
if ((tradeLineChilds.item(tradeLineChildIndex).getLocalName() != null) && tradeLineChilds.item(tradeLineChildIndex).getLocalName().equals("BuyerOrderReferencedDocument")) {
NodeList docChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes();
for (int docIndex = 0; docIndex < docChilds.getLength(); docIndex++) {
String localName = docChilds.item(docIndex).getLocalName();
if ((localName != null) && (localName.equals("LineID"))) {
referencedLineID = docChilds.item(docIndex).getTextContent();
}
}
}
if ((tradeLineChilds.item(tradeLineChildIndex).getLocalName() != null) && tradeLineChilds if ((tradeLineChilds.item(tradeLineChildIndex).getLocalName() != null) && tradeLineChilds
.item(tradeLineChildIndex).getLocalName().equals("NetPriceProductTradePrice")) { .item(tradeLineChildIndex).getLocalName().equals("NetPriceProductTradePrice")) {
NodeList netChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes(); NodeList netChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes();
@@ -263,6 +274,7 @@ public class Item implements IZUGFeRDExportableItem {
addReferencedDocument(rdoc); addReferencedDocument(rdoc);
} }
} }
addReferencedLineID( referencedLineID );
} }

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct; import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
/*** /***
* describes a product, good or service used in an invoice item line * describes a product, good or service used in an invoice item line
@@ -15,6 +16,8 @@ public class Product implements IZUGFeRDExportableProduct {
protected boolean isReverseCharge = false; protected boolean isReverseCharge = false;
protected boolean isIntraCommunitySupply = false; protected boolean isIntraCommunitySupply = false;
protected SchemedID globalId = null; protected SchemedID globalId = null;
protected String countryOfOrigin = null;
protected HashMap<String, String> attributes = null;
/*** /***
* default constructor * default constructor
@@ -63,6 +66,7 @@ public class Product implements IZUGFeRDExportableProduct {
} }
@Override
public String getSellerAssignedID() { public String getSellerAssignedID() {
return sellerAssignedID; return sellerAssignedID;
} }
@@ -77,6 +81,7 @@ public class Product implements IZUGFeRDExportableProduct {
return this; return this;
} }
@Override
public String getBuyerAssignedID() { public String getBuyerAssignedID() {
return buyerAssignedID; return buyerAssignedID;
} }
@@ -183,4 +188,32 @@ public class Product implements IZUGFeRDExportableProduct {
this.VATPercent = VATPercent; this.VATPercent = VATPercent;
return this; return this;
} }
@Override
public String getCountryOfOrigin() {
return this.countryOfOrigin;
}
public Product setCountryOfOrigin(String countryOfOrigin) {
this.countryOfOrigin = countryOfOrigin;
return this;
}
@Override
public HashMap<String, String> getAttributes() {
return this.attributes;
}
public Product setAttributes(HashMap<String, String> attributes) {
this.attributes = attributes;
return this;
}
public Product addAttribute(String name, String value ) {
if ( this.attributes == null ) {
this.attributes = new HashMap<>();
}
this.attributes.put(name, value);
return this;
}
} }

View File

@@ -44,6 +44,12 @@ public interface IZUGFeRDAllowanceCharge {
*/ */
String getReason(); String getReason();
/***
* get the code for the allowance/charge
* @return the code
*/
String getReasonCode();
/*** /***
* get the applicable tax percentage for the allowance/charge * get the applicable tax percentage for the allowance/charge
* @return the percentage * @return the percentage

View File

@@ -21,6 +21,7 @@
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants; import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
@@ -156,4 +157,12 @@ public interface IZUGFeRDExportableProduct {
} }
return null; return null;
} }
default String getCountryOfOrigin() {
return null;
}
default HashMap<String, String> getAttributes() {
return null;
}
} }

View File

@@ -34,6 +34,7 @@ import java.util.Base64;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -243,10 +244,16 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
// only in extended profile // only in extended profile
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>"; reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
} }
String reasonCode = "";
if ((allowance.getReasonCode() != null) && (profile == Profiles.getByName("XRechnung"))) {
// only in XRechnung profile
reasonCode = "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
}
final String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" + final String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage + chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" + "<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
reason + reason +
reasonCode +
"</ram:AppliedTradeAllowanceCharge>"; "</ram:AppliedTradeAllowanceCharge>";
return allowanceChargeStr; return allowanceChargeStr;
} }
@@ -268,10 +275,21 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
chargeIndicator = "true"; chargeIndicator = "true";
} }
String reason = "";
if ((allowance.getReason() != null) && (profile == Profiles.getByName("Extended"))) {
// only in extended profile
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
}
String reasonCode = "";
if ((allowance.getReasonCode() != null) && (profile == Profiles.getByName("XRechnung"))) {
// only in XRechnung profile
reasonCode = "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
}
final String itemTotalAllowanceChargeStr = "<ram:SpecifiedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" + final String itemTotalAllowanceChargeStr = "<ram:SpecifiedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage + chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" + "<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
"<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>" + reason +
reasonCode +
"</ram:SpecifiedTradeAllowanceCharge>"; "</ram:SpecifiedTradeAllowanceCharge>";
return itemTotalAllowanceChargeStr; return itemTotalAllowanceChargeStr;
} }
@@ -397,6 +415,19 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
XMLTools.encodeXML(currentItem.getProduct().getDescription()) + XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
"</ram:Description>"; "</ram:Description>";
} }
if (currentItem.getProduct().getAttributes() != null) {
for ( Entry<String, String> entry : currentItem.getProduct().getAttributes().entrySet() ) {
xml += "<ram:ApplicableProductCharacteristic>" +
"<ram:Description>" + XMLTools.encodeXML(entry.getKey()) + "</ram:Description>" +
"<ram:Value>" + XMLTools.encodeXML(entry.getValue()) + "</ram:Value>" +
"</ram:ApplicableProductCharacteristic>";
}
}
if (currentItem.getProduct().getCountryOfOrigin() != null) {
xml += "<ram:OriginTradeCountry><ram:ID>" +
XMLTools.encodeXML(currentItem.getProduct().getCountryOfOrigin()) +
"</ram:ID></ram:OriginTradeCountry>";
}
xml += "</ram:SpecifiedTradeProduct>" xml += "</ram:SpecifiedTradeProduct>"
+ "<ram:SpecifiedLineTradeAgreement>"; + "<ram:SpecifiedLineTradeAgreement>";
@@ -631,7 +662,29 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) { if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
if (profile == Profiles.getByName("XRechnung")) {
for(IZUGFeRDAllowanceCharge charge : trans.getZFCharges()) {
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
"<ram:ChargeIndicator>" +
"<udt:Indicator>true</udt:Indicator>" +
"</ram:ChargeIndicator>" +
"<ram:ActualAmount>" + currencyFormat(charge.getTotalAmount(calc)) + "</ram:ActualAmount>";
if (charge.getReason() != null) {
xml += "<ram:Reason>" + XMLTools.encodeXML(charge.getReason()) + "</ram:Reason>";
}
if (charge.getReasonCode() != null) {
xml += "<ram:ReasonCode>" + charge.getReasonCode() + "</ram:ReasonCode>";
}
xml += "<ram:CategoryTradeTax>" +
"<ram:TypeCode>VAT</ram:TypeCode>" +
"<ram:CategoryCode>" + charge.getCategoryCode() + "</ram:CategoryCode>";
if (charge.getTaxPercent() != null) {
xml += "<ram:RateApplicablePercent>" + vatFormat(charge.getTaxPercent()) + "</ram:RateApplicablePercent>";
}
xml += "</ram:CategoryTradeTax>" +
"</ram:SpecifiedTradeAllowanceCharge>";
}
} else {
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) { for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) { if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
xml += "<ram:SpecifiedTradeAllowanceCharge>" + xml += "<ram:SpecifiedTradeAllowanceCharge>" +
@@ -649,8 +702,32 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
} }
} }
}
if ((trans.getZFAllowances() != null) && (trans.getZFAllowances().length > 0)) { if ((trans.getZFAllowances() != null) && (trans.getZFAllowances().length > 0)) {
if (profile == Profiles.getByName("XRechnung")) {
for(IZUGFeRDAllowanceCharge allowance : trans.getZFAllowances()) {
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
"<ram:ChargeIndicator>" +
"<udt:Indicator>false</udt:Indicator>" +
"</ram:ChargeIndicator>" +
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(calc)) + "</ram:ActualAmount>";
if (allowance.getReason() != null) {
xml += "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
}
if (allowance.getReasonCode() != null) {
xml += "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
}
xml += "<ram:CategoryTradeTax>" +
"<ram:TypeCode>VAT</ram:TypeCode>" +
"<ram:CategoryCode>" + allowance.getCategoryCode() + "</ram:CategoryCode>";
if (allowance.getTaxPercent() != null) {
xml += "<ram:RateApplicablePercent>" + vatFormat(allowance.getTaxPercent()) + "</ram:RateApplicablePercent>";
}
xml += "</ram:CategoryTradeTax>" +
"</ram:SpecifiedTradeAllowanceCharge>";
}
} else {
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) { for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) { if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
xml += "<ram:SpecifiedTradeAllowanceCharge>" + xml += "<ram:SpecifiedTradeAllowanceCharge>" +
@@ -668,6 +745,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
} }
} }
}
if ((trans.getPaymentTerms() == null) && (getProfile() != Profiles.getByName("Minimum")) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) { if ((trans.getPaymentTerms() == null) && (getProfile() != Profiles.getByName("Minimum")) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) {

View File

@@ -357,6 +357,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
boolean isCharge = true; boolean isCharge = true;
String chargeAmount = null; String chargeAmount = null;
String reason = null; String reason = null;
String reasonCode = null;
String taxPercent = null; String taxPercent = null;
for (int chargeChildIndex = 0; chargeChildIndex < chargeNodeChilds.getLength(); chargeChildIndex++) { for (int chargeChildIndex = 0; chargeChildIndex < chargeNodeChilds.getLength(); chargeChildIndex++) {
String chargeChildName = chargeNodeChilds.item(chargeChildIndex).getLocalName(); String chargeChildName = chargeNodeChilds.item(chargeChildIndex).getLocalName();
@@ -377,6 +378,8 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
chargeAmount = chargeNodeChilds.item(chargeChildIndex).getTextContent(); chargeAmount = chargeNodeChilds.item(chargeChildIndex).getTextContent();
} else if (chargeChildName.equals("Reason")) { } else if (chargeChildName.equals("Reason")) {
reason = chargeNodeChilds.item(chargeChildIndex).getTextContent(); reason = chargeNodeChilds.item(chargeChildIndex).getTextContent();
} else if (chargeChildName.equals("ReasonCode")) {
reasonCode = chargeNodeChilds.item(chargeChildIndex).getTextContent();
} else if (chargeChildName.equals("CategoryTradeTax")) { } else if (chargeChildName.equals("CategoryTradeTax")) {
NodeList taxChilds = chargeNodeChilds.item(chargeChildIndex).getChildNodes(); NodeList taxChilds = chargeNodeChilds.item(chargeChildIndex).getChildNodes();
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) { for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
@@ -395,16 +398,21 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
if (reason != null) { if (reason != null) {
c.setReason(reason); c.setReason(reason);
} }
if (reasonCode != null) {
c.setReasonCode(reasonCode);
}
if (taxPercent != null) { if (taxPercent != null) {
c.setTaxPercent(new BigDecimal(taxPercent)); c.setTaxPercent(new BigDecimal(taxPercent));
} }
zpp.addCharge(c); zpp.addCharge(c);
} else { } else {
Allowance a = new Allowance(new BigDecimal(chargeAmount)); Allowance a = new Allowance(new BigDecimal(chargeAmount));
if (reason != null) { if (reason != null) {
a.setReason(reason); a.setReason(reason);
} }
if (reasonCode != null) {
a.setReasonCode(reasonCode);
}
if (taxPercent != null) { if (taxPercent != null) {
a.setTaxPercent(new BigDecimal(taxPercent)); a.setTaxPercent(new BigDecimal(taxPercent));
} }

View File

@@ -321,7 +321,7 @@ public class ZUGFeRDVisualizer {
FOUserAgent userAgent = fopFactory.newFOUserAgent(); FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b"); userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-3b");
// Step 2: Set up output stream. // Step 2: Set up output stream.
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams). // Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).

View File

@@ -23,6 +23,7 @@ import java.math.BigDecimal;
public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge { public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
private BigDecimal totalAmount; private BigDecimal totalAmount;
private String reason; private String reason;
private String reasonCode;
private BigDecimal taxPercent; private BigDecimal taxPercent;
boolean isCharge=true; boolean isCharge=true;
@@ -36,6 +37,11 @@ public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
return reason; return reason;
} }
@Override
public String getReasonCode() {
return reasonCode;
}
@Override @Override
public BigDecimal getTaxPercent() { public BigDecimal getTaxPercent() {
return taxPercent; return taxPercent;
@@ -61,6 +67,11 @@ public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
return this; return this;
} }
public IZUGFeRDAllowanceChargeImpl setReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
return this;
}
public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) { public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) {
this.taxPercent = taxPercent; this.taxPercent = taxPercent;
return this; return this;

View File

@@ -63,8 +63,7 @@
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version> <version>3.0.0-M1</version>
<configuration> <configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
</altDeploymentRepository>
</configuration> </configuration>
</plugin> </plugin>
@@ -82,6 +81,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.3.1</version>
<configuration> <configuration>
<runOrder>alphabetical</runOrder> <runOrder>alphabetical</runOrder>
</configuration> </configuration>
@@ -90,9 +90,6 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version> <version>3.2.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions> <executions>
<execution> <execution>
<id>attach-javadoc</id> <id>attach-javadoc</id>
@@ -118,7 +115,6 @@
<github.global.server>github</github.global.server> <github.global.server>github</github.global.server>
<additionalparam>-Xdoclint:none</additionalparam> <additionalparam>-Xdoclint:none</additionalparam>
<!-- Skip error check for javadoc --> <!-- Skip error check for javadoc -->
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<maven.deploy.skip>true</maven.deploy.skip><!-- prevent this to be deployed to maven central as "core", <maven.deploy.skip>true</maven.deploy.skip><!-- prevent this to be deployed to maven central as "core",

View File

@@ -6,12 +6,10 @@
<version>2.13.0-SNAPSHOT</version> <version>2.13.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
<artifactId>validator</artifactId> <artifactId>validator</artifactId>
<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.13.0-SNAPSHOT</version>
<repositories> <repositories>
<repository> <repository>
<!-- for jargs --> <!-- for jargs -->
@@ -27,18 +25,15 @@
</repositories> </repositories>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.deploy.skip>false <maven.deploy.skip>false</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>library</artifactId> <artifactId>library</artifactId>
<version>2.13.0-SNAPSHOT</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
@@ -134,12 +129,6 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.3.2</version>
<configuration> <configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
mvn clean compile assembly:single -->
<!-- or whatever version you use -->
<source>11</source> <source>11</source>
<target>11</target> <target>11</target>
</configuration> </configuration>
@@ -163,24 +152,12 @@
<exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.RSA</exclude>
</excludes> </excludes>
</filter> </filter>
<filter>
<artifact>log4j:log4j</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter> <filter>
<artifact>commons-logging:commons-logging</artifact> <artifact>commons-logging:commons-logging</artifact>
<includes> <includes>
<include>**</include> <include>**</include>
</includes> </includes>
</filter> </filter>
<filter>
<artifact>com.sun.xml.bind:jaxb-impl</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters> </filters>
</configuration> </configuration>
<executions> <executions>