AttestwireRule referenceBR-04

BR-04 An invoice must have an invoice type code

noun · EN 16931 · fatal · BT-3

For a sample invoice, the library reports: An invoice must have an invoice type code (BT-3), but invoiceTypeCode was set to "". The type code is what distinguishes a commercial invoice from a partial invoice, a correction or a self-billed document, and receiving systems branch on it before they read anything else.

Business term
BT-3
Severity
fatal

The fix

Remove invoiceTypeCode to accept the default "380" (commercial invoice), or set it to the UNTDID 1001 code you actually mean.

A passing value

the shape this field expects
"invoiceTypeCode": "380"

What the library returns

The full error returned by @attestwire/en16931. It includes the rule ID, affected field and suggested correction. Developers can use this object in their application:

TeachingError
{
  "rule": "BR-04",
  "field": "BT-3",
  "severity": "fatal",
  "message": "An invoice must have an invoice type code (BT-3), but invoiceTypeCode was set to \"\". The type code is what distinguishes a commercial invoice from a partial invoice, a correction or a self-billed document, and receiving systems branch on it before they read anything else. An empty string is not the same as omitting the field: omit it and this library supplies the default \"380\"; set it empty and you have explicitly asked for a document with no type.",
  "fix": "Remove invoiceTypeCode to accept the default \"380\" (commercial invoice), or set it to the UNTDID 1001 code you actually mean.",
  "example": "\"invoiceTypeCode\": \"380\"",
  "xpath": "/ubl:Invoice/cbc:InvoiceTypeCode",
  "docsUrl": "https://attestwire.com/rules/BR-04"
}

xpath is always a UBL path. On a CII invoice, look for the matching CII field instead.