Skip to content

TradeParty Name should be optional for ShipToTradeParty #772

@ivantomic77

Description

@ivantomic77

Issue: TradeParty Name Should Be Optional for ShipToTradeParty

Description

I am generating an XRechnung invoice using ZUGFeRD2PullProvider. The delivery information includes an optional field, Deliver to party name (BT-70), which, according to the specification, is not mandatory. However, the current implementation does not handle null values for this field, leading to potential issues.

The issue arises because the same function is used for creating a TradeParty, and this function does not allow the name field to be optional.

ZUGFeRD2PullProvider.java - Lines 635-649

if (this.trans.getDeliveryAddress() != null) {
	xml += "<ram:ShipToTradeParty>" +
		getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
		"</ram:ShipToTradeParty>";
}

ZUGFeRD2PullProvider.java - Line 142

xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";

Suggested fix:

if (party.getName() != null && !party.getName().isEmpty()) {
    xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";
}

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions