public BitPayTest2() { try { // If this test has never been run before then this test must be run twice in order to pass. // The first time this test runs it will create an identity and emit a client pairing code. // The pairing code must then be authorized in a BitPay account. Running the test a second // time should result in the authorized client (this test) running to completion. bitpay = new BitPay(clientName); if (!bitpay.clientIsAuthorized(BitPay.FACADE_POS)) { // Get POS facade authorization code. // Obtain a pairingCode from the BitPay server. The pairingCode must be emitted from // this device and input into and approved by the desired merchant account. To // generate invoices a POS facade is required. String pairingCode = bitpay.requestClientAuthorization(BitPay.FACADE_POS); // Signal the device operator that this client needs to be paired with a merchant account. System.Diagnostics.Debug.WriteLine("Info: Pair this client with your merchant account using the pairing code: " + pairingCode); throw new BitPayException("Error: client is not yet authorized, pair this client with your BitPay merchant account using the pairing code: " + pairingCode); } } catch (Exception ex) { Assert.Fail(ex.Message); } }
public BitPayTest3() { try { bitpay = new BitPay(clientName); if (!bitpay.clientIsAuthorized(BitPay.FACADE_PAYROLL)) { // Get PAYROLL facade authorization. // Obtain a pairingCode from your BitPay account administrator. When the pairingCode // is created by your administrator it is assigned a facade. To generate payout batches a // PAYROLL facade is required. // As an alternative to this client outputting a pairing code, the BitPay account owner // may interactively generate a pairing code via the BitPay merchant dashboard at // https://[test].bitpay.com/dashboard/merchant/api-tokens. This client can subsequently // accept the pairing code using the following call. // bitpay.authorizeClient(pairingCode); String pairingCode = bitpay.requestClientAuthorization(BitPay.FACADE_PAYROLL); // Signal the device operator that this client needs to be paired with a merchant account. System.Diagnostics.Debug.WriteLine("Info: Pair this client with your merchant account using the pairing code: " + pairingCode); System.Console.WriteLine("Info: Pair this client with your merchant account using the pairing code: " + pairingCode); throw new BitPayException("Error: client is not yet authorized, pair this client with your BitPay merchant account using the pairing code: " + pairingCode); } } catch (Exception ex) { Assert.Fail(ex.Message); } }
public BitPayTest() { try { // This scenario qualifies that this (test) client does not have merchant facade access. bitpay = new BitPay(clientName); if (!bitpay.clientIsAuthorized(BitPay.FACADE_POS)) { // Get POS facade authorization. // Obtain a pairingCode from your BitPay account administrator. When the pairingCode // is created by your administrator it is assigned a facade. To generate invoices a // POS facade is required. bitpay.authorizeClient(pairingCode); } } catch (Exception ex) { Assert.Fail(ex.Message); } }