phax / phase4

phase4 - AS4 client and server for integration into existing systems. Specific support for Peppol and CEF eDelivery built-in.
Apache License 2.0
147 stars 48 forks source link

Peppol Reporting missing C1 country code for incoming items #207

Closed Jef-VDD closed 8 months ago

Jef-VDD commented 8 months ago

Hello @phax

Since 01.01.2024 when creating a reporting item for an incoming message that is missing their peppolSBD c1CountryCode we see logs a warning log:

C1 Country Code is missing

followed by error:

Not all mandatory fields are set. Cannot create Peppol Reporting Item

This is due to to the following statement that activated since 2024 in the PeppolReportingItem builder.

      if (PDTFactory.getCurrentLocalDateUTC ().compareTo (DATE_COUNTRY_C1_BECOMES_MANDATORY) >= 0)
      {
        if (StringHelper.hasNoText (m_sCountryC1))
        {
          LOGGER.warn ("The field 'countryC1' is not set");
          return false;
        }
      }

I recall from the SPC meetings if the C2 Service provider does not provide a C1 Country code we should report it as country code 'ZZ' from the following codelist https://docs.peppol.eu/edelivery/specs/reporting/tsr/trn-transaction_statistics/codelist/ISO3166/. However I can't seem to find this in any other documentation.

In short I would just like to know what the proposed way to handle missing c1CountryCodes are in the Phase4 implementation of the access point. Is it possible for the builder to fill in 'ZZ' if the C1 code is missing Or should the C3 accesspoint alter the incoming peppolSBD with country code ZZ that is handed over to Phase4PeppolServletMessageProcessorSPI.createPeppolReportingItemForReceivedMessage ?

Thanks for you work within the peppol space and a happy new year!

phax commented 8 months ago

Thanks for asking the question :)

From a PeppolReportingItem perspective, the country code is mandatory. As such this change is totally okay imho.

However, the change needs to happen at the place where the collection takes place. Based on the email from OpenPeppol you have basically two options when receiving a messages without a country code:

  1. Reject the message, based on non-compliance or
  2. Accept the message, but use ZZ as the "assumed country code of C1"

In scenario 1 you dont need aPeppolReportingItem. In scenario 2 you need to pass theZZto thePeppolReportingItem`

Hope that makes sense