public ActionResult ManageSubscription()
        {
            var model = new ManageSubscriptionViewModel();

            try
            {
                //GetUptodate plan prices from stripe
                var planService = new StripePlanService(SensativeInformation.StripeKeys.SecretKey);
                var ordPlan     = planService.Get(StaticIdentifiers.OrdinaryMemberPlanId);
                var socialPlan  = planService.Get(StaticIdentifiers.SocialMemberPlanId);
                var patronPlan  = planService.Get(StaticIdentifiers.PatronPlanId);
                if (ordPlan != null)
                {
                    model.OrdinaryPrice = (ordPlan.Amount / 100m).ToString("N");
                }
                if (socialPlan != null)
                {
                    model.SocialPrice = (socialPlan.Amount / 100m).ToString("N");
                }
                if (patronPlan != null)
                {
                    model.PatronPrice = (patronPlan.Amount / 100m).ToString("N");
                }
            }
            catch (StripeException e)
            {
                _log.Error($"There was a stripe error whilst trying to load the current subscriptions prices for the manage membership page. The error was {e.Message}.");
            }
            try
            {
                var stripeAccountId = new Member(Members.GetCurrentMember()).StripeUserId;
                var dm = new DataManager();
                if (stripeAccountId.IsNotNullOrEmpty())
                {
                    model.IsStripeUser            = true;
                    model.HasExistingSubscription = false;
                    //Get plan status
                    var subscriptionService = new StripeSubscriptionService(SensativeInformation.StripeKeys.SecretKey);
                    var listOption          = new StripeSubscriptionListOptions {
                        CustomerId = stripeAccountId
                    };
                    var stripeSubscriptions = subscriptionService.List(listOption);

                    if (stripeSubscriptions != null && stripeSubscriptions.Any())
                    {
                        model.IsOrdinaryMember        = stripeSubscriptions.Any(m => m.StripePlan.Id == StaticIdentifiers.OrdinaryMemberPlanId && m.Status == StripeSubscriptionStatuses.Active);
                        model.IsSocialMember          = stripeSubscriptions.Any(m => m.StripePlan.Id == StaticIdentifiers.SocialMemberPlanId && m.Status == StripeSubscriptionStatuses.Active);
                        model.IsPatron                = stripeSubscriptions.Any(m => m.StripePlan.Id == StaticIdentifiers.PatronPlanId && m.Status == StripeSubscriptionStatuses.Active);
                        model.HasExistingSubscription = stripeSubscriptions.Any(m => m.Status == StripeSubscriptionStatuses.Active);
                    }
                }
            }
            catch (StripeException e)
            {
                _log.Error($"There was a stripe error whilst trying to load the current subscriptions for the managemembership page for user {Members.GetCurrentMember().Name} and id {Members.GetCurrentMember().Id}. The error was {e.Message}.");
            }

            return(PartialView("ManageSubscription", model));
        }
        public void WhenLoadingSubscription_DisplaysInformation()
        {
            bool         openUri = false;
            Action <Uri> act     = x => openUri = true;
            var          manage  = new ManageSubscriptionViewModel(_model, "Android", act, _mnNav, _logger.Object, _pageFactory.Object);

            Assert.AreEqual("   3", manage.RemainingOrdersLabel);
            Assert.AreEqual("   Basic", manage.SubscriptionTypeLabel);
            Assert.AreEqual("   " + _endDateTime.ToString("dddd, dd MMMM yyyy"), manage.EndDateLabel);
            Assert.IsFalse(openUri);
            manage.CancelSubCommand.Execute(null);
            Assert.IsTrue(openUri);
        }