/// <summary> /// Checks if changing your plan is possible. /// And begins the plan change (upgrade/downgrade) process is requested. /// </summary> /// <param name="proceed">/if set <c>true</c> then the upgrade process begins (if upgrade/downgrade is possible), otherwise related information only displayed.</param> /// <returns></returns> public virtual async Task <ActionResult> ChangePlan(bool proceed = false) { Logger.LogInformation("Getting current user to continue the plan change process."); var me = await AppUserCache.GetLoggedOnUser(); Logger.LogInformation("Found user is {@me}", me); Logger.LogInformation("Checking plan change feasibility."); var canUpgrage = Plans.CanUpgrade(me.PlanId.Value, me.IsAdmin); if (canUpgrage) { Logger.LogInformation("Plane change is possible."); if (proceed) { Logger.LogInformation($"Redirecting to {SHOPIFY_ACTIONS.ChoosePlan.ToString()}."); return(RedirectToAction(SHOPIFY_ACTIONS.ChoosePlan.ToString(), Settings.GetShopifyControllerName())); } else { Logger.LogInformation("Rendering change plan view."); Logger.LogInformation($"Change plan view name is {this.Views.MyProfile.ChangePlan}."); return(View(this.Views.MyProfile.ChangePlan)); } } else { Logger.LogWarning("Plane change is not possible already using highest plan."); WebMsg.AddTempInfo(this, "You are already using the highest plan."); Logger.LogInformation($"Redirecting to {PROFILE_ACTIONS.Index.ToString()}"); return(RedirectToAction(PROFILE_ACTIONS.Index.ToString(), Settings.GetAppMyProfileControllerName())); } }