Skip to content

Commit 260bedf

Browse files
committed
Update to Omnipay 3
1 parent 0eac0ad commit 260bedf

11 files changed

+64
-48
lines changed

.travis.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
language: php
22

3+
dist: trusty
34
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- hhvm
5+
- "7.4"
6+
- "7.3"
7+
- "7.2"
8+
- "7.1"
9+
- "7.0"
10+
- "5.6"
911

1012
before_script:
11-
- composer install -n --dev --prefer-source
13+
- travis_retry composer self-update
14+
- travis_retry composer install --no-interaction --prefer-source
1215

1316
script:
1417
- vendor/bin/phpcs --standard=PSR2 src
15-
- bash -c 'if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then vendor/bin/phpunit --verbose; fi;'
16-
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then vendor/bin/phpunit --verbose --coverage-clover coverage.clover; fi;'
18+
- vendor/bin/phpunit --verbose --coverage-clover coverage.clover
1719

1820
after_success:
19-
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi;'
20-
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi;'
21+
- wget https://scrutinizer-ci.com/ocular.phar
22+
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015 Leith Caldwell
1+
Copyright (c) 2020 Leith Caldwell
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
14-
processing library for PHP 5.3+. This package implements Redsys support for Omnipay. It includes
14+
processing library for PHP 5.6+. This package implements Redsys support for Omnipay. It includes
1515
support for both redirect (3-party) and webservice (2-party) versions of the gateway.
1616

1717
## Installation
@@ -22,7 +22,7 @@ to your `composer.json` file:
2222
```json
2323
{
2424
"require": {
25-
"PatronBase/omnipay-redsys": "~2.0"
25+
"PatronBase/omnipay-redsys": "~3.0"
2626
}
2727
}
2828
```

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@
3131
"psr-4": { "Omnipay\\Redsys\\" : "tests/" }
3232
},
3333
"require": {
34-
"omnipay/common": "~2.0"
34+
"omnipay/common": "~3.0"
3535
},
3636
"require-dev": {
37-
"omnipay/tests": "~2.0"
37+
"omnipay/tests": "~3.0",
38+
"squizlabs/php_codesniffer": "^3.5"
3839
},
3940
"suggest": {
4041
"ext-mcrypt": "Required for hashing functions to check message signatures"
4142
},
4243
"extra": {
4344
"branch-alias": {
44-
"dev-master": "2.1.x-dev"
45+
"dev-master": "3.0.x-dev"
4546
}
46-
}
47+
},
48+
"prefer-stable": true
4749
}

phpunit.xml.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<directory>./tests/</directory>
1818
</testsuite>
1919
</testsuites>
20-
<listeners>
21-
<listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" />
22-
</listeners>
2320
<filter>
2421
<whitelist>
2522
<directory>./src</directory>

src/Message/PurchaseResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
namespace Omnipay\Redsys\Message;
44

55
use Omnipay\Common\Message\AbstractResponse;
6+
use Omnipay\Common\Message\RedirectResponseInterface;
67

