ePages 7.48.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

AlphanumSubstring
AreMandatoryShippingFieldsSet
CountryPhonePrefix
GetLabelImagePath
GetTransactionImagePath
LastPhone9Digits
SetPlainHashDefined
ToIso
ToUtf

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

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

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