Skip to content

Commit

Permalink
Merge branch 'master' into position-allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
InnuceEAN committed Feb 3, 2025
2 parents 8d2dc90 + 5ec06bd commit be2d072
Show file tree
Hide file tree
Showing 19 changed files with 952 additions and 104 deletions.
27 changes: 27 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
#705
#707
-#708
-#709
607
649
650
665
684
703
701
691





2.16.1
=======
2025-01-21
- #678 some ubl creditnote attributes are not parsed
- #679 validation of a XR does not ignore whitespace
- #681 IBAN assigned to invoice sender not recipient on direct debit
- #689 incorrect element order when both charge reason and reasoncode are specified
- be able to set detailedDeliveryPeriodFrom, detailedDeliveryPeriodTo MS188
- updated verapdf from 1.26.1 to 1.26.2
- cashDiscount JSON now corrently ignores values for cii and xr methods

2.16.0
=======
Expand Down
6 changes: 3 additions & 3 deletions Mustang-CLI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.mustangproject</groupId>
<artifactId>core</artifactId>
<version>2.15.3-SNAPSHOT</version>
<version>2.16.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
Expand All @@ -12,7 +12,7 @@
should also work for XRechnung/CII.
</name>
<packaging>jar</packaging>
<version>2.15.3-SNAPSHOT</version>
<version>2.16.2-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>org.mustangproject</groupId>
<artifactId>validator</artifactId>
<version>2.15.3-SNAPSHOT</version>
<version>2.16.2-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
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
-->
Expand Down
10 changes: 8 additions & 2 deletions library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<parent>
<groupId>org.mustangproject</groupId>
<artifactId>core</artifactId>
<version>2.15.3-SNAPSHOT</version>
<version>2.16.2-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
<artifactId>library</artifactId>
<version>2.15.3-SNAPSHOT</version>
<version>2.16.2-SNAPSHOT</version>
<packaging>jar</packaging>
<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
Expand Down Expand Up @@ -59,6 +59,12 @@
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>net.sf.offo</groupId>
<artifactId>fop-hyph</artifactId>
<version>2.0</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE -->
<dependency>
<groupId>net.sf.saxon</groupId>
Expand Down
3 changes: 3 additions & 0 deletions library/src/main/java/org/mustangproject/CashDiscount.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mustangproject;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.mustangproject.ZUGFeRD.IZUGFeRDCashDiscount;
Expand Down Expand Up @@ -63,6 +64,7 @@ public CashDiscount setDays(Integer days) {
/***
* @return this particular cash discount as cross industry invoice XML
*/
@JsonIgnore
public String getAsCII() {
return "<ram:SpecifiedTradePaymentTerms>"+
"<ram:Description>Cash Discount</ram:Description>"+
Expand All @@ -78,6 +80,7 @@ public String getAsCII() {
* XRechnung CIUS defined it's own proprietary format for a freetext field
* @return this particular cash discount in proprietary xrechnung format
*/
@JsonIgnore
public String getAsXRechnung() {
return "#SKONTO#TAGE="+days+"#PROZENT="+XMLTools.nDigitFormat(percent,2)+"#\n";
}
Expand Down
20 changes: 20 additions & 0 deletions library/src/main/java/org/mustangproject/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class Invoice implements IExportableTransaction {
protected String vatDueDateTypeCode = null;
protected String creditorReferenceID; // required when direct debit is used.
private BigDecimal roundingAmount=null;
private String paymentReference; // Remittance information / Verwendungszweck, BT-83

public Invoice() {
ZFItems = new ArrayList<>();
Expand Down Expand Up @@ -650,6 +651,16 @@ public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerms) {
return this;
}

@Override
public String getPaymentReference() {
return paymentReference;
}

public Invoice setPaymentReference(String paymentReference) {
this.paymentReference = paymentReference;
return this;
}

@Override
public TradeParty getDeliveryAddress() {
return deliveryAddress;
Expand Down Expand Up @@ -783,11 +794,20 @@ public Date getDetailedDeliveryPeriodFrom() {
return detailedDeliveryDateStart;
}

public Invoice setDetailedDeliveryPeriodFrom(Date dt) {
detailedDeliveryDateStart=dt;
return this;
}

@Override
public Date getDetailedDeliveryPeriodTo() {
return detailedDeliveryPeriodEnd;
}

public Invoice setDetailedDeliveryPeriodTo(Date dt) {
detailedDeliveryPeriodEnd=dt;
return this;
}

/**
* adds a free text paragraph, which will become an includedNote element
Expand Down
4 changes: 4 additions & 0 deletions library/src/main/java/org/mustangproject/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ public Item(NodeList itemChilds, boolean recalcPrice) {
.flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent"))
.ifPresent(product::setVATPercent);

icnm.getAsNodeMap("ApplicableTradeTax")
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
.ifPresent(product::setTaxExemptionReason);

if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
.flatMap(cnm -> cnm.getAsBigDecimal("LineTotalAmount"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ default IZUGFeRDPaymentTerms getPaymentTerms() {
return null;
}

default String getPaymentReference() {
return null;
}

/**
* returns if a rebate agreements exists
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ protected String getAllowanceChargeStr(IZUGFeRDAllowanceCharge allowance, IAbsol
final String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
reason +
reasonCode +
reason +
"</ram:AppliedTradeAllowanceCharge>";
return allowanceChargeStr;
}
Expand Down Expand Up @@ -323,8 +323,8 @@ protected String getItemTotalAllowanceChargeStr(IZUGFeRDAllowanceCharge allowanc
final String itemTotalAllowanceChargeStr = "<ram:SpecifiedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
reason +
reasonCode +
reason +
"</ram:SpecifiedTradeAllowanceCharge>";
return itemTotalAllowanceChargeStr;
}
Expand Down Expand Up @@ -388,14 +388,13 @@ public void generateXML(IExportableTransaction trans) {
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
+ "</rsm:ExchangedDocumentContext>"
+ "<rsm:ExchangedDocument>"
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
// + "<ram:Name>RECHNUNG</ram:Name>"
// + "<ram:TypeCode>380</ram:TypeCode>"
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
+ "<ram:IssueDateTime>"
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>";
if (profile == Profiles.getByName("Extended") && trans.getDocumentName() != null) {
xml += "<ram:Name>" + XMLTools.encodeXML(trans.getDocumentName()) + "</ram:Name>";
}
xml += "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
+ "<ram:IssueDateTime>" + DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
+ buildNotes(trans)

+ "</rsm:ExchangedDocument>"
+ "<rsm:SupplyChainTradeTransaction>";
int lineID = 0;
Expand Down Expand Up @@ -662,8 +661,8 @@ public void generateXML(IExportableTransaction trans) {
if ((trans.getCreditorReferenceID() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
xml += "<ram:CreditorReferenceID>" + XMLTools.encodeXML(trans.getCreditorReferenceID()) + "</ram:CreditorReferenceID>";
}
if ((trans.getNumber() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>";
if ((trans.getPaymentReference() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getPaymentReference()) + "</ram:PaymentReference>";
}
xml += "<ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>";
if (this.trans.getPayee() != null) {
Expand Down Expand Up @@ -744,12 +743,12 @@ public void generateXML(IExportableTransaction trans) {
"<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>";
}
if (charge.getReason() != null) {
xml += "<ram:Reason>" + XMLTools.encodeXML(charge.getReason()) + "</ram:Reason>";
}
xml += "<ram:CategoryTradeTax>" +
"<ram:TypeCode>VAT</ram:TypeCode>" +
"<ram:CategoryCode>" + charge.getCategoryCode() + "</ram:CategoryCode>";
Expand Down
Loading

0 comments on commit be2d072

Please sign in to comment.