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 SubscriptionProduct GetProduct(string ProductId) { //TODO: Replace with proper stripe options later. var stripePlans = _planService.List( new StripePlanListOptions { ProductId = ProductId } ); var stripeProduct = _productService.Get(ProductId); var product = new SubscriptionProduct { Name = stripeProduct.Name, Plans = new List <SubscriptionPlan>(), Status = stripeProduct.Caption }; //Description if (stripeProduct.Metadata != null && stripeProduct.Metadata.ContainsKey("description")) { product.Description = stripeProduct.Metadata["description"]; } foreach (var stripePlan in stripePlans) { product.Plans.Add(stripePlan.ToSubscriptionPlan()); } return(product); }
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); }