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(); }
public IEnumerable <ProductView> GetProducts() { SetStripeKey(); var productService = new StripeProductService(); StripeList <StripeProduct> productItems = productService.List( new StripeProductListOptions() { Limit = _maximumItemsToReturn } ); var jsonProducts = productItems .Select(p => new ProductView { Id = p.Id, Name = p.Name, Type = p.Type }); return(jsonProducts); }
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); }