Skip to content

Commit 4a0f2e0

Browse files
authored
Merge pull request #26 from sudiptpa/v3-release
Omnipay v3 release
2 parents 8de212f + 3b62c8f commit 4a0f2e0

35 files changed

+316
-319
lines changed

.travis.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
75
- 7.0
86
- 7.1
9-
- hhvm
7+
- 7.2
8+
9+
env:
10+
global:
11+
- setup=basic
12+
13+
matrix:
14+
include:
15+
- php: 5.6
16+
env: setup=lowest
1017

11-
# This triggers builds to run on the new TravisCI infrastructure.
12-
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
1318
sudo: false
1419

15-
## Cache composer
16-
cache:
17-
directories:
18-
- $HOME/.composer/cache
20+
before_install:
21+
- travis_retry composer self-update
1922

20-
before_script:
21-
- composer install -n --dev --prefer-source
23+
install:
24+
- if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi
25+
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi
2226

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

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-2013 Adrian Macneil
1+
Copyright (c) 2012-2018 Adrian Macneil
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: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,12 @@ in 8 countries.
1414

1515
## Installation
1616

17-
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
18-
to your `composer.json` file:
19-
20-
```json
21-
{
22-
"require": {
23-
"omnipay/eway": "~2.0"
24-
}
25-
}
26-
```
17+
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `league/omnipay` and `omnipay/eway` with Composer:
2718

28-
And run composer to update your dependencies:
19+
```
20+
composer require league/omnipay omnipay/eway
2921
30-
$ curl -s http://getcomposer.org/installer | php
31-
$ php composer.phar update
22+
```
3223

3324
## Basic Usage
3425

composer.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@
2626
"psr-4": { "Omnipay\\Eway\\" : "src/" }
2727
},
2828
"require": {
29-
"omnipay/common": "~2.0"
29+
"omnipay/common": "^3"
3030
},
3131
"require-dev": {
32-
"omnipay/tests": "~2.0"
32+
"omnipay/tests": "^3",
33+
"squizlabs/php_codesniffer": "^3",
34+
"phpro/grumphp": "^0.14.0"
3335
},
3436
"extra": {
3537
"branch-alias": {
36-
"dev-master": "2.0.x-dev"
38+
"dev-master": "3.0.x-dev"
3739
}
38-
}
40+
},
41+
"scripts": {
42+
"test": "vendor/bin/phpunit",
43+
"check-style": "phpcs -p --standard=PSR2 src/",
44+
"fix-style": "phpcbf -p --standard=PSR2 src/"
45+
},
46+
"prefer-stable": true
3947
}

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/DirectGateway.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public function getName()
2424

2525
public function getDefaultParameters()
2626
{
27-
return array(
27+
return [
2828
'customerId' => '',
29-
'testMode' => false,
30-
);
29+
'testMode' => false,
30+
];
3131
}
3232

3333
public function getCustomerId()
@@ -40,27 +40,27 @@ public function setCustomerId($value)
4040
return $this->setParameter('customerId', $value);
4141
}
4242

43-
public function authorize(array $parameters = array())
43+
public function authorize(array $parameters = [])
4444
{
4545
return $this->createRequest('\Omnipay\Eway\Message\DirectAuthorizeRequest', $parameters);
4646
}
4747

48-
public function capture(array $parameters = array())
48+
public function capture(array $parameters = [])
4949
{
5050
return $this->createRequest('\Omnipay\Eway\Message\DirectCaptureRequest', $parameters);
5151
}
5252

53-
public function purchase(array $parameters = array())
53+
public function purchase(array $parameters = [])
5454
{
5555
return $this->createRequest('\Omnipay\Eway\Message\DirectPurchaseRequest', $parameters);
5656
}
5757

58-
public function refund(array $parameters = array())
58+
public function refund(array $parameters = [])
5959
{
6060
return $this->createRequest('\Omnipay\Eway\Message\DirectRefundRequest', $parameters);
6161
}
6262

63-
public function void(array $parameters = array())
63+
public function void(array $parameters = [])
6464
{
6565
return $this->createRequest('\Omnipay\Eway\Message\DirectVoidRequest', $parameters);
6666
}

src/Message/DirectAbstractRequest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Omnipay\Eway\Message;
44

55
use Omnipay\Common\Message\AbstractRequest;
6+
use SimpleXMLElement;
67

78
/**
89
* eWAY Direct Abstract Request
@@ -12,9 +13,11 @@ abstract class DirectAbstractRequest extends AbstractRequest
1213

1314
public function sendData($data)
1415
{
15-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data->asXML())->send();
16+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], $data->asXML());
1617

17-
return $this->response = new DirectResponse($this, $httpResponse->xml());
18+
$xml = new SimpleXMLElement($httpResponse->getBody()->getContents());
19+
20+
return $this->response = new DirectResponse($this, $xml);
1821
}
1922

2023
public function getCustomerId()

src/Message/RapidCaptureRequest.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public function getData()
3333
{
3434
$this->validate('amount', 'transactionReference');
3535

36-
$data = array();
36+
$data = [];
3737

38-
$data['Payment'] = array();
38+
$data['Payment'] = [];
3939
$data['Payment']['TotalAmount'] = $this->getAmountInteger();
4040
$data['Payment']['InvoiceNumber'] = $this->getTransactionId();
4141
$data['Payment']['InvoiceDescription'] = $this->getDescription();
@@ -49,20 +49,15 @@ public function getData()
4949

5050
public function getEndpoint()
5151
{
52-
return $this->getEndpointBase().'/CapturePayment';
52+
return $this->getEndpointBase() . '/CapturePayment';
5353
}
5454

5555
public function sendData($data)
5656
{
57-
// This request uses the REST endpoint and requires the JSON content type header
58-
$httpResponse = $this->httpClient->post(
59-
$this->getEndpoint(),
60-
array('content-type' => 'application/json'),
61-
json_encode($data)
62-
)
63-
->setAuth($this->getApiKey(), $this->getPassword())
64-
->send();
57+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [
58+
'content-type' => 'application/json',
59+
], json_encode($data));
6560

66-
return $this->response = new RapidResponse($this, $httpResponse->json());
61+
return $this->response = new RapidResponse($this, json_decode((string) $httpResponse->getBody(), true));
6762
}
6863
}

src/Message/RapidDirectAbstractRequest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function getBaseData()
6060
}
6161

6262
if ($this->getCard()) {
63-
$data['Customer']['CardDetails'] = array();
63+
$data['Customer']['CardDetails'] = [];
6464
$data['Customer']['CardDetails']['Name'] = $this->getCard()->getName();
6565

6666
if ($this->getCard()->getExpiryYear() && $this->getCard()->getExpiryMonth()) {
@@ -101,10 +101,8 @@ protected function getBaseData()
101101

102102
public function sendData($data)
103103
{
104-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
105-
->setAuth($this->getApiKey(), $this->getPassword())
106-
->send();
104+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], json_encode($data));
107105

108-
return $this->response = new RapidResponse($this, $httpResponse->json());
106+
return $this->response = new RapidResponse($this, json_decode((string) $httpResponse->getBody(), true));
109107
}
110108
}

0 commit comments

Comments
 (0)