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 add_plan_to_product_fixture() { ProductCreateOptions = new StripeProductCreateOptions { Name = $"test-product-{ Guid.NewGuid() }", Type = "service" }; var productService = new StripeProductService(Cache.ApiKey); Product = productService.Create(ProductCreateOptions); PlanCreateOptions = new StripePlanCreateOptions() { Nickname = "plan-name", Amount = 5000, Currency = "usd", Interval = "month", ProductId = Product.Id }; var planService = new StripePlanService(Cache.ApiKey); Plan = planService.Create(PlanCreateOptions); PlanRetrieved = planService.Get(Plan.Id); }
public StripeProductServiceTest() { this.service = new StripeProductService(); this.createOptions = new StripeProductCreateOptions() { Attributes = new string[] { "attr1", "attr2", }, Name = "product name", PackageDimensions = new StripePackageDimensionOptions { Height = 100, Length = 100, Weight = 100, Width = 100, }, Type = "good", }; this.updateOptions = new StripeProductUpdateOptions() { Metadata = new Dictionary <string, string>() { { "key", "value" }, }, }; this.listOptions = new StripeProductListOptions() { Limit = 1, }; }
public transform_usage_plan_fixture() { ProductCreateOptions = new StripeProductCreateOptions { Name = $"test-product-{ Guid.NewGuid() }", Type = "service" }; var productService = new StripeProductService(Cache.ApiKey); var product = productService.Create(ProductCreateOptions); var transformUsage = new StripePlanTransformUsageOptions() { DivideBy = 100, Round = "up" }; PlanCreateOptions = new StripePlanCreateOptions() { Nickname = "tiered-plan-name", Amount = 1000, Currency = "usd", Interval = "month", ProductId = product.Id, TransformUsage = transformUsage, }; var planService = new StripePlanService(Cache.ApiKey); Plan = planService.Create(PlanCreateOptions); PlanRetrieved = planService.Get(Plan.Id); }
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); }
public tiered_plan_fixture() { ProductCreateOptions = new StripeProductCreateOptions { Name = $"test-product-{ Guid.NewGuid() }", Type = "service" }; var productService = new StripeProductService(Cache.ApiKey); var product = productService.Create(ProductCreateOptions); var tiers = new List <StripePlanTierOptions> { new StripePlanTierOptions() { Amount = 1000, UpTo = new StripePlanTierOptions.UpToBound() { Bound = 10 } }, new StripePlanTierOptions() { Amount = 2000, UpTo = new StripePlanTierOptions.UpToInf() } }; PlanCreateOptions = new StripePlanCreateOptions() { Nickname = "tiered-plan-name", BillingScheme = "tiered", TiersMode = "volume", Tiers = tiers, Currency = "usd", Interval = "month", ProductId = product.Id }; var planService = new StripePlanService(Cache.ApiKey); Plan = planService.Create(PlanCreateOptions); PlanRetrieved = planService.Get(Plan.Id); }