public async Task ThenTheAddPayeToAccountCommandIsCalled()
        {
            //Act
            await _employerAccountPayeOrchestrator.AddPayeSchemeToAccount(_model, ExpectedUserId);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.Is <AddPayeToAccountCommand>(c => c.HashedAccountId.Equals(ExpectedHashedId) && c.Empref.Equals(ExpectedEmpref) && c.ExternalUserId.Equals(ExpectedUserId) && c.EmprefName.Equals(ExpectedEmprefName))), Times.Once);
        }
Пример #2
0
        public async Task <ActionResult> ConfirmPayeScheme(string hashedAccountId, AddNewPayeSchemeViewModel model)
        {
            var result = await _employerAccountPayeOrchestrator.AddPayeSchemeToAccount(model, OwinWrapper.GetClaimValue("sub"));

            if (result.Status != HttpStatusCode.OK)
            {
                return(View(result));
            }

            var flashMessage = new FlashMessageViewModel
            {
                Severity = FlashMessageSeverityLevel.Success,
                Headline = $"You've added {model.PayeScheme}",
                HiddenFlashMessageInformation = "page-paye-scheme-added"
            };

            AddFlashMessageToCookie(flashMessage);

            return(RedirectToAction("Index", "EmployerAccountPaye", new { model.HashedAccountId }));
        }
Пример #3
0
        public async Task <ActionResult> ConfirmPayeScheme(string hashedAccountId, AddNewPayeSchemeViewModel model)
        {
            var result = await _employerAccountPayeOrchestrator.AddPayeSchemeToAccount(model, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName));

            if (result.Status != HttpStatusCode.OK)
            {
                return(View(result));
            }

            var payeSchemeName = string.IsNullOrEmpty(model.PayeName) ? "this PAYE scheme" : model.PayeName;

            var flashMessage = new FlashMessageViewModel
            {
                Severity = FlashMessageSeverityLevel.Success,
                Headline = $"{model.PayeScheme} has been added",
                HiddenFlashMessageInformation = "page-paye-scheme-added"
            };

            AddFlashMessageToCookie(flashMessage);

            return(RedirectToAction(ControllerConstants.NextStepsActionName, ControllerConstants.EmployerAccountPayeControllerName, new { model.HashedAccountId }));
        }