public void Init() { // Initialize the BitPay object to be used in the following tests _bitpay = new BitPay(ClientName, BitpayTestUrl); // If the client doesn't have a POS token yet, fetch one. // For the Merchant and Payroll Facades, see below, in their corresponding tests if (!_bitpay.ClientIsAuthorized(BitPay.FacadePos)) { _bitpay.AuthorizeClient(PairingCode).Wait(); } // ledgers require the Merchant Facade if (!_bitpay.ClientIsAuthorized(BitPay.FacadeMerchant)) { // get a pairing code for the merchant facade for this client var pcode = _bitpay.RequestClientAuthorization(BitPay.FacadeMerchant).Result; /* We can't continue. Please make sure you write down this pairing code, then goto * your BitPay account in the API Tokens section * https://test.bitpay.com/dashboard/merchant/api-tokens * and paste it into the search field. * It should get you to a page to approve it. After you approve it, run the tests * again and they should pass. */ throw new BitPayException("Please approve the pairing code " + pcode + " in your account."); } // ledgers require the Payroll Facade if (!_bitpay.ClientIsAuthorized(BitPay.FacadePayroll)) { // get a pairing code for the merchant facade for this client var pcode = _bitpay.RequestClientAuthorization(BitPay.FacadePayroll).Result; /* We can't continue. Please make sure you write down this pairing code, then goto * your BitPay account in the API Tokens section * https://test.bitpay.com/dashboard/merchant/api-tokens * and paste it into the search field. * It should get you to a page to approve it. After you approve it, run the tests * again and they should pass. */ throw new BitPayException("Please approve the pairing code " + pcode + " in your account."); } }