Ejemplo n.º 1
0
        public StripeOrderServiceTest()
        {
            this.service = new StripeOrderService();

            this.createOptions = new StripeOrderCreateOptions()
            {
                Currency = "usd",
                Items    = new List <StripeOrderItemOptions>
                {
                    new StripeOrderItemOptions
                    {
                        Parent   = "sku_123",
                        Quantity = 1
                    },
                }
            };

            this.updateOptions = new StripeOrderUpdateOptions()
            {
                Metadata = new Dictionary <string, string>()
                {
                    { "key", "value" },
                },
            };

            this.payOptions = new StripeOrderPayOptions()
            {
                CustomerId = "cus_123",
            };

            this.listOptions = new StripeOrderListOptions()
            {
                Limit = 1,
            };
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }