Skip to content

Commit 1c95363

Browse files
committed
Merge pull request #12 from delatbabel/code-tidy-1
Code tidy 1
2 parents 0dcf285 + 8010523 commit 1c95363

25 files changed

+314
-110
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
composer.lock
33
composer.phar
44
phpunit.xml
5+
/.idea
6+
/documents
7+
.directory
8+
dirlist.app
9+
dirlist.cache
10+
dirlist.vendor

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
1010
processing library for PHP 5.3+. This package implements eWAY support for Omnipay.
1111

12+
[eWay](https://eway.io/about-eway) was launched in Australia in 1998 and now operates payment gateways
13+
in 8 countries.
14+
1215
## Installation
1316

1417
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
@@ -31,10 +34,19 @@ And run composer to update your dependencies:
3134

3235
The following gateways are provided by this package:
3336

34-
* Eway_Rapid
35-
* Eway_RapidShared
36-
* Eway_RapidDirect
37-
* Eway_Direct
37+
* Eway_Direct -- This gateway is deprecated. If you have existing code that uses it you can continue
38+
to do so but you should consider migrating to Eway_RapidDirect
39+
* Eway_RapidDirect -- This is the primary gateway used for direct card processing, i.e. where you collect the
40+
card details from the customer and pass them to eWay yourself via the API.
41+
* Eway_Rapid -- This is used for eWAY Rapid Transparent Redirect requests. The gateway is just
42+
called Eway_Rapid as it was the first implemented. Like other redirect gateways the purchase() call
43+
will return a redirect response and then requires you to redirect the customer to the eWay site for
44+
the actual purchase.
45+
* Eway_RapidShared -- This provides a hosted form for entering payment information, other than that
46+
it is similar to the Eway_Rapid gateway in functionality.
47+
48+
See the docblocks within the gateway classes for further information and links to the eWay gateway on
49+
line.
3850

3951
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)
4052
repository.

makedoc.sh

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#!/bin/sh
2+
3+
#
4+
# Smart little documentation generator.
5+
# GPL/LGPL
6+
# (c) Del 2015 http://www.babel.com.au/
7+
#
8+
9+
APPNAME='Omnipay eWay Gateway Module'
10+
CMDFILE=apigen.cmd.$$
11+
DESTDIR=./documents
12+
13+
#
14+
# Find apigen, either in the path or as a local phar file
15+
#
16+
if [ -f apigen.phar ]; then
17+
APIGEN="php apigen.phar"
18+
19+
else
20+
APIGEN=`which apigen`
21+
if [ ! -f "$APIGEN" ]; then
22+
23+
# Search for phpdoc if apigen is not found.
24+
if [ -f phpDocumentor.phar ]; then
25+
PHPDOC="php phpDocumentor.phar"
26+
27+
else
28+
PHPDOC=`which phpdoc`
29+
if [ ! -f "$PHPDOC" ]; then
30+
echo "Neither apigen nor phpdoc is installed in the path or locally, please install one of them"
31+
echo "see http://www.apigen.org/ or http://www.phpdoc.org/"
32+
exit 1
33+
fi
34+
fi
35+
fi
36+
fi
37+
38+
#
39+
# As of version 4 of apigen need to use the generate subcommand
40+
#
41+
if [ ! -z "$APIGEN" ]; then
42+
APIGEN="$APIGEN generate"
43+
fi
44+
45+
#
46+
# Without any arguments this builds the entire system documentation,
47+
# making the cache file first if required.
48+
#
49+
if [ -z "$1" ]; then
50+
#
51+
# Check to see that the cache has been made.
52+
#
53+
if [ ! -f dirlist.cache ]; then
54+
echo "Making dirlist.cache file"
55+
$0 makecache
56+
fi
57+
58+
#
59+
# Build the apigen/phpdoc command in a file.
60+
#
61+
if [ ! -z "$APIGEN" ]; then
62+
echo "$APIGEN --php --tree --title '$APPNAME API Documentation' --destination $DESTDIR/main \\" > $CMDFILE
63+
cat dirlist.cache | while read dir; do
64+
echo "--source $dir \\" >> $CMDFILE
65+
done
66+
echo "" >> $CMDFILE
67+
68+
elif [ ! -z "$PHPDOC" ]; then
69+
echo "$PHPDOC --sourcecode --title '$APPNAME API Documentation' --target $DESTDIR/main --directory \\" > $CMDFILE
70+
cat dirlist.cache | while read dir; do
71+
echo "${dir},\\" >> $CMDFILE
72+
done
73+
echo "" >> $CMDFILE
74+
75+
else
76+
"Neither apigen nor phpdoc are found, how did I get here?"
77+
exit 1
78+
fi
79+
80+
#
81+
# Run the apigen command
82+
#
83+
rm -rf $DESTDIR/main
84+
mkdir -p $DESTDIR/main
85+
. ./$CMDFILE
86+
87+
/bin/rm -f ./$CMDFILE
88+
89+
#
90+
# The "makecache" argument causes the script to just make the cache file
91+
#
92+
elif [ "$1" = "makecache" ]; then
93+
echo "Find application source directories"
94+
find src -name \*.php -print | \
95+
(
96+
while read file; do
97+
grep -q 'class' $file && dirname $file
98+
done
99+
) | sort -u | \
100+
grep -v -E 'config|docs|migrations|phpunit|test|Test|views|web' > dirlist.app
101+
102+
echo "Find vendor source directories"
103+
find vendor -name \*.php -print | \
104+
(
105+
while read file; do
106+
grep -q 'class' $file && dirname $file
107+
done
108+
) | sort -u | \
109+
grep -v -E 'config|docs|migrations|phpunit|codesniffer|test|Test|views' > dirlist.vendor
110+
111+
#
112+
# Filter out any vendor directories for which apigen fails
113+
#
114+
echo "Filter source directories"
115+
mkdir -p $DESTDIR/tmp
116+
cat dirlist.app dirlist.vendor | while read dir; do
117+
if [ ! -z "$APIGEN" ]; then
118+
$APIGEN --quiet --title "Test please ignore" \
119+
--source $dir \
120+
--destination $DESTDIR/tmp && (
121+
echo "Including $dir"
122+
echo $dir >> dirlist.cache
123+
) || (
124+
echo "Excluding $dir"
125+
)
126+
127+
elif [ ! -z "$PHPDOC" ]; then
128+
$PHPDOC --quiet --title "Test please ignore" \
129+
--directory $dir \
130+
--target $DESTDIR/tmp && (
131+
echo "Including $dir"
132+
echo $dir >> dirlist.cache
133+
) || (
134+
echo "Excluding $dir"
135+
)
136+
137+
fi
138+
done
139+
echo "Documentation cache dirlist.cache built OK"
140+
141+
#
142+
# Clean up
143+
#
144+
/bin/rm -rf $DESTDIR/tmp
145+
146+
fi

