ePages 6.14.0 - DE_EPAGES/SEUR/API/Tools.pm

Package DE_EPAGES::SEUR::API::Tools

This package provides the SEUR global functionality.

@EXPORT_OK
GetLabelImagePath
GetTransactionImagePath
AreMandatoryShippingFieldsSet
toIso
toUtf
lastPhone9Digits
alphanumSubstring
setPlainHashDefined
CountryPhonePrefix

Functions

AreMandatoryShippingFieldsSet
CountryPhonePrefix
GetLabelImagePath
GetTransactionImagePath
alphanumSubstring
lastPhone9Digits
setPlainHashDefined
toIso
toUtf

AreMandatoryShippingFieldsSet

checks all required fields are mandatory in the shop

Syntax
$IsAllowed = AreMandatoryShippingFieldsSet($Shop);
Example
my $IsAllowed  = AreMandatoryShippingFieldsSet($Shop);
Input
#Shop (object)
shop object
Return
#Value (boolean)
1 or 0

CountryPhonePrefix

It returns the associate country prefix for a given country code.

Syntax
$strPrefix = CountryPhonePrefix($countryCode);
Input
$countryCode (string)
two characters country code
Return
$strPrefix (string)
country prefix number

GetLabelImagePath

returns the path for the barcode image of a shipping label

Syntax
$Path = GetLabelImagePath($ShippingLabel,$FileExtension);
Example
my $Path  = GetLabelImagePath($ShippingLabel,'gif');
Input
#ShippingLabel (object)
shipping label object
#FileExtension (string)
image file extension
Return
#Path (string)
path and image name

GetTransactionImagePath

returns the path for the expedition manifest PDF image of a transaction

Syntax
$Path = GetTransactionImagePath($Transaction, $FileExtension);
Example
my $Path  = GetTransactionImagePath($Transaction, 'gif');
Input
$Transaction (object)
transaction object
FileExtension (string)
image file extension
Return
Path (string)
path and image name

alphanumSubstring

It returns first/last $length alphanumeric characters from a string.

Syntax
$subString = alphanumSubstring($string, $length, $startTermination;
Input
$string (string)
string to be processed
$length (integer)
amount of alphanumeric characters to be extracted
$startTermination (string)
specifies if characters must be extracted starting from
the right (end) or left (init) of the string
Return
$subString (string)
alphanumeric substring

lastPhone9Digits

It returns last 9 digits from an ordered list of possible phone numbers located into the address object.

Syntax
$phone = lastPhone9Digits($Address);
Input
$Address (object)
address object
Return
$phone (string)
last 9 phone number digits

setPlainHashDefined

It checks hash items and assigns empty string values to undefined items. (necessary to avoid web service calls failures)

Syntax
$hDefined = setPlainHashDefined($hash);
Input
$hash (hash)
plain hash structure with possible undefined values
Return
$hDefined (hash)
undefined values converted to empty strings

toIso

It encodes strings found into the hash to iso-8859-1 encoding.

Syntax
$hash = toIso($hash);
Input
$hash (hash)
SEUR request hash structure encoded with UTF-8
Return
$hash (hash)
iso-8859-1 encoded hash structure

toUtf

It encodes and returns entry strings into utf-8 encoding.

Syntax
$strOut = toUtf($strIn);
Input
$strIn (string)
string encoded with iso-8859-1
Return
$strOut (string)
utf8 encoded string