public ActionResult Billing(int planId) { string stripePublishableKey = ConfigurationManager.AppSettings["stripePublishableKey"]; var viewModel = new BillingViewModel() { Plan = PlanService.Find(planId), StripePublishableKey = stripePublishableKey }; return(View(viewModel)); }
public ActionResult Register(int id) { var plan = PlanService.Find(id); var model = new RegisterViewModel { Plan = plan }; if (Request.IsAuthenticated) { return(RedirectToAction("Billing", "Subscription", new { PlanId = model.Plan.Id })); } return(View(model)); }
public ActionResult Billing(BillingViewModel billingViewModel) { billingViewModel.Plan = PlanService.Find(billingViewModel.Plan.Id); try { SubscriptionService.Create(User.Identity.Name, billingViewModel.Plan, billingViewModel.StripeToken); } catch (StripeException stripeEx) { ModelState.AddModelError(string.Empty, stripeEx.Message); return(View(billingViewModel)); } return(RedirectToAction("Index", "Dashboard")); }
public ActionResult Register(int id) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; var plan = PlanService.Find(id); var model = new RegisterViewModel() { Plan = plan }; if (Request.IsAuthenticated) { return(RedirectToAction("Billing", "Subscription", new { PlanID = model.Plan.Id })); } return(View(model)); }