78
/**
89
* Redsys Purchase Response
910
*/
10-
class PurchaseResponse extends AbstractResponse
11+
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
1112
{
1213
public function isSuccessful()
1314
{

src/Message/WebservicePurchaseRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ public function sendData($data)
9393
</soapenv:Envelope>";
9494

9595
// send the actual SOAP request
96-
$httpResponse = $this->httpClient->post(
96+
$httpResponse = $this->httpClient->request(
97+
'POST',
9798
$this->getEndpoint(),
9899
array('SOAPAction' => 'trataPeticion'),
99100
$requestEnvelope
100-
)->send();
101+
);
101102

102103
// unwrap httpResponse into actual data as SimpleXMLElement tree
103-
$responseEnvelope = $httpResponse->xml();
104+
$responseEnvelope = simplexml_load_string($httpResponse->getBody()->getContents());
104105
$responseData = new SimpleXMLElement(htmlspecialchars_decode(
105106
$responseEnvelope->children("http://schemas.xmlsoap.org/soap/envelope/")
106107
->Body->children("http://webservice.sis.sermepa.es")

tests/Message/CompletePurchaseResponseTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ public function testCompletePurchaseError()
185185
}
186186

187187
/**
188-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
189-
* @expectedExceptionMessage Invalid response from payment gateway (no data)
188+
* @doesNotPerformAssertions
190189
*/
191190
public function testCompletePurchaseInvalidNoParameters()
192191
{
192+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
193+
$this->expectExceptionMessage('Invalid response from payment gateway (no data)');
193194
$this->response = new CompletePurchaseResponse(
194195
$this->getMockRequest(),
195196
array(
@@ -201,11 +202,12 @@ public function testCompletePurchaseInvalidNoParameters()
201202
}
202203

203204
/**
204-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
205-
* @expectedExceptionMessage Invalid response from payment gateway
205+
* @doesNotPerformAssertions
206206
*/
207207
public function testCompletePurchaseInvalidNoOrder()
208208
{
209+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
210+
$this->expectExceptionMessage('Invalid response from payment gateway');
209211
$this->response = new CompletePurchaseResponse(
210212
$this->getMockRequest(),
211213
array(
@@ -221,11 +223,13 @@ public function testCompletePurchaseInvalidNoOrder()
221223
}
222224

223225
/**
224-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
225-
* @expectedExceptionMessage Invalid response from payment gateway (signature mismatch)
226+
* @doesNotPerformAssertions
226227
*/
227228
public function testCompletePurchaseInvalidSignature()
228229
{
230+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
231+
$this->expectExceptionMessage('Invalid response from payment gateway (signature mismatch)');
232+
229233
$this->getMockRequest()->shouldReceive('getHmacKey')->once()->andReturn('Mk9m98IfEblmPfrpsawt7BmxObt98Jev');
230234

231235
$this->response = new CompletePurchaseResponse(

tests/Message/SecurityTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ public function testEncryptMessageSuccess()
6161

6262
/**
6363
* Make sure correct exception fires when no valid extension is installed
64+
*
65+
* @doesNotPerformAssertions
6466
*/
6567
public function testEncryptMessageException()
6668
{
67-
$this->setExpectedException(
68-
'\Omnipay\Common\Exception\RuntimeException',
69-
'No valid encryption extension installed'
70-
);
69+
$this->expectException('Omnipay\Common\Exception\RuntimeException');
70+
$this->expectExceptionMessage('No valid encryption extension installed');
7171
$this->mockSecurity->shouldReceive('hasValidEncryptionMethod')->once()->andReturn(false);
7272
$this->encryptMessage();
7373
}

tests/Message/WebservicePurchaseResponseTest.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ public function testPurchaseFailure()
109109
}
110110

111111
/**
112-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
113-
* @expectedExceptionMessage Invalid response from payment gateway (no data)
112+
* @doesNotPerformAssertions
114113
*/
115114
public function testPurchaseInvalidNoReturnCode()
116115
{
116+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
117+
$this->expectExceptionMessage('Invalid response from payment gateway (no data)');
117118
$this->response = new WebservicePurchaseResponse(
118119
$this->getMockRequest(),
119120
array(
@@ -123,11 +124,12 @@ public function testPurchaseInvalidNoReturnCode()
123124
}
124125

125126
/**
126-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
127-
* @expectedExceptionMessage Invalid response from payment gateway (no data)
127+
* @doesNotPerformAssertions
128128
*/
129129
public function testPurchaseInvalidNoTransactionData()
130130
{
131+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
132+
$this->expectExceptionMessage('Invalid response from payment gateway (no data)');
131133
$this->response = new WebservicePurchaseResponse(
132134
$this->getMockRequest(),
133135
array(
@@ -137,11 +139,12 @@ public function testPurchaseInvalidNoTransactionData()
137139
}
138140

139141
/**
140-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
141-
* @expectedExceptionMessage Invalid response from payment gateway (SIS0042)
142+
* @doesNotPerformAssertions
142143
*/
143144
public function testPurchaseIntegrationError()
144145
{
146+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
147+
$this->expectExceptionMessage('Invalid response from payment gateway (SIS0042)');
145148
$this->response = new WebservicePurchaseResponse(
146149
$this->getMockRequest(),
147150
array(
@@ -151,11 +154,12 @@ public function testPurchaseIntegrationError()
151154
}
152155

153156
/**
154-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
155-
* @expectedExceptionMessage Invalid response from payment gateway
157+
* @doesNotPerformAssertions
156158
*/
157159
public function testCompletePurchaseInvalidNoOrder()
158160
{
161+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
162+
$this->expectExceptionMessage('Invalid response from payment gateway');
159163
$this->response = new WebservicePurchaseResponse(
160164
$this->getMockRequest(),
161165
array(
@@ -168,11 +172,12 @@ public function testCompletePurchaseInvalidNoOrder()
168172
}
169173

170174
/**
171-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
172-
* @expectedExceptionMessage Invalid response from payment gateway (missing data)
175+
* @doesNotPerformAssertions
173176
*/
174177
public function testCompletePurchaseInvalidMissingData()
175178
{
179+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
180+
$this->expectExceptionMessage('Invalid response from payment gateway (missing data)');
176181
$this->response = new WebservicePurchaseResponse(
177182
$this->getMockRequest(),
178183
array(
@@ -187,11 +192,13 @@ public function testCompletePurchaseInvalidMissingData()
187192

188193

189194
/**
190-
* @expectedException Omnipay\Common\Exception\InvalidResponseException
191-
* @expectedExceptionMessage Invalid response from payment gateway (signature mismatch)
195+
* @doesNotPerformAssertions
192196
*/
193197
public function testPurchaseBadSignature()
194198
{
199+
$this->expectException('Omnipay\Common\Exception\InvalidResponseException');
200+
$this->expectExceptionMessage('Invalid response from payment gateway (signature mismatch)');
201+
195202
$this->getMockRequest()->shouldReceive('getHmacKey')->once()->andReturn('Mk9m98IfEblmPfrpsawt7BmxObt98Jev');
196203

197204
$this->response = new WebservicePurchaseResponse(

0 commit comments

Comments
 (0)