Exemplo n.º 1
0
        public async Task testShouldCreateGetCancelRefundRequest()
        {
            //check within the last few days
            var date         = DateTime.Now;
            var today        = date;
            var sevenDaysAgo = date.AddDays(-95);
            var invoices     = await _bitpay.GetInvoices(sevenDaysAgo, today, InvoiceStatus.Complete);

            Invoice firstInvoice = invoices.First();

            Assert.NotNull(firstInvoice);
            string refundEmail = "";

            Boolean createdRefund = await _bitpay.CreateRefund(firstInvoice, refundEmail, firstInvoice.Price, firstInvoice.Currency);

            List <Refund> retrievedRefunds = await _bitpay.GetRefunds(firstInvoice);

            Refund firstRefund     = retrievedRefunds.First();
            Refund retrievedRefund = await _bitpay.GetRefund(firstInvoice, firstRefund.Id);

            Boolean cancelled = await _bitpay.CancelRefund(firstInvoice, firstRefund.Id);

            Assert.True(createdRefund);
            Assert.True(retrievedRefunds.Count > 0);
            Assert.NotNull(firstRefund);
            Assert.NotNull(retrievedRefund);
            Assert.True(cancelled);
        }