Example #1
0
 public function execute(Base $request)
 {
     $this->_lastRequest = $request;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->_apiEndpoint);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml; charset=UTF-8"));
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getBody());
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT);
     $responseBody = curl_exec($ch);
     $responseInfo = curl_getinfo($ch);
     $responseClass = $request->getResponseClass();
     $this->_lastResponse = new $responseClass($responseInfo, $responseBody);
     return $this->_lastResponse;
 }
Example #2
0
 protected function getBasicHead()
 {
     $head = parent::getBasicHead();
     $head->setTransactionId($this->_transactionId);
     if (isset($this->_deviceToken)) {
         $head->setCustomerDevice(new Internals\CustomerDevice($this->_deviceToken));
     }
     $external = new Internals\External();
     $external->setOrderId($this->_orderId);
     $external->setMerchantConsumerId($this->_merchantConsumerId);
     $external->setMerchantConsumerClassification($this->_merchantConsumerClassification);
     $external->setTrackingId($this->_trackingId);
     $head->setExternal($external);
     if (isset($this->_systemName) && isset($this->_systemVersion)) {
         $head->setMeta(new Internals\Meta($this->_systemName, $this->_systemVersion));
     }
     return $head;
 }