public async Task TestShouldSubmitGetAndDeletePayoutBatch()
        {
            var date             = DateTime.Now;
            var threeDaysFromNow = date.AddDays(3);

            var effectiveDate = threeDaysFromNow;
            var currency      = Currency.USD;
            var instructions  = new List <PayoutInstruction>()
            {
                new PayoutInstruction(100.0, "mtHDtQtkEkRRB5mgeWpLhALsSbga3iZV6u"),
                new PayoutInstruction(200.0, "mvR4Xj7MYT7GJcL93xAQbSZ2p4eHJV5F7A")
            };

            var batch0 = new PayoutBatch(currency, effectiveDate, instructions);

            batch0 = await _bitpay.SubmitPayoutBatch(batch0);

            Assert.IsNotNull(batch0.Id, "Batch (0) created with id=NULL");
            Assert.IsTrue(batch0.Instructions.Count == 2);

            var batch1 = await _bitpay.GetPayoutBatch(batch0.Id);

            Assert.IsNotNull(batch1.Id, "Batch (1) created with id=NULL");
            Assert.IsTrue(batch1.Instructions.Count == 2);

            await _bitpay.CancelPayoutBatch(batch0.Id);
        }
        public async Task TestShouldSubmitGetAndDeletePayoutBatch()
        {
            /*
             * Unfortunately at the time of this writing the Payroll facade is not available through the API
             * so this test will always fail - since you can't approve the Payroll pairing code
             */

            var date             = DateTime.Now;
            var threeDaysFromNow = date.AddDays(3);

            var effectiveDate  = threeDaysFromNow;
            var reference      = "My test batch";
            var bankTransferId = "My bank transfer id";
            var currency       = "USD";
            var instructions   = new List <PayoutInstruction>()
            {
                new PayoutInstruction(100.0, "mtHDtQtkEkRRB5mgeWpLhALsSbga3iZV6u", "Alice"),
                new PayoutInstruction(200.0, "mvR4Xj7MYT7GJcL93xAQbSZ2p4eHJV5F7A", "Bob")
            };

            var batch0 = new PayoutBatch(currency, effectiveDate, bankTransferId, reference, instructions);

            batch0 = await _bitpay.SubmitPayoutBatch(batch0);

            Assert.IsNotNull(batch0.Id, "Batch (0) created with id=NULL");
            Assert.IsTrue(batch0.Instructions.Count == 2);

            var batch1 = await _bitpay.GetPayoutBatch(batch0.Id);

            Assert.IsNotNull(batch1.Id, "Batch (1) created with id=NULL");
            Assert.IsTrue(batch1.Instructions.Count == 2);

            await _bitpay.CancelPayoutBatch(batch0.Id);
        }
        private static bool TestTokenSuccess(string facade)
        {
            try
            {
                var bitpay = new BitPay(confFilePath);
                if (facade == Facade.Merchant)
                {
                    var response = bitpay.GetInvoice("1", facade).Result;
                }
                else if (facade == Facade.Payroll)
                {
                    var response = bitpay.GetPayoutBatch("1").Result;
                }

                return(true);
            }
            catch (Exception e)
            {
                if (e.InnerException.Message.ToLower().Contains("object not found"))
                {
                    return(true);
                }

                return(false);
            }
        }