ConnectingEurope / eInvoicing-EN16931

Validation artefacts for the European eInvoicing standard EN 16931
Other
135 stars 53 forks source link

BR-17 rule checks too hard? #344

Closed aronkankel closed 7 months ago

aronkankel commented 1 year ago

If I use the same name for ApplicableHeaderTradeAgreement/SellerTradeParty/Name and ApplicableHeaderTradeSettlement/PayeeTradeParty/Name I get an fatal error.

<ram:ApplicableHeaderTradeAgreement>
  <ram:BuyerReference>123456XRechnung</ram:BuyerReference>
  <ram:SellerTradeParty>
    <ram:Name>Beispieldaten</ram:Name>
    <ram:DefinedTradeContact>
[...]
<ram:ApplicableHeaderTradeSettlement>
  <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
  <ram:PayeeTradeParty>
    <ram:Name>Beispieldaten</ram:Name>
  </ram:PayeeTradeParty>

See also a XRechnung and a validation report in the zip: BR-17.zip

The rule says: "BR-17 Eine Rechnung (INVOICE) muss den Namen des Zahlungsempfän- gers "Payee name" (BT-59) enthalten, wenn sich der Zahlungsemp- fänger "PAYEE" (BG-10) vom Verkäufer "SELLER" (BG-4) unterscheidet."

The Business-Term BT-59 says, the name can be equal. "Payee name BT-59 Text 1 20 Der Name des Zahlungsempfängers. Anmerkung: Wird verwendet, wenn der Zahlungsempfänger nicht mit dem Verkäufer identisch ist. Gleichwohl kann der Name des Zahlungsempfänger identisch sein mit dem Namen des Verkäufers."

I think, it shouldn't be an error, if the seller-name and the payee-name are equal.

The rule was changed in October 2022 with issue 322: https://github.com/ConnectingEurope/eInvoicing-EN16931/issues/322

phax commented 1 year ago

For completeness: the document is an XRechnung 2.3 document based on the CEN 1.3.9 rule release

aronkankel commented 1 year ago

The solution is to delete the complete block of ram:PayeeTradeParty (BG-10). BG-10 is optional and only should be filled if the payee differs from the seller.

11.22. Gruppe PAYEE Diese Informationselement (ID: BG-10, Anz. 0..1) ist ein direkter Bestandteil des Wurzelelements INVOICE, siehe Abschnitt 11.1: Das Wurzelelement INVOICE. Eine Gruppe von Informationselementen, die Informationen über den Zahlungsempfänger enthalten. Die Gruppe wird genutzt, wenn der Zahlungsempfänger nicht mit dem Verkäufer identisch ist.

I'll close this issue and omit the section ram:PayeeTradeParty if the payee and the seller are the same company.

JannickWeisshaupt commented 11 months ago

@phax is this actually fixed in 1.3.11? I don't find any diff that would indicate that, although it is listed as fixed in the release notes.

phax commented 11 months ago

I guess reopening this issue then makes more sense, instead of opening a new one. Oriol needs to answer the other question :)

oriol commented 7 months ago

As @aronkankel said, the solution is to delete the complete block of ram:PayeeTradeParty (BG-10) as it is optional.

Another solution would be droping rule BR-17 as the only way to check whether the Payee and the Seller are the same is comparing the name, and it is true that in the EN it says that these names may be the same.

I would suggest maintaining the rule as is and avoiding repeating the information in the Seller and in the Payee.

AndreasPvd commented 6 months ago

Please reopen. There are still some issues with this test. In the original discussion back in 2016 the idea was to assure that the information is not completely identical. This is why the additional tests on the Ids were introduced. Unfortunately, the test fails if for instance in the seller a Global ID is provided, but in the Payee (another) ID is provided.

The test should be modified in a way that it compares only existing properties and takes missing into account:

(ram:Name) and ( not(ram:Name = ../../ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:Name) or ( exists(ram:ID) != exists(../../ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:ID) or not(ram:ID = ../../ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:ID) ) or ( exists(ram:SpecifiedLegalOrganization/ram:ID) != exists(../../ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization/ram:ID) or not(ram:SpecifiedLegalOrganization/ram:ID = ../../ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedLegalOrganization/ram:ID) ) )

AndreasPvd commented 6 months ago

Alternatively I support dropping the rule completely.