Exemplo n.º 1
0
 /**
  * Execute.
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Uphold client.
     $client = new UpholdClient(array('sandbox' => $input->getOption('sandbox')));
     // User's token.
     $token = $input->getArgument('token');
     try {
         $user = $client->getUser($token);
         $user->revokeToken();
     } catch (AuthenticationRequiredException $e) {
         return $output->writeln('Wrong credentials, please try again.');
     } catch (\Exception $e) {
         return $output->writeln($e->getMessage());
     }
     $output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, array('bold', 'blink')));
     $output->writeln('');
     $output->writeln('<red>Personal Access Token revoked!</red>');
 }
Exemplo n.º 2
0
<?php

require_once 'vendor/autoload.php';
use Uphold\UpholdClient as Client;
// Initialize the client.
$client = new Client();
// Get user.
$user = $client->getUser('AUTHORIZATION_TOKEN');
// Get current user cards.
$cards = $user->getCards();
echo "*** List of user cards ***\n";
foreach ($cards as $card) {
    echo sprintf("Label: %s\n", $card->getLabel());
    echo sprintf("Id: %s\n", $card->getId());
    echo sprintf("Bitcoin Address: %s\n", $card->getAddress()['bitcoin']);
    echo sprintf("Balance: %s\n", $card->getBalance());
    echo "\n";
}
// Get card by address.
$card = $user->getCardByAddress('1GpBtJXXa1NdG94cYPGZTc3DfRY2P7EwzH');
Exemplo n.º 3
0
 /**
  * @test
  */
 public function shouldReturnReserve()
 {
     $client = new UpholdClient();
     $this->assertInstanceOf('Uphold\\Model\\Reserve', $client->getReserve());
 }
Exemplo n.º 4
0
<?php

require_once 'vendor/autoload.php';
use Uphold\UpholdClient as Client;
// Initialize the client.
$client = new Client();
// Get the reserve summary of all the obligations and assets within it (public endpoint).
$statistics = $client->getReserve()->getStatistics();
print_r($statistics);
// Get the reserve ledger
$pager = $client->getReserve()->getLedger();
print_r($pager->getNext());
// Get latest transactions
$pager = $client->getReserve()->getTransactions();
print_r($pager->getNext());
Exemplo n.º 5
0
<?php

require_once 'vendor/autoload.php';
use Uphold\UpholdClient as Client;
// Initialize the client.
$client = new Client(array('sandbox' => true));
// Get rates (public endpoint).
$rates = $client->getRates();
echo "*** Current exchange rates ***\n";
foreach ($rates as $rate) {
    echo sprintf("Pair: %s\n", $rate->getPair());
    echo sprintf("Ask: 1 %s = %s %s\n", substr($rate->getPair(), 0, 3), $rate->getAsk(), $rate->getCurrency());
    echo sprintf("Bid: 1 %s = %s %s\n", substr($rate->getPair(), 0, 3), $rate->getBid(), $rate->getCurrency());
    echo "\n";
}