CustomerInputValidator

Implements \CustomerInputValidatorInterface

Class CustomerInputValidator

Validator class that checks the entered user data.

category

System

package

Customer

subpackage

Validation

implements

CustomerInputValidatorInterface

Methods

Constructor of the class CustomerInputValidator.

__construct(\CustomerServiceInterface $customerService, \CountryServiceInterface $countryService, \CustomerInputValidatorSettingsInterface $customerInputValidatorSettings, \CustomerCountryRepositoryInterface $customerCountryRepository, \CustomerCountryZoneRepositoryInterface $customerCountryZoneRepository, \VatNumberValidatorInterface $vatNumberValidator) 

Arguments

$customerService

\CustomerServiceInterface

Customer service.

$countryService

\CountryServiceInterface

Country service.

$customerInputValidatorSettings

\CustomerInputValidatorSettingsInterface

Customer input validator settings.

$customerCountryRepository

\CustomerCountryRepositoryInterface

Customer country repository.

$customerCountryZoneRepository

\CustomerCountryZoneRepositoryInterface

Customer country zone repository.

$vatNumberValidator

\VatNumberValidatorInterface

VAT number validator.

Returns a collection of error messages.

getErrorMessageCollection() : \EditableKeyValueCollection

Response

\EditableKeyValueCollection

Collection of error messages.

Returns error messages.

getErrorMessages() : array
deprecated

Use getErrorMessageCollection() instead

Response

array

Error messages.

Returns the error status.

getErrorStatus() : boolean

Response

boolean

Error status.

Checks if the entered additional values are valid.

validateAddonValues(\KeyValueCollection $addonValues) : boolean

Overload this method to implement needed validation logic.

Arguments

$addonValues

\KeyValueCollection

Customer's additional values.

Response

boolean

Is valid?

Checks if the captcha input is valid.

validateCaptcha(array $p_customerInput, string $p_section = 'vvCode') : boolean

Arguments

$p_customerInput

array

Input Customer form input.

$p_section

string

Captcha section.

Response

boolean

is captcha valid?

Checks if the entered city is valid.

validateCity(string $p_city) : boolean

Arguments

$p_city

string

Customer's city.

Response

boolean

Is valid?

Checks if the entered customer's company is valid.

validateCompany(string $p_company) : boolean

Arguments

$p_company

string

Customer's company.

Response

boolean

Is valid?

Checks if the entered country exists.

validateCountry(integer $p_countryId) : boolean

Arguments

$p_countryId

integer

Customer's country ID.

Response

boolean

Is valid?

Checks if the entered country zone is valid.

validateCountryZone( $p_countryZone,  $p_countryId) : boolean

Cases:

  • If country has zones: It checks if zone belongs to country.
  • If country does not contain zones: It checks the minimum length of zone name.

Arguments

$p_countryZone

Customer's country zone name.

$p_countryId

Customer's country ID.

Response

boolean

Is valid?

Checks if the entered customer's date of birth is valid.

validateDateOfBirth(string $p_dateOfBirth) : boolean

Valid format is: dd.mm.yyyy

Arguments

$p_dateOfBirth

string

Customer's date of birth.

Response

boolean

Is valid?

Checks if the entered email is valid.

validateEmail(string $p_email, mixed $p_emailAddressCheck = false) : boolean

Arguments

$p_email

string

Customer's E-Mail address.

$p_emailAddressCheck

mixed

C

Response

boolean

Is valid?

Checks if the entered email and email confirmation are valid.

validateEmailAndConfirmation(string $p_email, string $p_emailConfirmation) : boolean

It will check the minimum length, address syntax, confirmation matching and existence of e-mail address.

Arguments

$p_email

string

Customer's E-Mail address.

$p_emailConfirmation

string

Confirmation E-Mail address.

Response

boolean

Is valid?

Checks if the entered email already exists.

validateEmailExists(string $p_email, \CustomerInterface $customer = null) : boolean

