function showObject($obj, $recurse = TRUE) { if (!empty($obj) && is_object($obj) && get_class($obj) == 'stdClass') { echo '<ul>' . "\n"; foreach (get_object_vars($obj) as $key => $value) { if (is_object($value) && get_class($value) == 'stdClass') { if ($recurse) { echo " <li><b>{$key}:</b><br/>\n"; foreach ($value as $subkey => $subobj) { echo "<div><b>{$subkey}:</b></div>\n"; showObject($subobj); } echo " </li>\n"; } else { echo " <li><b>{$key}:</b> " . sizeof($value) . " OBJECTS NOT SHOWN</li>\n"; } } else { if (is_array($value)) { if ($recurse) { echo " <li><b>{$key}:</b><br/>\n"; foreach ($value as $subkey => $subobj) { echo "<div><b>{$subkey}:</b></div>\n"; showObject($subobj); } echo " </li>\n"; } else { echo " <li><b>{$key}:</b> " . sizeof($value) . " OBJECTS NOT SHOWN</li>\n"; } } else { echo " <li><b>{$key}:</b> " . $value . "</li>\n"; } } } echo '</ul>' . "\n"; } }
showObject($u); echo '<hr/>' . "\n"; break; } echo '<div style="color:#aa0000">NOTE: There are ' . (sizeof($users) - 1) . ' other users not shown</div>'; } //create user tests $CREATE = FALSE; $DELETE_ID = ''; if ($CREATE) { //create an array of fields to create a user $creates = array('email' => '*****@*****.**', 'first_name' => 'Foo', 'last_name' => 'Bar', 'password' => 'password', 'password_confirmation' => 'password'); //create the user $created = GoCoinAdmin::createUser($token, $creates); //show the created user echo '<h3 style="color:blue">Created User</h3>'; showObject($created); //get the id to delete $DELETE_ID = $created->id; } if (!empty($DELETE_ID)) { //delete the user $deleted = GoCoinAdmin::deleteUser($token, $DELETE_ID); if ($deleted) { echo '<div style="color:#008800">User deleted successfully!</div>'; } else { echo '<div style="color:#aa0000">Deletion failed!</div>'; } } //close our HTML block echo '</body></html>' . "\n";
//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";
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/GoCoinAdmin.php'; //pick a token $token = $TOKENS['full_access']; //echo an HTML block echo '<html><head><title>GoCoin Admin Merchant User Test</title></head><body>' . "\n"; echo '<h3 style="color:blue">Merchant Users</h3>'; //get a list of all merchant users $users = GoCoin::getMerchantUsers($token, MERCHANT_ID); if (!empty($users)) { foreach ($users as $key => $user) { showObject($user); echo '<hr/>' . "\n"; //break; } //echo '<div style="color:#aa0000">NOTE: There are ' . (sizeof($users) - 1) . ' other merchant users not shown</div>'; } //add a merchant user echo '<h3 style="color:blue">Add Merchant User</h3>'; $add = GoCoinAdmin::addMerchantUser($token, MERCHANT_ID, MERCHANT_USER_ID); var_dump($add); //remove a merchant user echo '<h3 style="color:blue">Delete Merchant User</h3>'; $del = GoCoinAdmin::deleteMerchantUser($token, MERCHANT_ID, MERCHANT_USER_ID); var_dump($del); //close our HTML block echo '</body></html>' . "\n";
} echo '</ul>' . "\n"; } //example search criteria array $criteria = array('merchant_id' => MERCHANT_ID, 'start_time' => '2014-03-14T00:00:00.000Z', 'per_page' => 10); echo '<hr/>' . "\n"; echo '<h3 style="color:blue">Recent Invoices</h3>'; //search invoices with criteria $invoices = GoCoin::searchInvoices($token, $criteria); if (!empty($invoices) && property_exists($invoices, 'invoices')) { foreach ($invoices->invoices as $invoice) { showObject($invoice); echo '<hr/>' . "\n"; } } echo '<h3 style="color:blue">Specific Invoices</h3>'; //get a specific invoice $specific = GoCoin::getInvoice($token, INVOICE_ID); showObject($invoice); $NEW_INVOICE = FALSE; if ($NEW_INVOICE) { echo '<hr/>' . "\n"; echo '<h3 style="color:blue">New Invoice</h3>'; //create a new invoice $new_invoice = array('price_currency' => 'BTC', 'base_price' => '456.00', 'base_price_currency' => 'USD', 'notification_level' => 'all', 'confirmations_required' => 5); $new_invoice = GoCoin::createInvoice($token, MERCHANT_ID, $new_invoice); //var_dump($new_invoice); showObject($new_invoice); } //close our HTML block echo '</body></html>' . "\n";
// $read_wsdl_loc = "http://media1.hgkz.ch/winet-backend/soap/wsdl/HgkMediaLib_Reading.wsdl"; /* $read_client = new SoapClient($read_wsdl_loc); $function_list = $read_client->__getFunctions(); */ $html = showHTMLHeader(); switch ($_GET['action']) { case 'getinformation': // $result_array = $read_client->getInformation($session_id, $_GET['id'], "de"); include 'getinfo.php'; $result_array = getInformation($session_id, $_GET['id'], "de"); // $result_array->subtree = initArray(); /* $html .= showInformationHeader($result_array); $aItem = 0; $html .= showObjectsData($result_array->informationBlocks[$aItem]->data, $aItem); */ $aLevelBackground = array(array("#afa8a3", "#bab4af", "#c6c2bd", "#d7d4d1", "#ddd8d8"), array("#be9994", "#c7a6a2", "#d0b5b2", "#dfccca", "#e3d3d1"), array("#a0a4ac", "#bec2c8", "#d8d8df", "#e6e8eb", "#f0f1f2", "#f6f6f7"), array("#888d95", "#a8acb3", "#c4c7cb", "#d3d5d8")); $gLevelBackground = $aLevelBackground[2]; $gCounter = 0; $aNodeLevel = 0; $html .= showsubtree($result_array->subtree, $aNodeLevel); break; default: $result_array = $read_client->find($session_id, $clauses, $sort_order, $limit, $lang); $html .= showAccordionObject($result_array); $html .= showObject($result_array); } $html .= showHTMLFooter(); echo $html; $result = showArray($result_array->subtree);
} //get all conversions echo '<hr/>' . "\n"; echo '<h3 style="color:blue">All Conversions</h3>'; $conversions = GoCoin::getCurrencyConversions($token, MERCHANT_ID); var_dump($conversions); if (!empty($conversions)) { foreach ($conversions as $conversion) { showObject($conversion); } } //request a conversion $DO_CONVERSION = TRUE; if ($DO_CONVERSION) { echo '<h3 style="color:blue">Requested Conversion</h3>'; try { $conversion = GoCoin::requestCurrencyConversion($token, MERCHANT_ID, 1); showObject($conversion); } catch (Exception $e) { //var_dump($e); echo '<div style="color:#aa0000">' . $e->getMessage() . '</div>' . "\n"; } } //show a specific conversion id if (!empty(CONVERSION_ID)) { echo '<h3 style="color:blue">Specific Conversion</h3>'; $specific = GoCoin::requestCurrencyConversion($token, MERCHANT_ID, 1); showObject($specific); } //close our HTML block echo '</body></html>' . "\n";
} $clauses = array(array('connector' => '', 'subject' => 'Titel', 'predicate' => '~', 'object' => 'Mord')); $sort_order = array('Titel' => 'asc'); $limit = ''; $lang = 'de'; } catch (SoapFault $f) { $fault = "SOAP Fehler:<br>faultcode: {$f->faultcode}<br>"; $fault .= "faultstring: {$f->faultstring}<br>"; $fault .= "faultactor: {$f->faultactor}<br>"; $fault .= "faultdetail: {$f->detail}<br>"; die($fault); } // $result_array = new cFoundInformation; /* search for entries in hgkmedialib db */ $read_wsdl_loc = "http://media1.hgkz.ch/winet-backend/soap/wsdl/HgkMediaLib_Reading.wsdl"; $read_client = new SoapClient($read_wsdl_loc); $function_list = $read_client->__getFunctions(); $result_array = $read_client->find($session_id, $clauses, $sort_order, $limit, $lang); echo showHTMLHeader(); echo showObject($result_array, 0); echo showHTMLFooter(); /* echo '<pre>result:'; echo 'Result Array:<br/>'; print_r($result_array); $result_array = $read_client->getInformation($session_id, 4545, "de"); print_r($result_array); echo '</pre>'; */
function viking_3_showObject($sys_id) { global $par, $a3pr; $sel_db = $a3pr[$sys_id]['a3_db']; $sel_object = $a3pr[$sys_id]['a3_object']; $link_from_sid = $par['a3_link_from_sid']; $link_from_object = $par['a3_link_from_object']; //echo("db=$sel_db object=$sel_object <br>"); if ($sel_db == 'void' || !$sel_object) { return; } showObject('a3', $sel_db, $sel_object); viking_3_setText_Link($sys_id); viking_3_setFile_Link($sys_id); viking_3_setImage_Link($sys_id); viking_3_renameObject_Link($sys_id); viking_3_addObject_Link($sys_id); viking_3_deleteObject_Link($sys_id); if (!$link_from_object) { viking_3_addLinkFrom_Link($sys_id); } if ($link_from_object && $link_from_sid != $sys_id) { viking_3_addLinkTo_Link($sys_id); } if ($link_from_object && $link_from_sid == $sys_id) { viking_3_addLinkCancel_Link($sys_id); } viking_3_setText_Form($sys_id); viking_3_setFile_Form($sys_id); viking_3_setImage_Form($sys_id); viking_3_renameObject_Form($sys_id); viking_3_addObject_Form($sys_id); viking_3_deleteObject_Form($sys_id); viking_3_addLinkFrom_Form($sys_id); viking_3_addLinkTo_Form($sys_id); viking_3_addLinkCancel_Form($sys_id); }
function showObjectbyName($db, $name) { $id = getObjectIdbyName($db, $name); showObject(1, $db, $id); }
$updates = array('id' => USER_ID, 'last_name' => $last_name . ' updated'); //update the user $updated = GoCoin::updateUser($token, $updates); //show the updates echo '<h3 style="color:blue">Updated User</h3>'; showObject($updated); //reset the last name $updates['last_name'] = $last_name; GoCoin::updateUser($token, $updates); } //show the applications echo '<h3 style="color:blue">Applications</h3>'; //get the user applications $apps = GoCoin::getUserApplications($token, USER_ID); foreach ($apps as $app) { showObject($app); } //update password tests $PASSWORD = FALSE; if ($PASSWORD) { echo '<h3 style="color:blue">Password Update Test</h3>'; //an array to update the password $pw_array = array("current_password" => "passw0rd", "password" => "newpassw0rd", "password_confirmation" => "newpassw0rd"); //update the password $pw_update = GoCoin::updatePassword($token, USER_ID, $pw_array); if ($pw_update->code == '204') { echo '<div>Password successfully updated!</div>'; } else { echo '<div>Password update failure:</div>'; var_dump($pw_update); }