Skip to content

Commit

Permalink
Merge pull request #385 from Syntaxrabbit/master
Browse files Browse the repository at this point in the history
Avoid Exception in InvoiceDescriptor22UBLWriter, satisfy validators for XRechnung with charges or allowances
  • Loading branch information
stephanstapel authored Oct 9, 2024
2 parents eaac0fe + 54a9fb5 commit 24fd9da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ZUGFeRD/InvoiceDescriptor22UBLWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, PartyTypes pa
writer.WriteEndElement();
}

if (this.Descriptor.PaymentMeans.SEPAMandateReference != null)
if (this.Descriptor.PaymentMeans?.SEPAMandateReference != null)
{
writer.WriteStartElement("cac:PartyIdentification");
writer.WriteStartElement("cbc:ID");
Expand Down
4 changes: 2 additions & 2 deletions ZUGFeRD/InvoiceDescriptor23CIIWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,11 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo

#region SpecifiedTradeAllowanceCharge (Basic, Comfort, Extended)
//Abschläge auf Ebene der Rechnungsposition (Basic, Comfort, Extended)
if (new Profile[] { Profile.Basic, Profile.Comfort, Profile.Extended }.Contains(descriptor.Profile))
if (new Profile[] { Profile.Basic, Profile.Comfort, Profile.Extended, Profile.XRechnung }.Contains(descriptor.Profile))
{
if (tradeLineItem.GetSpecifiedTradeAllowanceCharges().Count > 0)
{
Writer.WriteStartElement("ram:SpecifiedTradeAllowanceCharge", Profile.Basic | Profile.Comfort | Profile.Extended);
Writer.WriteStartElement("ram:SpecifiedTradeAllowanceCharge", Profile.Basic | Profile.Comfort | Profile.Extended | Profile.XRechnung);

foreach (TradeAllowanceCharge specifiedTradeAllowanceCharge in tradeLineItem.GetSpecifiedTradeAllowanceCharges()) // BT-147
{
Expand Down

0 comments on commit 24fd9da

Please sign in to comment.