VRBL-PAY-PL-4

Basic Info

Rule The Statement UUID MUST be provided and comply with the required format pattern ^([1-9](\d[1-9]|[1-9]\d)\d{7}|[1-9]\d{7}|M\d{9}|[A-Z]{3}\d{7})-(20[2-9][0-9]|2[1-9][0-9]{2}|[3-9][0-9]{3})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])-([0-9A-F]{6})-?([0-9A-F]{6})-([0-9A-F]{2})$
Context /ubl:Statement/cac:StatementLine
Pattern vrbl-statement-pl-paymentidrequest-1p0
Severity fatal

Implementation

cbc:UUID
and contains(cbc:UUID, '-')
and (
	(
		string-length(substring-before(cbc:UUID, '-')) = 10
		and translate(substring-before(cbc:UUID, '-'), $Numerics, '') = ''
		and substring(substring-before(cbc:UUID, '-'), 1, 1) != '0'
		and substring(substring-before(cbc:UUID, '-'), 2, 2) != '00'
	)
	or
	(
		string-length(substring-before(cbc:UUID, '-')) = 8
		and translate(substring(substring-before(cbc:UUID, '-'), 1, 1), '123456789', '') = ''
		and translate(substring(substring-before(cbc:UUID, '-'), 2, 7), $Numerics, '') = ''
	)
	or
	(
		string-length(substring-before(cbc:UUID, '-')) = 10
		and substring(substring-before(cbc:UUID, '-'), 1, 1) = 'M'
		and translate(substring(substring-before(cbc:UUID, '-'), 2, 9), $Numerics, '') = ''
	)
	or
	(
		string-length(substring-before(cbc:UUID, '-')) = 10
		and translate(substring(substring-before(cbc:UUID, '-'), 1, 3), $AlphabetUpperCase, '') = ''
		and translate(substring(substring-before(cbc:UUID, '-'), 4, 7), $Numerics, '') = ''
	)
)
and (
	(string-length(substring-after(cbc:UUID, '-')) = 24 or string-length(substring-after(cbc:UUID, '-')) = 25)
	and translate(substring(substring-after(cbc:UUID, '-'), 1, 8), $Numerics, '') = ''
	and number(substring(substring-after(cbc:UUID, '-'), 1, 4)) >= 2020
	and number(substring(substring-after(cbc:UUID, '-'), 5, 2)) >= 1
	and number(substring(substring-after(cbc:UUID, '-'), 5, 2)) <= 12
	and number(substring(substring-after(cbc:UUID, '-'), 7, 2)) >= 1
	and number(substring(substring-after(cbc:UUID, '-'), 7, 2)) <= 31
	and substring(substring-after(cbc:UUID, '-'), 9, 1) = '-'
	and translate(substring(substring-after(cbc:UUID, '-'), 10, 6), '0123456789ABCDEF', '') = ''
	and (
		(
			string-length(substring-after(cbc:UUID, '-')) = 25
			and substring(substring-after(cbc:UUID, '-'), 16, 1) = '-'
			and translate(substring(substring-after(cbc:UUID, '-'), 17, 6), '0123456789ABCDEF', '') = ''
			and substring(substring-after(cbc:UUID, '-'), 23, 1) = '-'
			and translate(substring(substring-after(cbc:UUID, '-'), 24, 2), '0123456789ABCDEF', '') = ''
		)
		or
		(
			string-length(substring-after(cbc:UUID, '-')) = 24
			and translate(substring(substring-after(cbc:UUID, '-'), 16, 6), '0123456789ABCDEF', '') = ''
			and substring(substring-after(cbc:UUID, '-'), 22, 1) = '-'
			and translate(substring(substring-after(cbc:UUID, '-'), 23, 2), '0123456789ABCDEF', '') = ''
		)
	)
)