Skip to content

Commit 2d2e6af

Browse files
committed
New release v3
1 parent 587f07a commit 2d2e6af

29 files changed

+247
-257
lines changed

.travis.yml

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

33
php:
4-
- '5.3'
5-
- '5.4'
6-
- '5.5'
7-
- '5.6'
8-
- '7.0'
9-
- '7.1'
4+
- 5.6
5+
- 7.0
6+
- 7.1
7+
- 7.2
108

11-
before_script:
12-
- composer install -n --dev --prefer-source
9+
env:
10+
global:
11+
- setup=basic
1312

14-
script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
13+
matrix:
14+
include:
15+
- php: 5.6
16+
env: setup=lowest
17+
18+
sudo: false
19+
20+
before_install:
21+
- travis_retry composer self-update
22+
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
26+
27+
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,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016
3+
Copyright (c) 2016-2018 Sujip Thapa
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
**NAB Transact driver for the Omnipay PHP payment processing library**
44

55
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
6-
processing library for PHP 5.3+. This package implements NAB Transact support for Omnipay.
6+
processing library for PHP. This package implements NAB Transact support for Omnipay.
77

88
[![StyleCI](https://styleci.io/repos/74269379/shield?style=flat&branch=master)](https://styleci.io/repos/74269379)
99
[![Build Status](https://travis-ci.org/sudiptpa/omnipay-nabtransact.svg?branch=master&style=flat-square)](https://travis-ci.org/sudiptpa/omnipay-nabtransact)
@@ -13,26 +13,20 @@ processing library for PHP 5.3+. This package implements NAB Transact support fo
1313

1414
## Installation
1515

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

19-
```json
20-
{
21-
"require": {
22-
"sudiptpa/omnipay-nabtransact": "~2.0"
23-
}
24-
}
2518
```
26-
27-
And run composer to update your dependencies:
28-
29-
$ curl -s http://getcomposer.org/installer | php
30-
$ php composer.phar update
19+
composer require league/omnipay omnipay/nabtransact
20+
```
3121

3222
## Basic Usage
3323

3424
The following gateways are provided by this package:
3525

26+
* NABTransact_DirectPost (NAB Transact Direct Post v2)
27+
* NABTransact_SecureXML (NAB Transact SecurePay XML)
28+
* NABTransact_UnionPay (UnionPay via NAB Transact)
29+
3630
### NAB Transact SecureXML API
3731

3832
```php
@@ -43,27 +37,27 @@ The following gateways are provided by this package:
4337
$gateway->setMerchantId('XYZ0010');
4438
$gateway->setTransactionPassword('abcd1234');
4539
$gateway->setTestMode(true);
46-
40+
4741
$card = new CreditCard([
4842
'firstName' => 'Sujip',
49-
'lastName' => 'Thapa',
43+
'lastName' => 'Thapa',
5044
'number' => '4444333322221111',
5145
'expiryMonth' => '06',
5246
'expiryYear' => '2030',
5347
'cvv' => '123',
5448
]
5549
);
56-
50+
5751
$transaction = $gateway->purchase([
5852
'amount' => '10.00',
5953
'currency' => 'AUD',
6054
'transactionId' => 'XYZ100',
6155
'card' => $card,
6256
]
6357
);
64-
58+
6559
$response = $transaction->send();
66-
60+
6761
if ($response->isSuccessful()) {
6862
echo sprintf('Transaction %s was successful!', $response->getTransactionReference());
6963
} else {

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sudiptpa/omnipay-nabtransact",
33
"type": "library",
4-
"description": "NAB Transact driver for the Omnipay payment processing library",
4+
"description": "National Australia Bank (NAB) Transact driver for the Omnipay payment processing library.",
55
"keywords": [
66
"gateway",
77
"merchant",
@@ -19,27 +19,27 @@
1919
}
2020
],
2121
"autoload": {
22-
"psr-4": {
22+
"psr-4": {
2323
"Omnipay\\NABTransact\\" : "src/"
2424
}
2525
},
2626
"require": {
27-
"cweagans/composer-patches": "~1.6",
28-
"omnipay/common": "~2.3"
27+
"omnipay/common": "^3"
2928
},
3029
"require-dev": {
31-
"omnipay/tests": "~2.0",
32-
"satooshi/php-coveralls": "1.0.0",
33-
"fzaninotto/faker": "~1.4"
30+
"omnipay/tests": "^3",
31+
"squizlabs/php_codesniffer": "^3",
32+
"phpro/grumphp": "^0.14.0"
3433
},
3534
"extra": {
3635
"branch-alias": {
37-
"dev-master": "2.0.x-dev"
38-
},
39-
"patches": {
40-
"guzzle/guzzle": {
41-
"Update CA": "patches/guzzle-guzzle-update-cacert.patch"
42-
}
36+
"dev-master": "3.0.x-dev"
4337
}
44-
}
45-
}
38+
},
39+
"scripts": {
40+
"test": "vendor/bin/phpunit",
41+
"check-style": "phpcs -p --standard=PSR2 src/",
42+
"fix-style": "phpcbf -p --standard=PSR2 src/"
43+
},
44+
"prefer-stable": true
45+
}

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]

index.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require __DIR__.'/vendor/autoload.php';
3+
require __DIR__ . '/vendor/autoload.php';
44

55
use Omnipay\Common\CreditCard;
66
use Omnipay\Omnipay;
@@ -12,22 +12,21 @@
1212

1313
$gateway->setTestMode(true);
1414

15-
$card = new CreditCard(array(
16-
'firstName' => 'Sujip',
17-
'lastName' => 'Thapa',
18-
'number' => '4444333322221111',
19-
'expiryMonth' => '10',
20-
'expiryYear' => '2030',
21-
'cvv' => '123',
22-
));
23-
24-
$response = $gateway->purchase(array(
25-
'amount' => '12.00',
26-
'transactionId' => 'ORDER-ZYX8',
27-
'currency' => 'AUD',
28-
'card' => $card,
29-
))
30-
->send();
15+
$card = new CreditCard([
16+
'firstName' => 'Sujip',
17+
'lastName' => 'Thapa',
18+
'number' => '4444333322221111',
19+
'expiryMonth' => '12',
20+
'expiryYear' => date('Y'),
21+
'cvv' => '123',
22+
]);
23+
24+
$response = $gateway->purchase([
25+
'amount' => '12.00',
26+
'transactionId' => 'ORDER-ZYX8789',
27+
'currency' => 'AUD',
28+
'card' => $card,
29+
])->send();
3130

3231
$message = sprintf(
3332
'Transaction with reference code (%s) - %s',

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public function getName()
2121

2222
public function getDefaultParameters()
2323
{
24-
return array(
25-
'merchantId' => '',
24+
return [
25+
'merchantId' => '',
2626
'transactionPassword' => '',
27-
'testMode' => false,
28-
);
27+
'testMode' => false,
28+
];
2929
}
3030

3131
/**

src/Message/DirectPostAbstractRequest.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ abstract class DirectPostAbstractRequest extends AbstractRequest
2222
*/
2323
public function generateFingerprint(array $data)
2424
{
25-
$hash = implode(
26-
'|',
27-
array(
28-
$data['EPS_MERCHANT'],
29-
$this->getTransactionPassword(),
30-
$data['EPS_TXNTYPE'],
31-
$data['EPS_REFERENCEID'],
32-
$data['EPS_AMOUNT'],
33-
$data['EPS_TIMESTAMP'],
34-
)
35-
);
25+
$hash = implode('|', [
26+
$data['EPS_MERCHANT'],
27+
$this->getTransactionPassword(),
28+
$data['EPS_TXNTYPE'],
29+
$data['EPS_REFERENCEID'],
30+
$data['EPS_AMOUNT'],
31+
$data['EPS_TIMESTAMP'],
32+
]);
3633

3734
return sha1($hash);
3835
}
@@ -42,7 +39,7 @@ public function generateFingerprint(array $data)
4239
*/
4340
public function getBaseData()
4441
{
45-
$data = array();
42+
$data = [];
4643

4744
$data['EPS_MERCHANT'] = $this->getMerchantId();
4845
$data['EPS_TXNTYPE'] = $this->txnType;

src/Message/DirectPostAuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function getCardData()
4343
{
4444
$this->getCard()->validate();
4545

46-
$data = array();
46+
$data = [];
4747

4848
$data['EPS_CARDNUMBER'] = $this->getCard()->getNumber();
4949
$data['EPS_EXPIRYMONTH'] = $this->getCard()->getExpiryMonth();

0 commit comments

Comments
 (0)