AttestwireRule referenceBR-CL-15

BR-CL-15 An item’s country of origin must be an ISO 3166-1 alpha-2 code

noun · EN 16931 · fatal · BT-159

For a sample invoice, the library reports: Line 1 declares an item country of origin (BT-159) of "UK", which is not an ISO 3166-1 code. The United Kingdom is "GB" in ISO 3166-1 — "UK" is a reserved code and is not in the list.

Business term
BT-159
Severity
fatal

The fix

Set line.originCountryCode to the two-letter ISO 3166-1 code of the country where the item was produced — not where it shipped from, which is a different fact. Omit the field when origin is not relevant to the supply, as it usually is not for services.

A passing value

the shape this field expects
"originCountryCode": "CN"

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-CL-15",
  "field": "BT-159",
  "severity": "fatal",
  "message": "Line 1 declares an item country of origin (BT-159) of \"UK\", which is not an ISO 3166-1 code. The United Kingdom is \"GB\" in ISO 3166-1 — \"UK\" is a reserved code and is not in the list. Origin is a customs and trade-preference fact, not a shipping detail: it decides duty rates, preferential-origin claims and whether the goods fall under a sanctions or safeguard measure. It is checked under its own rule id, BR-CL-15, because it binds cac:OriginCountry — the same list as BR-CL-14 on a different element, so a report can show one failing while the other passes.",
  "fix": "Set line.originCountryCode to the two-letter ISO 3166-1 code of the country where the item was produced — not where it shipped from, which is a different fact. Omit the field when origin is not relevant to the supply, as it usually is not for services.",
  "example": "\"originCountryCode\": \"CN\"",
  "xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cac:Item/cac:OriginCountry/cbc:IdentificationCode",
  "docsUrl": "https://attestwire.com/rules/BR-CL-15"
}

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