Пример #1
0
$lookupName = $client->lookup_wallet_name('wallet.BruceWayne.rocks', 'btc');
$lookupName->wallet_address;
// Wallet Address To Send Funds To
// Lookup Available Currencies for a Wallet Name
$lookupCurrencies = $client->get_wallet_name_currencies('wallet.BruceWayne.rocks');
$lookupCurrencies->available_currencies;
// All Currencies That a Wallet Name Contains Wallet Addresses for
// *** Wallet Name Management ***
// The following examples demonstrate common operations you will perform managing your customer's Wallet Names
/* Retrieve all Netki Wallet Names for your account. This call is useful if you need to make a mass update to your
Wallet Names. It is preferred that you provide specific parameters as covered in the next example below if you need to
retrieve a single Wallet Name. As your Wallet Name count grows, this data set will become large. It is also preferred
that you do not use this call to check if a Wallet Name already exists. Either attempt to fetch a Wallet Name
specifically by passing the appropriate externalId or simply try to create the Wallet Name. The server will provide the
appropriate messaging if the Wallet Name already exists. */
$walletNames = $client->get_wallet_names();
/* Retrieve a specific Netki Wallet Name based on the unique externalId that you
provided during creation. This is the preferred method of retrieving a
Wallet Name for the purposes of updating it or if necessary to check if the
Wallet Name has already been created. */
$walletNames = $client->get_wallet_names(null, "externalId");
/* Retrieve all Netki Wallet Names associated with a specific domainName. If
you have multiple domain names with which you use to create Wallet Names
this call is useful if you need to preform a mass update of all Wallet Names
specifically associated with a domain name. */
$filteredWalletNames = $client->get_wallet_names("testdomain.com", null);
// Create a new Netki Wallet Name by first creating the Wallet Name object
$walletName = $client->create_wallet_name("yourwalletnamedomain.com", "username", "externalId");
/* The above example will yield a walletName object with a Wallet Name of username.yourwalletnamedomain.com
A real example is batman.tip.me
Substitute:
 public function testGetWalletNamesGoRightNoDomainNoExternalIdTwoWalletNames()
 {
     // Add additional Wallet Name object to test
     $mockWalletName = new stdClass();
     $mockWalletName->id = 'id';
     $mockWalletName->domain_name = 'domain_name';
     $mockWalletName->name = 'name';
     $mockWalletName->external_id = 'extId';
     $mockWalletName->wallets = array();
     $mockWallet = new stdClass();
     $mockWallet->currency = 'btc';
     $mockWallet->wallet_address = '1btcaddy';
     $mockWalletName->wallets[] = $mockWallet;
     $mockWallet = new stdClass();
     $mockWallet->currency = 'dgc';
     $mockWallet->wallet_address = 'Doggyaddy';
     $mockWalletName->wallets[] = $mockWallet;
     $this->mockResponse->wallet_names[] = $mockWalletName;
     // Setup process_request mock for test
     $this->processRequestMock->expects($this->once())->method('process_request')->with($this->equalTo('partnerId'), $this->equalTo('apiKey'), $this->equalTo('apiUrl/v1/partner/walletname'), $this->equalTo('GET'), $this->equalTo(null))->willReturn($this->mockResponse);
     // Setup object in test
     $client = new Netki\NetkiClient('partnerId', 'apiKey', 'apiUrl');
     $client->set_requestor($this->processRequestMock);
     // Execute test
     $response = $client->get_wallet_names();
     // Validate Return Count
     $this->assertEquals(2, count($response));
     // Test Wallet Name One
     $walletName = $response[0];
     $testData = $this->mockResponse->wallet_names[0];
     $this->assertEquals($testData->id, $walletName->id);
     $this->assertEquals($testData->domain_name, $walletName->domainName);
     $this->assertEquals($testData->name, $walletName->name);
     $this->assertEquals($testData->external_id, $walletName->externalId);
     $mockWallets = array('btc' => $walletName->get_wallet_address('btc'), 'dgc' => $walletName->get_wallet_address('dgc'));
     $this->assertEquals(array('btc' => '1btcaddy', 'dgc' => 'Doggyaddy'), $mockWallets);
     // Test Wallet Name 2
     $walletName = $response[1];
     $this->assertEquals(2, count($response));
     $this->assertEquals($testData->id, $walletName->id);
     $this->assertEquals($testData->domain_name, $walletName->domainName);
     $this->assertEquals($testData->name, $walletName->name);
     $this->assertEquals($testData->external_id, $walletName->externalId);
     $mockWallets = array('btc' => $walletName->get_wallet_address('btc'), 'dgc' => $walletName->get_wallet_address('dgc'));
     $this->assertEquals(array('btc' => '1btcaddy', 'dgc' => 'Doggyaddy'), $mockWallets);
 }