ePages 6.17.17 - DE_EPAGES/POSTPAY/API/XML.pm

Package DE_EPAGES::POSTPAY::API::XML

XML functions for POSTPAY.

@EXPORT_OK
GetXMLHeader
ChangeResponseXMLToHash

Functions

ArrayHash2XML
ChangeResponseXMLToHash
GetXMLHeader

ArrayHash2XML

building xml format needs to get a array for elements in xml and a hash for attributes for this elements example: $aStructure = [{'submitCartResponse' => [{'header' => [{'login' => 123}, {'password' => 123}, {'language' => en} ]}, {'shoppingCart' => [{'cartId' => 1}, {'shoppingCartItem' => [{'productId' => 12345}, {'name' => 'test'}, {'basePrice' => 120}, {'tax' => 'standard'}, {'quantity' => 1} ]} ]} ]}]; will be converted to: <submitCartRequest> <header> <login>123</login> <password>123</password> <language>en</language> </header> <shoppingCart> <cartId>1</cartId> <shoppingCartItem> <productId>12345</productId> <name>test</name> <basePrice>120</basePrice> <tax>Standard</tax> <quantity>1</quantity> </shoppingCartItem> </shoppingCart> </submitCartRequest>

Syntax
$XML.= ArrayHash2XML($hXMLElements,$hXMLattributes);
Input
$aXMLElements (ref.array)
the xml elements
$hXMLattributes (ref.hash)
the xml attributes
Return
$xml (string)
the xml code

ChangeResponseXMLToHash

takes xml response from postpay and transforms it into hash

Syntax
my $hResponse = ChangeResponseXMLToHash($XMLResponse,$Shop);
Input
$XMLResponse (string)
xml response of request
$Shop (object)
Shop object
Return
$hResult (ref.hash)
result of xml as hash

GetXMLHeader

builds header for parameters

Syntax
$XML.= GetXMLHeader($LineItemPayment);
Input
$LineItemPayment (object)
LineItemPayment
Return
$xml (string)
the xml code