* Copyright (C) 2011 Steven Brendtro, ALL RIGHTS RESERVED * * Refer to /legal/license.txt for license information, or view the full license * online at http://openach.com/community/license.txt ********************************************************************************/ // API Test for OpenACH // Load the OpenACH SDK require_once '../../lib/OpenACHSdk.php'; // First create a Connection object. // The OAConnection constructor takes a ClientConfig instance to get the APIKey and APIToken references. // A default class that uses an INI file is provided. // The default directory is the API installation directory. // The default filename is ./conf/connection.ini (which ought to be chmod 400 and owned by the application daemon user) // We override that by submitting ".." as the configruation directory (a filename could also be provided if needed). echo "Creating a new OAConnection Object" . PHP_EOL; $oaConn = new OAConnection(new OAClientConfigIni('../..')); // Here's an example showing an INI Config file stored in the /etc/myapp/oaconf/local_connection.ini file //$oaConn = new OAConnection( new OAClientConfigIni('/etc/myapp', '/conf/local_connection.ini') ); // Now that we've got the connection, connect to the server and get an existing Payment Profile and update it echo "Connecting to server..." . PHP_EOL; $connected = ''; $attempts = 3; try { while (!$connected and $attempts > 0) { echo "Connecting: {$attempts} remaining" . PHP_EOL; $oaConn->connect(); $connected = $oaConn->isConnected(); if ($connected) { echo "Successfully connected!" . PHP_EOL; } $attempts = $attempts - 1;
* Copyright (C) 2011 Steven Brendtro, ALL RIGHTS RESERVED * * Refer to /legal/license.txt for license information, or view the full license * online at http://openach.com/community/license.txt ********************************************************************************/ // API Test for OpenACH // Load the OpenACH SDK require_once '../../lib/OpenACHSdk.php'; // First create a Connection object. // The OAConnection constructor takes a ClientConfig instance to get the APIKey and APIToken references. // A default class that uses an INI file is provided. // The default directory is the API installation directory. // The default filename is ./conf/connection.ini (which ought to be chmod 400 and owned by the application daemon user) // We override that by submitting ".." as the configruation directory (a filename could also be provided if needed). echo "Creating a new OAConnection Object" . PHP_EOL; $oaConn = new OAConnection(new OAClientConfigIni('../..')); // Here's an example showing an INI Config file stored in the /etc/myapp/oaconf/local_connection.ini file //$oaConn = new OAConnection( new OAClientConfigIni('/etc/myapp', '/conf/local_connection.ini') ); // Now that we've got the connection, connect to the server and create the ExternalAccount. echo "Connecting to server..." . PHP_EOL; $connected = ''; $attempts = 3; try { while (!$connected and $attempts > 0) { echo "Connecting: {$attempts} remaining" . PHP_EOL; $oaConn->connect(); $connected = $oaConn->isConnected(); if ($connected) { echo "Successfully connected!" . PHP_EOL; } $attempts = $attempts - 1;
<?php /********************************************************************************* * OpenACH is an ACH payment processing platform * Copyright (C) 2011 Steven Brendtro, ALL RIGHTS RESERVED * * Refer to /legal/license.txt for license information, or view the full license * online at http://openach.com/community/license.txt ********************************************************************************/ // API Test for OpenACH // Load the OpenACH SDK require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'OpenACHSdk.php'; echo "Creating a new OAConnection Object" . PHP_EOL; $oaConn = new OAConnection(new OAClientConfigIni('..')); //var_dump($oaConn); // The OAConnection takes a ClientConfig instance to get the APIKey and APIToken references. // A default class that uses an INI file is provided. // The default directory for the filename is the API installation folder // The default filename is ./conf/connection.ini (which ought to be chmod 400 and owned by the application daemon user) // Here's an example showing an INI Config file stored in the /etc/myapp/oaconf/connection_local.ini file //$oaConn = new OAConnection( new OAClientConfigIni('/etc/myapp', '/conf/connection_local.ini') ); // Using this file requires no parameters to be passed in though it does //$oaConn->setDebuglevel( 2 ); echo "Connecting to server..." . PHP_EOL; $connected = ''; $attempts = 3; while (!$connected and $attempts > 0) { try { echo "Connecting (" . $oaConn->endpointUrl() . "): {$attempts} remaining" . PHP_EOL; $oaConn->connect(); $connected = $oaConn->isConnected();