VRBL-INV-AE-1p0-148

Basic Info

Rule If the Buyer Tax ID is marked as an AE VAT Identifier, it must be exactly 15 digits long, starting with 1 and ending with 03.
Context /ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
Pattern vrbl-invoice-AE-1p0
Severity fatal

Used Template: VRBL-AE-VAT-ID-Format

Implementation

not(../cac:TaxScheme/cbc:ID = 'VAT')
or
not(../../cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'AE')
or
(
	string-length(.) = 15
	and translate(., $Numerics, '') = ''
	and starts-with(., '1')
	and substring(., 14, 2) = '03'
)