Rule reference

BR-57 The invoice carries a deliver-to address group (BG-15), so it must contain a deliver-to country code (BT-80)

The invoice carries a deliver-to address group (BG-15), so it must contain a deliver-to country code (BT-80). BG-15 is optional, but it is not partially optional: the country is the one element of a delivery address that carries tax consequence, because it is what separates a domestic supply from an export, an intra-community supply or a reverse-charge case.

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-80
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-57",
  "field": "BT-80",
  "severity": "fatal",
  "message": "The invoice carries a deliver-to address group (BG-15), so it must contain a deliver-to country code (BT-80). BG-15 is optional, but it is not partially optional: the country is the one element of a delivery address that carries tax consequence, because it is what separates a domestic supply from an export, an intra-community supply or a reverse-charge case.",
  "fix": "Set deliverTo.countryCode to the ISO 3166-1 alpha-2 code of the place of delivery, or remove deliverTo entirely if the goods or services were delivered to the buyer's own address. Under XRechnung, keeping BG-15 also obliges you to supply deliverTo.city and deliverTo.postalCode (BR-DE-10, BR-DE-11).",
  "example": "\"deliverTo\": { \"city\": \"Lyon\", \"postalCode\": \"69001\", \"countryCode\": \"FR\" }",
  "xpath": "/ubl:Invoice/cac:Delivery/cac:DeliveryLocation/cac:Address/cac:Country/cbc:IdentificationCode",
  "docsUrl": "https://attestwire.com/rules/BR-57"
}

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
"deliverTo": { "city": "Lyon", "postalCode": "69001", "countryCode": "FR" }

The fix

Set deliverTo.countryCode to the ISO 3166-1 alpha-2 code of the place of delivery, or remove deliverTo entirely if the goods or services were delivered to the buyer's own address. Under XRechnung, keeping BG-15 also obliges you to supply deliverTo.city and deliverTo.postalCode (BR-DE-10, BR-DE-11).

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