ePages 7.38.0 - 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
CompareZipCodes

Functions

CheckZipcode
CompareZipCodes
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

CompareZipCodes

Returns result of compare funtion see also: DE_EPAGES::Core::API::PerlTools::Compare The comparison type is determined from the input values.

Syntax
$result = CompareZipCodes($ZipCode1,$ZipCode2);
Input
$ZipCode1 (*)
value 1
$ZipCode2 (*)
value 2
Return
$result (int)
0 if equal / -1 if smaller / 1 if greater

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