diff --git a/.travis.yml b/.travis.yml
index eb13864..3f4469a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,27 @@
language: php
php:
- - 5.4
- - 5.5
- 5.6
- 7.0
- 7.1
- - hhvm
+ - 7.2
+
+env:
+ global:
+ - setup=basic
+
+matrix:
+ include:
+ - php: 5.6
+ env: setup=lowest
-# This triggers builds to run on the new TravisCI infrastructure.
-# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false
-## Cache composer
-cache:
- directories:
- - $HOME/.composer/cache
+before_install:
+ - travis_retry composer self-update
-before_script:
- - composer install -n --dev --prefer-source
+install:
+ - if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi
+ - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi
script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
diff --git a/LICENSE b/LICENSE
index d49d0a9..55cf185 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2012-2013 Adrian Macneil
+Copyright (c) 2012-2018 Adrian Macneil
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index d043fde..f377067 100644
--- a/README.md
+++ b/README.md
@@ -14,21 +14,12 @@ in 8 countries.
## Installation
-Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
-to your `composer.json` file:
-
-```json
-{
- "require": {
- "omnipay/eway": "~2.0"
- }
-}
-```
+Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `league/omnipay` and `omnipay/eway` with Composer:
-And run composer to update your dependencies:
+```
+composer require league/omnipay omnipay/eway
- $ curl -s http://getcomposer.org/installer | php
- $ php composer.phar update
+```
## Basic Usage
diff --git a/composer.json b/composer.json
index 228c15e..67c77ab 100644
--- a/composer.json
+++ b/composer.json
@@ -26,14 +26,22 @@
"psr-4": { "Omnipay\\Eway\\" : "src/" }
},
"require": {
- "omnipay/common": "~2.0"
+ "omnipay/common": "^3"
},
"require-dev": {
- "omnipay/tests": "~2.0"
+ "omnipay/tests": "^3",
+ "squizlabs/php_codesniffer": "^3",
+ "phpro/grumphp": "^0.14.0"
},
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "3.0.x-dev"
}
- }
+ },
+ "scripts": {
+ "test": "vendor/bin/phpunit",
+ "check-style": "phpcs -p --standard=PSR2 src/",
+ "fix-style": "phpcbf -p --standard=PSR2 src/"
+ },
+ "prefer-stable": true
}
diff --git a/grumphp.yml b/grumphp.yml
new file mode 100644
index 0000000..bf81fa5
--- /dev/null
+++ b/grumphp.yml
@@ -0,0 +1,15 @@
+parameters:
+ git_dir: .
+ bin_dir: vendor/bin
+ tasks:
+ phpunit:
+ config_file: ~
+ testsuite: ~
+ group: []
+ always_execute: false
+ phpcs:
+ standard: PSR2
+ warning_severity: ~
+ ignore_patterns:
+ - tests/
+ triggered_by: [php]
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index a35b736..535809e 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -14,9 +14,6 @@
./tests/
-
-
-
./src
diff --git a/src/DirectGateway.php b/src/DirectGateway.php
index f2480e9..e92799c 100644
--- a/src/DirectGateway.php
+++ b/src/DirectGateway.php
@@ -24,10 +24,10 @@ public function getName()
public function getDefaultParameters()
{
- return array(
+ return [
'customerId' => '',
- 'testMode' => false,
- );
+ 'testMode' => false,
+ ];
}
public function getCustomerId()
@@ -40,27 +40,27 @@ public function setCustomerId($value)
return $this->setParameter('customerId', $value);
}
- public function authorize(array $parameters = array())
+ public function authorize(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\DirectAuthorizeRequest', $parameters);
}
- public function capture(array $parameters = array())
+ public function capture(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\DirectCaptureRequest', $parameters);
}
- public function purchase(array $parameters = array())
+ public function purchase(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\DirectPurchaseRequest', $parameters);
}
- public function refund(array $parameters = array())
+ public function refund(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\DirectRefundRequest', $parameters);
}
- public function void(array $parameters = array())
+ public function void(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\DirectVoidRequest', $parameters);
}
diff --git a/src/Message/DirectAbstractRequest.php b/src/Message/DirectAbstractRequest.php
index f65ea71..1c3f9ac 100644
--- a/src/Message/DirectAbstractRequest.php
+++ b/src/Message/DirectAbstractRequest.php
@@ -3,6 +3,7 @@
namespace Omnipay\Eway\Message;
use Omnipay\Common\Message\AbstractRequest;
+use SimpleXMLElement;
/**
* eWAY Direct Abstract Request
@@ -12,9 +13,11 @@ abstract class DirectAbstractRequest extends AbstractRequest
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data->asXML())->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], $data->asXML());
- return $this->response = new DirectResponse($this, $httpResponse->xml());
+ $xml = new SimpleXMLElement($httpResponse->getBody()->getContents());
+
+ return $this->response = new DirectResponse($this, $xml);
}
public function getCustomerId()
diff --git a/src/Message/RapidCaptureRequest.php b/src/Message/RapidCaptureRequest.php
index 4001ba2..d876340 100644
--- a/src/Message/RapidCaptureRequest.php
+++ b/src/Message/RapidCaptureRequest.php
@@ -33,9 +33,9 @@ public function getData()
{
$this->validate('amount', 'transactionReference');
- $data = array();
+ $data = [];
- $data['Payment'] = array();
+ $data['Payment'] = [];
$data['Payment']['TotalAmount'] = $this->getAmountInteger();
$data['Payment']['InvoiceNumber'] = $this->getTransactionId();
$data['Payment']['InvoiceDescription'] = $this->getDescription();
@@ -49,20 +49,15 @@ public function getData()
public function getEndpoint()
{
- return $this->getEndpointBase().'/CapturePayment';
+ return $this->getEndpointBase() . '/CapturePayment';
}
public function sendData($data)
{
- // This request uses the REST endpoint and requires the JSON content type header
- $httpResponse = $this->httpClient->post(
- $this->getEndpoint(),
- array('content-type' => 'application/json'),
- json_encode($data)
- )
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [
+ 'content-type' => 'application/json',
+ ], json_encode($data));
- return $this->response = new RapidResponse($this, $httpResponse->json());
+ return $this->response = new RapidResponse($this, json_decode((string) $httpResponse->getBody(), true));
}
}
diff --git a/src/Message/RapidDirectAbstractRequest.php b/src/Message/RapidDirectAbstractRequest.php
index e29e89b..18e5811 100644
--- a/src/Message/RapidDirectAbstractRequest.php
+++ b/src/Message/RapidDirectAbstractRequest.php
@@ -60,7 +60,7 @@ protected function getBaseData()
}
if ($this->getCard()) {
- $data['Customer']['CardDetails'] = array();
+ $data['Customer']['CardDetails'] = [];
$data['Customer']['CardDetails']['Name'] = $this->getCard()->getName();
if ($this->getCard()->getExpiryYear() && $this->getCard()->getExpiryMonth()) {
@@ -101,10 +101,8 @@ protected function getBaseData()
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
- return $this->response = new RapidResponse($this, $httpResponse->json());
+ return $this->response = new RapidResponse($this, json_decode((string) $httpResponse->getBody(), true));
}
}
diff --git a/src/Message/RapidDirectCreateCardRequest.php b/src/Message/RapidDirectCreateCardRequest.php
index 26b66f1..0eaff37 100644
--- a/src/Message/RapidDirectCreateCardRequest.php
+++ b/src/Message/RapidDirectCreateCardRequest.php
@@ -5,7 +5,6 @@
namespace Omnipay\Eway\Message;
-use Omnipay\Eway\RapidDirectGateway;
use Omnipay\Omnipay;
/**
@@ -62,7 +61,7 @@ public function getData()
{
$data = $this->getBaseData();
- $data['Payment'] = array();
+ $data['Payment'] = [];
$data['Payment']['TotalAmount'] = 0;
$data['Method'] = 'CreateTokenCustomer';
@@ -72,31 +71,31 @@ public function getData()
protected function getEndpoint()
{
- return $this->getEndpointBase().'/DirectPayment.json';
+ return $this->getEndpointBase() . '/DirectPayment.json';
}
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
- $this->response = new RapidDirectCreateCardResponse($this, $httpResponse->json());
+ $this->response = new RapidDirectCreateCardResponse(
+ $this,
+ json_decode((string) $httpResponse->getBody(), true)
+ );
if ($this->getAction() === 'Purchase' && $this->response->isSuccessful()) {
- /** @var RapidDirectGateway $purchaseGateway */
$purchaseGateway = Omnipay::create('Eway_RapidDirect');
$purchaseGateway->setApiKey($this->getApiKey());
$purchaseGateway->setPassword($this->getPassword());
$purchaseGateway->setTestMode($this->getTestMode());
- $purchaseResponse = $purchaseGateway->purchase(array(
+ $purchaseResponse = $purchaseGateway->purchase([
'amount' => $this->getAmount(),
'currency' => $this->getCurrency(),
'description' => $this->getDescription(),
'transactionId' => $this->getTransactionId(),
'card' => $this->getCard(),
'cardReference' => $this->response->getCardReference(),
- ))->send();
+ ])->send();
$this->response->setPurchaseResponse($purchaseResponse);
}
diff --git a/src/Message/RapidDirectUpdateCardRequest.php b/src/Message/RapidDirectUpdateCardRequest.php
index 09c3884..3448d63 100644
--- a/src/Message/RapidDirectUpdateCardRequest.php
+++ b/src/Message/RapidDirectUpdateCardRequest.php
@@ -64,7 +64,7 @@ public function getData()
$this->validate('cardReference');
- $data['Payment'] = array();
+ $data['Payment'] = [];
$data['Payment']['TotalAmount'] = 0;
$data['Customer']['TokenCustomerID'] = $this->getCardReference();
@@ -76,15 +76,16 @@ public function getData()
protected function getEndpoint()
{
- return $this->getEndpointBase().'/DirectPayment.json';
+ return $this->getEndpointBase() . '/DirectPayment.json';
}
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
- return $this->response = new RapidDirectCreateCardResponse($this, $httpResponse->json());
+ return $this->response = new RapidDirectCreateCardResponse(
+ $this,
+ json_decode((string) $httpResponse->getBody(), true)
+ );
}
}
diff --git a/src/Message/RapidDirectVoidRequest.php b/src/Message/RapidDirectVoidRequest.php
index 176bc53..d50969b 100644
--- a/src/Message/RapidDirectVoidRequest.php
+++ b/src/Message/RapidDirectVoidRequest.php
@@ -2,7 +2,7 @@
/**
* eWAY Rapid Void Request
*/
-
+
namespace Omnipay\Eway\Message;
class RapidDirectVoidRequest extends AbstractRequest
@@ -11,27 +11,23 @@ public function getData()
{
$this->validate('transactionReference');
- $data = array();
+ $data = [];
$data['TransactionId'] = $this->getTransactionReference();
-
+
return $data;
}
protected function getEndpoint()
{
- return $this->getEndpointBase().'/CancelAuthorisation';
+ return $this->getEndpointBase() . '/CancelAuthorisation';
}
public function sendData($data)
{
- // This request uses the REST endpoint and requires the JSON content type header
- $httpResponse = $this->httpClient->post(
- $this->getEndpoint(),
- array('content-type' => 'application/json'),
- json_encode($data)
- )
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
- return $this->response = new RapidResponse($this, $httpResponse->json());
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [
+ 'content-type' => 'application/json',
+ ], json_encode($data));
+
+ return $this->response = new RapidResponse($this, json_decode((string) $httpResponse->getBody(), true));
}
}
diff --git a/src/Message/RapidPurchaseRequest.php b/src/Message/RapidPurchaseRequest.php
index cd34289..f7c53d1 100644
--- a/src/Message/RapidPurchaseRequest.php
+++ b/src/Message/RapidPurchaseRequest.php
@@ -23,7 +23,7 @@ public function getData()
$data['TransactionType'] = $this->getTransactionType();
$data['RedirectUrl'] = $this->getReturnUrl();
- $data['Payment'] = array();
+ $data['Payment'] = [];
$data['Payment']['TotalAmount'] = $this->getAmountInteger();
$data['Payment']['InvoiceNumber'] = $this->getTransactionId();
$data['Payment']['InvoiceDescription'] = $this->getDescription();
@@ -39,15 +39,13 @@ public function getData()
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
- return $this->response = new RapidResponse($this, $httpResponse->json());
+ return $this->response = new RapidResponse($this, json_decode((string) $httpResponse->getBody(), true));
}
protected function getEndpoint()
{
- return $this->getEndpointBase().'/CreateAccessCode.json';
+ return $this->getEndpointBase() . '/CreateAccessCode.json';
}
}
diff --git a/src/Message/RapidSharedPurchaseRequest.php b/src/Message/RapidSharedPurchaseRequest.php
index 2f6bcc6..c9120e5 100644
--- a/src/Message/RapidSharedPurchaseRequest.php
+++ b/src/Message/RapidSharedPurchaseRequest.php
@@ -33,7 +33,7 @@ public function getData()
$data['VerifyCustomerPhone'] = $this->getVerifyCustomerPhone();
$data['VerifyCustomerEmail'] = $this->getVerifyCustomerEmail();
- $data['Payment'] = array();
+ $data['Payment'] = [];
$data['Payment']['TotalAmount'] = $this->getAmountInteger();
$data['Payment']['InvoiceNumber'] = $this->getTransactionId();
$data['Payment']['InvoiceDescription'] = $this->getDescription();
@@ -49,16 +49,14 @@ public function getData()
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
- return $this->response = new RapidSharedResponse($this, $httpResponse->json());
+ return $this->response = new RapidSharedResponse($this, json_decode((string) $httpResponse->getBody(), true));
}
protected function getEndpoint()
{
- return $this->getEndpointBase().'/CreateAccessCodeShared.json';
+ return $this->getEndpointBase() . '/CreateAccessCodeShared.json';
}
public function getCancelUrl()
diff --git a/src/Message/RefundRequest.php b/src/Message/RefundRequest.php
index 9442ae0..4f540de 100644
--- a/src/Message/RefundRequest.php
+++ b/src/Message/RefundRequest.php
@@ -56,15 +56,13 @@ public function getData()
public function sendData($data)
{
- $httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
- ->setAuth($this->getApiKey(), $this->getPassword())
- ->send();
+ $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
- return $this->response = new RefundResponse($this, $httpResponse->json());
+ return $this->response = new RefundResponse($this, json_decode((string) $httpResponse->getBody(), true));
}
protected function getEndpoint()
{
- return $this->getEndpointBase().'/DirectRefund.json';
+ return $this->getEndpointBase() . '/DirectRefund.json';
}
}
diff --git a/src/RapidDirectGateway.php b/src/RapidDirectGateway.php
index 2e55a8a..28cfce7 100644
--- a/src/RapidDirectGateway.php
+++ b/src/RapidDirectGateway.php
@@ -95,11 +95,11 @@ public function getName()
public function getDefaultParameters()
{
- return array(
- 'apiKey' => '',
+ return [
+ 'apiKey' => '',
'password' => '',
'testMode' => false,
- );
+ ];
}
public function getApiKey()
@@ -133,7 +133,7 @@ public function setPassword($value)
* @param array $parameters
* @return \Omnipay\Eway\Message\RapidDirectPurchaseRequest
*/
- public function purchase(array $parameters = array())
+ public function purchase(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
}
@@ -150,7 +150,7 @@ public function purchase(array $parameters = array())
* @param array $parameters
* @return \Omnipay\Eway\Message\RapidDirectAuthorizeRequest
*/
- public function authorize(array $parameters = array())
+ public function authorize(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectAuthorizeRequest', $parameters);
}
@@ -165,7 +165,7 @@ public function authorize(array $parameters = array())
* @param array $parameters
* @return \Omnipay\Eway\Message\RapidCaptureRequest
*/
- public function capture(array $parameters = array())
+ public function capture(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidCaptureRequest', $parameters);
}
@@ -180,7 +180,7 @@ public function capture(array $parameters = array())
* @param array $parameters
* @return \Omnipay\Eway\Message\RefundRequest
*/
- public function refund(array $parameters = array())
+ public function refund(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RefundRequest', $parameters);
}
@@ -192,7 +192,7 @@ public function refund(array $parameters = array())
* @param array $parameters
* @return \Omnipay\Eway\Message\RapidDirectVoidRequest
*/
- public function void(array $parameters = array())
+ public function void(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectVoidRequest', $parameters);
}
@@ -209,7 +209,7 @@ public function void(array $parameters = array())
* @param array $parameters
* @return \Omnipay\Eway\Message\RapidDirectCreateCardRequest
*/
- public function createCard(array $parameters = array())
+ public function createCard(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectCreateCardRequest', $parameters);
}
@@ -225,7 +225,7 @@ public function createCard(array $parameters = array())
* @param array $parameters
* @return \Omnipay\Eway\Message\RapidDirectUpdateCardRequest
*/
- public function updateCard(array $parameters = array())
+ public function updateCard(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectUpdateCardRequest', $parameters);
}
diff --git a/src/RapidGateway.php b/src/RapidGateway.php
index 92625ae..cc74e6d 100644
--- a/src/RapidGateway.php
+++ b/src/RapidGateway.php
@@ -36,11 +36,11 @@ public function getName()
public function getDefaultParameters()
{
- return array(
- 'apiKey' => '',
+ return [
+ 'apiKey' => '',
'password' => '',
'testMode' => false,
- );
+ ];
}
public function getApiKey()
@@ -63,7 +63,7 @@ public function setPassword($value)
return $this->setParameter('password', $value);
}
- public function purchase(array $parameters = array())
+ public function purchase(array $parameters = [])
{
if (!empty($parameters['cardTransactionType']) && $parameters['cardTransactionType'] === 'continuous') {
$gateway = Omnipay::create('Eway_RapidDirect');
@@ -75,17 +75,17 @@ public function purchase(array $parameters = array())
return $this->createRequest('\Omnipay\Eway\Message\RapidPurchaseRequest', $parameters);
}
- public function completePurchase(array $parameters = array())
+ public function completePurchase(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidCompletePurchaseRequest', $parameters);
}
- public function refund(array $parameters = array())
+ public function refund(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RefundRequest', $parameters);
}
- public function createCard(array $parameters = array())
+ public function createCard(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidCreateCardRequest', $parameters);
}
diff --git a/src/RapidSharedGateway.php b/src/RapidSharedGateway.php
index 882549f..87871fa 100644
--- a/src/RapidSharedGateway.php
+++ b/src/RapidSharedGateway.php
@@ -33,11 +33,11 @@ public function getName()
public function getDefaultParameters()
{
- return array(
- 'apiKey' => '',
+ return [
+ 'apiKey' => '',
'password' => '',
'testMode' => false,
- );
+ ];
}
public function getApiKey()
@@ -60,7 +60,7 @@ public function setPassword($value)
return $this->setParameter('password', $value);
}
- public function purchase(array $parameters = array())
+ public function purchase(array $parameters = [])
{
if (!empty($parameters['cardTransactionType']) && $parameters['cardTransactionType'] === 'continuous') {
$gateway = Omnipay::create('Eway_RapidDirect');
@@ -72,22 +72,22 @@ public function purchase(array $parameters = array())
return $this->createRequest('\Omnipay\Eway\Message\RapidSharedPurchaseRequest', $parameters);
}
- public function completePurchase(array $parameters = array())
+ public function completePurchase(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidCompletePurchaseRequest', $parameters);
}
- public function refund(array $parameters = array())
+ public function refund(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RefundRequest', $parameters);
}
- public function createCard(array $parameters = array())
+ public function createCard(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidSharedCreateCardRequest', $parameters);
}
- public function updateCard(array $parameters = array())
+ public function updateCard(array $parameters = [])
{
return $this->createRequest('\Omnipay\Eway\Message\RapidSharedUpdateCardRequest', $parameters);
}
diff --git a/tests/DirectGatewayTest.php b/tests/DirectGatewayTest.php
index 838fb3b..e4b1bcc 100644
--- a/tests/DirectGatewayTest.php
+++ b/tests/DirectGatewayTest.php
@@ -2,8 +2,8 @@
namespace Omnipay\Eway;
-use Omnipay\Tests\GatewayTestCase;
use Omnipay\Common\CreditCard;
+use Omnipay\Tests\GatewayTestCase;
class DirectGatewayTest extends GatewayTestCase
{
@@ -18,31 +18,31 @@ public function setUp()
$card = new CreditCard($this->getValidCard());
- $this->purchaseOptions = array(
+ $this->purchaseOptions = [
'amount' => '10.00',
- 'card' => $card
- );
+ 'card' => $card,
+ ];
- $this->captureOptions = array(
+ $this->captureOptions = [
'amount' => '10.00',
- 'transactionId' => '10451614'
- );
-
- $this->refundOptions = array(
- 'card' => $card,
- 'amount' => '10.00',
- 'transactionId' => '10451628',
- 'refundPassword' => 'Refund123'
- );
-
- $this->voidOptions = array(
- 'transactionId' => '10451636'
- );
+ 'transactionId' => '10451614',
+ ];
+
+ $this->refundOptions = [
+ 'card' => $card,
+ 'amount' => '10.00',
+ 'transactionId' => '10451628',
+ 'refundPassword' => 'Refund123',
+ ];
+
+ $this->voidOptions = [
+ 'transactionId' => '10451636',
+ ];
}
public function testAuthorizeSuccess()
{
- $this->setMockHttpResponse('DirectAuthorizeSuccess.txt');
+ $this->setMockHttpResponse('DirectAuthorizeSuccess.txt');
$request = $this->gateway->authorize($this->purchaseOptions);
@@ -58,9 +58,9 @@ public function testAuthorizeSuccess()
public function testAuthorizeFailure()
{
- $this->purchaseOptions['amount'] = '10.63';
+ $this->purchaseOptions['amount'] = '10.63';
- $this->setMockHttpResponse('DirectAuthorizeFailure.txt');
+ $this->setMockHttpResponse('DirectAuthorizeFailure.txt');
$request = $this->gateway->authorize($this->purchaseOptions);
@@ -76,7 +76,7 @@ public function testAuthorizeFailure()
public function testCaptureSuccess()
{
- $this->setMockHttpResponse('DirectCaptureSuccess.txt');
+ $this->setMockHttpResponse('DirectCaptureSuccess.txt');
$request = $this->gateway->capture($this->captureOptions);
@@ -92,7 +92,7 @@ public function testCaptureSuccess()
public function testCaptureFailure()
{
- $this->setMockHttpResponse('DirectCaptureFailure.txt');
+ $this->setMockHttpResponse('DirectCaptureFailure.txt');
$request = $this->gateway->capture($this->captureOptions);
@@ -107,7 +107,7 @@ public function testCaptureFailure()
public function testPurchaseSuccess()
{
- $this->setMockHttpResponse('DirectPurchaseSuccess.txt');
+ $this->setMockHttpResponse('DirectPurchaseSuccess.txt');
$request = $this->gateway->purchase($this->purchaseOptions);
@@ -123,9 +123,9 @@ public function testPurchaseSuccess()
public function testPurchaseFailure()
{
- $this->purchaseOptions['amount'] = '10.63';
+ $this->purchaseOptions['amount'] = '10.63';
- $this->setMockHttpResponse('DirectPurchaseFailure.txt');
+ $this->setMockHttpResponse('DirectPurchaseFailure.txt');
$request = $this->gateway->purchase($this->purchaseOptions);
@@ -141,7 +141,7 @@ public function testPurchaseFailure()
public function testRefundSuccess()
{
- $this->setMockHttpResponse('DirectRefundSuccess.txt');
+ $this->setMockHttpResponse('DirectRefundSuccess.txt');
$request = $this->gateway->refund($this->refundOptions);
@@ -157,7 +157,7 @@ public function testRefundSuccess()
public function testRefundFailure()
{
- $this->setMockHttpResponse('DirectRefundFailure.txt');
+ $this->setMockHttpResponse('DirectRefundFailure.txt');
$request = $this->gateway->refund($this->refundOptions);
@@ -172,7 +172,7 @@ public function testRefundFailure()
public function testVoidSuccess()
{
- $this->setMockHttpResponse('DirectVoidSuccess.txt');
+ $this->setMockHttpResponse('DirectVoidSuccess.txt');
$request = $this->gateway->void($this->voidOptions);
@@ -188,7 +188,7 @@ public function testVoidSuccess()
public function testVoidFailure()
{
- $this->setMockHttpResponse('DirectVoidFailure.txt');
+ $this->setMockHttpResponse('DirectVoidFailure.txt');
$request = $this->gateway->void($this->voidOptions);
diff --git a/tests/Message/AbstractRequestTest.php b/tests/Message/AbstractRequestTest.php
index e1c46e7..d9c99c8 100644
--- a/tests/Message/AbstractRequestTest.php
+++ b/tests/Message/AbstractRequestTest.php
@@ -7,7 +7,6 @@
class AbstractRequestTest extends TestCase
{
-
public function setUp()
{
$this->request = m::mock('\Omnipay\Eway\Message\AbstractRequest')->makePartial();
@@ -52,10 +51,10 @@ public function testInvoiceReference()
public function testGetItemData()
{
- $this->request->setItems(array(
- array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
- array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
- ));
+ $this->request->setItems([
+ ['name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10],
+ ['name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40],
+ ]);
$data = $this->request->getItemData();
$this->assertSame('Floppy Disk', $data[0]['SKU']);
diff --git a/tests/Message/AbstractResponseTest.php b/tests/Message/AbstractResponseTest.php
index 90a26f7..7f4438c 100644
--- a/tests/Message/AbstractResponseTest.php
+++ b/tests/Message/AbstractResponseTest.php
@@ -15,27 +15,27 @@ public function setUp()
public function testIsSuccessful()
{
- $data = array('TransactionStatus' => true);
+ $data = ['TransactionStatus' => true];
$request = $this->getMockRequest();
- $this->response = m::mock('\Omnipay\Eway\Message\AbstractResponse', array($request, $data))->makePartial();
+ $this->response = m::mock('\Omnipay\Eway\Message\AbstractResponse', [$request, $data])->makePartial();
$this->assertTrue($this->response->isSuccessful());
}
public function testGetMessage()
{
- $data = array('ResponseMessage' => 'A2000');
+ $data = ['ResponseMessage' => 'A2000'];
$request = $this->getMockRequest();
- $this->response = m::mock('\Omnipay\Eway\Message\AbstractResponse', array($request, $data))->makePartial();
+ $this->response = m::mock('\Omnipay\Eway\Message\AbstractResponse', [$request, $data])->makePartial();
$this->assertSame('Transaction Approved', $this->response->getMessage());
}
public function testGetMessageMultiple()
{
- $data = array('ResponseMessage' => 'V6101,V6102');
+ $data = ['ResponseMessage' => 'V6101,V6102'];
$request = $this->getMockRequest();
- $this->response = m::mock('\Omnipay\Eway\Message\AbstractResponse', array($request, $data))->makePartial();
+ $this->response = m::mock('\Omnipay\Eway\Message\AbstractResponse', [$request, $data])->makePartial();
$this->assertSame('Invalid EWAY_CARDEXPIRYMONTH, Invalid EWAY_CARDEXPIRYYEAR', $this->response->getMessage());
}
diff --git a/tests/Message/RapidCaptureRequestTest.php b/tests/Message/RapidCaptureRequestTest.php
index dcd2c6d..39aeaf9 100644
--- a/tests/Message/RapidCaptureRequestTest.php
+++ b/tests/Message/RapidCaptureRequestTest.php
@@ -9,17 +9,17 @@ class RapidCaptureRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidCaptureRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
'transactionReference' => '12345678',
- ));
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
@@ -28,7 +28,7 @@ public function testGetData()
'description' => 'new car',
'transactionId' => '999',
'invoiceReference' => 'INV-123',
- ));
+ ]);
$data = $this->request->getData();
diff --git a/tests/Message/RapidCompletePurchaseRequestTest.php b/tests/Message/RapidCompletePurchaseRequestTest.php
index 9bca994..0b64298 100644
--- a/tests/Message/RapidCompletePurchaseRequestTest.php
+++ b/tests/Message/RapidCompletePurchaseRequestTest.php
@@ -9,13 +9,13 @@ class RapidCompletePurchaseRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidCompletePurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
- ));
- $this->getHttpRequest()->query->replace(array(
+ ]);
+ $this->getHttpRequest()->query->replace([
'AccessCode' => 'F9802j0-O7sdVLnOcb_3IPryTxHDtKY8u_0pb10GbYq-Xjvbc-5Bc_LhI-oBIrTxTCjhOFn7Mq-CwpkLDja5-iu-Dr3DjVTr9u4yxSB5BckdbJqSA4WWydzDO0jnPWfBdKcWL',
- ));
+ ]);
}
public function testGetData()
diff --git a/tests/Message/RapidDirectAuthorizeRequestTest.php b/tests/Message/RapidDirectAuthorizeRequestTest.php
index 2a008f0..24e4b9b 100644
--- a/tests/Message/RapidDirectAuthorizeRequestTest.php
+++ b/tests/Message/RapidDirectAuthorizeRequestTest.php
@@ -9,24 +9,24 @@ class RapidDirectAuthorizeRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidDirectAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
- 'card' => array(
+ 'card' => [
'firstName' => 'John',
'lastName' => 'Smith',
'number' => '4111111111111111',
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -38,7 +38,7 @@ public function testGetData()
'currency' => 'AUD',
'invoiceReference' => 'INV-123',
'clientIp' => '127.0.0.1',
- 'card' => array(
+ 'card' => [
'firstName' => 'John',
'lastName' => 'Smith',
'shippingFirstName' => 'Bob',
@@ -54,11 +54,11 @@ public function testGetData()
'startMonth' => '01',
'startYear' => '13',
'issueNumber' => '1',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
-
+
$this->assertSame('Authorise', $data['Method']);
$this->assertSame('127.0.0.1', $data['CustomerIP']);
$this->assertSame('1234', $data['PartnerID']);
diff --git a/tests/Message/RapidDirectCreateCardRequestTest.php b/tests/Message/RapidDirectCreateCardRequestTest.php
index e80b7e4..46f2051 100644
--- a/tests/Message/RapidDirectCreateCardRequestTest.php
+++ b/tests/Message/RapidDirectCreateCardRequestTest.php
@@ -9,10 +9,10 @@ class RapidDirectCreateCardRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidDirectCreateCardRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
- 'card' => array(
+ 'card' => [
'title' => 'Mr.',
'firstName' => 'John',
'lastName' => 'Smith',
@@ -20,13 +20,13 @@ public function setUp()
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -36,7 +36,7 @@ public function testGetData()
'currency' => 'AUD',
'invoiceReference' => 'INV-123',
'clientIp' => '127.0.0.1',
- 'card' => array(
+ 'card' => [
'title' => 'Mr.',
'firstName' => 'John',
'lastName' => 'Smith',
@@ -50,8 +50,8 @@ public function testGetData()
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -75,30 +75,30 @@ public function testGetData()
*/
public function testGetDataNoExpiryTokenPresent()
{
- $this->request->initialize(array(
- 'apiKey' => 'my api key',
- 'password' => 'secret',
- 'transactionId' => '999',
- 'description' => 'new car',
- 'currency' => 'AUD',
- 'invoiceReference' => 'INV-123',
- 'card' => array(
- 'title' => 'Mr.',
- 'firstName' => 'John',
- 'lastName' => 'Smith',
- 'shippingFirstName' => 'Bob',
- 'shippingLastName' => 'Mann',
- 'shippingAddress1' => 'Level 1',
- 'shippingAddress2' => '123 Test Lane',
- 'shippingState' => 'NSW',
- 'shippingCountry' => 'AU',
- 'cardReference' => 'myRef',
- ),
- ));
+ $this->request->initialize([
+ 'apiKey' => 'my api key',
+ 'password' => 'secret',
+ 'transactionId' => '999',
+ 'description' => 'new car',
+ 'currency' => 'AUD',
+ 'invoiceReference' => 'INV-123',
+ 'card' => [
+ 'title' => 'Mr.',
+ 'firstName' => 'John',
+ 'lastName' => 'Smith',
+ 'shippingFirstName' => 'Bob',
+ 'shippingLastName' => 'Mann',
+ 'shippingAddress1' => 'Level 1',
+ 'shippingAddress2' => '123 Test Lane',
+ 'shippingState' => 'NSW',
+ 'shippingCountry' => 'AU',
+ 'cardReference' => 'myRef',
+ ],
+ ]);
- $data = $this->request->getData();
- $this->assertTrue(!isset($data['Customer']['CardDetails']['ExpiryMonth']));
- $this->assertTrue(!isset($data['Customer']['CardDetails']['ExpiryYear']));
+ $data = $this->request->getData();
+ $this->assertTrue(!isset($data['Customer']['CardDetails']['ExpiryMonth']));
+ $this->assertTrue(!isset($data['Customer']['CardDetails']['ExpiryYear']));
}
public function testSendSuccess()
diff --git a/tests/Message/RapidDirectPurchaseRequestTest.php b/tests/Message/RapidDirectPurchaseRequestTest.php
index 772f242..0d38e8f 100644
--- a/tests/Message/RapidDirectPurchaseRequestTest.php
+++ b/tests/Message/RapidDirectPurchaseRequestTest.php
@@ -9,25 +9,25 @@ class RapidDirectPurchaseRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidDirectPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
'transactionType' => 'Purchase',
- 'card' => array(
+ 'card' => [
'firstName' => 'John',
'lastName' => 'Smith',
'number' => '4111111111111111',
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -39,7 +39,7 @@ public function testGetData()
'currency' => 'AUD',
'invoiceReference' => 'INV-123',
'clientIp' => '127.0.0.1',
- 'card' => array(
+ 'card' => [
'firstName' => 'John',
'lastName' => 'Smith',
'shippingFirstName' => 'Bob',
@@ -55,8 +55,8 @@ public function testGetData()
'startMonth' => '01',
'startYear' => '13',
'issueNumber' => '1',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -85,7 +85,7 @@ public function testGetData()
public function testGetDataWithToken()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'transactionType' => 'MOTO',
@@ -95,7 +95,7 @@ public function testGetDataWithToken()
'currency' => 'AUD',
'invoiceReference' => 'INV-123',
'cardReference' => '87654321',
- ));
+ ]);
$data = $this->request->getData();
@@ -106,7 +106,7 @@ public function testGetDataWithToken()
public function testGetDataWithEncryption()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -120,7 +120,7 @@ public function testGetDataWithEncryption()
'clientIp' => '127.0.0.1',
'encryptedCardNumber' => 'eCrypted:YVe4GMLMSxF5m1nixtBvVlmaLDgjI+ZYM5GHuX1XjlbRTnhe/khA2csWblJDqaQE9S4BV+y4Xnf61GmRDNC9yLBVduGFuigHJ8rk360m580fYOiHy+OaZpgpRvHPw==',
'encryptedCardCvv' => 'eCrypted:ZvEfRd1DHwJ7dYV59DZqoaCFujvK+26VKS9Tp3uGp5kVki8CHpy67WUaFqqDzjZ8C6e3+TUXtW6/rrXGYYIXMfbph4Uw+XyLja3MJzOGniULWJA5zt90wxRwpZeYGDNQ==',
- 'card' => array(
+ 'card' => [
'firstName' => 'John',
'lastName' => 'Smith',
'shippingFirstName' => 'Bob',
@@ -134,8 +134,8 @@ public function testGetDataWithEncryption()
'startMonth' => '01',
'startYear' => '13',
'issueNumber' => '1',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -151,10 +151,9 @@ public function testGetDataWithEncryption()
$this->assertSame('1', $data['Customer']['CardDetails']['IssueNumber']);
}
-
public function testGetDataWithItems()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
@@ -163,20 +162,20 @@ public function testGetDataWithItems()
'description' => 'new car',
'currency' => 'AUD',
'clientIp' => '127.0.0.1',
- 'card' => array(
+ 'card' => [
'firstName' => 'John',
'lastName' => 'Smith',
'number' => '4111111111111111',
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
- $this->request->setItems(array(
- array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
- array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
- ));
+ $this->request->setItems([
+ ['name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10],
+ ['name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40],
+ ]);
$data = $this->request->getData();
diff --git a/tests/Message/RapidDirectUpdateCardRequestTest.php b/tests/Message/RapidDirectUpdateCardRequestTest.php
index 4d36a90..b11d67e 100644
--- a/tests/Message/RapidDirectUpdateCardRequestTest.php
+++ b/tests/Message/RapidDirectUpdateCardRequestTest.php
@@ -9,11 +9,11 @@ class RapidDirectUpdateCardRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidDirectUpdateCardRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'cardReference' => '987654321',
- 'card' => array(
+ 'card' => [
'title' => 'Mr.',
'firstName' => 'John',
'lastName' => 'Smith',
@@ -21,17 +21,17 @@ public function setUp()
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'cardReference' => '987654321',
- 'card' => array(
+ 'card' => [
'title' => 'Mr.',
'firstName' => 'John',
'lastName' => 'Smith',
@@ -43,11 +43,11 @@ public function testGetData()
'expiryMonth' => '12',
'expiryYear' => gmdate('Y') + rand(1, 5),
'cvv' => rand(100, 999),
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
-
+
$this->assertSame('UpdateTokenCustomer', $data['Method']);
$this->assertSame('987654321', $data['Customer']['TokenCustomerID']);
$this->assertSame(0, $data['Payment']['TotalAmount']);
@@ -59,7 +59,7 @@ public function testGetData()
$this->assertSame('4111111111111111', $data['Customer']['CardDetails']['Number']);
$this->assertSame('12', $data['Customer']['CardDetails']['ExpiryMonth']);
}
-
+
public function testSendSuccess()
{
$this->setMockHttpResponse('RapidDirectUpdateCardRequestSuccess.txt');
diff --git a/tests/Message/RapidDirectVoidRequestTest.php b/tests/Message/RapidDirectVoidRequestTest.php
index 657d603..b91a0de 100644
--- a/tests/Message/RapidDirectVoidRequestTest.php
+++ b/tests/Message/RapidDirectVoidRequestTest.php
@@ -9,20 +9,20 @@ class RapidDirectVoidRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidDirectVoidRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
- 'transactionReference' => '4324324'
- ));
+ 'transactionReference' => '4324324',
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
- 'transactionReference' => '4324324'
- ));
+ 'transactionReference' => '4324324',
+ ]);
$data = $this->request->getData();
diff --git a/tests/Message/RapidPurchaseRequestTest.php b/tests/Message/RapidPurchaseRequestTest.php
index fd5624d..da8b8e0 100644
--- a/tests/Message/RapidPurchaseRequestTest.php
+++ b/tests/Message/RapidPurchaseRequestTest.php
@@ -9,17 +9,17 @@ class RapidPurchaseRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
'returnUrl' => 'https://www.example.com/return',
- ));
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -32,7 +32,7 @@ public function testGetData()
'invoiceReference' => 'INV-123',
'clientIp' => '127.0.0.1',
'returnUrl' => 'https://www.example.com/return',
- 'card' => array(
+ 'card' => [
'firstName' => 'Patrick',
'lastName' => 'Collison',
'shippingFirstName' => 'John',
@@ -41,8 +41,8 @@ public function testGetData()
'shippingAddress2' => '123 Test Lane',
'shippingState' => 'NSW',
'shippingCountry' => 'AU',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -66,7 +66,7 @@ public function testGetData()
public function testGetDataWithItems()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
@@ -75,16 +75,16 @@ public function testGetDataWithItems()
'currency' => 'AUD',
'clientIp' => '127.0.0.1',
'returnUrl' => 'https://www.example.com/return',
- 'card' => array(
+ 'card' => [
'firstName' => 'Patrick',
'lastName' => 'Collison',
- ),
- ));
+ ],
+ ]);
- $this->request->setItems(array(
- array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
- array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
- ));
+ $this->request->setItems([
+ ['name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10],
+ ['name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40],
+ ]);
$data = $this->request->getData();
@@ -108,7 +108,7 @@ public function testSendSuccess()
$this->assertTrue($response->isRedirect());
$this->assertSame('POST', $response->getRedirectMethod());
$this->assertSame('https://secure-au.sandbox.ewaypayments.com/Process', $response->getRedirectUrl());
- $this->assertSame(array('EWAY_ACCESSCODE' => 'F9802j0-O7sdVLnOcb_3IPryTxHDtKY8u_0pb10GbYq-Xjvbc-5Bc_LhI-oBIrTxTCjhOFn7Mq-CwpkLDja5-iu-Dr3DjVTr9u4yxSB5BckdbJqSA4WWydzDO0jnPWfBdKcWL'), $response->getRedirectData());
+ $this->assertSame(['EWAY_ACCESSCODE' => 'F9802j0-O7sdVLnOcb_3IPryTxHDtKY8u_0pb10GbYq-Xjvbc-5Bc_LhI-oBIrTxTCjhOFn7Mq-CwpkLDja5-iu-Dr3DjVTr9u4yxSB5BckdbJqSA4WWydzDO0jnPWfBdKcWL'], $response->getRedirectData());
$this->assertNull($response->getTransactionReference());
$this->assertNull($response->getMessage());
$this->assertNull($response->getCode());
diff --git a/tests/Message/RapidResponseTest.php b/tests/Message/RapidResponseTest.php
index ff8ab3a..92990a9 100644
--- a/tests/Message/RapidResponseTest.php
+++ b/tests/Message/RapidResponseTest.php
@@ -8,7 +8,7 @@ class RapidResponseTest extends TestCase
{
public function testGetMessage()
{
- $data = array('ResponseMessage' => 'A2000');
+ $data = ['ResponseMessage' => 'A2000'];
$response = new RapidResponse($this->getMockRequest(), $data);
$this->assertSame('Transaction Approved', $response->getMessage());
@@ -16,7 +16,7 @@ public function testGetMessage()
public function testGetMessageMultiple()
{
- $data = array('ResponseMessage' => 'V6101,V6102');
+ $data = ['ResponseMessage' => 'V6101,V6102'];
$response = new RapidResponse($this->getMockRequest(), $data);
$this->assertSame('Invalid EWAY_CARDEXPIRYMONTH, Invalid EWAY_CARDEXPIRYYEAR', $response->getMessage());
diff --git a/tests/Message/RapidSharedCreateCardRequestTest.php b/tests/Message/RapidSharedCreateCardRequestTest.php
index 38d4681..df827b0 100644
--- a/tests/Message/RapidSharedCreateCardRequestTest.php
+++ b/tests/Message/RapidSharedCreateCardRequestTest.php
@@ -9,26 +9,26 @@ class RapidSharedCreateCardRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidSharedCreateCardRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'returnUrl' => 'https://www.example.com/return',
- ));
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'returnUrl' => 'https://www.example.com/return',
- 'card' => array(
+ 'card' => [
'title' => 'Mr',
'firstName' => 'Patrick',
'lastName' => 'Collison',
'country' => 'AU',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
diff --git a/tests/Message/RapidSharedPurchaseRequestTest.php b/tests/Message/RapidSharedPurchaseRequestTest.php
index 40fddeb..e644f36 100644
--- a/tests/Message/RapidSharedPurchaseRequestTest.php
+++ b/tests/Message/RapidSharedPurchaseRequestTest.php
@@ -9,17 +9,17 @@ class RapidSharedPurchaseRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidSharedPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
'returnUrl' => 'https://www.example.com/return',
- ));
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -32,7 +32,7 @@ public function testGetData()
'invoiceReference' => 'INV-123',
'clientIp' => '127.0.0.1',
'returnUrl' => 'https://www.example.com/return',
- 'card' => array(
+ 'card' => [
'firstName' => 'Patrick',
'lastName' => 'Collison',
'shippingFirstName' => 'John',
@@ -41,8 +41,8 @@ public function testGetData()
'shippingAddress2' => '123 Test Lane',
'shippingState' => 'NSW',
'shippingCountry' => 'AU',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -66,7 +66,7 @@ public function testGetData()
public function testGetDataWithItems()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
@@ -75,16 +75,16 @@ public function testGetDataWithItems()
'currency' => 'AUD',
'clientIp' => '127.0.0.1',
'returnUrl' => 'https://www.example.com/return',
- 'card' => array(
+ 'card' => [
'firstName' => 'Patrick',
'lastName' => 'Collison',
- ),
- ));
+ ],
+ ]);
- $this->request->setItems(array(
- array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
- array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
- ));
+ $this->request->setItems([
+ ['name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10],
+ ['name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40],
+ ]);
$data = $this->request->getData();
@@ -177,5 +177,4 @@ public function testVerifyCustomerEmail()
$this->assertSame($this->request, $this->request->setVerifyCustomerEmail('true'));
$this->assertSame('true', $this->request->getVerifyCustomerEmail());
}
-
}
diff --git a/tests/Message/RapidSharedUpdateCardRequestTest.php b/tests/Message/RapidSharedUpdateCardRequestTest.php
index 1cdc316..0020725 100644
--- a/tests/Message/RapidSharedUpdateCardRequestTest.php
+++ b/tests/Message/RapidSharedUpdateCardRequestTest.php
@@ -9,28 +9,28 @@ class RapidSharedUpdateCardRequestTest extends TestCase
public function setUp()
{
$this->request = new RapidSharedUpdateCardRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'returnUrl' => 'https://www.example.com/return',
- 'cardReference' => '123456789'
- ));
+ 'cardReference' => '123456789',
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'returnUrl' => 'https://www.example.com/return',
'cardReference' => '123456789',
- 'card' => array(
+ 'card' => [
'title' => 'Mr',
'firstName' => 'Patrick',
'lastName' => 'Collison',
'country' => 'AU',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -122,5 +122,4 @@ public function testVerifyCustomerEmail()
$this->assertSame($this->request, $this->request->setVerifyCustomerEmail('true'));
$this->assertSame('true', $this->request->getVerifyCustomerEmail());
}
-
}
diff --git a/tests/Message/RefundRequestTest.php b/tests/Message/RefundRequestTest.php
index 62ef01b..3ebfd2a 100644
--- a/tests/Message/RefundRequestTest.php
+++ b/tests/Message/RefundRequestTest.php
@@ -9,17 +9,17 @@ class RapidRefundRequestTest extends TestCase
public function setUp()
{
$this->request = new RefundRequest($this->getHttpClient(), $this->getHttpRequest());
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
'transactionReference' => '87654321',
- ));
+ ]);
}
public function testGetData()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'partnerId' => '1234',
@@ -30,7 +30,7 @@ public function testGetData()
'currency' => 'AUD',
'invoiceReference' => 'INV-123',
'clientIp' => '127.0.0.1',
- 'card' => array(
+ 'card' => [
'firstName' => 'Patrick',
'lastName' => 'Collison',
'shippingFirstName' => 'John',
@@ -39,8 +39,8 @@ public function testGetData()
'shippingAddress2' => '123 Test Lane',
'shippingState' => 'NSW',
'shippingCountry' => 'AU',
- ),
- ));
+ ],
+ ]);
$data = $this->request->getData();
@@ -62,7 +62,7 @@ public function testGetData()
public function testGetDataWithItems()
{
- $this->request->initialize(array(
+ $this->request->initialize([
'apiKey' => 'my api key',
'password' => 'secret',
'amount' => '10.00',
@@ -71,16 +71,16 @@ public function testGetDataWithItems()
'description' => 'new car',
'currency' => 'AUD',
'clientIp' => '127.0.0.1',
- 'card' => array(
+ 'card' => [
'firstName' => 'Patrick',
'lastName' => 'Collison',
- ),
- ));
+ ],
+ ]);
- $this->request->setItems(array(
- array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
- array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
- ));
+ $this->request->setItems([
+ ['name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10],
+ ['name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40],
+ ]);
$data = $this->request->getData();
@@ -115,4 +115,4 @@ public function testSendFailure()
$this->assertSame('Unauthorised API Access, Account Not PCI Certified, Invalid Refund Transaction ID', $response->getMessage());
$this->assertSame('V6111,V6115', $response->getCode());
}
-}
\ No newline at end of file
+}