Fix #1000 : support ItemSellerTradeParty in line level

This commit is contained in:
Zahi YOUSFI
2025-12-29 12:19:59 +01:00
parent eae7d95920
commit 3af1230401
3 changed files with 33 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ public class Item implements IZUGFeRDExportableItem {
protected String accountingReference; protected String accountingReference;
protected String parentLineID = null; protected String parentLineID = null;
protected String lineStatusReasonCode = null; protected String lineStatusReasonCode = null;
protected TradeParty lineSeller;
//protected HashMap<String, String> attributes = new HashMap<>(); //protected HashMap<String, String> attributes = new HashMap<>();
/*** /***
@@ -681,4 +682,19 @@ public class Item implements IZUGFeRDExportableItem {
this.lineStatusReasonCode = lineStatusReasonCode; this.lineStatusReasonCode = lineStatusReasonCode;
return this; return this;
} }
/***
* For line seller
* @param seller The line seller
* @return fluent setter
*/
public Item setLineSeller(TradeParty seller) {
this.lineSeller = seller;
return this;
}
@Override
public TradeParty getLineSeller() {
return this.lineSeller;
}
} }

View File

@@ -32,6 +32,7 @@ import java.util.List;
import org.mustangproject.IncludedNote; import org.mustangproject.IncludedNote;
import org.mustangproject.Item; import org.mustangproject.Item;
import org.mustangproject.TradeParty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -237,4 +238,13 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
} }
default LineCalculator getCalculation() {return new LineCalculator(this); }; default LineCalculator getCalculation() {return new LineCalculator(this); };
/***
* For line seller
* @return the seller
*/
default TradeParty getLineSeller() {
return null;
}
} }

View File

@@ -525,8 +525,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ "</ram:ChargeAmount>" // currencyID=\"EUR\" + "</ram:ChargeAmount>" // currencyID=\"EUR\"
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>" + "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
+ "</ram:NetPriceProductTradePrice>" + "</ram:NetPriceProductTradePrice>";
+ "</ram:SpecifiedLineTradeAgreement>"
if(currentItem.getLineSeller()!=null) {
xml += "<ram:ItemSellerTradeParty>" + getTradePartyAsXML(currentItem.getLineSeller(), true, false) + "</ram:ItemSellerTradeParty>";
}
xml += "</ram:SpecifiedLineTradeAgreement>"
+ "<ram:SpecifiedLineTradeDelivery>" + "<ram:SpecifiedLineTradeDelivery>"
+ "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">" + "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>" + quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>"