ePages 6.17.40 - DE_EPAGES/POSTPAY/API/Tools.pm

Package DE_EPAGES::POSTPAY::API::Tools

provide some tool functions

Base
-
@EXPORT_OK
POSTPAYLog
CheckMandatoryFields
GetUrl
GetPOSTPAYTax
GetDisplayName
ParseKeyValues
KeyValuesToString
roundMoney
GetAllPOSTPAYShops
GetPOSTPAYPaymentMethod
ConvertUndefValuesToDefaultValue
GetValidOrderUnits

Functions

CheckMandatoryFields
ConvertUndefValuesToDefaultValue
GetAllPOSTPAYShops
GetDisplayName
GetPOSTPAYPaymentMethod
GetPOSTPAYTax
GetUrl
GetValidOrderUnits
KeyValuesToString
POSTPAYLog
ParseKeyValues
_MaskPOSTPAYPassword
roundMoney

CheckMandatoryFields

checks if hash values are not empty and defined every xml tag should have a value

Syntax
CheckMandatoryFields($Shop,$Basket,$hRequestParameters);
Input
$Shop (object)
the payment method
$Basket (object)
the basket
$hRequestParameters (ref.array)
parameter to be checked

ConvertUndefValuesToDefaultValue

converts undef values in a hash to a default value

Syntax
ConvertUndefValuesToDefaultValue($hHash, $DefaultValue);
Input
$hHash (ref.hash)
hash with values
$DefaultValue (any)
default value which replaces undef values

GetAllPOSTPAYShops

Returns all shops with valid POSTPAY account.

Syntax
$aShops = GetAllPOSTPAYShops();
Return
$aSShops (ref.array.object)
list of shop objects

GetDisplayName

Calculates DisplayName from FirstName and LastName

Syntax
GetDisplayName( $FirstName, $LastName );
Input
$FirstName (string)
first name
$LastName (string)
last name
Return
$DisplayName (string)
displayname

GetPOSTPAYPaymentMethod

returns the postpaypaymentmethod

Syntax
$POSTPAYPayment = GetPOSTPAYPaymentMethod($Shop);
Input
$Shop (object)
shop
Return
$POSTPAYPaymentMethod (object)
postpaypaymentmethod

GetPOSTPAYTax

gets tax string for postpay, if tax doesnt match a tax string from postpay write stantard in taxfield because its just for statistic reasons

Syntax
GetPOSTPAYTax($LineItemProduct);
Input
$LineItemProduct (object)
the payment lineitem
Return
$taxname (string)
tax name

GetUrl

returns POSTPAY url

Syntax
my $url= GetUrl($PaymentMethod);
Input
$PaymentMethod (object)
PaymentMethod
Return
$url (string)
POSTPAY url

GetValidOrderUnits

returns all units which are valid for POSTPAY

Syntax
$hValidUnits = GetValidOrderUnits();
Return
$aValidUnits (ref.array)
valid units

KeyValuesToString

Converts a hash with key value pairs into a string, which is formatted using the constants DELIMITER and JOIN_SIGN.

Syntax
KeyValuesToString($hKeyValues);
Input
$hKeyValues (hash)
hash
Return
$String (string)
string

POSTPAYLog

Logs a structure to the communication.log.

Syntax
POSTPAYLog($Name, $Debug, $Section);
Example
POSTPAYLog('SendRequestHash', \%Hash, 'Send');
Input
$Name (string)
name of data
$Debug (hash)
data to be logged
$Section (string)
name of the section to be logged

ParseKeyValues

Parses string with multiple key value pairs, which are formatted using the constants DELIMITER and JOIN_SIGN. The parsed key value pairs are put into a hash.

Syntax
ParseKeyValues($String);
Input
$String (string)
string
Return
$hKeyValues (hash)
hash

_MaskPOSTPAYPassword

remove password from xml for logging

Syntax
_MaskPOSTPAYPassword($LogXML);
Input
$LogXML (string or ref.hash)
XML request or hash
Return
$XML (string)
XML request without password

roundMoney

round a value to 2 digits after comma

Syntax
roundMoney($Price);
Input
$Price (string)
string
Return
$String (string)
string