Пример #1
0
        public products_fixture()
        {
            ProductCreateOptions = new StripeProductCreateOptions
            {
                Name = $"test-product-{ Guid.NewGuid() }"
            };

            ProductTwoCreateOptions = new StripeProductCreateOptions
            {
                Name = $"test-product-{ Guid.NewGuid() }"
            };

            ProductUpdateOptions = new StripeProductUpdateOptions
            {
                Name = $"test-product-{ Guid.NewGuid() }"
            };

            var service = new StripeProductService(Cache.ApiKey);

            Product          = service.Create(ProductCreateOptions);
            ProductTwo       = service.Create(ProductTwoCreateOptions);
            ProductUpdated   = service.Update(Product.Id, ProductUpdateOptions);
            ProductRetrieved = service.Get(Product.Id);

            ProductListOptions = new StripeProductListOptions
            {
                Url = Product.Url,
                Ids = new [] { Product.Id, ProductTwo.Id }
            };

            ProductList = service.List(ProductListOptions).ToList();
        }
Пример #2
0
        public products_fixture()
        {
            ProductCreateOptions = new StripeProductCreateOptions
            {
                Name = $"test-product-{ Guid.NewGuid() }",
                Type = "good",
                PackageDimensions = new StripePackageDimensionOptions {
                    Height = 100,
                    Length = 100,
                    Weight = 100,
                    Width  = 100,
                },
                Attributes = new string[] { "color", "size" },
            };

            ProductTwoCreateOptions = new StripeProductCreateOptions
            {
                Name = $"test-product-{ Guid.NewGuid() }",
                Type = "good",
            };

            ProductUpdateOptions = new StripeProductUpdateOptions
            {
                Name = $"test-product-{ Guid.NewGuid() }",
            };

            var service = new StripeProductService(Cache.ApiKey);

            Product          = service.Create(ProductCreateOptions);
            ProductTwo       = service.Create(ProductTwoCreateOptions);
            ProductUpdated   = service.Update(Product.Id, ProductUpdateOptions);
            ProductRetrieved = service.Get(Product.Id);

            ProductListOptions = new StripeProductListOptions
            {
                Url = Product.Url,
                Ids = new [] { Product.Id, ProductTwo.Id }
            };

            ProductList = service.List(ProductListOptions);

            service.Delete(Product.Id);
            service.Delete(ProductTwo.Id);
        }