Exemplo n.º 1
0
        private static void TestCreateInvoiceItems(StripePayment payment)
        {
            StripeCustomer cust = payment.CreateCustomer(new StripeCustomerInfo());
            StripeInvoiceItemInfo info = GetInvoiceItemInfo();
            info.CustomerId = cust.Id;
            StripeInvoiceItem item = payment.CreateInvoiceItem(info);
            StripeInvoiceItemUpdateInfo updateInfo = GetInvoiceItemUpdateInfo();
            updateInfo.Description = "Invoice item: " + Guid.NewGuid().ToString();
            StripeInvoiceItem item2 = payment.UpdateInvoiceItem(item.Id, updateInfo);
            StripeInvoiceItem item3 = payment.GetInvoiceItem(item2.Id);
            if (item.Description == item3.Description) throw new Exception("Update failed");
            StripeInvoiceItem deleted = payment.DeleteInvoiceItem(item2.Id);
            if (!deleted.Deleted.HasValue && deleted.Deleted.Value) throw new Exception("Delete failed");
            int total;

            var items = payment.GetInvoiceItems(10, 10, null, out total);
            Console.WriteLine(total);
            payment.DeleteCustomer(cust.Id);
        }