Esempio n. 1
0
        public orders_fixture()
        {
            OrderCreateOptions = new StripeOrderCreateOptions()
            {
                Currency = "usd",
                Items    = new List <StripeOrderItemOptions>
                {
                    new StripeOrderItemOptions
                    {
                        Amount      = 1,
                        Description = "some random items in a furry sack",
                        Parent      = "sku_AafhRMBaimSiAO", // i hardcoded this because skus isn't written yet. created from the dashboard
                        Quantity    = 1
                    },
                },
                Shipping = new StripeShippingOptions
                {
                    Name  = "Namey Namerson",
                    Line1 = "123 Main St"
                }
            };

            OrderUpdateOptions = new StripeOrderUpdateOptions
            {
                Metadata = new Dictionary <string, string>()
                {
                    { "some-key", "some-value" }
                }
            };

            var customer = Cache.GetCustomer();

            OrderPayOptions = new StripeOrderPayOptions
            {
                SourceId = Cache.GetToken().Id,
                Email    = customer.Email,
            };

            var service = new StripeOrderService(Cache.ApiKey);

            Order          = service.Create(OrderCreateOptions);
            OrderUpdated   = service.Update(Order.Id, OrderUpdateOptions);
            OrderRetrieved = service.Get(Order.Id);
            OrderPaid      = service.Pay(Order.Id, OrderPayOptions);

            OrderListOptions = new StripeOrderListOptions()
            {
                Created = Order.Created
            };

            OrderList = service.List(OrderListOptions).ToList();
        }
Esempio n. 2
0
        public orders_fixture()
        {
            OrderCreateOptions = new StripeOrderCreateOptions()
            {
                Currency = "usd",
                Items    = new List <StripeOrderItemOptions>
                {
                    new StripeOrderItemOptions
                    {
                        Amount      = 1,
                        Description = "Blue Shirts",
                        Parent      = "sku_stripe_net_test", // TODO: Remove hardcoding
                        Quantity    = 1
                    },
                },
                Shipping = new StripeShippingOptions
                {
                    Name  = "Namey Namerson",
                    Line1 = "123 Main St"
                }
            };

            OrderUpdateOptions = new StripeOrderUpdateOptions
            {
                Metadata = new Dictionary <string, string>()
                {
                    { "some-key", "some-value" }
                }
            };

            var customer = Cache.GetCustomer();

            OrderPayOptions = new StripeOrderPayOptions
            {
                SourceId = "tok_visa",
                Email    = customer.Email,
            };

            var service = new StripeOrderService(Cache.ApiKey);

            Order          = service.Create(OrderCreateOptions);
            OrderUpdated   = service.Update(Order.Id, OrderUpdateOptions);
            OrderRetrieved = service.Get(Order.Id);
            OrderPaid      = service.Pay(Order.Id, OrderPayOptions);

            OrderListOptions = new StripeOrderListOptions()
            {
                Created = Order.Created
            };

            OrderList = service.List(OrderListOptions);
        }
Esempio n. 3
0
        public orders_fixture()
        {
            var productService = new StripeProductService(Cache.ApiKey);
            var product        = productService.Create(new StripeProductCreateOptions {
                Name = "T-shirt",
                Type = "good"
            });

            var skuService = new StripeSkuService(Cache.ApiKey);
            var sku        = skuService.Create(new StripeSkuCreateOptions
            {
                Currency  = "usd",
                Inventory = new StripeInventoryOptions {
                    Type = "infinite",
                },
                Price   = 1234,
                Product = product.Id
            });

            OrderCreateOptions = new StripeOrderCreateOptions()
            {
                Currency = "usd",
                Items    = new List <StripeOrderItemOptions>
                {
                    new StripeOrderItemOptions
                    {
                        Amount      = 1,
                        Description = "Blue Shirts",
                        Parent      = sku.Id,
                        Quantity    = 1
                    },
                },
                Shipping = new StripeShippingOptions
                {
                    Name  = "Namey Namerson",
                    Line1 = "123 Main St"
                }
            };

            OrderUpdateOptions = new StripeOrderUpdateOptions
            {
                Metadata = new Dictionary <string, string>()
                {
                    { "some-key", "some-value" }
                }
            };

            var customer = Cache.GetCustomer();

            OrderPayOptions = new StripeOrderPayOptions
            {
                SourceId = "tok_visa",
                Email    = customer.Email,
            };

            var service = new StripeOrderService(Cache.ApiKey);

            Order          = service.Create(OrderCreateOptions);
            OrderUpdated   = service.Update(Order.Id, OrderUpdateOptions);
            OrderRetrieved = service.Get(Order.Id);
            OrderPaid      = service.Pay(Order.Id, OrderPayOptions);

            OrderListOptions = new StripeOrderListOptions()
            {
                Created = Order.Created
            };

            OrderList = service.List(OrderListOptions);
        }