<?php ini_set('display_errors', 1); //include the config and the gocoin api require_once __DIR__ . '/includes/config.php'; require_once __DIR__ . '/includes/functions.php'; require_once __DIR__ . '/../src/GoCoin.php'; //pick a token $token = $TOKENS['full_access']; //echo an HTML block echo '<html><head><title>GoCoin Account Test</title></head><body>' . "\n"; echo '<h3 style="color:blue">Merchant Accounts</h3>'; //get accounts for this merchant $accounts = GoCoin::getAccounts($token, MERCHANT_ID); if (!empty($accounts)) { foreach ($accounts as $account) { showObject($account); echo '<hr/>' . "\n"; } } if (!empty(ACCOUNT_ID)) { //example search criteria array $criteria = array('per_page' => 10); echo '<h3 style="color:blue">Account Transactions</h3>'; //search transactions with criteria $xactions = GoCoin::getAccountTransactions($token, ACCOUNT_ID, $criteria); //var_dump($xactions); if (!empty($xactions) && $xactions->paging_info->total > 0) { foreach ($xactions->transactions as $xaction) { showObject($xaction); echo '<hr/>' . "\n";
public function testGetAccounts() { if (!$this->doTest(__FUNCTION__)) { return; } //perform assertion $this->assertEquals(GoCoin::getApiMode(), 'test'); $this->assertNotEmpty(TOKEN); //get accounts for this merchant $accounts = GoCoin::getAccounts(TOKEN, MERCHANT_ID); $this->assertNotEmpty(sizeof($accounts)); $this->assertGreaterThan(0, sizeof($accounts)); //example search criteria array $criteria = array('per_page' => 10); //search transactions with criteria $xactions = GoCoin::getAccountTransactions(TOKEN, ACCOUNT_ID, $criteria); $this->assertEquals($xactions->status, '200'); echo '[DEBUG]: Found ' . $xactions->paging_info->total . ' total transactions' . "\n"; echo '[DEBUG]: SUCCESS:' . sizeof($accounts) . "\n"; }