public List <SubscriptionPlan> GetPlans(string productId) { var planListOption = new PlanListFilterOptions { ProductId = productId }; return(GetPlans(planListOption)); }
public List <SubscriptionPlan> GetPlans(PlanListFilterOptions planListOptions) { var stripeListOptions = planListOptions.ToStripePlanListOptions(); var stripePlans = _planService.List(stripeListOptions); var subscriptionPlans = new List <SubscriptionPlan>(); foreach (var stripePlan in stripePlans) { subscriptionPlans.Add(stripePlan.ToSubscriptionPlan()); } return(subscriptionPlans); }
public static PlanListFilterOptions ToPlanListFilter(this StripePlanListOptions stripePlanOptions) { var planFilter = new PlanListFilterOptions { Active = stripePlanOptions.Active, EndingBefore = stripePlanOptions.EndingBefore, StartingAfter = stripePlanOptions.StartingAfter, ProductId = stripePlanOptions.ProductId, Limit = stripePlanOptions.Limit }; if (stripePlanOptions.Created != null) { planFilter.CreatedBefore = stripePlanOptions.Created.LessThanOrEqual; planFilter.CreatedAfter = stripePlanOptions.Created.GreaterThanOrEqual; } return(planFilter); }
/**** TO STRIPE ****/ public static StripePlanListOptions ToStripePlanListOptions(this PlanListFilterOptions planFilter) { var stripePlanOption = new StripePlanListOptions { Active = planFilter.Active, EndingBefore = planFilter.EndingBefore, StartingAfter = planFilter.StartingAfter, ProductId = planFilter.ProductId, Limit = planFilter.Limit, Created = new StripeDateFilter { GreaterThanOrEqual = planFilter.CreatedAfter, LessThanOrEqual = planFilter.CreatedBefore } }; return(stripePlanOption); }