Пример #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>');
 }
Пример #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');