Rule reference

BR-CO-21 Taken individually, the reason (BT-97) and the reason code (BT-98) on the document level allowance at allowances[0] are both optional terms — which is why this constraint exists separately from BR-33: it is the co-occurrence rule that forbids the one combination the cardinalities allow, namely neither

Taken individually, the reason (BT-97) and the reason code (BT-98) on the document level allowance at allowances[0] are both optional terms — which is why this constraint exists separately from BR-33: it is the co-occurrence rule that forbids the one combination the cardinalities allow, namely neither. Supplying both is explicitly permitted and is usually the better answer, since the code is what a receiving system can act on automatically and the text is what a person reads.

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-97 / BT-98
Severity
fatal

What the library returns

The exact object in result.errors when this rule fires. Generated by running @attestwire/en16931, not transcribed:

TeachingError
{
  "rule": "BR-CO-21",
  "field": [
    "BT-97",
    "BT-98"
  ],
  "severity": "fatal",
  "message": "Taken individually, the reason (BT-97) and the reason code (BT-98) on the document level allowance at allowances[0] are both optional terms — which is why this constraint exists separately from BR-33: it is the co-occurrence rule that forbids the one combination the cardinalities allow, namely neither. Supplying both is explicitly permitted and is usually the better answer, since the code is what a receiving system can act on automatically and the text is what a person reads.",
  "fix": "Add allowances[0].reason, allowances[0].reasonCode, or both. If no UNCL 5189 code fits what you are discounting, omit the code and write the reason as free text — the list has no \"other\" entry, and inventing a code fails BR-CL-19.",
  "example": "\"reason\": \"Discount\", \"reasonCode\": \"95\"",
  "xpath": "/ubl:Invoice/cac:AllowanceCharge[1]/cbc:AllowanceChargeReasonCode",
  "docsUrl": "https://attestwire.com/rules/BR-CO-21"
}

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

the shape this field expects
"reason": "Discount", "reasonCode": "95"

The fix

Add allowances[0].reason, allowances[0].reasonCode, or both. If no UNCL 5189 code fits what you are discounting, omit the code and write the reason as free text — the list has no "other" entry, and inventing a code fails BR-CL-19.

Arrived from a stack trace? The docsUrl on every error links straight here. Something wrong on this page — tell us.