Skip to content

Commit

Permalink
Added fallback to ZZ
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Jan 29, 2024
1 parent 4bc18ca commit ec6ae9c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import com.helger.xml.serialize.write.XMLWriter;
import com.helger.xsds.peppol.smp1.EndpointType;
import com.helger.xsds.peppol.smp1.SignedServiceMetadataType;
import com.helper.peppol.reporting.api.CPeppolReporting;
import com.helper.peppol.reporting.api.PeppolReportingItem;

/**
Expand Down Expand Up @@ -509,6 +510,13 @@ public static PeppolReportingItem createPeppolReportingItemForReceivedMessage (@

try
{
String sC1CountryCode = aPeppolSBD.getCountryC1 ();
if (StringHelper.hasNoText (sC1CountryCode))
{
// Fallback to ZZ to make sure the item can be created
sC1CountryCode = CPeppolReporting.REPLACEMENT_COUNTRY_CODE;
}

return PeppolReportingItem.builder ()
.exchangeDateTime (aExchangeDT)
.directionReceiving ()
Expand All @@ -517,7 +525,7 @@ public static PeppolReportingItem createPeppolReportingItemForReceivedMessage (@
.docTypeID (aPeppolSBD.getDocumentTypeAsIdentifier ())
.processID (aPeppolSBD.getProcessAsIdentifier ())
.transportProtocolPeppolAS4v2 ()
.c1CountryCode (aPeppolSBD.getCountryC1 ())
.c1CountryCode (sC1CountryCode)
.c4CountryCode (sC4CountryCode)
.endUserID (sEndUserID)
.build ();
Expand Down

0 comments on commit ec6ae9c

Please sign in to comment.