Exemple #1
0
        public void ThenIShouldReturnAnOrganisationWithTheCorrectAddress()
        {
            //Act
            var result = _orchestrator.AddOrganisationAddress(_viewModel);

            //Assert
            _mapper.Verify(x => x.Map <CreateOrganisationAddressRequest>(_viewModel.Address), Times.Once);
            _mediator.Verify(x => x.Send(_request), Times.Once);
            Assert.AreEqual(_address, result.Data.Address);
        }
Exemple #2
0
        public ActionResult UpdateOrganisationAddress(AddOrganisationAddressViewModel request)
        {
            var response = _orchestrator.AddOrganisationAddress(request);

            var viewResult = ReturnAddOrganisationAddressViewIfBadRequest(request, response);

            if (viewResult != null)
            {
                return(viewResult);
            }

            ActionResult redirectToAction =
                RedirectToGatewayInformWhenHashedAccountIdIsNotPresentInTheRoute(response);

            return(redirectToAction ?? View(ControllerConstants.ConfirmOrganisationDetailsViewName, response));
        }
        public ActionResult UpdateOrganisationAddress(AddOrganisationAddressViewModel request)
        {
            var response = _orchestrator.AddOrganisationAddress(request);

            if (response.Status == HttpStatusCode.BadRequest)
            {
                request.Address = request.Address ?? new AddressViewModel();
                request.Address.ErrorDictionary = response.Data.ErrorDictionary;

                var errorResponse = new OrchestratorResponse <AddOrganisationAddressViewModel>
                {
                    Data         = request,
                    Status       = HttpStatusCode.BadRequest,
                    Exception    = response.Exception,
                    FlashMessage = response.FlashMessage
                };

                return(View("AddOrganisationAddress", errorResponse));
            }

            return(View("ConfirmOrganisationDetails", response));
        }
        public ActionResult UpdateOrganisationAddress(AddOrganisationAddressViewModel request)
        {
            var response = _orchestrator.AddOrganisationAddress(request);

            var viewResult = ReturnAddOrganisationAddressViewIfBadRequest(request, response);

            if (viewResult != null)
            {
                return(viewResult);
            }

            if (RouteData.Values[ControllerConstants.AccountHashedIdRouteKeyName] != null)
            {
                return(View(ControllerConstants.ConfirmOrganisationDetailsViewName, response));
            }

            if (response.Data?.Name != null)
            {
                _mediatr
                .SendAsync(new SaveOrganisationData
                           (
                               new EmployerAccountOrganisationData
                {
                    OrganisationType              = response.Data.Type,
                    OrganisationReferenceNumber   = response.Data.ReferenceNumber,
                    OrganisationName              = response.Data.Name,
                    OrganisationDateOfInception   = response.Data.DateOfInception,
                    OrganisationRegisteredAddress = response.Data.Address,
                    OrganisationStatus            = response.Data.Status ?? string.Empty,
                    PublicSectorDataSource        = response.Data.PublicSectorDataSource,
                    Sector    = response.Data.Sector,
                    NewSearch = response.Data.NewSearch
                }
                           ));
            }

            return(RedirectToAction(ControllerConstants.SummaryActionName,
                                    ControllerConstants.EmployerAccountControllerName, response.Data));
        }
Exemple #5
0
        public ActionResult UpdateOrganisationAddress(AddOrganisationAddressViewModel request)
        {
            var response = _orchestrator.AddOrganisationAddress(request);

            if (response.Status == HttpStatusCode.BadRequest)
            {
                request.Address = request.Address ?? new AddressViewModel();
                request.Address.ErrorDictionary = response.Data.ErrorDictionary;

                var errorResponse = new OrchestratorResponse <AddOrganisationAddressViewModel>
                {
                    Data         = request,
                    Status       = HttpStatusCode.BadRequest,
                    Exception    = response.Exception,
                    FlashMessage = response.FlashMessage
                };

                return(View("AddOrganisationAddress", errorResponse));
            }
            CreateOrganisationCookieData(response);

            return(RedirectToAction("GatewayInform", "EmployerAccount", response.Data));
        }