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']); }
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);
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); } }