public IActionResult ActivateSubscription(Guid subscriptionId, string planId) { this.logger.LogInformation("Home Controller / ActivateSubscription subscriptionId:{0} :: planId:{1}", subscriptionId, planId); SubscriptionResult subscriptionDetail = new SubscriptionResult(); if (User.Identity.IsAuthenticated) { var userId = this.userService.AddPartnerDetail(GetCurrentUserDetail()); var currentUserId = this.userService.GetUserIdFromEmailAddress(this.CurrentUserEmailAddress); this.webSubscriptionService = new WebSubscriptionService(this.subscriptionRepo, this.planRepository, userId); //this.log.Info("User authenticate successfully"); this.logger.LogInformation("User authenticate successfully & GetSubscriptionByIdAsync SubscriptionID :{0}", JsonConvert.SerializeObject(subscriptionId)); this.TempData["ShowWelcomeScreen"] = false; var subscriptionData = this.fulfillApiClient.GetSubscriptionByIdAsync(subscriptionId).ConfigureAwait(false).GetAwaiter().GetResult(); //var subscribeId = this.webSubscriptionService.AddUpdatePartnerSubscriptions(subscriptionData); var oldValue = this.webSubscriptionService.GetSubscriptionsByScheduleId(subscriptionId); var serializedParent = JsonConvert.SerializeObject(subscriptionData); subscriptionDetail = JsonConvert.DeserializeObject <SubscriptionResult>(serializedParent); this.logger.LogInformation("serializedParent :{0}", serializedParent); //subscriptionDetail = (SubscriptionResultExtension)subscriptionData; subscriptionDetail.ShowWelcomeScreen = false; subscriptionDetail.SaasSubscriptionStatus = oldValue.SaasSubscriptionStatus; subscriptionDetail.CustomerEmailAddress = oldValue.CustomerEmailAddress; subscriptionDetail.CustomerName = oldValue.CustomerName; } return(this.View(subscriptionDetail)); }
/// <summary> /// Initializes a new instance of the <see cref="HomeController" /> class. /// </summary> /// <param name="UsersRepository">The users repository.</param> /// <param name="apiClient">The API client.</param> /// <param name="logger">The logger.</param> /// <param name="SubscriptionRepo">The subscription repo.</param> /// <param name="PlanRepository">The plan repository.</param> /// <param name="SubscriptionUsageLogsRepository">The subscription usage logs repository.</param> public HomeController(IUsersRepository UsersRepository, IMeteredBillingApiClient apiClient, ILogger <HomeController> logger, ISubscriptionsRepository SubscriptionRepo, IPlansRepository PlanRepository, ISubscriptionUsageLogsRepository SubscriptionUsageLogsRepository, IMeteredDimensionsRepository DimensionsRepository, ISubscriptionLogRepository subscriptionLogsRepo, IApplicationConfigRepository applicationConfigRepository, IUsersRepository userRepository, IFulfillmentApiClient fulfillApiClient, IApplicationLogRepository applicationLogRepository, IEmailTemplateRepository emailTemplateRepository) { this.apiClient = apiClient; subscriptionRepo = SubscriptionRepo; this.subscriptionLogRepository = subscriptionLogsRepo; planRepository = PlanRepository; subscriptionUsageLogsRepository = SubscriptionUsageLogsRepository; dimensionsRepository = DimensionsRepository; this.logger = logger; this.applicationConfigRepository = applicationConfigRepository; usersRepository = UsersRepository; this.userRepository = userRepository; this.userService = new UserService(userRepository); this.fulfillApiClient = fulfillApiClient; webSubscriptionService = new WebSubscriptionService(this.subscriptionRepo, this.planRepository); this.applicationLogRepository = applicationLogRepository; this.applicationLogService = new ApplicationLogService(this.applicationLogRepository); this.applicationConfigRepository = applicationConfigRepository; this.subscriptionRepository = subscriptionRepo; this.subscriptionService = new SubscriptionService(this.subscriptionRepository, this.planRepository); this.emailTemplateRepository = emailTemplateRepository; }