VRBL-INV-SG-1p4-18

Basic Info

Rule The value of the Payment Means Payment Means Code must be contained in UNCL4461 payment means [VRBL-CL-PaymentMeansCode] or be contained in Special payment means [VRBL-CL-SG-PaymentMeansCode] (prefixed by 'VRBL:SG:'). For more information visit: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL4461/
Context /ubl:Invoice/cac:PaymentMeans/cbc:PaymentMeansCode
Pattern vrbl-invoice-sg-1p4
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-CL-PaymentMeansCode or $VRBL-SG-Prefix:$VRBL-CL-SG-PaymentMeansCode
showValues = false

Implementation

not(boolean(.))
or
(
	(
		not(
			contains(
				normalize-space(.),
				substring($VRBL-CL-PaymentMeansCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-PaymentMeansCode,
			concat(
				substring($VRBL-CL-PaymentMeansCode, 1, 1),
				normalize-space(.),
				substring($VRBL-CL-PaymentMeansCode, 1, 1)
			)
		)
	)
)
or
(
	(
		substring(normalize-space(.), 1, string-length($VRBL-SG-Prefix)) = $VRBL-SG-Prefix
		and
		not(
			contains(
				substring-after(normalize-space(.), $VRBL-SG-Prefix),
				substring($VRBL-CL-SG-PaymentMeansCode, 1, 1)
			)
		)
		and
		contains(
			$VRBL-CL-SG-PaymentMeansCode,
			concat(
				substring($VRBL-CL-SG-PaymentMeansCode, 1, 1),
				substring-after(normalize-space(.), $VRBL-SG-Prefix),
				substring($VRBL-CL-SG-PaymentMeansCode, 1, 1)
			)
		)
	)
)