CustomerAccountInputValidator
extends CustomerInputValidator
in package
implements
CustomerAccountInputValidatorInterface
Class CustomerAccountInputValidator
This class is used for validating input data from the customer account
Tags
Interfaces, Classes and Traits
- CustomerAccountInputValidatorInterface
- Interface CustomerAccountInputValidatorInterface
Table of Contents
- $countryService : CountryServiceInterface
- Country service.
- $customerCountryRepository : CustomerCountryRepositoryInterface
- Customer country repository.
- $customerCountryZoneRepository : CustomerCountryZoneRepositoryInterface
- Customer country zone repository.
- $customerService : CustomerServiceInterface
- Customer service.
- $errorMessageCollection : EditableKeyValueCollection
- Error message collection.
- $errorStatus : bool
- Error status.
- $settings : CustomerInputValidatorSettingsInterface
- Customer input validator settings.
- $vatNumberValidator : VatNumberValidatorInterface
- VAT number validator.
- __construct() : mixed
- Constructor of the class CustomerInputValidator.
- getErrorMessageCollection() : EditableKeyValueCollection
- Returns a collection of error messages.
- getErrorMessages() : array<string|int, mixed>
- Returns error messages.
- getErrorStatus() : bool
- Returns the error status.
- validateAddonValues() : bool
- Checks if the entered additional values are valid.
- validateByArray() : bool
- Checks if the entered customer data is valid based on an array.
- validateCaptcha() : bool
- Checks if the captcha input is valid.
- validateCity() : bool
- Checks if the entered city is valid.
- validateCompany() : bool
- Checks if the entered customer's company is valid.
- validateCountry() : bool
- Checks if the entered country exists.
- validateCountryZone() : bool
- Checks if the entered country zone is valid.
- validateDateOfBirth() : bool
- Checks if the entered customer's date of birth is valid.
- validateEmail() : bool
- Checks if the entered email is valid.
- validateEmailAndConfirmation() : bool
- Checks if the entered email and email confirmation are valid.
- validateEmailExists() : bool
- Checks if the entered email already exists.
- validateFaxNumber() : bool
- Checks if the entered fax number is valid.
- validateFirstname() : bool
- Checks if the entered customer's first name is valid.
- validateGender() : bool
- Checks if the entered customer's gender is valid.
- validateHouseNumber() : bool
- Checks if the entered house number is valid.
- validateLastname() : bool
- Checks if the entered customer's last name is valid.
- validatePassword() : bool
- Checks if the entered password is valid.
- validatePostcode() : bool
- Checks if the entered postcode is valid.
- validatePrivacy() : bool
- Checks if the user has accepted the privacy policy.
- validateStreet() : bool
- Checks if the entered street is valid.
- validateSuburb() : bool
- Checks if the entered suburb is valid.
- validateTelephoneNumber() : bool
- Checks if the entered telephone number is valid.
- validateVatNumber() : bool
- Checks if the entered parameters are in a valid format.
- xtcDateRaw() : string
- IMPORTANT NOTE: The algorithm and PHPDoc block is copied from the xtc_date_raw() function.
- xtcValidateEmail() : mixed
Properties
$countryService
Country service.
protected
CountryServiceInterface
$countryService
$customerCountryRepository
Customer country repository.
protected
CustomerCountryRepositoryInterface
$customerCountryRepository
$customerCountryZoneRepository
Customer country zone repository.
protected
CustomerCountryZoneRepositoryInterface
$customerCountryZoneRepository
$customerService
Customer service.
protected
CustomerServiceInterface
$customerService
$errorMessageCollection
Error message collection.
protected
EditableKeyValueCollection
$errorMessageCollection
$errorStatus
Error status.
protected
bool
$errorStatus
= alse
$settings
Customer input validator settings.
protected
CustomerInputValidatorSettingsInterface
$settings
$vatNumberValidator
VAT number validator.
protected
VatNumberValidatorInterface
$vatNumberValidator
Methods
__construct()
Constructor of the class CustomerInputValidator.
public
__construct(CustomerServiceInterface $customerService, CountryServiceInterface $countryService, CustomerInputValidatorSettingsInterface $customerInputValidatorSettings, CustomerCountryRepositoryInterface $customerCountryRepository, CustomerCountryZoneRepositoryInterface $customerCountryZoneRepository, VatNumberValidatorInterface $vatNumberValidator) : mixed
Parameters
- $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.
Return values
mixed —getErrorMessageCollection()
Returns a collection of error messages.
public
getErrorMessageCollection() : EditableKeyValueCollection
Return values
EditableKeyValueCollection —Collection of error messages.
getErrorMessages()
Returns error messages.
public
getErrorMessages() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Error messages.
getErrorStatus()
Returns the error status.
public
getErrorStatus() : bool
Return values
bool —Error status.
validateAddonValues()
Checks if the entered additional values are valid.
public
validateAddonValues(KeyValueCollection $addonValues) : bool
Overload this method to implement needed validation logic.
Parameters
- $addonValues : KeyValueCollection
-
Customer's additional values.
Return values
bool —Is valid?
validateByArray()
Checks if the entered customer data is valid based on an array.
public
validateByArray(array<string|int, mixed> $inputArray, CustomerInterface $customer) : bool
Expects an array with following keys:
- gender
- firstname
- lastname
- dob (date of birth)
- email_address
- telephone
- vat
- country
Parameters
- $inputArray : array<string|int, mixed>
-
Input data.
- $customer : CustomerInterface
-
Customer data.
Return values
bool —Returns the validation result (true indicates no validation error).
validateCaptcha()
Checks if the captcha input is valid.
public
validateCaptcha(array<string|int, mixed> $p_customerInput[, string $p_section = 'vvCode' ]) : bool
Parameters
- $p_customerInput : array<string|int, mixed>
-
Input Customer form input.
- $p_section : string = 'vvCode'
-
Captcha section.
Return values
bool —is captcha valid?
validateCity()
Checks if the entered city is valid.
public
validateCity(string $p_city) : bool
Parameters
- $p_city : string
-
Customer's city.
Return values
bool —Is valid?
validateCompany()
Checks if the entered customer's company is valid.
public
validateCompany(string $p_company) : bool
Parameters
- $p_company : string
-
Customer's company.
Return values
bool —Is valid?
validateCountry()
Checks if the entered country exists.
public
validateCountry(int $p_countryId) : bool
Parameters
- $p_countryId : int
-
Customer's country ID.
Return values
bool —Is valid?
validateCountryZone()
Checks if the entered country zone is valid.
public
validateCountryZone( $p_countryZone, $p_countryId) : bool
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.
Parameters
Return values
bool —Is valid?
validateDateOfBirth()
Checks if the entered customer's date of birth is valid.
public
validateDateOfBirth(string $p_dateOfBirth) : bool
Valid format is: dd.mm.yyyy
Parameters
- $p_dateOfBirth : string
-
Customer's date of birth.
Return values
bool —Is valid?
validateEmail()
Checks if the entered email is valid.
public
validateEmail(string $p_email[, mixed $p_emailAddressCheck = false ]) : bool
Parameters
- $p_email : string
-
Customer's E-Mail address.
- $p_emailAddressCheck : mixed = false
Return values
bool —Is valid?
validateEmailAndConfirmation()
Checks if the entered email and email confirmation are valid.
public
validateEmailAndConfirmation(string $p_email, string $p_emailConfirmation) : bool
It will check the minimum length, address syntax, confirmation matching and existence of e-mail address.
Parameters
- $p_email : string
-
Customer's E-Mail address.
- $p_emailConfirmation : string
-
Confirmation E-Mail address.
Return values
bool —Is valid?
validateEmailExists()
Checks if the entered email already exists.
public
validateEmailExists(string $p_email[, CustomerInterface $customer = null ]) : bool
Parameters
- $p_email : string
-
Customer's E-Mail address-
- $customer : CustomerInterface = null
-
Customer.
Return values
bool —Is valid?
validateFaxNumber()
Checks if the entered fax number is valid.
public
validateFaxNumber(string $p_faxNumber) : bool
Parameters
- $p_faxNumber : string
-
Customer's fax number.
Return values
bool —Is valid?
validateFirstname()
Checks if the entered customer's first name is valid.
public
validateFirstname(string $p_firstname) : bool
Parameters
- $p_firstname : string
-
Customer's first name.
Return values
bool —Is valid?
validateGender()
Checks if the entered customer's gender is valid.
public
validateGender(string $p_gender) : bool
Parameters
- $p_gender : string
-
Customer's gender.
Return values
bool —Is valid?
validateHouseNumber()
Checks if the entered house number is valid.
public
validateHouseNumber(string $p_house_number) : bool
Parameters
- $p_house_number : string
-
Customer's house number.
Return values
bool —Is valid?
validateLastname()
Checks if the entered customer's last name is valid.
public
validateLastname(string $p_lastname) : bool
Parameters
- $p_lastname : string
-
Customer's last name.
Return values
bool —Is valid?
validatePassword()
Checks if the entered password is valid.
public
validatePassword(string $p_password, string $p_passwordConfirmation) : bool
Parameters
- $p_password : string
-
Customer's password.
- $p_passwordConfirmation : string
-
Customer's password confirmation.
Return values
bool —Is valid?
validatePostcode()
Checks if the entered postcode is valid.
public
validatePostcode(string $p_postcode) : bool
Parameters
- $p_postcode : string
-
Customer's post code.
Return values
bool —Is valid?
validatePrivacy()
Checks if the user has accepted the privacy policy.
public
validatePrivacy(string $p_privacyAccepted) : bool
Parameters
- $p_privacyAccepted : string
Return values
bool —Is valid?
validateStreet()
Checks if the entered street is valid.
public
validateStreet(string $p_street) : bool
Parameters
- $p_street : string
-
Customer's street.
Return values
bool —Is valid?
validateSuburb()
Checks if the entered suburb is valid.
public
validateSuburb( $p_suburb) : bool
Parameters
Return values
bool —Is valid?
validateTelephoneNumber()
Checks if the entered telephone number is valid.
public
validateTelephoneNumber(string $p_telephoneNumber) : bool
Parameters
- $p_telephoneNumber : string
-
Customer's telephone number.
Return values
bool —Is valid?
validateVatNumber()
Checks if the entered parameters are in a valid format.
public
validateVatNumber(string $p_vatNumber, int $p_countryId, bool $p_isGuest) : bool
Parameters
- $p_vatNumber : string
-
VAT number.
- $p_countryId : int
-
Country ID.
- $p_isGuest : bool
-
Is customer a guest?
Return values
bool —Is valid?
xtcDateRaw()
IMPORTANT NOTE: The algorithm and PHPDoc block is copied from the xtc_date_raw() function.
public
xtcDateRaw(string $date[, bool $reverse = false ]) : string
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.
Parameters
- $date : string
- $reverse : bool = false
-
(optional)
Return values
string —xtcValidateEmail()
public
xtcValidateEmail(mixed $email, mixed $emailAddressCheck) : mixed
Parameters
- $email : mixed
- $emailAddressCheck : mixed