BR-04 An invoice must have an invoice type code (BT-3), but invoiceTypeCode was set to ""
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.
This rule is implemented and its error payload below is real, but the long-form write-up — normative text, worked example, divergence note — is not written yet. Everything the library knows about this rule is on this page. Ask and we will prioritise it.
- Business term
BT-3- Severity
fatal
What the library returns
The exact object in result.errors when this rule fires.
Generated by running @attestwire/en16931, not transcribed:
{
"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 locates the element in the generated UBL document,
which is where a KoSIT or Peppol validator will report the same problem.
A passing value
"invoiceTypeCode": "380"The fix
Remove invoiceTypeCode to accept the default "380" (commercial invoice), or set it to the UNTDID 1001 code you actually mean.