public static function getSingletonClient() { return BillForwardClient::getDefaultClient(); }
private static function setupClient() { $credentials = self::grabCredentials(); self::$client = new \BillForwardClient($credentials['access_token'], $credentials['urlRoot'], $credentials['curlProxy']); \BillForwardClient::setDefaultClient(self::$client); }
//namespace BFPHPClientTest; //echo "Running Bf_Account tests for BillForward PHP Client Library.\n"; //use BFPHPClient\Account; function getUsualAccountsProfileEmail() { return '*****@*****.**'; } function getUsualPrpName() { return 'Cool Plan'; } // Grab an API token from: https://app-sandbox.billforward.net/setup/#/personal/api-keys $access_token = 'INSERT ACCESS TOKEN HERE'; $urlRoot = 'https://api-sandbox.billforward.net/2014.223.0/'; $client = new BillForwardClient($access_token, $urlRoot); BillForwardClient::setDefaultClient($client); //-- Find the account we login with (assume first found with associated user) // order by userID so that we are likely to see our login user's account $accounts = Bf_Account::getAll(array('order_by' => 'userID')); $foundLoginAccount = NULL; foreach ($accounts as $account) { if (array_key_exists('userID', $account)) { $foundLoginAccount = $account; break; } } if (is_null($foundLoginAccount)) { throw new Exception('Login account not found.'); } //var_export($foundLoginAccount); //-- Get the organization we log in with (assume first found)