src/icepay_api_order.php
public function createXML() {

        $this->_orderData = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Order></Order>");
        $this->_consumerNode = $this->_orderData->addChild('Consumer');
        $this->_addressesNode = $this->_orderData->addChild('Addresses');
        $this->_productsNode = $this->_orderData->addChild('Products');

        // Set Consumer
        $this->array_to_xml($this->_data['consumer'], $this->_consumerNode);

        // Set Addresses
        $shippingNode = $this->_addressesNode->addChild('Address');
        $shippingNode->addAttribute('id', 'shipping');

        $this->array_to_xml($this->_data['shippingAddress'], $shippingNode);

        $billingNode = $this->_addressesNode->addChild('Address');
        $billingNode->addAttribute('id', 'billing');

        $this->array_to_xml($this->_data['billingAddress'], $billingNode);

        // Set Products
        foreach ($this->_data['products'] as $product) {
            $productNode = $this->_productsNode->addChild('Product');
            $this->array_to_xml($product, $productNode);
        }

        if ($this->_debug == true) {
            header("Content-type: text/xml");
            echo $this->_orderData->asXML();
            exit;
        }

        return $this->_orderData->asXML();
    }
public function createXML() {

        $this->_orderData = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Order></Order>");
        $this->_consumerNode = $this->_orderData->addChild('Consumer');
        $this->_addressesNode = $this->_orderData->addChild('Addresses');
        $this->_productsNode = $this->_orderData->addChild('Products');

        // Set Consumer
        $this->array_to_xml($this->_data['consumer'], $this->_consumerNode);

        // Set Addresses
        $shippingNode = $this->_addressesNode->addChild('Address');
        $shippingNode->addAttribute('id', 'shipping');

        $this->array_to_xml($this->_data['shippingAddress'], $shippingNode);

        $billingNode = $this->_addressesNode->addChild('Address');
        $billingNode->addAttribute('id', 'billing');

        $this->array_to_xml($this->_data['billingAddress'], $billingNode);

        // Set Products
        foreach ($this->_data['products'] as $product) {
            $productNode = $this->_productsNode->addChild('Product');
            $this->array_to_xml($product, $productNode);
        }

        if ($this->_debug == true) {
            header("Content-type: text/xml");
            echo $this->_orderData->asXML();
            exit;
        }

        return $this->_orderData->asXML();
    }
public function createXML ( ) { $ this -> _orderData = new SimpleXMLElement ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Order></Order>" ) ; $ this -> _consumerNode = $ this -> _orderData -> addChild ( 'Consumer' ) ; $ this -> _addressesNode = $ this -> _orderData -> addChild ( 'Addresses' ) ; $ this -> _productsNode = $ this -> _orderData -> addChild ( 'Products' ) ; // Set Consumer $ this -> array_to_xml ( $ this -> _data [ 'consumer' ] , $ this -> _consumerNode ) ; // Set Addresses $ shippingNode = $ this -> _addressesNode -> addChild ( 'Address' ) ; $ shippingNode -> addAttribute ( 'id' , 'shipping' ) ; $ this -> array_to_xml ( $ this -> _data [ 'shippingAddress' ] , $ shippingNode ) ; $ billingNode = $ this -> _addressesNode -> addChild ( 'Address' ) ; $ billingNode -> addAttribute ( 'id' , 'billing' ) ; $ this -> array_to_xml ( $ this -> _data [ 'billingAddress' ] , $ billingNode ) ; // Set Products foreach ( $ this -> _data [ 'products' ] as $ product ) { $ productNode = $ this -> _productsNode -> addChild ( 'Product' ) ; $ this -> array_to_xml ( $ product , $ productNode ) ; } if ( $ this -> _debug == true ) { header ( "Content-type: text/xml" ) ; echo $ this -> _orderData -> asXML ( ) ; exit ; } return $ this -> _orderData -> asXML ( ) ; }
Generates the XML for the webservice

@since 1.0.0
@return XML
Generates the XML for the webservice