runtests.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
#
4+
# Command line runner for unit tests for composer projects
5+
# (c) Del 2015 http://www.babel.com.au/
6+
# No Rights Reserved
7+
#
8+
9+
#
10+
# Clean up after any previous test runs
11+
#
12+
mkdir -p documents
13+
rm -rf documents/coverage-html-new
14+
rm -f documents/coverage.xml
15+
16+
#
17+
# Run phpunit
18+
#
19+
vendor/bin/phpunit --coverage-html documents/coverage-html-new --coverage-clover documents/coverage.xml
20+
21+
if [ -d documents/coverage-html-new ]; then
22+
rm -rf documents/coverage-html
23+
mv documents/coverage-html-new documents/coverage-html
24+
fi
25+

src/DirectGateway.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* eWAY Legacy Direct XML Payments Gateway
44
*/
5-
5+
66
namespace Omnipay\Eway;
77

88
use Omnipay\Common\AbstractGateway;
@@ -14,7 +14,6 @@
1414
*
1515
* NOTE: The APIs called by this gateway are older legacy APIs, new integrations should instead
1616
* use eWAY Rapid.
17-
*
1817
*/
1918
class DirectGateway extends AbstractGateway
2019
{
@@ -27,7 +26,7 @@ public function getDefaultParameters()
2726
{
2827
return array(
2928
'customerId' => '',
30-
'testMode' => false,
29+
'testMode' => false,
3130
);
3231
}
3332

src/Message/AbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* eWAY Rapid Abstract Request
44
*/
5-
5+
66
namespace Omnipay\Eway\Message;
77

88
/**
@@ -83,7 +83,7 @@ public function setInvoiceReference($value)
8383
{
8484
return $this->setParameter('invoiceReference', $value);
8585
}
86-
86+
8787
protected function getBaseData()
8888
{
8989
$data = array();

src/Message/AbstractResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* eWAY Rapid Abstract Response
44
*/
5-
5+
66
namespace Omnipay\Eway\Message;
77

88
/**

src/Message/DirectCaptureRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DirectCaptureRequest extends DirectAbstractRequest
1515
public function getData()
1616
{
1717
$this->validate('transactionId');
18-
18+
1919
$xml = '<?xml version="1.0"?><ewaygateway></ewaygateway>';
2020
$sxml = new \SimpleXMLElement($xml);
2121

src/Message/DirectRefundRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function getRefundPassword()
2525
public function getData()
2626
{
2727
$this->validate('refundPassword', 'transactionId');
28-
28+
2929
$xml = '<?xml version="1.0"?><ewaygateway></ewaygateway>';
3030
$sxml = new \SimpleXMLElement($xml);
3131

src/Message/DirectResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getTransactionReference()
2626
if (empty($this->data->ewayTrxnNumber)) {
2727
return null;
2828
}
29-
29+
3030
return (int) $this->data->ewayTrxnNumber;
3131
}
3232

0 commit comments

Comments
 (0)