Copyright (c) 2008 <Jeremy Ballard Flash2xs, LLC>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Tools useful when making payflow pro credit card transactions
Note: Future releases of this class will also support paypal payments
@author Jeremy Ballard
@version 1.0.0
@email
This plugin was adapted from the sfPaypalLitePlugin by Ian Ricketson
@email (_Slick_Rick on IRC)
Example Usage
try{
// Initialize the class in TEST mode
$q = new paymentTools(true);
// Initialize the class in LIVE mode
//$q = new paymentTools(false);
$q->setPayflowUser('User');
$q->setPayflowVendor('Vendor');
$q->setPayflowPartner('Partner');
$q->setPayflowPassword('Password');
$q->setPayflowTender('C');
$q->setPayflowTransactionType('S');
$q->setPayflowCardNumber('4111111111111111');
$q->setPayflowCardCVV2('123');
$q->setPayflowCardExpiration('0311');
$q->setPayflowCardType('Visa');
$q->setPayflowTransactionAmount('420.00');
$q->setPayflowCurrency('USD');
$q->setPayflowName('Jeremy Ballard');
$q->setPayflowStreet('420 W. Side Way');
$q->setPayflowCity('Compton');
$q->setPayflowState('CA');
$q->setPayflowCountry('US');
$q->setPayflowZip('90220');
$q->setPayflowCustomerIp('192.168.1.1');
$q->setPayflowComment1('Custom comment #1');
$q->setPayflowComment2('Custom comment #2');
$q->setPayflowVerbosity('MEDIUM');
// Process the credit card and set any errors
if (!$q->execute())
{
if ($q->hasErrors())
{
foreach ($q->getErrors() as $key => $error)
{
$this->getRequest()->setError('payflow_error_' . $key, $error);
echo $error;
}
throw new Exception($error);
}
}
}
catch (Exception $e)
{
//if error
$this->redirect('checkout/action');
}