コード例 #1
0
        public void Get()
        {
            // Arrange
            var id = service.Create(new Invoice
            {
                organizationId   = "",
                contactId        = "",
                entryDate        = DateTime.Now.ToString("yyyy-MM-dd"),
                paymentTermsDays = 0,
                state            = "approved",
                sentState        = "unsent",
                taxMode          = "incl",
                invoiceNo        = "",
                lines            = new List <InvoiceLine>
                {
                    new InvoiceLine
                    {
                        unitPrice   = 0,
                        productId   = "",
                        description = ""
                    }
                }
            });

            // Act
            var result = service.Get(id);

            // Assert
            Assert.IsNotNull(result);
        }
コード例 #2
0
        public void GetInvoice()
        {
            var account = CreateNewAccountWithBillingInfo();

            var adjustment = account.NewAdjustment("USD", 5000, "Test Charge");

            adjustment.Create();

            var invoice = account.InvoicePendingCharges().ChargeInvoice;

            Assert.Equal("usst", invoice.TaxType);
            Assert.Equal(0.085M, invoice.TaxRate.Value);

            var fromService = Invoices.Get(invoice.InvoiceNumber);

            invoice.Should().Be(fromService);
        }
コード例 #3
0
        public void LookupCouponInvoice()
        {
            var discounts = new Dictionary <string, int> {
                { "USD", 1000 }
            };
            var coupon = new Coupon(GetMockCouponCode(), GetMockCouponName(), discounts);

            coupon.Create();

            var plan = new Plan(GetMockPlanCode(), GetMockPlanCode())
            {
                Description = "Test Lookup Coupon Invoice"
            };

            plan.UnitAmountInCents.Add("USD", 1500);
            plan.Create();
            PlansToDeactivateOnDispose.Add(plan);

            var account = CreateNewAccountWithBillingInfo();

            var redemption = account.RedeemCoupon(coupon.CouponCode, "USD");

            var sub = new Subscription(account, plan, "USD", coupon.CouponCode);

            sub.Create();

            // TODO complete this test

            var invoices = account.GetInvoices();

            invoices.Should().NotBeEmpty();

            var invoice     = Invoices.Get(invoices.First().InvoiceNumber);
            var fromInvoice = invoice.GetRedemption();

            redemption.Should().Be(fromInvoice);
        }