Skip to content

Commit f1dc0d1

Browse files
sudiptpabarryvdh
authored andcommitted
Prepare for v3 Release (#14)
* Prepare for v3 Release * Fixing doc blocks, headers not needed * Adding dynamic expiryYear * Added new version to README
1 parent ac2982c commit f1dc0d1

22 files changed

+162
-143
lines changed

.travis.yml

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

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
75
- 7.0
86
- 7.1
9-
7+
- 7.2
8+
9+
env:
10+
global:
11+
- setup=basic
12+
1013
matrix:
1114
include:
12-
- php: 5.3
13-
dist: precise
15+
- php: 5.6
16+
env: setup=lowest
17+
18+
sudo: false
19+
20+
before_install:
21+
- travis_retry composer self-update
1422

1523
install:
16-
- composer install -n --dev
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
1726

1827
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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,15 @@
77
[![Total Downloads](https://poser.pugx.org/omnipay/securepay/d/total.png)](https://packagist.org/packages/omnipay/securepay)
88

99
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
10-
processing library for PHP 5.3+. This package implements SecurePay support for Omnipay.
10+
processing library for PHP. This package implements SecurePay support for Omnipay.
1111

1212
## Installation
1313

14-
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
15-
to your `composer.json` file:
14+
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply require `league/omnipay` and `omnipay/securepay` with Composer:
1615

17-
```json
18-
{
19-
"require": {
20-
"omnipay/securepay": "~2.0"
21-
}
22-
}
2316
```
24-
25-
And run composer to update your dependencies:
26-
27-
$ curl -s http://getcomposer.org/installer | php
28-
$ php composer.phar update
17+
composer require league/omnipay omnipay/securepay
18+
```
2919

3020
## Basic Usage
3121

composer.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@
2626
"psr-4": { "Omnipay\\SecurePay\\" : "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/DirectPostGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public function getName()
2020

2121
public function getDefaultParameters()
2222
{
23-
return array(
23+
return [
2424
'merchantId' => '',
2525
'transactionPassword' => '',
2626
'testMode' => false,
27-
);
27+
];
2828
}
2929

3030
public function getMerchantId()

src/Message/DirectPostAuthorizeRequest.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function getData()
1313
{
1414
$this->validate('amount', 'returnUrl', 'card');
1515

16-
$data = array();
16+
$data = [];
1717
$data['EPS_MERCHANT'] = $this->getMerchantId();
1818
$data['EPS_TXNTYPE'] = $this->txnType;
1919
$data['EPS_IP'] = $this->getClientIp();
@@ -33,17 +33,14 @@ public function getData()
3333

3434
public function generateFingerprint(array $data)
3535
{
36-
$hash = implode(
37-
'|',
38-
array(
39-
$data['EPS_MERCHANT'],
40-
$this->getTransactionPassword(),
41-
$data['EPS_TXNTYPE'],
42-
$data['EPS_REFERENCEID'],
43-
$data['EPS_AMOUNT'],
44-
$data['EPS_TIMESTAMP'],
45-
)
46-
);
36+
$hash = implode('|', [
37+
$data['EPS_MERCHANT'],
38+
$this->getTransactionPassword(),
39+
$data['EPS_TXNTYPE'],
40+
$data['EPS_REFERENCEID'],
41+
$data['EPS_AMOUNT'],
42+
$data['EPS_TIMESTAMP'],
43+
]);
4744

4845
return sha1($hash);
4946
}
@@ -57,7 +54,7 @@ protected function getCardData()
5754
{
5855
$this->getCard()->validate();
5956

60-
$data = array();
57+
$data = [];
6158
$data['EPS_CARDNUMBER'] = $this->getCard()->getNumber();
6259
$data['EPS_EXPIRYMONTH'] = $this->getCard()->getExpiryMonth();
6360
$data['EPS_EXPIRYYEAR'] = $this->getCard()->getExpiryYear();

src/Message/DirectPostCompletePurchaseRequest.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ public function getData()
2222

2323
public function generateResponseFingerprint($data)
2424
{
25-
$fields = implode(
26-
'|',
27-
array(
28-
$data['merchant'],
29-
$this->getTransactionPassword(),
30-
$data['refid'],
31-
$this->getAmount(),
32-
$data['timestamp'],
33-
$data['summarycode'],
34-
)
35-
);
25+
$fields = implode('|', [
26+
$data['merchant'],
27+
$this->getTransactionPassword(),
28+
$data['refid'],
29+
$this->getAmount(),
30+
$data['timestamp'],
31+
$data['summarycode'],
32+
]);
3633

3734
return sha1($fields);
3835
}

src/Message/SecureXMLAbstractRequest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@
77
*/
88
abstract class SecureXMLAbstractRequest extends AbstractRequest
99
{
10+
/**
11+
* @var string
12+
*/
1013
public $testEndpoint = 'https://test.api.securepay.com.au/xmlapi/payment';
14+
15+
/**
16+
* @var string
17+
*/
1118
public $liveEndpoint = 'https://api.securepay.com.au/xmlapi/payment';
1219

20+
/**
21+
* @var string
22+
*/
1323
protected $requestType = 'Payment';
14-
protected $requiredFields = array();
24+
25+
/**
26+
* @var array
27+
*/
28+
protected $requiredFields = [];
1529

1630
/**
1731
* Set the messageID on the request.
@@ -43,9 +57,11 @@ public function getMessageId()
4357

4458
public function sendData($data)
4559
{
46-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data->asXML())->send();
60+
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], $data->asXML());
61+
62+
$xml = new \SimpleXMLElement($httpResponse->getBody()->getContents());
4763

48-
return $this->response = new SecureXMLResponse($this, $httpResponse->xml());
64+
return $this->response = new SecureXMLResponse($this, $xml);
4965
}
5066

5167
/**

0 commit comments

Comments
 (0)