Skip to content

Commit 1b6a255

Browse files
authored
Merge pull request #8 from delatbabel/update-docblocks
Add docblocks, deprecate inquiry for fetchTransaction
2 parents ec827f6 + e1689f5 commit 1b6a255

13 files changed

+817
-14
lines changed

.gitignore

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

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Total Downloads](https://poser.pugx.org/omnipay/payflow/d/total.png)](https://packagist.org/packages/omnipay/payflow)
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 Payflow support for Omnipay.
10+
processing library for PHP 5.3+. This package implements [Payflow](https://developer.paypal.com/docs/classic/products/payflow-gateway/) support for Omnipay.
1111

1212
## Installation
1313

@@ -31,7 +31,7 @@ And run composer to update your dependencies:
3131

3232
The following gateways are provided by this package:
3333

34-
* Payflow_Pro
34+
* [Payflow_Pro](https://developer.paypal.com/docs/classic/products/payflow-gateway/)
3535

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

makedoc.sh

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

runtests.sh

+25
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/Message/AuthorizeRequest.php

+112-1
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,153 @@
66

77
/**
88
* Payflow Authorize Request
9+
*
10+
* ### Example
11+
*
12+
* <code>
13+
* // Create a gateway for the Payflow pro Gateway
14+
* // (routes to GatewayFactory::create)
15+
* $gateway = Omnipay::create('Payflow_Pro');
16+
*
17+
* // Initialise the gateway
18+
* $gateway->initialize(array(
19+
* 'username' => $myusername,
20+
* 'password' => $mypassword,
21+
* 'vendor' => $mymerchantid,
22+
* 'partner' => $PayPalPartner,
23+
* 'testMode' => true, // Or false for live transactions.
24+
* ));
25+
*
26+
* // Create a credit card object
27+
* // This card can be used for testing.
28+
* $card = new CreditCard(array(
29+
* 'firstName' => 'Example',
30+
* 'lastName' => 'Customer',
31+
* 'number' => '4242424242424242',
32+
* 'expiryMonth' => '01',
33+
* 'expiryYear' => '2020',
34+
* 'cvv' => '123',
35+
* ));
36+
*
37+
* // Do an authorize transaction on the gateway
38+
* $transaction = $gateway->authorize(array(
39+
* 'amount' => '10.00',
40+
* 'currency' => 'AUD',
41+
* 'card' => $card,
42+
* ));
43+
* $response = $transaction->send();
44+
* if ($response->isSuccessful()) {
45+
* echo "Authorize transaction was successful!\n";
46+
* $sale_id = $response->getTransactionReference();
47+
* echo "Transaction reference = " . $sale_id . "\n";
48+
* }
49+
* </code>
950
*/
1051
class AuthorizeRequest extends AbstractRequest
1152
{
1253
protected $liveEndpoint = 'https://payflowpro.paypal.com';
1354
protected $testEndpoint = 'https://pilot-payflowpro.paypal.com';
1455
protected $action = 'A';
1556

57+
/**
58+
* Get the username.
59+
*
60+
* This is the ID that you specified when you got the Payflow account.
61+
*
62+
* @return string
63+
*/
1664
public function getUsername()
1765
{
1866
return $this->getParameter('username');
1967
}
2068

69+
/**
70+
* Set the username.
71+
*
72+
* This is the ID that you specified when you got the Payflow account.
73+
*
74+
* @param string $value
75+
* @return AuthorizeRequest provides a fluent interface.
76+
*/
2177
public function setUsername($value)
2278
{
2379
return $this->setParameter('username', $value);
2480
}
2581

82+
/**
83+
* Get the password.
84+
*
85+
* This is the password that you specified when you got the Payflow account.
86+
*
87+
* @return string
88+
*/
2689
public function getPassword()
2790
{
2891
return $this->getParameter('password');
2992
}
3093

94+
/**
95+
* Set the password.
96+
*
97+
* This is the password that you specified when you got the Payflow account.
98+
*
99+
* @param string $value
100+
* @return AuthorizeRequest provides a fluent interface.
101+
*/
31102
public function setPassword($value)
32103
{
33104
return $this->setParameter('password', $value);
34105
}
35106

107+
/**
108+
* Get the vendor.
109+
*
110+
* The ID that you specified when you got the Payflow account, the same as the username unless you
111+
* have created additional users on the account. That is, the merchant login ID for the account.
112+
*
113+
* @return string
114+
*/
36115
public function getVendor()
37116
{
38117
return $this->getParameter('vendor');
39118
}
40119

120+
/**
121+
* Set the vendor.
122+
*
123+
* The ID that you specified when you got the Payflow account, the same as the username unless you
124+
* have created additional users on the account. That is, the merchant login ID for the account.
125+
*
126+
* @param string $value
127+
* @return AuthorizeRequest provides a fluent interface.
128+
*/
41129
public function setVendor($value)
42130
{
43131
return $this->setParameter('vendor', $value);
44132
}
45133

134+
/**
135+
* Get the partner.
136+
*
137+
* The Payflow partner. This may be PayPal, or if an account was provided by an authorized PayPal
138+
* reseller, who registered a Payflow user, then the ID provided by the reseller is used.
139+
*
140+
* @return string
141+
*/
46142
public function getPartner()
47143
{
48144
return $this->getParameter('partner');
49145
}
50146

147+
/**
148+
* Set the partner.
149+
*
150+
* The Payflow partner. This may be PayPal, or if an account was provided by an authorized PayPal
151+
* reseller, who registered a Payflow user, then the ID provided by the reseller is used.
152+
*
153+
* @param string $value
154+
* @return AuthorizeRequest provides a fluent interface.
155+
*/
51156
public function setPartner($value)
52157
{
53158
return $this->setParameter('partner', $value);
@@ -73,11 +178,17 @@ public function setComment2($value)
73178
return $this->setParameter('comment2', $value);
74179
}
75180

181+
/**
182+
* @deprecated
183+
*/
76184
public function getOrigid()
77185
{
78186
return $this->getParameter('origid');
79187
}
80188

189+
/**
190+
* @deprecated
191+
*/
81192
public function setOrigid($value)
82193
{
83194
return $this->setParameter('origid', $value);
@@ -117,7 +228,7 @@ public function getData()
117228
$data['BILLTOZIP'] = $this->getCard()->getPostcode();
118229
$data['BILLTOCOUNTRY'] = $this->getCard()->getCountry();
119230
}
120-
231+
121232
$data['TENDER'] = 'C';
122233
$data['AMT'] = $this->getAmount();
123234
$data['COMMENT1'] = $this->getDescription();

0 commit comments

Comments
 (0)