ePages 6.17.9 - DE_EPAGES/Address/API/Address.pm

Package DE_EPAGES::Address::API::Address

This module includes a function to update VATID

@EXPORT_OK
CheckZipcode
IsValidBankName
IsUnambiguousBasketAddress
SecureAddressFields

Functions

CheckZipcode
IsUnambiguousBasketAddress
IsValidBankName
SecureAddressFields

CheckZipcode

Returns true if zipcode is valid for the country and the country is one of the know countries incuded in $DE_EPAGES::Address::API::Constants::REGULAREXPRESSIONS_FOR_ZIPCODE. Returns true if $ZipCode or $CountryID is undefined or an empty string. Returns true if $CountryID is not included in $DE_EPAGES::Address::API::Constants::REGULAREXPRESSIONS_FOR_ZIPCODE.

Syntax
$check = CheckZipcode( $Zipcode, $CountryID );
Input
$Zipcode (string)
zipcode
$CountryID (int)
country id
Return
$check (boolean)
valid

IsUnambiguousBasketAddress

Determines if the shipping address in the Basket is either unset or equal to the billing address. Returns false if no billing address has been set.

Syntax
  my $Unambiguous = IsUnambiguousBasketAddress($Basket);
Input
$Basket (Object)
Basket
Return
$Unambiguous (boolean)
true if billing address equals shipping address

IsValidBankName

Determines if the bank name is valid. A bank name is valid if its encrypted hash is not greater than 255 characters. In order to avoid unnecessary encryptions, the bank name is first checked for non-ascii characters or having a length greater than 64 characters --- which is the maximum length defined for a bank name (cf. EPG-23503). Empty bank names are considered valid.

Syntax
my $IsValid = IsValidBankName( $BankName );
Example
if ( !IsValidBankName( $FormValues->{'BankName'} ) ) {
    $Servlet->form->addFormError({
        Reason => 'BankNameTooLong',
        Form   => 'SavePaymentDirectDebit',
        Name   => 'BankName',
    });
    $Servlet->form->executeFormError;
}
Input
$BankName (string)
a bank name
Return
$IsValidBankName (boolean)
true if the bank name is valid

SecureAddressFields

Secures the address fields by removing suspicious characters from String fields.

Syntax
  my $hValues = SecureAddressFields($hValues);
Input
$hValues (ref.hash)
Address values
Return
$hValues (ref.hash)
updated Address values