示例#1
0
    }
    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";
示例#2
0
 public function testGetInvoices()
 {
     if (!$this->doTest(__FUNCTION__)) {
         return;
     }
     //perform assertion
     $this->assertEquals(GoCoin::getApiMode(), 'test');
     $this->assertNotEmpty(TOKEN);
     //search invoices with no criteria, returns all of em
     $invoices = GoCoin::searchInvoices(TOKEN);
     $this->assertEquals($invoices->status, '200');
     echo '[DEBUG]: Found ' . $invoices->paging_info->total . ' total invoices' . "\n";
     echo '[DEBUG]: Currently have ' . sizeof($invoices->invoices) . ' invoices' . "\n";
     //example search criteria array
     $criteria = array('merchant_id' => MERCHANT_ID, 'start_time' => '2014-03-14T00:00:00.000Z', 'per_page' => 10);
     //search invoices with criteria
     $invoices = GoCoin::searchInvoices(TOKEN, $criteria);
     echo '[DEBUG]: Found ' . $invoices->paging_info->total . ' total recent invoices' . "\n";
     echo '[DEBUG]: Currently have ' . sizeof($invoices->invoices) . ' recent invoices' . "\n";
     //get a specific invoice
     $specific = GoCoin::getInvoice(TOKEN, INVOICE_ID);
     $this->assertEquals($specific->id, INVOICE_ID);
     echo '[DEBUG]: SUCCESS: ' . $specific->id . "\n";
 }