Skip to content

Commit 6d8f56a

Browse files
authored
Merge pull request #110 from thephpleague/upgrade-v3
Update to v3
2 parents 4af9581 + efe8ba9 commit 6d8f56a

26 files changed

+85
-54
lines changed

.travis.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
75
- 7.0
86
- 7.1
97
- 7.2
108

9+
# This triggers builds to run on the new TravisCI infrastructure.
10+
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
11+
sudo: false
12+
13+
## Cache composer
14+
cache:
15+
directories:
16+
- $HOME/.composer/cache
17+
18+
env:
19+
global:
20+
- setup=basic
21+
1122
matrix:
12-
allow_failures:
13-
- php: hhvm
23+
include:
24+
- php: 5.6
25+
env: setup=lowest
1426

15-
before_script:
16-
- composer install -n --dev --prefer-source
27+
install:
28+
- if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction; fi
29+
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi
1730

1831
script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text

composer.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,22 @@
2828
"psr-4": { "Omnipay\\AuthorizeNet\\" : "src/" }
2929
},
3030
"require": {
31-
"omnipay/common": "~2.2"
31+
"omnipay/common": "^3"
3232
},
3333
"require-dev": {
34-
"omnipay/tests": "~2.0"
34+
"omnipay/tests": "^3",
35+
"squizlabs/php_codesniffer": "^3",
36+
"phpro/grumphp": "^0.14"
3537
},
3638
"extra": {
3739
"branch-alias": {
38-
"dev-master": "2.0.x-dev"
40+
"dev-master": "3.0.x-dev"
3941
}
40-
}
42+
},
43+
"scripts": {
44+
"test": "phpunit",
45+
"check-style": "phpcs -p --standard=PSR2 src/",
46+
"fix-style": "phpcbf -p --standard=PSR2 src/"
47+
},
48+
"prefer-stable": true
4149
}

grumphp.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
parameters:
2+
git_dir: .
3+
bin_dir: vendor/bin
4+
tasks:
5+
phpunit:
6+
config_file: ~
7+
testsuite: ~
8+
group: []
9+
always_execute: false
10+
phpcs:
11+
standard: PSR2
12+
warning_severity: ~
13+
ignore_patterns:
14+
- tests/
15+
triggered_by: [php]

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
<directory>./tests/</directory>
1515
</testsuite>
1616
</testsuites>
17-
<listeners>
18-
<listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
19-
</listeners>
2017
<filter>
2118
<whitelist>
2219
<directory>./src</directory>

src/Message/AIMAbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ public function sendData($data)
224224
$headers = array('Content-Type' => 'text/xml; charset=utf-8');
225225

226226
$data = $data->saveXml();
227-
$httpResponse = $this->httpClient->post($this->getEndpoint(), $headers, $data)->send();
227+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data);
228228

229-
return $this->response = new AIMResponse($this, $httpResponse->getBody());
229+
return $this->response = new AIMResponse($this, $httpResponse->getBody()->getContents());
230230
}
231231

232232
/**

src/Message/AIMResponse.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ public function getReasonCode()
7979
if (isset($this->data->transactionResponse->messages)) {
8080
// In case of a successful transaction, a "messages" element is present
8181
$code = intval((string)$this->data->transactionResponse->messages->message->code);
82-
8382
} elseif (isset($this->data->transactionResponse->errors)) {
8483
// In case of an unsuccessful transaction, an "errors" element is present
8584
$code = intval((string)$this->data->transactionResponse->errors->error->errorCode);
86-
8785
} elseif (isset($this->data->messages->message)) {
8886
// In case of invalid request, the top-level message provides details.
8987
$code = (string)$this->data->messages->message->code;
@@ -104,11 +102,9 @@ public function getMessage()
104102
if (isset($this->data->transactionResponse->messages)) {
105103
// In case of a successful transaction, a "messages" element is present
106104
$message = (string)$this->data->transactionResponse->messages->message->description;
107-
108105
} elseif (isset($this->data->transactionResponse->errors)) {
109106
// In case of an unsuccessful transaction, an "errors" element is present
110107
$message = (string)$this->data->transactionResponse->errors->error->errorText;
111-
112108
} elseif (isset($this->data->messages->message)) {
113109
// In case of invalid request, the top-level message provides details.
114110
$message = (string)$this->data->messages->message->text;

src/Message/CIMAbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public function sendData($data)
104104
$headers = array('Content-Type' => 'text/xml; charset=utf-8');
105105

106106
$data = $data->saveXml();
107-
$httpResponse = $this->httpClient->post($this->getEndpoint(), $headers, $data)->send();
107+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data);
108108

109-
return $this->response = new CIMResponse($this, $httpResponse->getBody());
109+
return $this->response = new CIMResponse($this, $httpResponse->getBody()->getContents());
110110
}
111111
}

src/Message/CIMAbstractResponse.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public function getResultCode()
6767
return static::TRANSACTION_RESULT_CODE_ERROR;
6868
default:
6969
return null;
70-
7170
}
7271
}
7372

@@ -115,7 +114,6 @@ public function getMessage()
115114
if (isset($this->data['messages'])) {
116115
// In case of a successful transaction, a "messages" element is present
117116
$message = (string)$this->data['messages']['message']['text'];
118-
119117
}
120118

121119
return $message;

src/Message/CIMCreateCardRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ public function sendData($data)
152152
{
153153
$headers = array('Content-Type' => 'text/xml; charset=utf-8');
154154
$data = $data->saveXml();
155-
$httpResponse = $this->httpClient->post($this->getEndpoint(), $headers, $data)->send();
155+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data);
156156

157-
$response = new CIMCreateCardResponse($this, $httpResponse->getBody());
157+
$response = new CIMCreateCardResponse($this, $httpResponse->getBody()->getContents());
158158

159159
if (!$response->isSuccessful() && $response->getReasonCode() == 'E00039') {
160160
// Duplicate profile. Try adding a new payment profile for the same profile and get the response

src/Message/CIMCreatePaymentProfileRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function sendData($data)
4343
{
4444
$headers = array('Content-Type' => 'text/xml; charset=utf-8');
4545
$data = $data->saveXml();
46-
$httpResponse = $this->httpClient->post($this->getEndpoint(), $headers, $data)->send();
46+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, $data);
4747

48-
return $this->response = new CIMCreatePaymentProfileResponse($this, $httpResponse->getBody());
48+
return $this->response = new CIMCreatePaymentProfileResponse($this, $httpResponse->getBody()->getContents());
4949
}
5050
}

0 commit comments

Comments
 (0)