public function testFailedSafeDelete()
 {
     $params = array('PaymentType' => 'creditcard', 'SAFE_Action' => 'add_safe', 'FirstName' => 'test first', 'LastName' => 'test last', 'CCNumber' => '4111111111111111', 'CCExpDate' => '1220');
     $result = Agms::process($params);
     $this->assertEquals(1, $result['STATUS_CODE']);
     $this->assertEquals("SAFE Record added successfully. No transaction processed.", $result['STATUS_MSG']);
     $safe_id = $result['SAFE_ID'];
     $params = array('SAFE_ID' => '123', 'SAFE_Action' => 'delete_safe');
     $result = Agms::process($params);
     $this->assertEquals(2, $result['STATUS_CODE']);
     $this->assertEquals("SAFE record failed to deactivate", $result['STATUS_MSG']);
 }
Пример #2
0
 /**
  * Convert object to array
  * @param $data
  * @return array
  */
 private static function object2array($data)
 {
     if (is_array($data) || is_object($data)) {
         $result = array();
         foreach ($data as $key => $value) {
             $result[$key] = Agms::object2array($value);
         }
         return $result;
     }
     return $data;
 }
Пример #3
0
<?php

/*
 * Autoload Path
 */
require_once realpath(dirname(__FILE__)) . '/../vendor/autoload.php';
/*
 * Autoload Agms Php Lite
 */
require_once realpath(dirname(__FILE__)) . '/../lib/agms.php';
/*
 * Gateway Credentials
 */
Agms::setUsername('osdgithub');
Agms::setPassword('Ks1m32aF@');
Agms::setVerbose(false);
Пример #4
0
require '../lib/agms.php';
/*
 * Gateway Credentials
 */
Agms::setUsername('osdgithub');
Agms::setPassword('Ks1m32aF@');
/**
 *
 * A minimalist example of a processed transaction
 *
 **/
$params = array('TransactionType' => 'sale', 'Amount' => '20.00', 'CCNumber' => '4111111111111111', 'CCExpDate' => '1220');
$result = Agms::process($params);
var_dump($result);
/**
 *
 * A decline
 *
 **/
$params = array('TransactionType' => 'sale', 'Amount' => '0.01', 'CCNumber' => '4111111111111111', 'CCExpDate' => '1220');
$result = Agms::process($params);
var_dump($result);
/**
 *
 * A FULL example of a processed transaction
 *
 **/
$params = array('TransactionType' => 'sale', 'Amount' => '20.00', 'TaxAmount' => '2.00', 'ShippingAmount' => '3.00', 'OrderDescription' => 'big transaction detail test', 'OrderID' => '1AFSS224', 'PONumber' => '256645', 'FirstName' => 'Joe', 'LastName' => 'Smith', 'CompanyName' => 'Smith Enterprises', 'Address' => '125 Main St', 'Address2' => 'Suite C', 'City' => 'Blaine', 'State' => 'MN', 'Zip' => '55443', 'Country' => 'US', 'Phone' => '222-222-2222', 'Fax' => '333-333-3333', 'Email' => '*****@*****.**', 'Website' => 'www.smith.com', 'ShippingFirstName' => 'Joe', 'ShippingLastName' => 'Smith', 'ShippingCompanyName' => 'Smith Enterprises', 'ShippingAddress' => '125 Main St', 'ShippingAddress2' => 'Suite C', 'ShippingCity' => 'Blaine', 'ShippingState' => 'MN', 'ShippingZip' => '55443', 'ShippingCountry' => 'US', 'ShippingEmail' => '*****@*****.**', 'ShippingPhone' => '444-444-4444', 'ShippingFax' => '555-555-5555', 'ShippingCarrier' => 'ups', 'IPAddress' => '128.101.101.101', 'ShippingTrackingNumber' => '1Z223452433282822', 'CustomField1' => 'custom 1', 'CustomField2' => 'custom 2', 'CustomField3' => 'custom 3', 'CustomField4' => 'custom 4', 'CustomField5' => 'custom 5', 'CustomField6' => 'custom 6', 'CustomField7' => 'custom 7', 'CustomField8' => 'custom 8', 'CustomField9' => 'custom 9', 'CustomField10' => 'custom 10', 'CCNumber' => '4111111111111111', 'CCExpDate' => '1220');
$result = Agms::process($params);
var_dump($result);
Пример #5
0
 public function testSuccessfulHPPGetLink()
 {
     $params = array('TransactionType' => 'sale', 'Amount' => '20.00', 'FirstName' => 'John', 'LastName' => 'Doe', 'HPPFormat' => '1');
     $result = Agms::hostedPayment($params);
     $this->assertTrue(is_string($result));
 }
Пример #6
0
 public function testFailedVerify()
 {
     $params = array('TransactionType' => 'auth', 'Amount' => '20.00', 'CCNumber' => '4111111111111111', 'CCExpDate' => '1220');
     $result = Agms::process($params);
     $this->assertEquals($result['STATUS_CODE'], 1);
     $this->assertEquals($result['STATUS_MSG'], "Approved");
     $params = array('TransactionType' => 'void', 'Amount' => '20.00', 'TransactionID' => '123');
     try {
         Agms::process($params);
     } catch (ResponseException $e) {
         $args = $e->getTrace();
         $args = $args[0]['args'][0];
         $this->assertEquals(10, (string) $args->STATUS_CODE);
         $this->assertEquals("Transaction ID is not valid. Please double check your Transaction ID", (string) $args->STATUS_MSG);
     }
 }
Пример #7
0
require '../lib/agms.php';
/*
 * Gateway Credentials
 */
Agms::setUsername('osdgithub');
Agms::setPassword('Ks1m32aF@');
/**
 *
 * An example of adding a SAFE entry
 *
 **/
$params = array('PaymentType' => 'creditcard', 'SAFE_Action' => 'add_safe', 'FirstName' => 'test first', 'LastName' => 'test last', 'CCNumber' => '4111111111111111', 'CCExpDate' => '1220');
$result = Agms::addToSafe($params);
$safe_id = $result['SAFE_ID'];
/**
 *
 * An example of updating that new SAFE entry
 *
 **/
$params = array('SAFE_ID' => $safe_id, 'SAFE_Action' => 'update_safe', 'FirstName' => 'test first updated', 'LastName' => 'test last updated');
$result = Agms::updateSafe($params);
var_dump($result);
/**
 *
 * An example of deleting that new SAFE entry
 *
 **/
$params = array('SAFE_ID' => $safe_id, 'SAFE_Action' => 'delete_safe');
$result = Agms::deleteFromSafe($params);
var_dump($result);
Пример #8
0
<?php

require '../lib/agms.php';
/*
 * Gateway Credentials
 */
Agms::setUsername('osdgithub');
Agms::setPassword('Ks1m32aF@');
/**
 *
 * A minimalist example of a quick $20 payment page with template 1
 *
 **/
$params = array('TransactionType' => 'sale', 'Amount' => '20.00', 'FirstName' => 'John', 'LastName' => 'Doe', 'HPPFormat' => '1');
$result = Agms::hostedPayment($params);
echo "\n\n" . 'Quick $20 payment page: <a href="' . $result . '" target="_blank">' . $hpp->getLink() . "</a>\n\n";