public async Task <ActionResult> SaveAndSearch(string returnUrl)
        {
            var userId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);

            if (string.IsNullOrWhiteSpace(userId))
            {
                _logger.Warn($"UserId not found on OwinWrapper. Redirecting back to passed in returnUrl: {returnUrl}");
                return(Redirect(returnUrl));
            }

            await OwinWrapper.UpdateClaims();

            var userRef   = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);
            var email     = OwinWrapper.GetClaimValue(ControllerConstants.EmailClaimKeyName);
            var firstName = OwinWrapper.GetClaimValue(DasClaimTypes.GivenName);
            var lastName  = OwinWrapper.GetClaimValue(DasClaimTypes.FamilyName);

            await _homeOrchestrator.SaveUpdatedIdentityAttributes(userRef, email, firstName, lastName);

            _returnUrlCookieStorageService.Create(new ReturnUrlModel {
                Value = returnUrl
            }, ReturnUrlCookieName);

            return(RedirectToAction(ControllerConstants.GetApprenticeshipFundingActionName, ControllerConstants.EmployerAccountControllerName));
        }
        public ActionResult GatewayInform(string hashedAccountId)
        {
            if (!string.IsNullOrWhiteSpace(hashedAccountId))
            {
                _accountCookieStorage.Delete(_hashedAccountIdCookieName);

                _accountCookieStorage.Create(
                    new HashedAccountIdModel {
                    Value = hashedAccountId
                },
                    _hashedAccountIdCookieName);
            }

            var gatewayInformViewModel = new OrchestratorResponse <GatewayInformViewModel>
            {
                Data = new GatewayInformViewModel
                {
                    BreadcrumbDescription = "Back to Your User Profile",
                    ConfirmUrl            = Url.Action(ControllerConstants.GatewayViewName, ControllerConstants.EmployerAccountControllerName),
                }
            };

            var flashMessageViewModel = GetFlashMessageViewModelFromCookie();

            if (flashMessageViewModel != null)
            {
                gatewayInformViewModel.FlashMessage = flashMessageViewModel;
            }

            return(View(gatewayInformViewModel));
        }
 private void createNewCookieWithData(EmployerAccountOrganisationData organisationData)
 {
     _cookieRepository
     .Create(
         new EmployerAccountData
     {
         EmployerAccountOrganisationData = organisationData,
         EmployerAccountPayeRefData      = new EmployerAccountPayeRefData()
     },
         CookieName,
         CookieExpiryInDays);
 }
Exemplo n.º 4
0
        protected void SetInfoMessage(string messageText, FlashMessageSeverityLevel level)
        {
            var message = new FlashMessageViewModel
            {
                Message  = messageText,
                Severity = level
            };

            _flashMessage.Delete(FlashMessageCookieName);

            _flashMessage.Create(message, FlashMessageCookieName);
        }
Exemplo n.º 5
0
        private void SaveContext(OrchestratorResponse <AccountDashboardViewModel> orchestratorResponse)
        {
            if (orchestratorResponse.Status == HttpStatusCode.OK)
            {
                _accountContext.Delete(AccountContextCookieName);

                _accountContext.Create(
                    new AccountContext
                {
                    HashedAccountId            = orchestratorResponse.Data.HashedAccountId,
                    ApprenticeshipEmployerType = orchestratorResponse.Data.ApprenticeshipEmployerType
                }
                    , AccountContextCookieName);
            }
        }
Exemplo n.º 6
0
        public async Task <ActionResult> SearchPensionRegulatorByAorn(string payeRef, string aorn, string hashedAccountId)
        {
            if (!string.IsNullOrWhiteSpace(hashedAccountId))
            {
                _accountCookieStorage.Delete(typeof(HashedAccountIdModel).FullName);

                _accountCookieStorage.Create(
                    new HashedAccountIdModel {
                    Value = hashedAccountId
                },
                    typeof(HashedAccountIdModel).FullName);
            }

            var userRef  = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);
            var aornLock = await _mediatr.SendAsync(new GetUserAornLockRequest
            {
                UserRef = userRef
            });

            if (!string.IsNullOrWhiteSpace(payeRef) && !string.IsNullOrWhiteSpace(aorn))
            {
                return(await PerformSearchPensionRegulatorByAorn(new SearchPensionRegulatorByAornViewModel
                {
                    Aorn = aorn,
                    PayeRef = payeRef,
                    IsLocked = aornLock.UserAornStatus.IsLocked,
                    RemainingAttempts = aornLock.UserAornStatus.RemainingAttempts,
                    AllowedAttempts = aornLock.UserAornStatus.AllowedAttempts,
                    RemainingLock = aornLock.UserAornStatus.RemainingLock
                }));
            }

            return(View(ControllerConstants.SearchUsingAornViewName, new SearchPensionRegulatorByAornViewModel
            {
                IsLocked = aornLock.UserAornStatus.IsLocked,
                RemainingAttempts = aornLock.UserAornStatus.RemainingAttempts,
                AllowedAttempts = aornLock.UserAornStatus.AllowedAttempts,
                RemainingLock = aornLock.UserAornStatus.RemainingLock
            }));
        }
Exemplo n.º 7
0
        public void AddFlashMessageToCookie(FlashMessageViewModel model)
        {
            _flashMessage.Delete(FlashMessageCookieName);

            _flashMessage.Create(model, FlashMessageCookieName);
        }
Exemplo n.º 8
0
 public virtual void CreateCookieData(HttpContextBase context, EmployerAccountData data)
 {
     _cookieService.Create(data, CookieName, 365);
 }
Exemplo n.º 9
0
 public void CreateApprenticeshipViewModelCookie(UpdateApprenticeshipViewModel model)
 {
     _apprenticshipsViewModelCookieStorageService.Delete(CookieName);
     model.OriginalApprenticeship = null;
     _apprenticshipsViewModelCookieStorageService.Create(model, CookieName);
 }
Exemplo n.º 10
0
 private void SaveRequestStatusInCookie(RequestStatus status)
 {
     _lastCohortCookieStorageService.Delete(LastCohortPageCookieKey);
     _lastCohortCookieStorageService.Create(status.ToString(), LastCohortPageCookieKey);
 }
Exemplo n.º 11
0
 public void SetCookie(ApprenticeshipFiltersViewModel filtersViewModel)
 {
     _filterCookieStorageService.Delete(nameof(ApprenticeshipFiltersViewModel));
     _filterCookieStorageService.Create(filtersViewModel, nameof(ApprenticeshipFiltersViewModel));
 }