diff --git a/README.md b/README.md index 4e28bb7..d676b0f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Sage Pay support for Omnipay. -This version only supports PHP 7.1+. +This version supports PHP ^5.6 and PHP ^7. This is the `master` branch of Omnipay, handling Omnipay version `3.x`. For the `2.x` branch, please visit https://github.com/thephpleague/omnipay-sagepay/tree/2.x @@ -629,10 +629,10 @@ $gateway = OmniPay::create('SagePay\Form')->initialize([ The `encryptionKey` is generated in "My Sage Pay" when logged in as the administrator. -Note that this gateway will assume all input data (names, addresses etc.) +Note that this gateway driver will assume all input data (names, addresses etc.) are UTF-8 encoded. It will then recode the data to ISO8859-1 before encrypting it for the gateway, -as the gateway strictly accepts ISO8859-1 only, regardless of what encoding is +since the gateway strictly accepts ISO8859-1 only, regardless of what encoding is used to submit the form from the merchant site. If you do not want this conversion to happen, it can be disabled with this parameter: diff --git a/composer.json b/composer.json index df3cf5b..1f95e3d 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ } }, "require": { + "php": "^5.6|^7", "omnipay/common": "~3.0" }, "require-dev": { diff --git a/tests/Message/ResponseTest.php b/tests/Message/ResponseTest.php index 88c4298..c993f8b 100644 --- a/tests/Message/ResponseTest.php +++ b/tests/Message/ResponseTest.php @@ -2,6 +2,7 @@ namespace Omnipay\SagePay\Message; +use Omnipay\Common\Message\RequestInterface; use Omnipay\Tests\TestCase; class ResponseTest extends TestCase @@ -100,4 +101,25 @@ public function testDirectPurchaseWithToken() $this->assertTrue($response->isSuccessful()); $this->assertSame('{ABCDEFGH-ABCD-ABCD-ABCD-ABCDEFGHIJKL}', $response->getToken()); } + + + public function testRedirectMethodIsPost() + { + $httpResponse = new Response($this->prophesize(RequestInterface::class)->reveal(), []); + $this->assertEquals('POST', $httpResponse->getRedirectMethod()); + } + + public function testDataGetters() + { + $vPSTxId = (string) rand(0, 100); + $securityKey = (string) rand(0, 100); + $data = [ + 'VPSTxId' => $vPSTxId, + 'SecurityKey' => $securityKey, + ]; + $httpResponse = new Response($this->prophesize(RequestInterface::class)->reveal(), $data); + + $this->assertEquals($vPSTxId, $httpResponse->getVPSTxId()); + $this->assertEquals($securityKey, $httpResponse->getSecurityKey()); + } }