示例#1
0
<?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 Admin Merchant Test</title></head><body>' . "\n";
echo '<h3 style="color:blue">Merchants</h3>';
//get a list of merchants (admin only function)
$merchants = GoCoinAdmin::listMerchants($token);
if (!empty($merchants)) {
    foreach ($merchants as $merchant) {
        showObject($merchant);
        //echo '<hr/>' . "\n";
        break;
    }
    echo '<div style="color:#aa0000">NOTE: There are ' . (sizeof($merchants) - 1) . ' other merchants not shown</div>';
}
//create merchant tests
$CREATE = FALSE;
$DELETE_ID = '';
if ($CREATE) {
    //create an array of fields to create a merchant
    $create = array('name' => 'Another Test Merchant for Aaron');
    //create the merchant
    $created = GoCoinAdmin::createMerchant($token, $create);
    //show the created merchant