Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Gateway/Http/Client/Adapter/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@
namespace OnTap\MasterCard\Gateway\Http\Client\Adapter;

use Magento\Framework\HTTP\Adapter\Curl;
use Zend_Http_Client;
use Zend_Uri_Exception;
use Zend_Uri_Http;
use Laminas\Http\Request;
use Laminas\Uri\Exception\InvalidUriException;
use Laminas\Uri\UriInterface;

class Rest extends Curl
{
/**
* Send request to the remote server
*
* @param string $method
* @param Zend_Uri_Http|string $url
* @param UriInterface|string $url
* @param string $httpVer
* @param array $headers
* @param string $body
* @return string Request as text
* @throws Zend_Uri_Exception
* @throws InvalidUriException
*/
public function write($method, $url, $httpVer = '1.1', $headers = [], $body = '')
{
if ($url instanceof Zend_Uri_Http) {
$url = $url->getUri();
if ($url instanceof UriInterface) {
$url = (string)$url;
}
$this->_applyConfig();

Expand All @@ -47,15 +47,15 @@ public function write($method, $url, $httpVer = '1.1', $headers = [], $body = ''
curl_setopt($this->_getResource(), CURLOPT_URL, $url);
curl_setopt($this->_getResource(), CURLOPT_RETURNTRANSFER, true);

if ($method == Zend_Http_Client::POST) {
if ($method == Request::METHOD_POST) {
curl_setopt($this->_getResource(), CURLOPT_POST, true);
curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body);
$headers[] = 'Content-Length: ' . strlen($body);
} elseif ($method == Zend_Http_Client::PUT) {
curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, Zend_Http_Client::PUT);
} elseif ($method == Request::METHOD_PUT) {
curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, Request::METHOD_PUT);
curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body);
$headers[] = 'Content-Length: ' . strlen($body);
} elseif ($method == Zend_Http_Client::GET) {
} elseif ($method == Request::METHOD_GET) {
curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true);
}

Expand Down
8 changes: 4 additions & 4 deletions Gateway/Http/Client/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

namespace OnTap\MasterCard\Gateway\Http\Client;

use Zend_Http_Response;
use Laminas\Http\Response;

class ResponseFactory
{
/**
* Create a new Zend_Http_Response object from a string
* Create a new Response object from a string
*
* @param string $response
* @return Zend_Http_Response
* @return Response
*/
public function create($response)
{
return Zend_Http_Response::fromString($response);
return Response::fromString($response);
}
}