ConnectingEurope / eInvoicing-EN16931

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

Error in validation of rule BR-CO-25 #84

Closed SiwMeckelborg closed 5 years ago

SiwMeckelborg commented 5 years ago

The following issue has been reported to openPEPPOL: "When validating a credit note file using PEPPOL bis 3, if you populate the cbc:PayableAmount then the schematron expect either the DueDate or PaymentTerms/Notes to be popoulated (BR-CO-25] -In case the Amount due for payment (BT-115) is positive, either the Payment due date (BT-9) or the Payment terms (BT-20) shall be present.).

However, the Schematron is looking for the DueDate in the root of the XML, but this isn't a valid element according to the PEPPOL bis 3 credit note specification.

please can someone confirm if this is an issue and let us know if this will address in the fall 2018 release."

I did look into this a bit, and there is a problem that the rule does not check the PaymentDueDate that is used in the CreditNote schema, but I think maybe there should be some further consideration regarding the meaning of the rule text, it states (my emphasis): "In case the Amount due for payment (BT-115) is positive, either the Payment due date (BT-9) or the Payment terms (BT-20) shall be present.)"

On a credit note, a positive amount actually means you should not pay, so I think this rule should either be changed to only fire on an Invoice and not on a CreditNote, or test for positive amount on Invoice and negative amount on CreditNote.

oriol commented 5 years ago

There is an issue in the Syntax Binding of UBL, as the Credit Note Payment Due Date is mapped to ubl:CreditNote/cbc:DueDate when this element does not exist in UBL 2.1. It was introduced in UBL 2.2.

Therefore, this needs to be added in a future corrigenda of the mapping.

In order to solve this issue, I'd suggest not checking this rule for CreditNote until the mapping and the business rules are reviewed by the TC.

SiwMeckelborg commented 5 years ago

In table 4.4 in the TS, BT-9, Payment Due date is mapped to: "/CreditNote/cac:PaymentMeans/cbc:PaymentDueDate", so I think that is correct. My suggestion is to fix this validation by changing the context so it only matches Invoices, not Credit notes. In my opinion, the intention of this rule, is to say that if the invoice has an amount to be paid, a due date or payment terms must be sent. For a CreditNote however, a positive amount is not indicating you need to pay, hence the due date is not needed.