Ejemplo n.º 1
0
<?php

require '../vendor/autoload.php';
require '../init.php';
// Instantiate NetkiClient
$partnerId = "XXXXXXXXXXXXXXXXXXXX";
$apiKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$client = new \Netki\NetkiClient($partnerId, $apiKey, "http://localhost:5000");
/* Lookup a Wallet Name. This call is useful on a SEND screen where your customer
might be looking up ANY Wallet Name. This includes Wallet Names that you do not
manage. e.g. wallet.yourcompany.name user sending to wallet.anothercompany.name user.
This will lookup Wallet Names that you manage as well, which is why it is perfect
for the SEND screen.
This call will return JSON that contains either a wallet address or bip21/72 URI. */
$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
 public function testLookupWalletNameGoRight()
 {
     // Setup process_request mock for test
     $this->processRequestMock->expects($this->once())->method('process_request')->with($this->equalTo(null), $this->equalTo(null), $this->equalTo('lookupUrl/walletName/currency'), $this->equalTo('GET'), $this->equalTo(null))->willReturn($this->mockResponse);
     // Setup object in test
     $client = new Netki\NetkiClient('partnerId', 'apiKey', 'apiUrl', 'lookupUrl/');
     $client->set_requestor($this->processRequestMock);
     // Execute test
     $response = $client->lookup_wallet_name('walletName', 'currency');
     // Validate Result
     $this->assertEquals($this->mockResponse, $response);
 }