Skip to content

TaxIdValidatorInterface ​

Type
Interface
Namespace
craft\commerce\base
Implemented by
craft\commerce\taxidvalidators\EuVatIdValidator
Since
5.3.0

Interface for Tax ID Validators.

View source

Public Methods ​

MethodDescription
displayName()The display name of this tax ID type.
isEnabled()Tests if the validator is available for use by tax rates.
validate()This would usually just call validateFormat() and then validateExistence() and return the result.
validateExistence()Tests if the ID exists as valid in the country's tax system. This would usually be an API call.
validateFormat()Tests if the ID looks generally correct. This would usually be something like a regex check.

displayName() ​

Since
5.3.0

The display name of this tax ID type.

View source

Returns ​

string

isEnabled() ​

Since
5.3.0

Tests if the validator is available for use by tax rates.

This would usually be a check against the existence or settings or API keys so that the validator can be used.

View source

Returns ​

boolean

validate() ​

Since
5.3.0

This would usually just call validateFormat() and then validateExistence() and return the result.

View source

Arguments ​

Returns ​

boolean

validateExistence() ​

Since
5.3.0

Tests if the ID exists as valid in the country's tax system. This would usually be an API call.

View source

Arguments ​

Returns ​

boolean

validateFormat() ​

Since
5.3.0

Tests if the ID looks generally correct. This would usually be something like a regex check.

View source

Arguments ​

Returns ​

boolean