* * (c) John Conde <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /************************************************************************************************* Use the SIM tools to create a SIM transaction form *************************************************************************************************/ namespace JohnConde\Authnet; require '../../config.inc.php'; require '../../src/autoload.php'; $sim = AuthnetApiFactory::getSimHandler(AUTHNET_LOGIN, AUTHNET_TRANSKEY, AuthnetApiFactory::USE_DEVELOPMENT_SERVER); $amount = 10.0; $login = $sim->getLogin(); $url = $sim->getEndpoint(); $fingerprint = $sim->getFingerprint($amount); $sequence = $sim->getSequence(); $timestamp = $sim->getTimestamp(); ?> <!DOCTYPE html> <html> <html lang="en"> <head> <title>SIM </title> </head> <body>
/** * @covers \JohnConde\Authnet\AuthnetApiFactory::getSimURL * @expectedException \JohnConde\Authnet\AuthnetInvalidServerException */ public function testExceptionIsRaisedForAuthnetInvalidSimServer() { $authnet = AuthnetApiFactory::getSimHandler($this->login, $this->transactionKey, null); }
/** * @covers \JohnConde\Authnet\AuthnetSim::resetParameters() */ public function testResetParameters() { $sim = AuthnetApiFactory::getSimHandler($this->login, $this->transactionKey, $this->server); $sequence = $sim->getSequence(); $timestamp = $sim->getTimestamp(); sleep(1); $sim->resetParameters(); $reflectionOfRequest = new \ReflectionObject($sim); $timestampReflection = $reflectionOfRequest->getProperty('timestamp'); $timestampReflection->setAccessible(true); $sequenceReflection = $reflectionOfRequest->getProperty('sequence'); $sequenceReflection->setAccessible(true); $this->assertNotEquals($timestamp, $timestampReflection->getValue($sim)); $this->assertNotEquals($timestamp, $sequenceReflection->getValue($sim)); }