BR-RO-110

Daca Codul tarii Vanzatorului (BT-40) este RO, atunci Subdiviziunea tarii Vanzatorului (BT-39) trebuie sa fie codificata folosind lista de coduri ISO 3166-2:RO (ex. "RO-B" pentru Municipiul Bucuresti, "RO-AB" pentru judetul Alba...). #If the Seller's country Code (BT-40) is RO, then the Seller's country subdivision (BT-39) must be coded using the ISO 3166-2: RO code list (ex. "RO-B" for Bucharest, "RO-AB" for Alba County...).

error: the document is invalid

Why it fails

  • The seller's address in Romania has no cbc:CountrySubentity, or it holds the county name (Cluj) or the code without its prefix (CJ).

How to fix it

Write the county as its ISO 3166-2:RO code: RO-CJ for Cluj, RO-AB for Alba, RO-B for Bucharest. BR-RO-111, BR-RO-170 and BR-RO-212 ask the same for the buyer, the tax representative and the delivery address.

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Context
/ubl:Invoice | /cn:CreditNote
Test
normalize-space(cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode) = 'RO' and not(normalize-space(cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity) = $ISO-3166-RO-CODES)

Checked with Romania RO e-Factura Invoice (UBL), Romania RO e-Factura Credit Note (UBL)