public function setUp() { $object = Payment_Process2_Type::factory('eCheck'); $object->accountNumber = 1; $object->routingCode = 2; $object->bankName = "Unit test"; $this->object = $object; }
public function aValidPayment() { $object = Payment_Process2_Type::factory('eCheck'); $object->accountNumber = 1; $object->routingCode = 2; $object->bankName = "Unit test"; return $object; }
public function setUp() { $object = Payment_Process2_Type::factory('CreditCard'); $object->type = Payment_Process2_Type::CC_MASTERCARD; $object->cvv = 123; $object->cardNumber = "5123456789012346"; $object->expDate = "05/2013"; $this->object = $object; }
public function aValidPayment() { $cc = Payment_Process2_Type::factory('CreditCard'); $cc->setDate(strtotime('2008-01-01')); $cc->type = Payment_Process2_Type::CC_MASTERCARD; $cc->cardNumber = '5123456789012346'; $cc->expDate = '12/2008'; $cc->cvv = '123'; return $cc; }
require_once 'Payment/Process2.php'; $options = array(); // If you have a test store on the staging server uncomment these // $options['host'] = 'staging.linkpt.net'; // $options['port'] = '1129'; // Path to your keyfile (the pem file given to you by linkpiont) $options['keyfile'] = '/path/to/your/keyfile.pem'; $process = Payment_Process::factory('LinkPoint', $options); $process->_debug = true; $process->login = '******'; // Your linkpoint store ID $process->password = '******'; // Your store's password $process->action = Payment_Process2::ACTION_AUTHONLY; $process->amount = 1.0; $card = Payment_Process2_Type::factory('CreditCard'); $card->type = Payment_Process2_Type::CC_VISA; $card->invoiceNumber = 112345145; $card->customerId = 1461264151; $card->cardNumber = '411111111111111'; $card->expDate = '08/2008'; $card->zip = '98123'; $card->cvv = '444'; $process->setPayment($card); $result = $process->process(); print_r($result); echo "\n"; echo "---------------------- RESPONSE ------------------------\n"; echo $result->getMessage() . "\n"; echo $result->getCode() . "\n"; $validate = $result->validate();
/** * Sets payment * * Returns false if payment could not be set. This usually means the * payment type is not valid or that the payment type is valid, but did * not validate. It could also mean that the payment type is not supported * by the given processor. * * @param mixed $payment Object of Payment_Process2_Type * * @return bool * @access public * @author Joe Stump <*****@*****.**> */ function setPayment(Payment_Process2_Type $payment) { if (isset($this->_typeFieldMap[$payment->getType()]) && is_array($this->_typeFieldMap[$payment->getType()])) { $payment->validate(); $this->_payment = $payment; // Map over the payment specific fields. Check out // $_typeFieldMap for more information. $paymentType = $payment->getType(); foreach ($this->_typeFieldMap[$paymentType] as $generic => $specific) { $func = '_handle' . ucfirst($generic); if (method_exists($this, $func)) { $this->{$func}(); } else { // TODO This may screw things up - the problem is that // CC information is no longer member variables, so we // can't overwrite it. You could always handle this // with a _handle funciton. I don't think it will cause // problems, but it could. if (!isset($this->_data[$specific])) { if (isset($this->_payment->{$generic})) { $this->_data[$specific] = $this->_payment->{$generic}; } } } } return true; } throw new Payment_Process2_Exception('Invalid type field map'); }
<?php require_once 'Payment/Process2.php'; $options = array(); $options['x_delim_data'] = 'TRUE'; $process = Payment_Process::factory('AuthorizeNet', $options); $process->_debug = true; $process->login = '******'; $process->password = '******'; $process->action = Payment_Process2::ACTION_AUTHONLY; $process->amount = 9.949999999999999; $check = Payment_Process2_Type::factory('eCheck'); $check->invoiceNumber = 112345145; $check->customerId = 1461264151; $check->firstName = 'Jose'; $check->lastName = 'Perez'; $check->type = Payment_Process2::CK_CHECKING; $check->bankName = 'Bank of USA'; $check->accountNumber = '2222222222'; $check->routingCode = '2222222222'; $process->setPayment($check); $result = $process->process(); print_r($result); echo "\n"; echo "---------------------- RESPONSE ------------------------\n"; echo $result->getMessage() . "\n"; echo $result->getCode() . "\n"; $result->validate(); echo "---------------------- RESPONSE ------------------------\n";
public function testShouldValidateAmericanZipCodesCorrectly3() { $object = Payment_Process2_Type::factory('eCheck'); $object->zip = 123456; $object->accountNumber = 1; $object->routingCode = 2; $object->bankName = "Unit test"; $this->assertTrue($object->validate()); }
/** * @deprecated * * @return Payment_Process2_Type_CreditCard */ public function aMockANZCard() { /* @var Payment_Process2_Type_CreditCard $cc */ $cc = Payment_Process2_Type::factory('MockCreditCard'); $cc->type = Payment_Process2_Type::CC_MASTERCARD; $cc->cardNumber = '5123456789012346'; $cc->expDate = '13/2005'; $cc->cvv = '123'; return $cc; }