VRBL-INV-AE-1p0-119

Basic Info

Rule When the Buyer Party Legal Entity Company ID, Buyer Endpoint ID Scheme ID = '0235', and the Buyer Endpoint ID starts with '1', the value of the Buyer Party Legal Entity Company ID Scheme Agency ID must be contained in UAE schemeAgencyID codes [VRBL-CL-AE-schemeAgencyID] or be contained in UAE schemeAgencyID codes [VRBL-CL-AE-schemeAgencyID] (prefixed by 'VRBL:AE:'). Allowed values: CD, EID, PAS, TL or VRBL:AE:CD, VRBL:AE:EID, VRBL:AE:PAS, VRBL:AE:TL.
Context /ubl:Invoice/cac:AccountingCustomerParty/cac:Party
Pattern vrbl-invoice-AE-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID
codeList = $VRBL-CL-AE-schemeAgencyID or $VRBL-AE-Prefix:$VRBL-CL-AE-schemeAgencyID
showValues = true

Implementation

(
	not(cac:PartyLegalEntity/cbc:CompanyID and cbc:EndpointID/@schemeID = '0235' and not(starts-with(cbc:EndpointID, '1')))
)
or
(
	not(boolean(cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID))
	or
	(
		(
			not(
				contains(
					normalize-space(cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID),
					substring($VRBL-CL-AE-schemeAgencyID, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-AE-schemeAgencyID,
				concat(
					substring($VRBL-CL-AE-schemeAgencyID, 1, 1),
					normalize-space(cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID),
					substring($VRBL-CL-AE-schemeAgencyID, 1, 1)
				)
			)
		)
	)
	or
	(
		(
			substring(normalize-space(cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID), 1, string-length($VRBL-AE-Prefix)) = $VRBL-AE-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID), $VRBL-AE-Prefix),
					substring($VRBL-CL-AE-schemeAgencyID, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-AE-schemeAgencyID,
				concat(
					substring($VRBL-CL-AE-schemeAgencyID, 1, 1),
					substring-after(normalize-space(cac:PartyLegalEntity/cbc:CompanyID/@schemeAgencyID), $VRBL-AE-Prefix),
					substring($VRBL-CL-AE-schemeAgencyID, 1, 1)
				)
			)
		)
	)
)