/** Public method to perform a call to the API */ public function plazaCall($targetUri, $httpMethod = 'POST', $xmlPayLoad = false, $mimeType = 'application/xml') { $response = $this->_compileAndPerformHTTPCall($targetUri, $httpMethod, $xmlPayLoad, $mimeType); if ($this->debug) { Tools::debug($response, true); } $xmlObject = new \DOMDocument(); $xmlObject->loadXML($response); return Tools::xmlToArray($xmlObject); }
public function toXml() { $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<ProcessOrders xmlns="http://plazaapi.bol.com/services/xsd/plazaapiservice-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://plazaapi.bol.com/services/xsd/plazaapiservice-1.0.xsd plazaapiservice-1.0.xsd ">' . "\n"; // Shipments if (count($this->OrderTransaction['Shipments']) > 0) { $xml .= "\t<Shipments>\n"; foreach ($this->OrderTransaction['Shipments'] as $shipment) { $xml .= "\t\t<Shipment>\n"; $xml .= Tools::arrayToXML($shipment, 3); $xml .= "\t\t</Shipment>\n"; } $xml .= "\t</Shipments>\n"; } // Cancellations if (count($this->OrderTransaction['Cancellations']) > 0) { $xml .= "\t<Cancellations>\n"; foreach ($this->OrderTransaction['Cancellations'] as $cancellation) { $xml .= "\t\t<Cancellation>\n"; $xml .= Tools::arrayToXML($cancellation, 3); $xml .= "\t\t</Cancellation>\n"; } $xml .= "\t</Cancellations>\n"; } $xml .= '</ProcessOrders>'; die($xml); return $xml; }