VRBL-INV-MX-1p0-47

Basic Info

Rule The Seller Tax ID must be a valid RFC. For a Legal Entity, 12 characters are expected (3 Letters, 6 Digits, 3 Alphanumeric). For a Natural Person, 13 characters are expected (4 Letters, 6 Digits, 3 Alphanumeric).
Context /ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
Pattern vrbl-invoice-mx-1p0
Severity fatal

Used Template: VRBL-MX-IsRFC

Parameter Value
probe = .

Implementation

(
	not(../../cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'MX') and normalize-space(../../cac:PostalAddress/cac:Country/cbc:IdentificationCode) != ''
)
or
(
	(
		string-length(.) = 12 
		and 
		translate(substring(., 1, 3), $AlphabetUpperCase, '') = '' 
		and 
		translate(substring(., 4, 6), $Numerics, '') = '' 
		and 
		translate(substring(., 10, 3), $AlphaNumerics, '') = ''
	) 
		or 
	(
		string-length(.) = 13 
		and 
		translate(substring(., 1, 4), $AlphabetUpperCase, '') = '' 
		and 
		translate(substring(., 5, 6), $Numerics, '') = '' 
		and 
		translate(substring(., 11, 3), $AlphaNumerics, '') = ''
	)
)