Skip to content

Commit 0c5eebd

Browse files
committed
Adds omnipay3 compatibility
1 parent 8e85dd4 commit 0c5eebd

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"psr-4": { "Omnipay\\CoinGate\\" : "src/" }
2525
},
2626
"require": {
27-
"omnipay/common": "~2.0"
27+
"omnipay/common": "^3.0"
2828
},
2929
"require-dev": {
30-
"omnipay/tests": "~2.0"
30+
"omnipay/tests": "^3.0"
3131
},
3232
"extra": {
3333
"branch-alias": {

src/Message/AbstractRequest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ public function getEndpoint()
5454

5555
public function sendData($data)
5656
{
57-
$body = $data ? http_build_query($data) : null;
58-
59-
$httpRequest = $this->httpClient->createRequest($this->getHttpMethod(), $this->getEndpoint(), null, $body);
60-
$httpRequest->setHeader('Authorization', "Token " . $this->getApiKey());
57+
$body = $data ? json_encode($data) : null;
58+
59+
$headers = [];
60+
$headers ['Authorization'] = "Token " . $this->getApiKey();
6161

6262
if ($this->getHttpMethod() == 'POST') {
63-
$httpRequest->setHeader('Content-Type', 'application/x-www-form-urlencoded');
63+
$headers['Content-Type'] = 'application/json';
6464
}
6565

66-
$httpResponse = $httpRequest->send();
66+
$httpresponse = $this->httpClient->request($this->getHttpMethod(), $this->getEndpoint(), $headers, $body);
6767

68-
return $this->response = $this->createResponse($httpResponse->json(), $httpResponse->getStatusCode());
68+
return $this->response = $this->createResponse(json_decode($httpresponse->getBody()->getContents(), true), $httpresponse->getStatusCode());
6969
}
7070

7171
protected function createResponse($data, $statusCode)

0 commit comments

Comments
 (0)