/// <summary>
        /// Updates the subscription plan asynchronous.
        /// </summary>
        /// <param name="subscriptionPlan">The subscription plan.</param>
        /// <returns></returns>
        public async Task<int> UpdateAsync(SubscriptionPlan subscriptionPlan)
        {
            int res = await _subscriptionDataService.UpdateAsync(subscriptionPlan);
            _subscriptionPlanProvider.Update(subscriptionPlan);

            return res;
        }
        /// <summary>
        /// Updates the specified plan.
        /// </summary>
        /// <param name="plan">The plan.</param>
        /// <returns></returns>
        public object Update(SubscriptionPlan plan)
        {
            var res = PlanService.Update(plan.Id, new StripePlanUpdateOptions
            {
                Name = plan.Name
            });

            return res;
        }
        /// <summary>
        /// Adds the specified plan.
        /// </summary>
        /// <param name="plan">The plan.</param>
        /// <returns></returns>
        public object Add(SubscriptionPlan plan)
        {
            var result = PlanService.Create(new StripePlanCreateOptions
            {
                Id = plan.Id,
                Name = plan.Name,
                Amount = (int)Math.Round(plan.Price * 100),
                Currency = plan.Currency,
                Interval = GetInterval(plan.Interval),
                TrialPeriodDays = plan.TrialPeriodInDays,
                IntervalCount = 1, // The number of intervals (specified in the interval property) between each subscription billing. For example, interval=month and interval_count=3 bills every 3 months.
            });

            return result;
        }
        private static string GetInterval(SubscriptionPlan.SubscriptionInterval interval)
        {
            string result = null;

            switch (interval)
            {
                case (SubscriptionPlan.SubscriptionInterval.Monthly):
                    result = "month";
                    break;
                case (SubscriptionPlan.SubscriptionInterval.Yearly):
                    result = "year";
                    break;
                case (SubscriptionPlan.SubscriptionInterval.Weekly):
                    result = "week";
                    break;
                case (SubscriptionPlan.SubscriptionInterval.EveryThreeMonths):
                    result = "3-month";
                    break;
                case (SubscriptionPlan.SubscriptionInterval.EverySixMonths):
                    result = "6-month";
                    break;
            }

            return result;
        }
 /// <summary>
 /// Adds the subscription plan asynchronous.
 /// </summary>
 /// <param name="subscriptionPlan">The subscription plan.</param>
 /// <returns></returns>
 public async Task AddAsync(SubscriptionPlan subscriptionPlan)
 {
     await _subscriptionDataService.AddAsync(subscriptionPlan);
     _subscriptionPlanProvider.Add(subscriptionPlan);
 }