Arguments

$p_email

string

Customer's E-Mail address-

$customer

\CustomerInterface

Customer.

Response

boolean

Is valid?

Checks if the entered fax number is valid.

validateFaxNumber(string $p_faxNumber) : boolean

Arguments

$p_faxNumber

string

Customer's fax number.

Response

boolean

Is valid?

Checks if the entered customer's first name is valid.

validateFirstname(string $p_firstname) : boolean

Arguments

$p_firstname

string

Customer's first name.

Response

boolean

Is valid?

Checks if the entered customer's gender is valid.

validateGender(string $p_gender) : boolean

Arguments

$p_gender

string

Customer's gender.

Response

boolean

Is valid?

Checks if the entered house number is valid.

validateHouseNumber(string $p_house_number) : boolean

Arguments

$p_house_number

string

Customer's house number.

Response

boolean

Is valid?

Checks if the entered customer's last name is valid.

validateLastname(string $p_lastname) : boolean

Arguments

$p_lastname

string

Customer's last name.

Response

boolean

Is valid?

Checks if the entered password is valid.

validatePassword(string $p_password, string $p_passwordConfirmation) : boolean

Arguments

$p_password

string

Customer's password.

$p_passwordConfirmation

string

Customer's password confirmation.

Response

boolean

Is valid?

Checks if the entered postcode is valid.

validatePostcode(string $p_postcode) : boolean

Arguments

$p_postcode

string

Customer's post code.

Response

boolean

Is valid?

Checks if the user has accepted the privacy policy.

validatePrivacy(string $p_privacyAccepted) : boolean

Arguments

$p_privacyAccepted

string

Response

boolean

Is valid?

Checks if the entered street is valid.

validateStreet(string $p_street) : boolean

Arguments

$p_street

string

Customer's street.

Response

boolean

Is valid?

Checks if the entered suburb is valid.

validateSuburb( $p_suburb) : boolean

Arguments

$p_suburb

Customer's suburb.

Response

boolean

Is valid?

Checks if the entered telephone number is valid.

validateTelephoneNumber(string $p_telephoneNumber) : boolean

Arguments

$p_telephoneNumber

string

Customer's telephone number.

Response

boolean

Is valid?

Checks if the entered parameters are in a valid format.

validateVatNumber(string $p_vatNumber, integer $p_countryId, boolean $p_isGuest) : boolean

Arguments

$p_vatNumber

string

VAT number.

$p_countryId

integer

Country ID.

$p_isGuest

boolean

Is customer a guest?

Response

boolean

Is valid?

IMPORTANT NOTE: The algorithm and PHPDoc block is copied from the xtc_date_raw() function.

xtcDateRaw(string $date, boolean $reverse = false) : string
inherited

The function file can be found here: src/inc/xtc_date_raw.inc.php

Return date in raw format.

Provided $p_date parameter should be in DD.MM.YYYY or MM.DD.YYYY format depending the current language. The result (raw date) will be formatted in YYYYMMDD. If the provided $p_date parameter is invalid the result will be an empty string.

Arguments

$date

string

$reverse

boolean

(optional)

Response

string

xtcValidateEmail

xtcValidateEmail( $email,  $emailAddressCheck) 
inherited

Arguments

$email

$emailAddressCheck

Properties

Customer country repository.

customerCountryRepository : \CustomerCountryRepositoryInterface

Customer country zone repository.

customerCountryZoneRepository : \CustomerCountryZoneRepositoryInterface

Customer service.

customerService : \CustomerServiceInterface

Country service.

countryService : \CountryServiceInterface

Customer input validator settings.

settings : \CustomerInputValidatorSettingsInterface

VAT number validator.

vatNumberValidator : \VatNumberValidatorInterface

Error message collection.

errorMessageCollection : \EditableKeyValueCollection

Error status.

errorStatus : boolean
var

Type(s)

boolean