Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2.24.x
=======
- #1162 Skip the elements "Information" and "PayeeSpecifiedCreditorFinancialInstitution" for basic profiles.
- #1134 Fix: Trade party universal communication id not imported when scheme is not "email address" (EM) but "electronic address" (0225).
- #1150 Remove [D].[M].[Y] after Rechnungsdatum in HTML visualization
- #996 Omit ExemptionReason written to line item level for profile EN16931, some validators raise a warning or even an error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ public interface IZUGFeRDTradeSettlement {
* @return zf2 xml
*/
@JsonIgnore
String getSettlementXML();
String getSettlementXML(Profile profile);


/***
* gets the applicableHeaderTradePayment
* @return zf2 xml
*/
@JsonIgnore
default String getPaymentXML() {
default String getPaymentXML() {
return null;
}



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {

@Override
default String getSettlementXML() {
default String getSettlementXML(Profile profile) {
String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
+ "<ram:TypeCode>" + XMLTools.encodeXML(getPaymentMeansCode()) + "</ram:TypeCode>"
+ "<ram:Information>" + XMLTools.encodeXML(getPaymentMeansInformation()) + "</ram:Information>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
package org.mustangproject.ZUGFeRD;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.Arrays;
import java.util.List;

import org.mustangproject.XMLTools;

public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement {
Expand Down Expand Up @@ -62,41 +66,42 @@ default String getOwnIBAN() {
/***
* @return payment means code (BT-81 / UNTDID 4461)
*/
default String getPaymentMeansCode() { return null; };
default String getPaymentMeansCode() { return null; }

/***
* @return payment means description (BT-82) (optional)
*/
default String getPaymentMeansInformation() { return null; };
default String getPaymentMeansInformation() { return null; }


@Override
@JsonIgnore
default String getSettlementXML() {
default String getSettlementXML(Profile profile) {
List<Profile> basicProfiles = Arrays.asList(Profiles.getByName("Basic", 1), Profiles.getByName("BasicWL", 2), Profiles.getByName("Basic", 2));
String accountNameStr="";
if (getAccountName()!=null) {
if (getAccountName() != null) {
accountNameStr="<ram:AccountName>" + XMLTools.encodeXML(getAccountName()) + "</ram:AccountName>";

}

String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
+ "<ram:TypeCode>" + XMLTools.encodeXML(getPaymentMeansCode()) + "</ram:TypeCode>"
+ "<ram:Information>" + XMLTools.encodeXML(getPaymentMeansInformation()) + "</ram:Information>";
+ "<ram:TypeCode>" + XMLTools.encodeXML(getPaymentMeansCode()) + "</ram:TypeCode>";
if (!basicProfiles.contains(profile) && getOwnBIC() != null) {
xml += "<ram:Information>" + XMLTools.encodeXML(getPaymentMeansInformation()) + "</ram:Information>";
}
if (getOwnIBAN() != null) {
xml += "<ram:PayeePartyCreditorFinancialAccount>"
+ "<ram:IBANID>" + XMLTools.encodeXML(getOwnIBAN()) + "</ram:IBANID>"
+ accountNameStr
+ "</ram:PayeePartyCreditorFinancialAccount>";
}
if (getOwnBIC()!=null) {
xml+= "<ram:PayeeSpecifiedCreditorFinancialInstitution>"
if (!basicProfiles.contains(profile) && getOwnBIC() != null) {
xml += "<ram:PayeeSpecifiedCreditorFinancialInstitution>"
+ "<ram:BICID>" + XMLTools.encodeXML(getOwnBIC()) + "</ram:BICID>"
// + " <ram:Name>"+trans.getOwnBankName()+"</ram:Name>"
//
+ "</ram:PayeeSpecifiedCreditorFinancialInstitution>";

}
xml+= "</ram:SpecifiedTradeSettlementPaymentMeans>";
xml += "</ram:SpecifiedTradeSettlementPaymentMeans>";
return xml;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public void generateXML(IExportableTransaction trans) {
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
if (payment != null) {
hasDueDate = true;
xml += payment.getSettlementXML();
xml += payment.getSettlementXML(getProfile());
}
}
}
Expand All @@ -250,7 +250,7 @@ public void generateXML(IExportableTransaction trans) {
if (payment instanceof IZUGFeRDTradeSettlementPayment) {
hasDueDate = true;
}
xml += payment.getSettlementXML();
xml += payment.getSettlementXML(getProfile());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ public BigDecimal getQuantity() {
if (payment != null) {
hasDueDate = true;
if (getProfile() != Profiles.getByName("Minimum")) {
xml += payment.getSettlementXML();
xml += payment.getSettlementXML(getProfile());
}
}
}
Expand All @@ -825,7 +825,7 @@ public BigDecimal getQuantity() {
hasDueDate = true;
}
if (getProfile() != Profiles.getByName("Minimum")) {
xml += payment.getSettlementXML();
xml += payment.getSettlementXML(getProfile());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mustangproject.BankDetails;
import org.mustangproject.Invoice;
import org.mustangproject.Item;
import org.mustangproject.Product;
Expand Down Expand Up @@ -74,13 +75,14 @@ void should_generate_xml_and_include_basic_profile_and_invoice_content_to_build_

provider.generateXML(invoice);
String xml = new String(provider.getXML(), StandardCharsets.UTF_8);

assertTrue(xml.contains("urn:ferd:CrossIndustryDocument:invoice:1p0"));
assertTrue(xml.contains("<ram:GuidelineSpecifiedDocumentContextParameter>"));
assertTrue(xml.contains("<ram:ID>urn:ferd:CrossIndustryDocument:invoice:1p0:basic</ram:ID>"));
assertTrue(xml.contains("<ram:ID>INV-1</ram:ID>"));
assertTrue(xml.contains("<ram:IncludedSupplyChainTradeLineItem>"));
assertTrue(xml.contains("<!-- generated by: mustangproject.org -->"));
assertFalse(xml.contains("<ram:Information>"));
assertFalse(xml.contains("<ram:BICID>"));
}

@Test
Expand Down Expand Up @@ -154,7 +156,7 @@ private Invoice createMinimalInvoice() {
Date deliveryDate = new Date(1700000000000L);
Date dueDate = new Date(1700600000000L);

TradeParty seller = new TradeParty("Seller GmbH", "Musterstr. 1", "10115", "Berlin", "DE");
TradeParty seller = new TradeParty("Seller GmbH", "Musterstr. 1", "10115", "Berlin", "DE").addBankDetails(new BankDetails("DE88200800000970375700", "COBADEFFXXX").setPaymentMeansInformation("whatever it takes"));
TradeParty buyer = new TradeParty("Buyer AG", "Beispielweg 2", "80331", "Muenchen", "DE");

Product product = new Product("Beratung", "IT-Beratung", "C62", new BigDecimal("19.00"));
Expand Down
Loading