Skip to content

Commit 29b67bd

Browse files
committed
Merge branch 'jamieburchell-opayo-urls'
2 parents 2925574 + 3db0fbd commit 29b67bd

27 files changed

+73
-32
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
composer.lock
33
composer.phar
44
phpunit.xml
5+
/.phpunit.result.cache

composer.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@
3535
},
3636
"require": {
3737
"php": "^7.3|^8",
38-
"omnipay/common": "~3.0"
38+
"omnipay/common": "~3.0",
39+
"symfony/http-client": "^6.0"
3940
},
4041
"require-dev": {
4142
"omnipay/tests": "^4.1",
4243
"squizlabs/php_codesniffer": "^3",
43-
"phpspec/prophecy-phpunit": "^2.0"
44+
"phpspec/prophecy-phpunit": "^2.0",
45+
"http-interop/http-factory-guzzle": "^1.2"
4446
},
4547
"extra": {
4648
"branch-alias": {
@@ -51,5 +53,10 @@
5153
"test": "phpunit",
5254
"check-style": "phpcs -p --standard=PSR2 src/",
5355
"fix-style": "phpcbf -p --standard=PSR2 src/"
56+
},
57+
"config": {
58+
"allow-plugins": {
59+
"php-http/discovery": true
60+
}
5461
}
5562
}

phpunit.xml.dist

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
beStrictAboutTestsThatDoNotTestAnything="false">
1312
<testsuites>
1413
<testsuite name="Omnipay Test Suite">
1514
<directory>./tests/</directory>
1615
</testsuite>
1716
</testsuites>
18-
<filter>
19-
<whitelist>
17+
<coverage>
18+
<include>
2019
<directory>./src</directory>
21-
</whitelist>
22-
</filter>
20+
</include>
21+
</coverage>
2322
</phpunit>

src/Message/AbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ abstract class AbstractRequest extends OmnipayAbstractRequest implements Constan
5858
/**
5959
* @var string Endpoint base URLs.
6060
*/
61-
protected $liveEndpoint = 'https://live.sagepay.com/gateway/service';
62-
protected $testEndpoint = 'https://test.sagepay.com/gateway/service';
61+
protected $liveEndpoint = 'https://live.opayo.eu.elavon.com/gateway/service';
62+
protected $testEndpoint = 'https://sandbox.opayo.eu.elavon.com/gateway/service';
6363

6464
/**
6565
* Convenience method to switch iframe mode on or off.

src/Message/Form/AuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function generateCrypt(array $data)
201201

202202
$query = [];
203203
foreach ($data as $name => $value) {
204-
$query[] = $name . '=' . ($disableUtf8Decode ? $value : utf8_decode($value));
204+
$query[] = $name . '=' . ($disableUtf8Decode ? $value : mb_convert_encoding($value, 'ISO-8859-1', 'UTF-8'));
205205
}
206206
$query = implode('&', $query);
207207

src/Message/Form/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class Response extends AbstractResponse implements RedirectResponseInterface, Co
1515
/**
1616
* @var string Endpoint base URLs.
1717
*/
18-
protected $liveEndpoint = 'https://live.sagepay.com/gateway/service/vspform-register.vsp';
19-
protected $testEndpoint = 'https://test.sagepay.com/gateway/service/vspform-register.vsp';
18+
protected $liveEndpoint = 'https://live.opayo.eu.elavon.com/gateway/service/vspform-register.vsp';
19+
protected $testEndpoint = 'https://sandbox.opayo.eu.elavon.com/gateway/service/vspform-register.vsp';
2020

2121
/**
2222
* Always a redirect, so not yet successful.

src/Message/ServerAuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getData()
3838

3939
// Set the profile only if it is LOW (for iframe use) or NORMAL (for full-page redirects)
4040

41-
$profile = strtoupper($this->getProfile());
41+
$profile = strtoupper($this->getProfile() ?? '');
4242

4343
if ($profile === static::PROFILE_NORMAL || $profile === static::PROFILE_LOW) {
4444
$data['Profile'] = $this->getProfile();

src/Message/ServerCompleteAuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getData()
6565
{
6666
// The two signatures to compare.
6767
$signature = $this->getSignature();
68-
$VPSSignature = strtolower($this->httpRequest->request->get('VPSSignature'));
68+
$VPSSignature = strtolower($this->httpRequest->request->get('VPSSignature') ?? '');
6969

7070
if ($VPSSignature !== $signature) {
7171
throw new InvalidResponseException;

src/Traits/ServerNotifyTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait ServerNotifyTrait
1818
*/
1919
public function getSignature()
2020
{
21-
return strtolower($this->getDataItem('VPSSignature'));
21+
return strtolower($this->getDataItem('VPSSignature') ?? '');
2222
}
2323

2424
/**
@@ -56,7 +56,7 @@ public function buildSignature()
5656
$this->getTransactionId(),
5757
$this->getStatus(),
5858
$this->getTxAuthNo(),
59-
strtolower($this->getVendor()),
59+
strtolower($this->getVendor() ?? ''),
6060
$this->getAVSCV2(),
6161
($this->getTxType() === Response::TXTYPE_TOKEN ? $this->getToken() : ''),
6262
// As saved in the merchant application.

tests/DirectGatewayTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
class DirectGatewayTest extends GatewayTestCase
88
{
9+
protected $purchaseOptions;
10+
protected $captureOptions;
11+
protected $repeatOptions;
12+
protected $refundOptions;
13+
protected $voidOptions;
14+
protected $abortOptions;
15+
916
public function setUp(): void
1017
{
1118
parent::setUp();
@@ -90,7 +97,7 @@ public function testAuthorize3dSecure()
9097
$this->assertTrue($response->isRedirect());
9198
$this->assertNull($response->getTransactionReference());
9299
$this->assertNull($response->getMessage());
93-
$this->assertSame('https://test.sagepay.com/Simulator/3DAuthPage.asp', $response->getRedirectUrl());
100+
$this->assertSame('https://sandbox.opayo.eu.elavon.com/Simulator/3DAuthPage.asp', $response->getRedirectUrl());
94101

95102
$redirectData = $response->getRedirectData();
96103
$this->assertSame('065379457749061954', $redirectData['MD']);
@@ -132,7 +139,7 @@ public function testPurchase3dSecure()
132139
$this->assertTrue($response->isRedirect());
133140
$this->assertNull($response->getTransactionReference());
134141
$this->assertNull($response->getMessage());
135-
$this->assertSame('https://test.sagepay.com/Simulator/3DAuthPage.asp', $response->getRedirectUrl());
142+
$this->assertSame('https://sandbox.opayo.eu.elavon.com/Simulator/3DAuthPage.asp', $response->getRedirectUrl());
136143

137144
$redirectData = $response->getRedirectData();
138145
$this->assertSame('065379457749061954', $redirectData['MD']);

0 commit comments

Comments
 (0)