Beispiel #1
0
//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";
        }
    } else {
        echo '<div style="color:#aa0000">There are no transactions for this account</div>' . "\n";
    }
}
//close our HTML block
echo '</body></html>' . "\n";
Beispiel #2
0
 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";
 }