From 45be3c2115252256bd4deec090d23ec889e6eb38 Mon Sep 17 00:00:00 2001 From: jamdade-sharad Date: Tue, 17 Sep 2024 17:03:20 +0100 Subject: [PATCH 1/2] PODS-9772 - Removed toggle related code --- app/config/FrontendAppConfig.scala | 2 - .../cache/FeatureToggleConnector.scala | 57 ----------- .../register/BusinessTypeController.scala | 14 +-- ...eclarationWorkingKnowledgeController.scala | 9 +- .../RegisterAsBusinessController.scala | 12 +-- .../adviser/AdviserAddressController.scala | 20 ++-- .../AdviserAddressListController.scala | 26 ++--- ...viserAddressPostCodeLookupController.scala | 22 ++--- .../adviser/AdviserEmailController.scala | 22 ++--- .../adviser/AdviserNameController.scala | 46 ++++----- .../adviser/AdviserPhoneController.scala | 19 +--- .../adviser/CheckYourAnswersController.scala | 49 ++++------ .../AddCompanyDirectorsController.scala | 62 +++++------- .../register/company/AddressController.scala | 13 +-- ...ssMatchingCheckYourAnswersController.scala | 15 +-- .../CompanyAddressListController.scala | 32 ++---- .../CompanyAddressYearsController.scala | 17 +--- .../CompanyContactAddressController.scala | 24 ++--- .../CompanyContactAddressListController.scala | 20 ++-- ...ntactAddressPostCodeLookupController.scala | 27 ++---- .../company/CompanyEmailController.scala | 17 +--- .../company/CompanyEnterPAYEController.scala | 21 +--- .../company/CompanyEnterVATController.scala | 27 ++---- .../company/CompanyPhoneController.scala | 27 ++---- .../CompanyPreviousAddressController.scala | 19 +--- ...viousAddressPostCodeLookupController.scala | 19 +--- .../CompanyRegistrationNumberController.scala | 23 +---- .../CompanySameContactAddressController.scala | 23 ++--- .../CompanyTradingOverAYearController.scala | 23 +---- .../ConfirmCompanyDetailsController.scala | 18 +--- .../company/HasCompanyCRNController.scala | 13 +-- .../company/HasCompanyPAYEController.scala | 20 +--- .../company/HasCompanyVATController.scala | 20 +--- .../CheckYourAnswersController.scala | 15 +-- .../WhatYouWillNeedController.scala | 17 +--- .../CheckYourAnswersController.scala | 17 +--- .../WhatYouWillNeedController.scala | 13 +-- .../CheckYourAnswersController.scala | 36 +++---- ...CompanyDirectorAddressListController.scala | 26 ++--- ...ectorAddressPostCodeLookupController.scala | 16 +-- .../ConfirmDeleteDirectorController.scala | 23 ++--- .../directors/DirectorAddressController.scala | 16 +-- .../DirectorAddressYearsController.scala | 16 +-- .../directors/DirectorDOBController.scala | 16 +-- .../directors/DirectorEmailController.scala | 19 +--- .../DirectorEnterNINOController.scala | 17 +--- .../DirectorEnterUTRController.scala | 16 +-- .../directors/DirectorNameController.scala | 19 +--- .../DirectorNoNINOReasonController.scala | 16 +-- .../DirectorNoUTRReasonController.scala | 19 +--- .../directors/DirectorPhoneController.scala | 16 +-- .../DirectorPreviousAddressController.scala | 17 +--- ...irectorPreviousAddressListController.scala | 26 ++--- ...viousAddressPostCodeLookupController.scala | 16 +-- .../directors/HasDirectorNINOController.scala | 20 +--- .../directors/HasDirectorUTRController.scala | 17 +--- .../WhatYouWillNeedController.scala | 14 +-- app/models/FeatureToggle.scala | 83 ---------------- app/utils/Toggles.scala | 20 ---- conf/application.conf | 1 - .../actions/FakeFeatureToggleConnector.scala | 38 -------- .../register/BusinessTypeControllerSpec.scala | 17 +--- ...rationWorkingKnowledgeControllerSpec.scala | 17 +--- .../RegisterAsBusinessControllerSpec.scala | 27 +----- .../AdviserAddressControllerSpec.scala | 5 +- .../AdviserAddressListControllerSpec.scala | 16 +-- ...rAddressPostCodeLookupControllerSpec.scala | 11 +-- .../adviser/AdviserEmailControllerSpec.scala | 5 +- .../adviser/AdviserNameControllerSpec.scala | 9 +- .../adviser/AdviserPhoneControllerSpec.scala | 5 +- .../CheckYourAnswersControllerSpec.scala | 7 +- .../AddCompanyDirectorsControllerSpec.scala | 97 +------------------ .../company/AddressControllerSpec.scala | 6 +- .../CompanyAddressListControllerSpec.scala | 8 +- .../CompanyAddressYearsControllerSpec.scala | 19 ++-- .../CompanyContactAddressControllerSpec.scala | 5 +- ...panyContactAddressListControllerSpec.scala | 14 +-- ...tAddressPostCodeLookupControllerSpec.scala | 10 +- .../company/CompanyEmailControllerSpec.scala | 5 +- .../CompanyEnterPAYEControllerSpec.scala | 12 +-- .../CompanyEnterVATControllerSpec.scala | 18 ++-- .../company/CompanyPhoneControllerSpec.scala | 24 ++--- ...CompanyPreviousAddressControllerSpec.scala | 5 +- ...sAddressPostCodeLookupControllerSpec.scala | 5 +- ...panyRegistrationNumberControllerSpec.scala | 11 +-- ...panySameContactAddressControllerSpec.scala | 8 +- ...ompanyTradingOverAYearControllerSpec.scala | 13 ++- .../ConfirmCompanyDetailsControllerSpec.scala | 8 +- .../company/HasCompanyCRNControllerSpec.scala | 8 +- .../HasCompanyPAYEControllerSpec.scala | 12 +-- .../company/HasCompanyVATControllerSpec.scala | 18 ++-- .../CheckYourAnswersControllerSpec.scala | 5 +- ...anyDirectorAddressListControllerSpec.scala | 5 +- ...rAddressPostCodeLookupControllerSpec.scala | 5 +- .../ConfirmDeleteDirectorControllerSpec.scala | 10 +- .../DirectorAddressControllerSpec.scala | 5 +- .../DirectorAddressYearsControllerSpec.scala | 5 +- .../directors/DirectorDOBControllerSpec.scala | 5 +- .../DirectorEmailControllerSpec.scala | 5 +- .../DirectorEnterNINOControllerSpec.scala | 5 +- .../DirectorEnterUTRControllerSpec.scala | 5 +- .../DirectorNameControllerSpec.scala | 5 +- .../DirectorNoNINOReasonControllerSpec.scala | 5 +- .../DirectorNoUTRReasonControllerSpec.scala | 5 +- .../DirectorPhoneControllerSpec.scala | 5 +- ...irectorPreviousAddressControllerSpec.scala | 5 +- ...torPreviousAddressListControllerSpec.scala | 5 +- ...sAddressPostCodeLookupControllerSpec.scala | 5 +- .../HasDirectorNINOControllerSpec.scala | 5 +- .../HasDirectorUTRControllerSpec.scala | 5 +- 110 files changed, 456 insertions(+), 1432 deletions(-) delete mode 100644 app/connectors/cache/FeatureToggleConnector.scala delete mode 100644 app/models/FeatureToggle.scala delete mode 100644 app/utils/Toggles.scala delete mode 100644 test/controllers/actions/FakeFeatureToggleConnector.scala diff --git a/app/config/FrontendAppConfig.scala b/app/config/FrontendAppConfig.scala index 29efb11d5..0c815f5a0 100644 --- a/app/config/FrontendAppConfig.scala +++ b/app/config/FrontendAppConfig.scala @@ -171,8 +171,6 @@ class FrontendAppConfig @Inject()(runModeConfiguration: Configuration, environme }" }" - def featureToggleUrl(toggle: String): String = s"$pensionAdministratorUrl${runModeConfiguration.get[String]("urls.featureToggle").format(toggle)}" - def identityValidationFrontEndEntry(relativeCompletionURL: RedirectUrl, relativeFailureURL: RedirectUrl): String = { val url = loadConfig("urls.iv-uplift-entry") val query = s"?origin=pods&confidenceLevel=250&completionURL=${relativeCompletionURL.get(OnlyRelative).url}&failureURL=${relativeFailureURL.get(OnlyRelative).url}" diff --git a/app/connectors/cache/FeatureToggleConnector.scala b/app/connectors/cache/FeatureToggleConnector.scala deleted file mode 100644 index 56ceae9bd..000000000 --- a/app/connectors/cache/FeatureToggleConnector.scala +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2024 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package connectors.cache - -import com.google.inject.{ImplementedBy, Inject} -import config.FrontendAppConfig -import models.{FeatureToggle, FeatureToggleName} -import play.api.Logger -import play.api.http.Status._ -import uk.gov.hmrc.http.HttpReads.Implicits._ -import uk.gov.hmrc.http.{HeaderCarrier, HttpClient, HttpResponse} -import utils.HttpResponseHelper - -import scala.concurrent.{ExecutionContext, Future} -import scala.util.Failure - -class IFeatureToggleConnector @Inject()(http: HttpClient, config: FrontendAppConfig) - extends FeatureToggleConnector with HttpResponseHelper { - - private val logger = Logger(classOf[FeatureToggleConnector]) - - override def get(name: String) - (implicit hc: HeaderCarrier, ec: ExecutionContext): Future[FeatureToggle] = { - val endPoint = config.featureToggleUrl(name) - http.GET[HttpResponse](endPoint) map { - response => - response.status match { - case OK => response.json.as[FeatureToggle] - case _ => handleErrorResponse("GET", endPoint)(response) - } - } andThen { - case Failure(t: Throwable) => logger.warn("Unable to get toggle value", t) - } - } -} - -@ImplementedBy(classOf[IFeatureToggleConnector]) -trait FeatureToggleConnector { - def get(name: String)(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[FeatureToggle] - - def enabled(name: FeatureToggleName)(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Boolean] = - get(name.asString).map(_.isEnabled) -} diff --git a/app/controllers/register/BusinessTypeController.scala b/app/controllers/register/BusinessTypeController.scala index 33bb97fb1..3c04e3376 100644 --- a/app/controllers/register/BusinessTypeController.scala +++ b/app/controllers/register/BusinessTypeController.scala @@ -17,13 +17,10 @@ package controllers.register import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import forms.register.BusinessTypeFormProvider import identifiers.register.BusinessTypeId -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.Mode import play.api.data.Form import play.api.i18n.I18nSupport @@ -33,6 +30,7 @@ import utils.annotations.{Register, RegisterV2} import utils.{Enumerable, Navigator, UserAnswers} import views.html.register.businessType +import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} class BusinessTypeController @Inject()(appConfig: FrontendAppConfig, @@ -45,7 +43,6 @@ class BusinessTypeController @Inject()(appConfig: FrontendAppConfig, requireData: DataRequiredAction, formProvider: BusinessTypeFormProvider, val controllerComponents: MessagesControllerComponents, - featureToggleConnector: FeatureToggleConnector, val view: businessType )(implicit val executionContext: ExecutionContext) extends FrontendBaseController with I18nSupport with Enumerable.Implicits { @@ -68,14 +65,9 @@ class BusinessTypeController @Inject()(appConfig: FrontendAppConfig, Future.successful(BadRequest(view(formWithErrors, mode))), value => for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) newCache <- dataCacheConnector.save(request.externalId, BusinessTypeId, value) } yield { - if (isFeatureEnabled) { - Redirect(navigatorV2.nextPage(BusinessTypeId, mode, UserAnswers(newCache))) - } else { - Redirect(navigator.nextPage(BusinessTypeId, mode, UserAnswers(newCache))) - } + Redirect(navigatorV2.nextPage(BusinessTypeId, mode, UserAnswers(newCache))) } ) } diff --git a/app/controllers/register/DeclarationWorkingKnowledgeController.scala b/app/controllers/register/DeclarationWorkingKnowledgeController.scala index e04a4c856..ea6ce4155 100644 --- a/app/controllers/register/DeclarationWorkingKnowledgeController.scala +++ b/app/controllers/register/DeclarationWorkingKnowledgeController.scala @@ -16,12 +16,11 @@ package controllers.register -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions._ import forms.register.DeclarationWorkingKnowledgeFormProvider import identifiers.register.DeclarationWorkingKnowledgeId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.register.DeclarationWorkingKnowledge import play.api.data.Form @@ -43,8 +42,7 @@ class DeclarationWorkingKnowledgeController @Inject()( requireData: DataRequiredAction, formProvider: DeclarationWorkingKnowledgeFormProvider, val controllerComponents: MessagesControllerComponents, - val view: declarationWorkingKnowledge, - featureToggleConnector: FeatureToggleConnector + val view: declarationWorkingKnowledge )(implicit val executionContext: ExecutionContext) extends FrontendBaseController with I18nSupport with Enumerable.Implicits with Retrievals { @@ -66,9 +64,8 @@ class DeclarationWorkingKnowledgeController @Inject()( Future.successful(BadRequest(view(formWithErrors, mode, psaName(), taskListReturnLinkUrl()))), value => { for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) cacheMap <- dataCacheConnector.save(request.externalId, DeclarationWorkingKnowledgeId, - DeclarationWorkingKnowledge.declarationWorkingKnowledge(value, isFeatureEnabled)) + DeclarationWorkingKnowledge.declarationWorkingKnowledge(value, isRegistrationToggleEnabled = true)) } yield { Redirect(navigator.nextPage(DeclarationWorkingKnowledgeId, mode, UserAnswers(cacheMap))) } diff --git a/app/controllers/register/RegisterAsBusinessController.scala b/app/controllers/register/RegisterAsBusinessController.scala index 72d4683a3..37c5a0f24 100644 --- a/app/controllers/register/RegisterAsBusinessController.scala +++ b/app/controllers/register/RegisterAsBusinessController.scala @@ -19,11 +19,10 @@ package controllers.register import audit.{AuditService, PSAStartEvent} import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRetrievalAction} import forms.register.RegisterAsBusinessFormProvider import identifiers.register.{BusinessTypeId, RegisterAsBusinessId, RegistrationInfoId} -import models.FeatureToggleName.PsaRegistration import models.RegistrationCustomerType.UK import models.{Mode, NormalMode} import play.api.data.Form @@ -41,7 +40,6 @@ class RegisterAsBusinessController @Inject()(appConfig: FrontendAppConfig, allowAccess: AllowAccessActionProvider, getData: DataRetrievalAction, cache: UserAnswersCacheConnector, - featureToggleConnector: FeatureToggleConnector, auditService: AuditService, val controllerComponents: MessagesControllerComponents, val view: registerAsBusiness @@ -68,12 +66,10 @@ class RegisterAsBusinessController @Inject()(appConfig: FrontendAppConfig, for { _ <- cache.save(request.externalId, RegisterAsBusinessId, isBusiness) _ = PSAStartEvent.sendEvent(auditService) - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) } yield { - (isBusiness, isFeatureEnabled) match { - case (false, _) => Redirect(individual.routes.WhatYouWillNeedController.onPageLoad()) - case (true, false) => Redirect(routes.WhatYouWillNeedController.onPageLoad(NormalMode)) - case (true, true) => + isBusiness match { + case false => Redirect(individual.routes.WhatYouWillNeedController.onPageLoad()) + case true => val businessType = request.userAnswers.flatMap(_.get(BusinessTypeId)) val customerType = request.userAnswers.flatMap(_.get(RegistrationInfoId).map(_.customerType)) (businessType, customerType) match { diff --git a/app/controllers/register/adviser/AdviserAddressController.scala b/app/controllers/register/adviser/AdviserAddressController.scala index 2ad04422b..f58f775c4 100644 --- a/app/controllers/register/adviser/AdviserAddressController.scala +++ b/app/controllers/register/adviser/AdviserAddressController.scala @@ -18,15 +18,12 @@ package controllers.register.adviser import audit.AuditService import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.address.ManualAddressController import forms.AddressFormProvider import identifiers.UpdateContactAddressId import identifiers.register.adviser.{AdviserAddressId, AdviserAddressListId, AdviserNameId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.requests.DataRequest import models.{Address, Mode} import play.api.data.Form @@ -38,6 +35,7 @@ import viewmodels.Message import viewmodels.address.ManualAddressViewModel import views.html.address.manualAddress +import javax.inject.Inject import scala.concurrent.ExecutionContext class AdviserAddressController @Inject()(override val appConfig: FrontendAppConfig, @@ -51,8 +49,7 @@ class AdviserAddressController @Inject()(override val appConfig: FrontendAppConf val countryOptions: CountryOptions, val auditService: AuditService, val controllerComponents: MessagesControllerComponents, - val view: manualAddress, - featureToggleConnector: FeatureToggleConnector + val view: manualAddress )(implicit val executionContext: ExecutionContext) extends ManualAddressController { protected val form: Form[Address] = formProvider() @@ -72,17 +69,12 @@ class AdviserAddressController @Inject()(override val appConfig: FrontendAppConf def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(AdviserAddressId, AdviserAddressListId, addressViewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink), mode) - } + get(AdviserAddressId, AdviserAddressListId, + addressViewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl())), mode) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(AdviserAddressId, addressViewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink), mode) - } + post(AdviserAddressId, addressViewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/adviser/AdviserAddressListController.scala b/app/controllers/register/adviser/AdviserAddressListController.scala index 7e7038ee7..f3ecd1c18 100644 --- a/app/controllers/register/adviser/AdviserAddressListController.scala +++ b/app/controllers/register/adviser/AdviserAddressListController.scala @@ -17,27 +17,24 @@ package controllers.register.adviser import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions._ import controllers.address.AddressListController import forms.address.AddressListFormProvider import identifiers.UpdateContactAddressId import identifiers.register.adviser._ -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.requests.DataRequest import models.{Mode, TolerantAddress} import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Result} import utils.Navigator -import utils.annotations.Adviser -import utils.annotations.NoRLSCheck +import utils.annotations.{Adviser, NoRLSCheck} import viewmodels.Message import viewmodels.address.AddressListViewModel import views.html.address.addressList +import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} class AdviserAddressListController @Inject()(override val appConfig: FrontendAppConfig, @@ -49,8 +46,7 @@ class AdviserAddressListController @Inject()(override val appConfig: FrontendApp requireData: DataRequiredAction, formProvider: AddressListFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressList, - featureToggleConnector: FeatureToggleConnector + val view: addressList )(implicit val executionContext: ExecutionContext) extends AddressListController with Retrievals { def form(addresses: Seq[TolerantAddress], name: String)(implicit request: DataRequest[AnyContent]): Form[Int] = @@ -58,21 +54,15 @@ class AdviserAddressListController @Inject()(override val appConfig: FrontendApp def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink).map { vm => - get(vm, mode, form(vm.addresses, entityName)) - } + viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl())).map { vm => + get(vm, mode, form(vm.addresses, entityName)) } } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink) - .map(vm => post(vm, AdviserAddressId, AdviserAddressListId, AdviserAddressPostCodeLookupId, mode, form(vm.addresses, entityName))) - } + viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl())) + .map(vm => post(vm, AdviserAddressId, AdviserAddressListId, AdviserAddressPostCodeLookupId, mode, form(vm.addresses, entityName))) } def viewModel(mode: Mode, displayReturnLink: Boolean, returnLink: Option[String]) diff --git a/app/controllers/register/adviser/AdviserAddressPostCodeLookupController.scala b/app/controllers/register/adviser/AdviserAddressPostCodeLookupController.scala index a8ff68b70..c7fd2077b 100644 --- a/app/controllers/register/adviser/AdviserAddressPostCodeLookupController.scala +++ b/app/controllers/register/adviser/AdviserAddressPostCodeLookupController.scala @@ -18,26 +18,23 @@ package controllers.register.adviser import config.FrontendAppConfig import connectors.AddressLookupConnector -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.address.PostcodeLookupController import forms.address.PostCodeLookupFormProvider import identifiers.UpdateContactAddressId import identifiers.register.adviser.{AdviserAddressPostCodeLookupId, AdviserNameId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.Mode import models.requests.DataRequest import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import utils.Navigator -import utils.annotations.Adviser -import utils.annotations.NoRLSCheck +import utils.annotations.{Adviser, NoRLSCheck} import viewmodels.Message import viewmodels.address.PostcodeLookupViewModel import views.html.address.postcodeLookup +import javax.inject.Inject import scala.concurrent.ExecutionContext class AdviserAddressPostCodeLookupController @Inject()( @@ -51,8 +48,7 @@ class AdviserAddressPostCodeLookupController @Inject()( requireData: DataRequiredAction, formProvider: PostCodeLookupFormProvider, val controllerComponents: MessagesControllerComponents, - val view: postcodeLookup, - featureToggleConnector: FeatureToggleConnector + val view: postcodeLookup )(implicit val executionContext: ExecutionContext) extends PostcodeLookupController { override protected def form: Form[String] = formProvider() @@ -74,18 +70,12 @@ class AdviserAddressPostCodeLookupController @Inject()( def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink), mode) - } + get(viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl())), mode) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(AdviserAddressPostCodeLookupId, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink), mode) - } + post(AdviserAddressPostCodeLookupId, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/adviser/AdviserEmailController.scala b/app/controllers/register/adviser/AdviserEmailController.scala index b36fecfde..30c0d784c 100644 --- a/app/controllers/register/adviser/AdviserEmailController.scala +++ b/app/controllers/register/adviser/AdviserEmailController.scala @@ -17,24 +17,21 @@ package controllers.register.adviser import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.EmailAddressController import forms.EmailFormProvider import identifiers.UpdateContactAddressId import identifiers.register.adviser.{AdviserEmailId, AdviserNameId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.Mode import models.requests.DataRequest import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import utils.Navigator -import utils.annotations.Adviser -import utils.annotations.NoRLSCheck +import utils.annotations.{Adviser, NoRLSCheck} import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.email +import javax.inject.Inject import scala.concurrent.ExecutionContext class AdviserEmailController @Inject()(@Adviser val navigator: Navigator, @@ -46,8 +43,7 @@ class AdviserEmailController @Inject()(@Adviser val navigator: Navigator, requireData: DataRequiredAction, formProvider: EmailFormProvider, val controllerComponents: MessagesControllerComponents, - val view: email, - featureToggleConnector: FeatureToggleConnector + val view: email )(implicit val executionContext: ExecutionContext) extends EmailAddressController { private val form = formProvider() @@ -55,18 +51,12 @@ class AdviserEmailController @Inject()(@Adviser val navigator: Navigator, def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(AdviserEmailId, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink)) - } + get(AdviserEmailId, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(AdviserEmailId, mode, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink)) - } + post(AdviserEmailId, mode, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl()))) } private def entityName(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/adviser/AdviserNameController.scala b/app/controllers/register/adviser/AdviserNameController.scala index cba59224b..f11298379 100644 --- a/app/controllers/register/adviser/AdviserNameController.scala +++ b/app/controllers/register/adviser/AdviserNameController.scala @@ -18,13 +18,12 @@ package controllers.register.adviser import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import forms.register.adviser.AdviserNameFormProvider import identifiers.UpdateContactAddressId import identifiers.register.adviser.AdviserNameId -import models.FeatureToggleName.PsaRegistration import models.Mode import play.api.data.Form import play.api.i18n.I18nSupport @@ -34,7 +33,7 @@ import utils.annotations.Adviser import utils.{Navigator, UserAnswers} import views.html.register.adviser.adviserName -import scala.concurrent.ExecutionContext +import scala.concurrent.{ExecutionContext, Future} class AdviserNameController @Inject()( appConfig: FrontendAppConfig, @@ -45,8 +44,7 @@ class AdviserNameController @Inject()( formProvider: AdviserNameFormProvider, dataCacheConnector: UserAnswersCacheConnector, val controllerComponents: MessagesControllerComponents, - val view: adviserName, - featureToggleConnector: FeatureToggleConnector + val view: adviserName )(implicit val executionContext: ExecutionContext) extends FrontendBaseController with I18nSupport with Retrievals { val form: Form[String] = formProvider() @@ -57,37 +55,27 @@ class AdviserNameController @Inject()( case None => form case Some(value) => form.fill(value) } - val displayReturnLink = request.userAnswers.get(UpdateContactAddressId).isEmpty - - featureToggleConnector.enabled(PsaRegistration).map { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - - Ok(view( - preparedForm, - mode, - if (displayReturnLink) psaName() else None, - returnLink - )) - } + Future.successful(Ok(view( + preparedForm, + mode, + if (displayReturnLink) psaName() else None, + Some(companyTaskListUrl()) + ))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requiredData).async { implicit request => - val displayReturnLink = request.userAnswers.get(UpdateContactAddressId).isEmpty - form.bindFromRequest().fold( - (formWithErrors: Form[_]) => - featureToggleConnector.enabled(PsaRegistration).map { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - BadRequest(view( - formWithErrors, - mode, - if (displayReturnLink) psaName() else None, - returnLink - )) - }, + (formWithErrors: Form[_]) =>{ + Future.successful(BadRequest(view( + formWithErrors, + mode, + if (displayReturnLink) psaName() else None, + Some(companyTaskListUrl()) + ))) + }, value => { dataCacheConnector.save(request.externalId, AdviserNameId, value).map( cacheMap => diff --git a/app/controllers/register/adviser/AdviserPhoneController.scala b/app/controllers/register/adviser/AdviserPhoneController.scala index 0682bae45..27c4f58d7 100644 --- a/app/controllers/register/adviser/AdviserPhoneController.scala +++ b/app/controllers/register/adviser/AdviserPhoneController.scala @@ -17,15 +17,12 @@ package controllers.register.adviser import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.PhoneController import forms.PhoneFormProvider import identifiers.UpdateContactAddressId import identifiers.register.adviser.{AdviserNameId, AdviserPhoneId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.Mode import models.requests.DataRequest import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -34,6 +31,7 @@ import utils.annotations.{Adviser, NoRLSCheck} import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.phone +import javax.inject.Inject import scala.concurrent.ExecutionContext class AdviserPhoneController @Inject()(@Adviser val navigator: Navigator, @@ -45,8 +43,7 @@ class AdviserPhoneController @Inject()(@Adviser val navigator: Navigator, requireData: DataRequiredAction, formProvider: PhoneFormProvider, val controllerComponents: MessagesControllerComponents, - val view: phone, - featureToggleConnector: FeatureToggleConnector + val view: phone )(implicit val executionContext: ExecutionContext) extends PhoneController { private val form = formProvider() @@ -54,18 +51,12 @@ class AdviserPhoneController @Inject()(@Adviser val navigator: Navigator, def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(AdviserPhoneId, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink)) - } + get(AdviserPhoneId, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(AdviserPhoneId, mode, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, returnLink)) - } + post(AdviserPhoneId, mode, form, viewModel(mode, request.userAnswers.get(UpdateContactAddressId).isEmpty, Some(companyTaskListUrl()))) } private def entityName(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/adviser/CheckYourAnswersController.scala b/app/controllers/register/adviser/CheckYourAnswersController.scala index d1a961ef7..767e66c97 100644 --- a/app/controllers/register/adviser/CheckYourAnswersController.scala +++ b/app/controllers/register/adviser/CheckYourAnswersController.scala @@ -17,15 +17,11 @@ package controllers.register.adviser import config.FrontendAppConfig -import connectors.cache.FeatureToggleConnector import controllers.Retrievals import controllers.actions._ import identifiers.UpdateContactAddressId import identifiers.register.BusinessTypeId import identifiers.register.adviser._ -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.Mode import models.Mode._ import models.register.BusinessType @@ -41,6 +37,7 @@ import utils.dataCompletion.DataCompletion import viewmodels.{AnswerSection, Link} import views.html.check_your_answers +import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} class CheckYourAnswersController @Inject()(appConfig: FrontendAppConfig, @@ -51,44 +48,34 @@ class CheckYourAnswersController @Inject()(appConfig: FrontendAppConfig, dataCompletion: DataCompletion, implicit val countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, - val view: check_your_answers, - featureToggleConnector: FeatureToggleConnector + val view: check_your_answers )(implicit val executionContext: ExecutionContext) extends FrontendBaseController with Retrievals with I18nSupport { def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => retrieveAdviserName(mode) { _ => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(cyaPage(mode, returnLink)) - } + Future.successful(cyaPage(mode, Some(companyTaskListUrl()))) } } - def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { + def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => val isDataComplete = dataCompletion.isAdviserComplete(request.userAnswers, mode) - for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) - } yield { - (isFeatureEnabled, isDataComplete) match { - case(true, true) => - request.userAnswers.get(BusinessTypeId) match { - case Some(BusinessType.LimitedCompany) | Some(BusinessType.UnlimitedCompany) => - Redirect(controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad()) - case Some(BusinessType.BusinessPartnership) | Some(BusinessType.LimitedPartnership) | Some(BusinessType.LimitedLiabilityPartnership) => - Redirect(controllers.register.administratorPartnership.routes.PartnershipRegistrationTaskListController.onPageLoad()) - case None => // Must be individual - Redirect(navigator.nextPage(CheckYourAnswersId, mode, request.userAnswers)) - case _ => - Redirect(controllers.routes.SessionExpiredController.onPageLoad) - } - case(false, true) => Redirect(navigator.nextPage(CheckYourAnswersId, mode, request.userAnswers)) - case(true, false) => cyaPage(mode, Some(companyTaskListUrl())) - case(false, false) => cyaPage(mode, None) - } - } + isDataComplete match { + case true => + request.userAnswers.get(BusinessTypeId) match { + case Some(BusinessType.LimitedCompany) | Some(BusinessType.UnlimitedCompany) => + Redirect(controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad()) + case Some(BusinessType.BusinessPartnership) | Some(BusinessType.LimitedPartnership) | Some(BusinessType.LimitedLiabilityPartnership) => + Redirect(controllers.register.administratorPartnership.routes.PartnershipRegistrationTaskListController.onPageLoad()) + case None => // Must be individual + Redirect(navigator.nextPage(CheckYourAnswersId, mode, request.userAnswers)) + case _ => + Redirect(controllers.routes.SessionExpiredController.onPageLoad) + } + case false => cyaPage(mode, Some(companyTaskListUrl())) + } } private def cyaPage(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): Result = { diff --git a/app/controllers/register/company/AddCompanyDirectorsController.scala b/app/controllers/register/company/AddCompanyDirectorsController.scala index 007599a97..d21989815 100644 --- a/app/controllers/register/company/AddCompanyDirectorsController.scala +++ b/app/controllers/register/company/AddCompanyDirectorsController.scala @@ -17,28 +17,24 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.FeatureToggleConnector import controllers.Retrievals import controllers.actions._ import forms.register.company.AddCompanyDirectorsFormProvider import identifiers.register.company.AddCompanyDirectorsId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration -import models.{FeatureToggle, Mode, NormalMode, UpdateMode} +import models.{Mode, NormalMode, UpdateMode} import play.api.Logger import play.api.data.Form import play.api.i18n.I18nSupport import play.api.libs.json.JsResultException import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Result} import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController -import utils.{Navigator, UserAnswers} import utils.annotations.CompanyDirector +import utils.{Navigator, UserAnswers} import viewmodels.Person -import views.html.register.company.addCompanyDirectors -import views.html.register.company.addCompanyDirectorsv2 +import views.html.register.company.{addCompanyDirectors, addCompanyDirectorsv2} import javax.inject.Inject -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.ExecutionContext class AddCompanyDirectorsController @Inject()( appConfig: FrontendAppConfig, @@ -50,8 +46,7 @@ class AddCompanyDirectorsController @Inject()( formProvider: AddCompanyDirectorsFormProvider, val controllerComponents: MessagesControllerComponents, val view: addCompanyDirectors, - val viewv2: addCompanyDirectorsv2, - featureToggleConnector: FeatureToggleConnector + val viewv2: addCompanyDirectorsv2 )(implicit val executionContext: ExecutionContext) extends FrontendBaseController with I18nSupport @@ -62,38 +57,29 @@ class AddCompanyDirectorsController @Inject()( private val form: Form[Boolean] = formProvider() def onPageLoad(mode: Mode): Action[AnyContent] = - (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { + (authenticate andThen allowAccess(mode) andThen getData andThen requireData) { implicit request => val directors: Seq[Person] = request.userAnswers.allDirectorsAfterDelete(mode) - - featureToggleConnector.get(PsaRegistration.asString).map { - case Enabled(_) => - val directorsComplete = directors.filter(_.isComplete) - val directorsIncomplete = directors.filterNot(_.isComplete) - Ok(viewv2(form, mode, directorsComplete,directorsIncomplete, psaName())) - case _ => Ok(view(form, mode, directors, psaName())) - } + val directorsComplete = directors.filter(_.isComplete) + val directorsIncomplete = directors.filterNot(_.isComplete) + Ok(viewv2(form, mode, directorsComplete,directorsIncomplete, psaName())) } def onSubmit(mode: Mode): Action[AnyContent] = - (authenticate andThen getData andThen requireData).async { + (authenticate andThen getData andThen requireData) { implicit request => val directors: Seq[Person] = request.userAnswers.allDirectorsAfterDelete(mode) if (directors.isEmpty || directors.lengthCompare(appConfig.maxDirectors) >= 0) { - Future.successful(Redirect(navigator.nextPage(AddCompanyDirectorsId, mode, request.userAnswers))) + Redirect(navigator.nextPage(AddCompanyDirectorsId, mode, request.userAnswers)) } else { - featureToggleConnector.get(PsaRegistration.asString).map { featureToggle => form.bindFromRequest().fold( - (formWithErrors: Form[_]) => - if(featureToggle.isEnabled){ - val directorsComplete = directors.filter(_.isComplete) - val directorsIncomplete = directors.filterNot(_.isComplete) - BadRequest(viewv2(formWithErrors, mode, directorsComplete,directorsIncomplete, psaName())) - }else{ - BadRequest(view(formWithErrors, mode, directors, psaName())) - }, + (formWithErrors: Form[_]) =>{ + val directorsComplete = directors.filter(_.isComplete) + val directorsIncomplete = directors.filterNot(_.isComplete) + BadRequest(viewv2(formWithErrors, mode, directorsComplete, directorsIncomplete, psaName())) + }, value => request.userAnswers.set(AddCompanyDirectorsId)(value).fold( errors => { @@ -101,24 +87,20 @@ class AddCompanyDirectorsController @Inject()( (InternalServerError) }, userAnswers => { - addCompanyDirectorNavigation(mode, userAnswers, featureToggle) + addCompanyDirectorNavigation(mode, userAnswers) } ) ) - } + } } - private def addCompanyDirectorNavigation(mode: Mode, userAnswers: UserAnswers, featureToggle: FeatureToggle):Result = { - (featureToggle.isEnabled, userAnswers.get(AddCompanyDirectorsId)) match { - case (true, Some(false)) if mode == NormalMode => + private def addCompanyDirectorNavigation(mode: Mode, userAnswers: UserAnswers):Result = { + userAnswers.get(AddCompanyDirectorsId) match { + case Some(false) if mode == NormalMode => Redirect(controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad()) - case (true, Some(false)) if mode == UpdateMode => + case Some(false) if mode == UpdateMode => Redirect(controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad()) - case (false, Some(false)) if mode == NormalMode => - Redirect(controllers.register.company.routes.CompanyReviewController.onPageLoad()) - case (false, Some(false)) if mode == UpdateMode => - Redirect(controllers.register.routes.AnyMoreChangesController.onPageLoad()) case _ => val index = userAnswers.allDirectorsAfterDelete(mode).length maxDirectorNavigation(mode, userAnswers, index) diff --git a/app/controllers/register/company/AddressController.scala b/app/controllers/register/company/AddressController.scala index 33d846dd1..fcf522138 100644 --- a/app/controllers/register/company/AddressController.scala +++ b/app/controllers/register/company/AddressController.scala @@ -16,12 +16,11 @@ package controllers.register.company -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import forms.UKAddressFormProvider import identifiers.register.company.ConfirmCompanyAddressId -import models.FeatureToggleName.PsaRegistration import models._ import models.requests.DataRequest import play.api.data.Form @@ -30,7 +29,7 @@ import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Result} import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import utils.annotations.{RegisterCompany, RegisterCompanyV2} import utils.countryOptions.CountryOptions -import utils.{AddressHelper, Navigator, UserAnswers} +import utils.{AddressHelper, Navigator} import viewmodels.Message import viewmodels.address.ManualAddressViewModel import views.html.address.manualAddress @@ -42,7 +41,6 @@ class AddressController @Inject()(authenticate: AuthAction, val cacheConnector: UserAnswersCacheConnector, val controllerComponents: MessagesControllerComponents, val countryOptions: CountryOptions, - featureToggleConnector: FeatureToggleConnector, val formProvider: UKAddressFormProvider, getData: DataRetrievalAction, @RegisterCompany val navigator: Navigator, @@ -89,14 +87,9 @@ class AddressController @Inject()(authenticate: AuthAction, address.postcode, Some(address.country) ) for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) - newCache <- cacheConnector.save(request.externalId, ConfirmCompanyAddressId, tolerantAddress) + _ <- cacheConnector.save(request.externalId, ConfirmCompanyAddressId, tolerantAddress) } yield { - if (isFeatureEnabled) { Redirect(routes.CompanyRegistrationTaskListController.onPageLoad()) - } else { - Redirect(navigator.nextPage(ConfirmCompanyAddressId, mode, UserAnswers(newCache))) - } } } ) diff --git a/app/controllers/register/company/BusinessMatchingCheckYourAnswersController.scala b/app/controllers/register/company/BusinessMatchingCheckYourAnswersController.scala index 11217b0ad..d1efc2c58 100644 --- a/app/controllers/register/company/BusinessMatchingCheckYourAnswersController.scala +++ b/app/controllers/register/company/BusinessMatchingCheckYourAnswersController.scala @@ -16,11 +16,9 @@ package controllers.register.company -import connectors.cache.FeatureToggleConnector import controllers.Retrievals import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import identifiers.register.{BusinessNameId, BusinessUTRId} -import models.FeatureToggleName.PsaRegistration import models.NormalMode import play.api.i18n.I18nSupport import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -30,18 +28,16 @@ import viewmodels.{AnswerSection, Section} import views.html.check_your_answers import javax.inject.Inject -import scala.concurrent.ExecutionContext class BusinessMatchingCheckYourAnswersController @Inject()( val controllerComponents: MessagesControllerComponents, @AuthWithNoIV authenticate: AuthAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - checkYourAnswersView: check_your_answers, - featureToggleConnector: FeatureToggleConnector - )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport with Retrievals { + checkYourAnswersView: check_your_answers + ) extends FrontendBaseController with I18nSupport with Retrievals { - def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { + def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => val sections: Seq[Section] = Seq( AnswerSection(None, @@ -49,10 +45,7 @@ class BusinessMatchingCheckYourAnswersController @Inject()( BusinessUTRId.cya.row(BusinessUTRId)(None, request.userAnswers) ) ) - featureToggleConnector.enabled(PsaRegistration).map { featureEnabled => - val returnLink = if (featureEnabled) Some(companyName) else None - Ok(checkYourAnswersView(sections, routes.CompanyRegistrationTaskListController.onPageLoad(), None, NormalMode, isComplete = true, returnLink)) - } + Ok(checkYourAnswersView(sections, routes.CompanyRegistrationTaskListController.onPageLoad(), None, NormalMode, isComplete = true, Some(companyName))) } def onSubmit(): Action[AnyContent] = authenticate { _ => diff --git a/app/controllers/register/company/CompanyAddressListController.scala b/app/controllers/register/company/CompanyAddressListController.scala index 3a23371e2..1901ece6e 100644 --- a/app/controllers/register/company/CompanyAddressListController.scala +++ b/app/controllers/register/company/CompanyAddressListController.scala @@ -18,15 +18,13 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.AddressListController import forms.address.AddressListFormProvider import identifiers.register.company.{CompanyAddressListId, CompanyContactAddressPostCodeLookupId, CompanyPreviousAddressId, CompanyPreviousAddressPostCodeLookupId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Mode, TolerantAddress} import play.api.data.Form @@ -49,8 +47,7 @@ class CompanyAddressListController @Inject()(override val appConfig: FrontendApp requireData: DataRequiredAction, formProvider: AddressListFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressList, - featureToggleConnector: FeatureToggleConnector + val view: addressList )(implicit val executionContext: ExecutionContext) extends AddressListController with Retrievals { def form(addresses: Seq[TolerantAddress])(implicit request: DataRequest[AnyContent]): Form[Int] = @@ -58,29 +55,20 @@ class CompanyAddressListController @Inject()(override val appConfig: FrontendApp def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewmodel(mode, returnLink).map(vm => - get(vm, mode, form(vm.addresses)) - ) - } + viewModel(mode, Some(companyTaskListUrl())).map(vm => + get(vm, mode, form(vm.addresses)) + ) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - - featureToggleConnector.get(PsaRegistration.asString).flatMap { - case Enabled(_) => - viewmodel(mode, Some(companyTaskListUrl())).map(vm => - post(vm, CompanyPreviousAddressId, CompanyAddressListId, CompanyContactAddressPostCodeLookupId, mode, - form(vm.addresses), Some(navigatorV2)) - ) - case _ => viewmodel(mode, Some(companyTaskListUrl())).map(vm => - post(vm, CompanyPreviousAddressId, CompanyAddressListId, CompanyContactAddressPostCodeLookupId, mode, form(vm.addresses))) - } + viewModel(mode, Some(companyTaskListUrl())).map(vm => + post(vm, CompanyPreviousAddressId, CompanyAddressListId, CompanyContactAddressPostCodeLookupId, mode, + form(vm.addresses), Some(navigatorV2)) + ) } - def viewmodel(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): Either[Future[Result], AddressListViewModel] = { + def viewModel(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): Either[Future[Result], AddressListViewModel] = { CompanyPreviousAddressPostCodeLookupId.retrieve.map { addresses => AddressListViewModel( postCall = routes.CompanyAddressListController.onSubmit(mode), diff --git a/app/controllers/register/company/CompanyAddressYearsController.scala b/app/controllers/register/company/CompanyAddressYearsController.scala index 769666ef2..b827f05d6 100644 --- a/app/controllers/register/company/CompanyAddressYearsController.scala +++ b/app/controllers/register/company/CompanyAddressYearsController.scala @@ -17,14 +17,12 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions._ import controllers.address.AddressYearsController import forms.address.AddressYearsFormProvider import identifiers.register.company.CompanyAddressYearsId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{AddressYears, Mode} import play.api.data.Form @@ -49,8 +47,7 @@ class CompanyAddressYearsController @Inject()(@RegisterCompany override val navi requireData: DataRequiredAction, formProvider: AddressYearsFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressYears, - featureToggleConnector: FeatureToggleConnector + val view: addressYears )(implicit val executionContext: ExecutionContext) extends AddressYearsController with I18nSupport with Retrievals { @@ -59,18 +56,12 @@ class CompanyAddressYearsController @Inject()(@RegisterCompany override val navi def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(CompanyAddressYearsId, form, viewModel(mode, returnLink), mode) - } + get(CompanyAddressYearsId, form, viewModel(mode, Some(companyTaskListUrl())), mode) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { - case Enabled(_) => post(CompanyAddressYearsId, mode, form, viewModel(mode, Some(companyTaskListUrl())), Some(navigatorV2)) - case _ => post(CompanyAddressYearsId, mode, form, viewModel(mode)) - } + post(CompanyAddressYearsId, mode, form, viewModel(mode, Some(companyTaskListUrl())), Some(navigatorV2)) } private def viewModel(mode: Mode, returnLink: Option[String] = None)(implicit request: DataRequest[AnyContent]): AddressYearsViewModel = { diff --git a/app/controllers/register/company/CompanyContactAddressController.scala b/app/controllers/register/company/CompanyContactAddressController.scala index adfa2040a..8ce263467 100644 --- a/app/controllers/register/company/CompanyContactAddressController.scala +++ b/app/controllers/register/company/CompanyContactAddressController.scala @@ -18,13 +18,12 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.ManualAddressController import forms.UKAddressFormProvider import identifiers.register.BusinessNameId import identifiers.register.company._ -import models.FeatureToggleName.PsaRegistration import models.{Address, Mode} import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -47,8 +46,7 @@ class CompanyContactAddressController @Inject()(override val appConfig: Frontend formProvider: UKAddressFormProvider, val countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, - val view: manualAddress, - featureToggleConnector: FeatureToggleConnector + val view: manualAddress )(implicit val executionContext: ExecutionContext) extends ManualAddressController { override protected val form: Form[Address] = formProvider("error.country.invalid") @@ -70,21 +68,15 @@ class CompanyContactAddressController @Inject()(override val appConfig: Frontend def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - addressViewModel(mode, returnLink).retrieve.map(vm => - get(CompanyContactAddressId, CompanyContactAddressListId, vm, mode) - ) - } + addressViewModel(mode, Some(companyTaskListUrl())).retrieve.map(vm => + get(CompanyContactAddressId, CompanyContactAddressListId, vm, mode) + ) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - addressViewModel(mode, returnLink).retrieve.map(vm => - post(CompanyContactAddressId, vm, mode) - ) - } + addressViewModel(mode, Some(companyTaskListUrl())).retrieve.map(vm => + post(CompanyContactAddressId, vm, mode) + ) } } diff --git a/app/controllers/register/company/CompanyContactAddressListController.scala b/app/controllers/register/company/CompanyContactAddressListController.scala index dfe59d4bb..a5feef614 100644 --- a/app/controllers/register/company/CompanyContactAddressListController.scala +++ b/app/controllers/register/company/CompanyContactAddressListController.scala @@ -18,14 +18,13 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.AddressListController import forms.address.AddressListFormProvider import identifiers.register.BusinessNameId import identifiers.register.company._ -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Mode, TolerantAddress} import play.api.data.Form @@ -47,8 +46,7 @@ class CompanyContactAddressListController @Inject()(override val appConfig: Fron requireData: DataRequiredAction, formProvider: AddressListFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressList, - featureToggleConnector: FeatureToggleConnector + val view: addressList )(implicit val executionContext: ExecutionContext) extends AddressListController with Retrievals { def form(addresses: Seq[TolerantAddress])(implicit request: DataRequest[AnyContent]): Form[Int] = @@ -56,22 +54,16 @@ class CompanyContactAddressListController @Inject()(override val appConfig: Fron def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewmodel(mode, returnLink).map(vm => + viewmodel(mode, Some(companyTaskListUrl())).map(vm => get(vm, mode, form(vm.addresses)) ) - } } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewmodel(mode, returnLink).map(vm => - post(vm, CompanyContactAddressId, CompanyContactAddressListId, CompanyContactAddressPostCodeLookupId, mode, form(vm.addresses)) - ) - } + viewmodel(mode, Some(companyTaskListUrl())).map(vm => + post(vm, CompanyContactAddressId, CompanyContactAddressListId, CompanyContactAddressPostCodeLookupId, mode, form(vm.addresses)) + ) } def viewmodel(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): Either[Future[Result], AddressListViewModel] = { diff --git a/app/controllers/register/company/CompanyContactAddressPostCodeLookupController.scala b/app/controllers/register/company/CompanyContactAddressPostCodeLookupController.scala index 189b90b58..25603db56 100644 --- a/app/controllers/register/company/CompanyContactAddressPostCodeLookupController.scala +++ b/app/controllers/register/company/CompanyContactAddressPostCodeLookupController.scala @@ -19,20 +19,18 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig import connectors.AddressLookupConnector -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.PostcodeLookupController import forms.address.PostCodeLookupFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.CompanyContactAddressPostCodeLookupId -import models.FeatureToggleName.PsaRegistration import models.Mode import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import utils.Navigator -import utils.annotations.NoRLSCheck -import utils.annotations.RegisterCompany +import utils.annotations.{NoRLSCheck, RegisterCompany} import viewmodels.Message import viewmodels.address.PostcodeLookupViewModel import views.html.address.postcodeLookup @@ -50,8 +48,7 @@ class CompanyContactAddressPostCodeLookupController @Inject()( requireData: DataRequiredAction, formProvider: PostCodeLookupFormProvider, val controllerComponents: MessagesControllerComponents, - val view: postcodeLookup, - featureToggleConnector: FeatureToggleConnector + val view: postcodeLookup )(implicit val executionContext: ExecutionContext) extends PostcodeLookupController with Retrievals { @@ -75,21 +72,15 @@ class CompanyContactAddressPostCodeLookupController @Inject()( def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, returnLink).retrieve.map(vm => - get(vm, mode) - ) - } + viewModel(mode, Some(companyTaskListUrl())).retrieve.map(vm => + get(vm, mode) + ) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, returnLink).retrieve.map(vm => - post(CompanyContactAddressPostCodeLookupId, vm, mode) - ) - } + viewModel(mode, Some(companyTaskListUrl())).retrieve.map(vm => + post(CompanyContactAddressPostCodeLookupId, vm, mode) + ) } } diff --git a/app/controllers/register/company/CompanyEmailController.scala b/app/controllers/register/company/CompanyEmailController.scala index 9c5c79fcc..9462726ff 100644 --- a/app/controllers/register/company/CompanyEmailController.scala +++ b/app/controllers/register/company/CompanyEmailController.scala @@ -17,13 +17,11 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.EmailAddressController import forms.EmailFormProvider import identifiers.register.company.CompanyEmailId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -45,8 +43,7 @@ class CompanyEmailController @Inject()(@RegisterCompany val navigator: Navigator requireData: DataRequiredAction, formProvider: EmailFormProvider, val controllerComponents: MessagesControllerComponents, - val view: email, - featureToggleConnector: FeatureToggleConnector + val view: email )(implicit val executionContext: ExecutionContext) extends EmailAddressController { private val form = formProvider() @@ -54,18 +51,12 @@ class CompanyEmailController @Inject()(@RegisterCompany val navigator: Navigator def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(CompanyEmailId, form, viewModel(mode, returnLink)) - } + get(CompanyEmailId, form, viewModel(mode, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { - case Enabled(_) => post(CompanyEmailId, mode, form, viewModel(mode, Some(companyTaskListUrl())), Some(navigatorV2)) - case _ => post(CompanyEmailId, mode, form, viewModel(mode)) - } + post(CompanyEmailId, mode, form, viewModel(mode, Some(companyTaskListUrl())), Some(navigatorV2)) } private def viewModel(mode: Mode, returnLink: Option[String] = None)(implicit request: DataRequest[AnyContent]) = diff --git a/app/controllers/register/company/CompanyEnterPAYEController.scala b/app/controllers/register/company/CompanyEnterPAYEController.scala index 1c4ed3be6..9fa35a445 100644 --- a/app/controllers/register/company/CompanyEnterPAYEController.scala +++ b/app/controllers/register/company/CompanyEnterPAYEController.scala @@ -18,13 +18,12 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.register.EnterPAYEController import forms.EnterPAYEFormProvider import identifiers.register.EnterPAYEId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -46,8 +45,7 @@ class CompanyEnterPAYEController @Inject()(val appConfig: FrontendAppConfig, requireData: DataRequiredAction, formProvider: EnterPAYEFormProvider, val controllerComponents: MessagesControllerComponents, - val view: enterPAYE, - featureToggleConnector: FeatureToggleConnector + val view: enterPAYE )(implicit val executionContext: ExecutionContext) extends EnterPAYEController with Retrievals { protected def form(companyName: String) @@ -66,30 +64,19 @@ class CompanyEnterPAYEController @Inject()(val appConfig: FrontendAppConfig, def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(EnterPAYEId, form(companyName), viewModel(mode, returnLink)) - } + get(EnterPAYEId, form(companyName), viewModel(mode, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => form(companyName).bindFromRequest().fold( (formWithErrors: Form[_]) => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(BadRequest(view(formWithErrors, viewModel(mode, returnLink)))) - }, + Future.successful(BadRequest(view(formWithErrors, viewModel(mode, Some(companyTaskListUrl()))))), value => for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) newCache <- cacheConnector.save(request.externalId, EnterPAYEId, value) } yield { - if (isFeatureEnabled) { Redirect(navigatorV2.nextPage(EnterPAYEId, mode, UserAnswers(newCache))) - } else { - Redirect(navigator.nextPage(EnterPAYEId, mode, UserAnswers(newCache))) - } } ) } diff --git a/app/controllers/register/company/CompanyEnterVATController.scala b/app/controllers/register/company/CompanyEnterVATController.scala index 0b3b66141..8515832b8 100644 --- a/app/controllers/register/company/CompanyEnterVATController.scala +++ b/app/controllers/register/company/CompanyEnterVATController.scala @@ -17,19 +17,18 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.register.VATNumberController import forms.register.EnterVATFormProvider import identifiers.register.EnterVATId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} +import utils.Navigator import utils.annotations.RegisterCompany -import utils.{Navigator, UserAnswers} import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.enterVAT @@ -45,8 +44,7 @@ class CompanyEnterVATController @Inject()(val appConfig: FrontendAppConfig, requireData: DataRequiredAction, formProvider: EnterVATFormProvider, val controllerComponents: MessagesControllerComponents, - val view: enterVAT, - featureToggleConnector: FeatureToggleConnector + val view: enterVAT )(implicit val executionContext: ExecutionContext) extends VATNumberController with Retrievals { private def form(companyName: String) @@ -64,30 +62,19 @@ class CompanyEnterVATController @Inject()(val appConfig: FrontendAppConfig, def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(EnterVATId, form(companyName), viewModel(mode, returnLink)) - } + get(EnterVATId, form(companyName), viewModel(mode, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => form(companyName).bindFromRequest().fold( errors => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(BadRequest(view(errors, viewModel(mode, returnLink)))) - }, + Future.successful(BadRequest(view(errors, viewModel(mode, Some(companyTaskListUrl()))))), value => for { - featureToggle <- featureToggleConnector.get(PsaRegistration.asString) - newCache <- cacheConnector.save(request.externalId, EnterVATId, value) + _ <- cacheConnector.save(request.externalId, EnterVATId, value) } yield { - if (featureToggle.isEnabled) { - Redirect(companydetails.routes.CheckYourAnswersController.onPageLoad()) - } else { - Redirect(navigator.nextPage(EnterVATId, mode, UserAnswers(newCache))) - } + Redirect(companydetails.routes.CheckYourAnswersController.onPageLoad()) } ) } diff --git a/app/controllers/register/company/CompanyPhoneController.scala b/app/controllers/register/company/CompanyPhoneController.scala index eb4fa243e..264ee6c67 100644 --- a/app/controllers/register/company/CompanyPhoneController.scala +++ b/app/controllers/register/company/CompanyPhoneController.scala @@ -17,24 +17,23 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.PhoneController import forms.PhoneFormProvider import identifiers.UpdateContactAddressId import identifiers.register.company.CompanyPhoneId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} +import utils.Navigator import utils.annotations.{NoRLSCheck, RegisterCompany} -import utils.{Navigator, UserAnswers} import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.phone import javax.inject.Inject -import scala.concurrent.ExecutionContext +import scala.concurrent.{ExecutionContext, Future} class CompanyPhoneController @Inject()(@RegisterCompany val navigator: Navigator, val appConfig: FrontendAppConfig, @@ -45,8 +44,7 @@ class CompanyPhoneController @Inject()(@RegisterCompany val navigator: Navigator requireData: DataRequiredAction, formProvider: PhoneFormProvider, val controllerComponents: MessagesControllerComponents, - val view: phone, - featureToggleConnector: FeatureToggleConnector + val view: phone )(implicit val executionContext: ExecutionContext) extends PhoneController { private val form = formProvider() @@ -54,31 +52,20 @@ class CompanyPhoneController @Inject()(@RegisterCompany val navigator: Navigator def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(CompanyPhoneId, form, viewModel(mode, returnLink)) - } + get(CompanyPhoneId, form, viewModel(mode, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => form.bindFromRequest().fold( (formWithErrors: Form[_]) => - featureToggleConnector.enabled(PsaRegistration).map { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - BadRequest(view(formWithErrors, viewModel(mode, returnLink), psaName())) - }, + Future.successful(BadRequest(view(formWithErrors, viewModel(mode, Some(companyTaskListUrl())), psaName()))), value => { for { - cacheMap <- cacheConnector.save(request.externalId, CompanyPhoneId, value) - featureToggle <- featureToggleConnector.get(PsaRegistration.asString) + _ <- cacheConnector.save(request.externalId, CompanyPhoneId, value) _ <- saveChangeFlag(mode, CompanyPhoneId) } yield { - if(featureToggle.isEnabled){ Redirect(contactdetails.routes.CheckYourAnswersController.onPageLoad()) - } else { - Redirect(navigator.nextPage(CompanyPhoneId, mode, UserAnswers(cacheMap))) - } } } ) diff --git a/app/controllers/register/company/CompanyPreviousAddressController.scala b/app/controllers/register/company/CompanyPreviousAddressController.scala index 3d69864e8..082859326 100644 --- a/app/controllers/register/company/CompanyPreviousAddressController.scala +++ b/app/controllers/register/company/CompanyPreviousAddressController.scala @@ -18,20 +18,18 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.ManualAddressController import forms.UKAddressFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.{CompanyAddressListId, CompanyPreviousAddressId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Address, Mode} import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import utils.Navigator -import utils.annotations.NoRLSCheck -import utils.annotations.RegisterCompany +import utils.annotations.{NoRLSCheck, RegisterCompany} import utils.countryOptions.CountryOptions import viewmodels.Message import viewmodels.address.ManualAddressViewModel @@ -49,8 +47,7 @@ class CompanyPreviousAddressController @Inject()(override val appConfig: Fronten formProvider: UKAddressFormProvider, val countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, - val view: manualAddress, - featureToggleConnector: FeatureToggleConnector + val view: manualAddress )(implicit val executionContext: ExecutionContext) extends ManualAddressController { override protected val form: Form[Address] = formProvider("error.country.invalid") @@ -67,20 +64,14 @@ class CompanyPreviousAddressController @Inject()(override val appConfig: Fronten def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => BusinessNameId.retrieve.map { name => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(CompanyPreviousAddressId, CompanyAddressListId, addressViewModel(mode, name, returnLink), mode) - } + get(CompanyPreviousAddressId, CompanyAddressListId, addressViewModel(mode, name, Some(companyTaskListUrl())), mode) } } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => BusinessNameId.retrieve.map { name => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(CompanyPreviousAddressId, addressViewModel(mode, name, returnLink), mode) - } + post(CompanyPreviousAddressId, addressViewModel(mode, name, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/company/CompanyPreviousAddressPostCodeLookupController.scala b/app/controllers/register/company/CompanyPreviousAddressPostCodeLookupController.scala index a27699927..2cc41bcc0 100644 --- a/app/controllers/register/company/CompanyPreviousAddressPostCodeLookupController.scala +++ b/app/controllers/register/company/CompanyPreviousAddressPostCodeLookupController.scala @@ -19,20 +19,18 @@ package controllers.register.company import com.google.inject.Inject import config.FrontendAppConfig import connectors.AddressLookupConnector -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.PostcodeLookupController import forms.address.PostCodeLookupFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.CompanyPreviousAddressPostCodeLookupId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import utils.Navigator -import utils.annotations.NoRLSCheck -import utils.annotations.RegisterCompany +import utils.annotations.{NoRLSCheck, RegisterCompany} import viewmodels.Message import viewmodels.address.PostcodeLookupViewModel import views.html.address.postcodeLookup @@ -50,8 +48,7 @@ class CompanyPreviousAddressPostCodeLookupController @Inject()( requireData: DataRequiredAction, formProvider: PostCodeLookupFormProvider, val controllerComponents: MessagesControllerComponents, - val view: postcodeLookup, - featureToggleConnector: FeatureToggleConnector + val view: postcodeLookup )(implicit val executionContext: ExecutionContext) extends PostcodeLookupController { override protected def form: Form[String] = formProvider() @@ -59,20 +56,14 @@ class CompanyPreviousAddressPostCodeLookupController @Inject()( def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => BusinessNameId.retrieve.map { name => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(viewModel(mode, name, returnLink), mode) - } + get(viewModel(mode, name, Some(companyTaskListUrl())), mode) } } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => BusinessNameId.retrieve.map { name => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(CompanyPreviousAddressPostCodeLookupId, viewModel(mode, name, returnLink), mode) - } + post(CompanyPreviousAddressPostCodeLookupId, viewModel(mode, name, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/company/CompanyRegistrationNumberController.scala b/app/controllers/register/company/CompanyRegistrationNumberController.scala index ded940e41..0374ab833 100644 --- a/app/controllers/register/company/CompanyRegistrationNumberController.scala +++ b/app/controllers/register/company/CompanyRegistrationNumberController.scala @@ -17,13 +17,12 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions._ import controllers.register.EnterNumberController import forms.register.company.CompanyRegistrationNumberFormProvider import identifiers.register.company.CompanyRegistrationNumberId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -46,8 +45,7 @@ class CompanyRegistrationNumberController @Inject()(val appConfig: FrontendAppCo requireData: DataRequiredAction, formProvider: CompanyRegistrationNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: enterNumber, - featureToggleConnector: FeatureToggleConnector + val view: enterNumber )(implicit val executionContext: ExecutionContext) extends EnterNumberController with Retrievals { private val form = formProvider() @@ -65,10 +63,7 @@ class CompanyRegistrationNumberController @Inject()(val appConfig: FrontendAppCo def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - get(CompanyRegistrationNumberId, form, viewModel(mode, returnLink)) - } + get(CompanyRegistrationNumberId, form, viewModel(mode, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { @@ -76,20 +71,12 @@ class CompanyRegistrationNumberController @Inject()(val appConfig: FrontendAppCo form.bindFromRequest().fold( (formWithErrors: Form[_]) => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - Future.successful(BadRequest(view(formWithErrors, viewModel(mode, returnLink)))) - }, + Future.successful(BadRequest(view(formWithErrors, viewModel(mode, Some(companyTaskListUrl()))))), value => for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) newCache <- cacheConnector.save(request.externalId, CompanyRegistrationNumberId, value) } yield { - if (isFeatureEnabled) { - Redirect(navigatorV2.nextPage(CompanyRegistrationNumberId, mode, UserAnswers(newCache))) - } else { - Redirect(navigator.nextPage(CompanyRegistrationNumberId, mode, UserAnswers(newCache))) - } + Redirect(navigatorV2.nextPage(CompanyRegistrationNumberId, mode, UserAnswers(newCache))) } ) } diff --git a/app/controllers/register/company/CompanySameContactAddressController.scala b/app/controllers/register/company/CompanySameContactAddressController.scala index 631d601aa..02bcced26 100644 --- a/app/controllers/register/company/CompanySameContactAddressController.scala +++ b/app/controllers/register/company/CompanySameContactAddressController.scala @@ -17,7 +17,7 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.SameContactAddressController import controllers.register.company.routes.CompanySameContactAddressController @@ -25,9 +25,6 @@ import forms.address.SameContactAddressFormProvider import identifiers.UpdateContactAddressId import identifiers.register.BusinessNameId import identifiers.register.company._ -import models.FeatureToggleName.PsaRegistration - -import javax.inject.{Inject, Singleton} import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -40,6 +37,7 @@ import viewmodels.Message import viewmodels.address.SameContactAddressViewModel import views.html.address.sameContactAddress +import javax.inject.{Inject, Singleton} import scala.concurrent.ExecutionContext @Singleton() @@ -54,8 +52,7 @@ class CompanySameContactAddressController @Inject()(@RegisterCompany val navigat formProvider: SameContactAddressFormProvider, val countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, - val view: sameContactAddress, - featureToggleConnector: FeatureToggleConnector + val view: sameContactAddress )(implicit val executionContext: ExecutionContext) extends SameContactAddressController { def form(name: String)(implicit request: DataRequest[AnyContent]): Form[Boolean] = formProvider(Message("same.contact.address.error").withArgs(name)) @@ -86,21 +83,15 @@ class CompanySameContactAddressController @Inject()(@RegisterCompany val navigat def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - viewmodel(mode, returnLink).retrieve.map { vm => - get(CompanySameContactAddressId, vm, form(vm.psaName)) - } + viewmodel(mode, Some(companyTaskListUrl())).retrieve.map { vm => + get(CompanySameContactAddressId, vm, form(vm.psaName)) } } def onSubmit(mode: Mode): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - viewmodel(mode, returnLink).retrieve.map { vm => - post(CompanySameContactAddressId, CompanyAddressListId, CompanyContactAddressId, vm, mode, form(vm.psaName)) - } + viewmodel(mode, Some(companyTaskListUrl())).retrieve.map { vm => + post(CompanySameContactAddressId, CompanyAddressListId, CompanyContactAddressId, vm, mode, form(vm.psaName)) } } } diff --git a/app/controllers/register/company/CompanyTradingOverAYearController.scala b/app/controllers/register/company/CompanyTradingOverAYearController.scala index 20f65066c..64a543e82 100644 --- a/app/controllers/register/company/CompanyTradingOverAYearController.scala +++ b/app/controllers/register/company/CompanyTradingOverAYearController.scala @@ -17,14 +17,13 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.HasReferenceNumberController import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.register.company.routes._ import forms.HasReferenceNumberFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.CompanyTradingOverAYearId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -47,8 +46,7 @@ class CompanyTradingOverAYearController @Inject()(override val appConfig: Fronte requireData: DataRequiredAction, formProvider: HasReferenceNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: hasReferenceNumber, - featureToggleConnector: FeatureToggleConnector + val view: hasReferenceNumber )(implicit val executionContext: ExecutionContext) extends HasReferenceNumberController { private def viewModel(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): CommonFormWithHintViewModel = @@ -70,10 +68,7 @@ class CompanyTradingOverAYearController @Inject()(override val appConfig: Fronte implicit request => BusinessNameId.retrieve.map { companyName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(CompanyTradingOverAYearId, form(companyName), viewModel(mode, returnLink)) - } + get(CompanyTradingOverAYearId, form(companyName), viewModel(mode, Some(companyTaskListUrl()))) } } @@ -84,20 +79,12 @@ class CompanyTradingOverAYearController @Inject()(override val appConfig: Fronte companyName => { form(companyName).bindFromRequest().fold( (formWithErrors: Form[_]) => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(BadRequest(view(formWithErrors, viewModel(mode, returnLink)))) - }, + Future.successful(BadRequest(view(formWithErrors, viewModel(mode, Some(companyTaskListUrl()))))), value => { for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) newCache <- dataCacheConnector.save(request.externalId, CompanyTradingOverAYearId, value) } yield { - if (isFeatureEnabled) { - Redirect(navigatorV2.nextPage(CompanyTradingOverAYearId, mode, UserAnswers(newCache))) - } else { - Redirect(navigator.nextPage(CompanyTradingOverAYearId, mode, UserAnswers(newCache))) - } + Redirect(navigatorV2.nextPage(CompanyTradingOverAYearId, mode, UserAnswers(newCache))) } } ) diff --git a/app/controllers/register/company/ConfirmCompanyDetailsController.scala b/app/controllers/register/company/ConfirmCompanyDetailsController.scala index 3b53f0a05..d60bdea4a 100644 --- a/app/controllers/register/company/ConfirmCompanyDetailsController.scala +++ b/app/controllers/register/company/ConfirmCompanyDetailsController.scala @@ -17,7 +17,7 @@ package controllers.register.company import connectors.RegistrationConnector -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import forms.AddressFormProvider @@ -25,7 +25,6 @@ import forms.register.company.CompanyAddressFormProvider import identifiers.TypedIdentifier import identifiers.register.company.ConfirmCompanyAddressId import identifiers.register.{BusinessNameId, BusinessTypeId, BusinessUTRId, RegistrationInfoId} -import models.FeatureToggleName.PsaRegistration import models._ import models.requests.DataRequest import play.api.Logger @@ -55,7 +54,6 @@ class ConfirmCompanyDetailsController @Inject()( countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, val view: confirmCompanyDetails, - featureToggleConnector: FeatureToggleConnector, addressHelper: AddressHelper )(implicit val executionContext: ExecutionContext) extends FrontendBaseController @@ -109,16 +107,10 @@ class ConfirmCompanyDetailsController @Inject()( } invalidAddressFields.map { invalidFields => - featureToggleConnector.get(PsaRegistration.asString).map { featureToggle => - if (invalidFields) { - Redirect(routes.AddressController.onPageLoad()) - } else { - if (featureToggle.isEnabled) { - Redirect(routes.CompanyRegistrationTaskListController.onPageLoad()) - } else { - Redirect(navigator.nextPage(ConfirmCompanyAddressId, mode, request.userAnswers)) - } - } + if (invalidFields) { + Future.successful(Redirect(routes.AddressController.onPageLoad())) + } else { + Future.successful(Redirect(routes.CompanyRegistrationTaskListController.onPageLoad())) } } case false => diff --git a/app/controllers/register/company/HasCompanyCRNController.scala b/app/controllers/register/company/HasCompanyCRNController.scala index 8ff03a420..40ed6a590 100644 --- a/app/controllers/register/company/HasCompanyCRNController.scala +++ b/app/controllers/register/company/HasCompanyCRNController.scala @@ -17,14 +17,13 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.HasReferenceNumberController import controllers.actions._ import controllers.register.company.routes._ import forms.HasReferenceNumberFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.HasCompanyCRNId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -47,8 +46,7 @@ class HasCompanyCRNController @Inject()(override val appConfig: FrontendAppConfi requireData: DataRequiredAction, formProvider: HasReferenceNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: hasReferenceNumber, - featureToggleConnector: FeatureToggleConnector + val view: hasReferenceNumber )(implicit val executionContext: ExecutionContext) extends HasReferenceNumberController { private def viewModel(mode: Mode, entityName: String): CommonFormWithHintViewModel = @@ -82,14 +80,9 @@ class HasCompanyCRNController @Inject()(override val appConfig: FrontendAppConfi Future.successful(BadRequest(view(formWithErrors, viewModel(mode, companyName)))), value => for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) newCache <- dataCacheConnector.save(request.externalId, HasCompanyCRNId, value) } yield { - if (isFeatureEnabled) { - Redirect(navigatorV2.nextPage(HasCompanyCRNId, mode, UserAnswers(newCache))) - } else { - Redirect(navigator.nextPage(HasCompanyCRNId, mode, UserAnswers(newCache))) - } + Redirect(navigatorV2.nextPage(HasCompanyCRNId, mode, UserAnswers(newCache))) } ) } diff --git a/app/controllers/register/company/HasCompanyPAYEController.scala b/app/controllers/register/company/HasCompanyPAYEController.scala index 9e462920c..792349f44 100644 --- a/app/controllers/register/company/HasCompanyPAYEController.scala +++ b/app/controllers/register/company/HasCompanyPAYEController.scala @@ -17,12 +17,11 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.{HasReferenceNumberController, Retrievals} import forms.HasReferenceNumberFormProvider import identifiers.register.HasPAYEId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -45,8 +44,7 @@ class HasCompanyPAYEController @Inject()(override val appConfig: FrontendAppConf requireData: DataRequiredAction, formProvider: HasReferenceNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: hasReferenceNumber, - featureToggleConnector: FeatureToggleConnector + val view: hasReferenceNumber )(implicit val executionContext: ExecutionContext) extends HasReferenceNumberController with Retrievals { private def viewModel(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): CommonFormWithHintViewModel = @@ -66,10 +64,7 @@ class HasCompanyPAYEController @Inject()(override val appConfig: FrontendAppConf def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(HasPAYEId, form(companyName), viewModel(mode, returnLink)) - } + get(HasPAYEId, form(companyName), viewModel(mode, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode): Action[AnyContent] = @@ -77,17 +72,12 @@ class HasCompanyPAYEController @Inject()(override val appConfig: FrontendAppConf implicit request => form(companyName).bindFromRequest().fold( (formWithErrors: Form[_]) => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(BadRequest(view(formWithErrors, viewModel(mode, returnLink)))) - }, + Future.successful(BadRequest(view(formWithErrors, viewModel(mode, Some(companyTaskListUrl()))))), value => for { - isFeatureEnabled <- featureToggleConnector.get(PsaRegistration.asString).map(_.isEnabled) newCache <- dataCacheConnector.save(request.externalId, HasPAYEId, value) } yield { - val userSelectsNo = !value - if (isFeatureEnabled && userSelectsNo) { + if (!value) { Redirect(navigatorV2.nextPage(HasPAYEId, mode, UserAnswers(newCache))) } else { Redirect(navigator.nextPage(HasPAYEId, mode, UserAnswers(newCache))) diff --git a/app/controllers/register/company/HasCompanyVATController.scala b/app/controllers/register/company/HasCompanyVATController.scala index 5ba34dc8d..dbc45de1b 100644 --- a/app/controllers/register/company/HasCompanyVATController.scala +++ b/app/controllers/register/company/HasCompanyVATController.scala @@ -17,13 +17,12 @@ package controllers.register.company import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.company.routes.HasCompanyVATController import controllers.{HasReferenceNumberController, Retrievals} import forms.HasReferenceNumberFormProvider import identifiers.register.HasVATId -import models.FeatureToggleName.PsaRegistration import models.Mode import models.requests.DataRequest import play.api.data.Form @@ -45,8 +44,7 @@ class HasCompanyVATController @Inject()(override val appConfig: FrontendAppConfi requireData: DataRequiredAction, formProvider: HasReferenceNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: hasReferenceNumber, - featureToggleConnector: FeatureToggleConnector + val view: hasReferenceNumber )(implicit val executionContext: ExecutionContext) extends HasReferenceNumberController with Retrievals { private def viewModel(mode: Mode, returnLink: Option[String])(implicit request: DataRequest[AnyContent]): CommonFormWithHintViewModel = @@ -67,10 +65,7 @@ class HasCompanyVATController @Inject()(override val appConfig: FrontendAppConfi def onPageLoad(mode: Mode): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLinkCompanyName = if (featureEnabled) Some(companyTaskListUrl()) else None - get(HasVATId, form(companyName), viewModel(mode, returnLinkCompanyName)) - } + get(HasVATId, form(companyName), viewModel(mode, Some(companyTaskListUrl()) )) } def onSubmit(mode: Mode): Action[AnyContent] = @@ -78,17 +73,12 @@ class HasCompanyVATController @Inject()(override val appConfig: FrontendAppConfi implicit request => form(companyName).bindFromRequest().fold( (formWithErrors: Form[_]) => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLinkCompanyName = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(BadRequest(view(formWithErrors, viewModel(mode, returnLinkCompanyName)))) - }, + Future.successful(BadRequest(view(formWithErrors, viewModel(mode, Some(companyTaskListUrl()))))), value => for { cacheMap <- dataCacheConnector.save(request.externalId, HasVATId, value) - featureToggle <- featureToggleConnector.get(PsaRegistration.asString) } yield { - val userSelectsNo = !value - if (featureToggle.isEnabled && userSelectsNo) { + if (!value) { Redirect(companydetails.routes.CheckYourAnswersController.onPageLoad()) } else { Redirect(navigator.nextPage(HasVATId, mode, UserAnswers(cacheMap))) diff --git a/app/controllers/register/company/companydetails/CheckYourAnswersController.scala b/app/controllers/register/company/companydetails/CheckYourAnswersController.scala index 27ed210f9..267b47394 100644 --- a/app/controllers/register/company/companydetails/CheckYourAnswersController.scala +++ b/app/controllers/register/company/companydetails/CheckYourAnswersController.scala @@ -16,13 +16,11 @@ package controllers.register.company.companydetails -import connectors.cache.FeatureToggleConnector import controllers.Retrievals import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.register.company import identifiers.register.company.{CompanyRegistrationNumberId, HasCompanyCRNId} import identifiers.register.{EnterPAYEId, EnterVATId, HasPAYEId, HasVATId} -import models.FeatureToggleName.PsaRegistration import models.{CheckMode, NormalMode} import play.api.i18n.I18nSupport import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -32,18 +30,16 @@ import viewmodels.{AnswerSection, Link, Section} import views.html.check_your_answers import javax.inject.Inject -import scala.concurrent.ExecutionContext class CheckYourAnswersController @Inject()( val controllerComponents: MessagesControllerComponents, @AuthWithNoIV authenticate: AuthAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - checkYourAnswersView: check_your_answers, - featureToggleConnector: FeatureToggleConnector - )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport with Retrievals { + checkYourAnswersView: check_your_answers + ) extends FrontendBaseController with I18nSupport with Retrievals { - def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { + def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => val sections: Seq[Section] = Seq( AnswerSection(None, @@ -58,10 +54,7 @@ class CheckYourAnswersController @Inject()( ) ) val nextPage = controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad() - featureToggleConnector.enabled(PsaRegistration).ifA ( - ifTrue = Ok(checkYourAnswersView(sections, nextPage, Some(companyName), NormalMode, isComplete = true, returnLink = taskListReturnLinkUrl())), - ifFalse = Ok(checkYourAnswersView(sections, nextPage, None, NormalMode, isComplete = true)) - ) + Ok(checkYourAnswersView(sections, nextPage, Some(companyName), NormalMode, isComplete = true, returnLink = taskListReturnLinkUrl())) } def onSubmit(): Action[AnyContent] = authenticate { _ => diff --git a/app/controllers/register/company/companydetails/WhatYouWillNeedController.scala b/app/controllers/register/company/companydetails/WhatYouWillNeedController.scala index 4a096c953..a1577844a 100644 --- a/app/controllers/register/company/companydetails/WhatYouWillNeedController.scala +++ b/app/controllers/register/company/companydetails/WhatYouWillNeedController.scala @@ -16,11 +16,9 @@ package controllers.register.company.companydetails -import connectors.cache.FeatureToggleConnector import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import identifiers.register.BusinessNameId import identifiers.register.company.WhatYouWillNeedIdV2 -import models.FeatureToggleName.PsaRegistration import models.NormalMode import models.requests.DataRequest import play.api.i18n.I18nSupport @@ -32,7 +30,6 @@ import viewmodels.Message import views.html.register.company.companydetails import javax.inject.Inject -import scala.concurrent.ExecutionContext class WhatYouWillNeedController @Inject()( val controllerComponents: MessagesControllerComponents, @@ -40,17 +37,13 @@ class WhatYouWillNeedController @Inject()( @RegisterCompanyV2 navigator: Navigator, getData: DataRetrievalAction, requireData: DataRequiredAction, - whatYouWillNeedView: companydetails.whatYouWillNeed, - featureToggleConnector: FeatureToggleConnector - )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport { - def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).map { feature => - val returnLinkCompanyName = if (feature.isEnabled) Some(companyName) else None - Ok(whatYouWillNeedView(companyName, returnLinkCompanyName)) - } + whatYouWillNeedView: companydetails.whatYouWillNeed + ) extends FrontendBaseController with I18nSupport { + def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => + Ok(whatYouWillNeedView(companyName, Some(companyName))) } - def onSubmit(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { + def onSubmit(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => Redirect(navigator.nextPage(WhatYouWillNeedIdV2, NormalMode, request.userAnswers)) } diff --git a/app/controllers/register/company/contactdetails/CheckYourAnswersController.scala b/app/controllers/register/company/contactdetails/CheckYourAnswersController.scala index 8936f3b5c..9d1d92d97 100644 --- a/app/controllers/register/company/contactdetails/CheckYourAnswersController.scala +++ b/app/controllers/register/company/contactdetails/CheckYourAnswersController.scala @@ -16,12 +16,10 @@ package controllers.register.company.contactdetails -import connectors.cache.FeatureToggleConnector import controllers.Retrievals import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.register.company import identifiers.register.company._ -import models.FeatureToggleName.PsaRegistration import models.{CheckMode, NormalMode} import play.api.i18n.{I18nSupport, Messages} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -33,27 +31,22 @@ import viewmodels.{AnswerSection, Link, Section} import views.html.check_your_answers import javax.inject.Inject -import scala.concurrent.ExecutionContext class CheckYourAnswersController @Inject()( val controllerComponents: MessagesControllerComponents, @AuthWithNoIV authenticate: AuthAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - checkYourAnswersView: check_your_answers, - featureToggleConnector: FeatureToggleConnector + checkYourAnswersView: check_your_answers ) - (implicit countryOptions: CountryOptions, ec: ExecutionContext) extends FrontendBaseController + (implicit countryOptions: CountryOptions) extends FrontendBaseController with I18nSupport with Retrievals { - def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { + def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => val nextPage = controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad() - featureToggleConnector.enabled(PsaRegistration).ifA ( - ifTrue = Ok(checkYourAnswersView(checkYourAnswersSummary(request.userAnswers), nextPage, - Some(companyName), NormalMode, isComplete = true, returnLink = taskListReturnLinkUrl())), - ifFalse = Ok(checkYourAnswersView(checkYourAnswersSummary(request.userAnswers), nextPage, None, NormalMode, isComplete = true)) - ) + Ok(checkYourAnswersView(checkYourAnswersSummary(request.userAnswers), nextPage, + Some(companyName), NormalMode, isComplete = true, returnLink = taskListReturnLinkUrl())) } def onSubmit(): Action[AnyContent] = authenticate { _ => diff --git a/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala b/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala index 2e0c94bdf..af297bbe6 100644 --- a/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala +++ b/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala @@ -16,10 +16,8 @@ package controllers.register.company.contactdetails -import connectors.cache.FeatureToggleConnector import controllers.actions.{AuthAction, DataRequiredAction, DataRetrievalAction} import identifiers.register.BusinessNameId -import models.FeatureToggleName.PsaRegistration import models.NormalMode import models.requests.DataRequest import play.api.i18n.I18nSupport @@ -30,7 +28,6 @@ import viewmodels.Message import views.html.register.company.contactdetails import javax.inject.Inject -import scala.concurrent.ExecutionContext class WhatYouWillNeedController @Inject()( val controllerComponents: MessagesControllerComponents, @@ -38,13 +35,9 @@ class WhatYouWillNeedController @Inject()( getData: DataRetrievalAction, requireData: DataRequiredAction, whatYouWillNeedView: contactdetails.whatYouWillNeed, - featureToggleConnector: FeatureToggleConnector - )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport { - def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).map { feature => - val returnLinkCompanyName = if (feature.isEnabled) Some(companyName) else None - Ok(whatYouWillNeedView(companyName, returnLinkCompanyName)) - } + ) extends FrontendBaseController with I18nSupport { + def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => + Ok(whatYouWillNeedView(companyName, Some(companyName))) } def onSubmit(): Action[AnyContent] = authenticate { _ => diff --git a/app/controllers/register/company/directors/CheckYourAnswersController.scala b/app/controllers/register/company/directors/CheckYourAnswersController.scala index a427463c4..54c9c9370 100644 --- a/app/controllers/register/company/directors/CheckYourAnswersController.scala +++ b/app/controllers/register/company/directors/CheckYourAnswersController.scala @@ -17,15 +17,14 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.company.directors.routes._ import controllers.{Retrievals, Variations} import identifiers.register.company.directors._ -import models.FeatureToggleName.PsaRegistration import models.Mode.checkMode -import models.requests.DataRequest import models._ +import models.requests.DataRequest import play.api.i18n.I18nSupport import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Result} import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController @@ -51,8 +50,7 @@ class CheckYourAnswersController @Inject()( override val cacheConnector: UserAnswersCacheConnector, implicit val countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, - view: check_your_answers, - featureToggleConnector: FeatureToggleConnector + view: check_your_answers )(implicit val executionContext: ExecutionContext) extends FrontendBaseController with Retrievals with Variations with I18nSupport with Enumerable.Implicits { @@ -93,24 +91,14 @@ class CheckYourAnswersController @Inject()( DirectorPhoneId(index).row(Some(Link(DirectorPhoneController.onPageLoad(checkMode(mode), index).url))) )) - featureToggleConnector.enabled(PsaRegistration).ifA( - ifTrue = - Ok(view( - answersSection, - controllers.register.company.directors.routes.CheckYourAnswersController.onSubmit(mode, index), - psaName(), - mode, - dataCompletion.isDirectorComplete(request.userAnswers, index), - returnLink = taskListReturnLinkUrl() - )), - ifFalse = - Ok(view( - answersSection, - controllers.register.company.directors.routes.CheckYourAnswersController.onSubmit(mode, index), - None, - mode, - dataCompletion.isDirectorComplete(request.userAnswers, index) - )) - ) + Future.successful(Ok(view( + answersSection, + controllers.register.company.directors.routes.CheckYourAnswersController.onSubmit(mode, index), + psaName(), + mode, + dataCompletion.isDirectorComplete(request.userAnswers, index), + returnLink = taskListReturnLinkUrl() + ))) + } } diff --git a/app/controllers/register/company/directors/CompanyDirectorAddressListController.scala b/app/controllers/register/company/directors/CompanyDirectorAddressListController.scala index 91af0f724..cc8abfae8 100644 --- a/app/controllers/register/company/directors/CompanyDirectorAddressListController.scala +++ b/app/controllers/register/company/directors/CompanyDirectorAddressListController.scala @@ -18,13 +18,12 @@ package controllers.register.company.directors import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.AddressListController import forms.address.AddressListFormProvider import identifiers.register.company.directors.{CompanyDirectorAddressListId, CompanyDirectorAddressPostCodeLookupId, DirectorAddressId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode, TolerantAddress} import play.api.data.Form @@ -46,8 +45,7 @@ class CompanyDirectorAddressListController @Inject()(override val appConfig: Fro requireData: DataRequiredAction, formProvider: AddressListFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressList, - featureToggleConnector: FeatureToggleConnector + val view: addressList )(implicit val executionContext: ExecutionContext) extends AddressListController with Retrievals { def form(addresses: Seq[TolerantAddress], name: String)(implicit request: DataRequest[AnyContent]): Form[Int] = @@ -55,23 +53,17 @@ class CompanyDirectorAddressListController @Inject()(override val appConfig: Fro def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, index, returnLink).map(vm => - get(vm, mode, form(vm.addresses, entityName(index))) - ) - } + viewModel(mode, index, Some(companyTaskListUrl())).map(vm => + get(vm, mode, form(vm.addresses, entityName(index))) + ) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, index, returnLink).map(vm => - post(vm, DirectorAddressId(index), CompanyDirectorAddressListId(index), CompanyDirectorAddressPostCodeLookupId(index), mode, - form(vm.addresses, entityName(index))) - ) - } + viewModel(mode, index, Some(companyTaskListUrl())).map(vm => + post(vm, DirectorAddressId(index), CompanyDirectorAddressListId(index), CompanyDirectorAddressPostCodeLookupId(index), mode, + form(vm.addresses, entityName(index))) + ) } private def viewModel(mode: Mode, index: Index, returnLink: Option[String]) diff --git a/app/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupController.scala b/app/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupController.scala index 61e5158f0..592f53e54 100644 --- a/app/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupController.scala +++ b/app/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupController.scala @@ -19,13 +19,12 @@ package controllers.register.company.directors import com.google.inject.Inject import config.FrontendAppConfig import connectors.AddressLookupConnector -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.PostcodeLookupController import forms.address.PostCodeLookupFormProvider import identifiers.register.company.directors.{CompanyDirectorAddressPostCodeLookupId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode} import play.api.data.Form @@ -49,8 +48,7 @@ class CompanyDirectorAddressPostCodeLookupController @Inject()( requireData: DataRequiredAction, formProvider: PostCodeLookupFormProvider, val controllerComponents: MessagesControllerComponents, - val view: postcodeLookup, - featureToggleConnector: FeatureToggleConnector + val view: postcodeLookup )(implicit val executionContext: ExecutionContext) extends PostcodeLookupController with Retrievals { @@ -58,18 +56,12 @@ class CompanyDirectorAddressPostCodeLookupController @Inject()( def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(viewModel(mode, index, returnLink), mode) - } + get(viewModel(mode, index, Some(companyTaskListUrl())), mode) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(CompanyDirectorAddressPostCodeLookupId(index), viewModel(mode, index, returnLink), mode) - } + post(CompanyDirectorAddressPostCodeLookupId(index), viewModel(mode, index, Some(companyTaskListUrl())), mode) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/ConfirmDeleteDirectorController.scala b/app/controllers/register/company/directors/ConfirmDeleteDirectorController.scala index 76d5a36de..b0ff5cf65 100644 --- a/app/controllers/register/company/directors/ConfirmDeleteDirectorController.scala +++ b/app/controllers/register/company/directors/ConfirmDeleteDirectorController.scala @@ -17,15 +17,12 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.company.routes.AddCompanyDirectorsController import controllers.{ConfirmDeleteController, Retrievals} import forms.ConfirmDeleteFormProvider import identifiers.register.company.directors.DirectorNameId -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.requests.DataRequest import models.{Index, Mode, NormalMode} import play.api.data.Form @@ -34,6 +31,7 @@ import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import viewmodels.{ConfirmDeleteViewModel, Message} import views.html.confirmDelete +import javax.inject.Inject import scala.concurrent.ExecutionContext class ConfirmDeleteDirectorController @Inject()(val appConfig: FrontendAppConfig, @@ -45,8 +43,7 @@ class ConfirmDeleteDirectorController @Inject()(val appConfig: FrontendAppConfig val cacheConnector: UserAnswersCacheConnector, formProvider: ConfirmDeleteFormProvider, val controllerComponents: MessagesControllerComponents, - val view: confirmDelete, - featureToggleConnector: FeatureToggleConnector + val view: confirmDelete )(implicit val executionContext: ExecutionContext) extends ConfirmDeleteController with Retrievals { def form(directorName: String)(implicit messages: Messages): Form[Boolean] = formProvider(directorName) @@ -64,21 +61,15 @@ class ConfirmDeleteDirectorController @Inject()(val appConfig: FrontendAppConfig def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - DirectorNameId(index).retrieve.map { details => - get(vm(index, details.fullName, mode, returnLink), details.isDeleted, routes.AlreadyDeletedController.onPageLoad(index), mode) - } + DirectorNameId(index).retrieve.map { details => + get(vm(index, details.fullName, mode, Some(companyTaskListUrl())), details.isDeleted, routes.AlreadyDeletedController.onPageLoad(index), mode) } } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - DirectorNameId(index).retrieve.map { details => - post(vm(index, details.fullName, mode, returnLink), DirectorNameId(index), AddCompanyDirectorsController.onPageLoad(mode), mode) - } + DirectorNameId(index).retrieve.map { details => + post(vm(index, details.fullName, mode, Some(companyTaskListUrl())), DirectorNameId(index), AddCompanyDirectorsController.onPageLoad(mode), mode) } } diff --git a/app/controllers/register/company/directors/DirectorAddressController.scala b/app/controllers/register/company/directors/DirectorAddressController.scala index cd03f986f..48df7ea77 100644 --- a/app/controllers/register/company/directors/DirectorAddressController.scala +++ b/app/controllers/register/company/directors/DirectorAddressController.scala @@ -18,13 +18,12 @@ package controllers.register.company.directors import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.ManualAddressController import controllers.{Retrievals, Variations} import forms.AddressFormProvider import identifiers.register.company.directors.{CompanyDirectorAddressListId, DirectorAddressId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Address, Index, Mode} import play.api.data.Form @@ -48,8 +47,7 @@ class DirectorAddressController @Inject()(override val appConfig: FrontendAppCon formProvider: AddressFormProvider, countryOptions: CountryOptions, val controllerComponents: MessagesControllerComponents, - val view: manualAddress, - featureToggleConnector: FeatureToggleConnector + val view: manualAddress )(implicit val executionContext: ExecutionContext) extends ManualAddressController with Retrievals with Variations { override protected val form: Form[Address] = formProvider() @@ -68,10 +66,7 @@ class DirectorAddressController @Inject()(override val appConfig: FrontendAppCon implicit request => retrieveDirectorName(mode, index) { directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorAddressId(index), CompanyDirectorAddressListId(index), addressViewModel(mode, index, directorName, returnLink), mode) - } + get(DirectorAddressId(index), CompanyDirectorAddressListId(index), addressViewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } } @@ -79,10 +74,7 @@ class DirectorAddressController @Inject()(override val appConfig: FrontendAppCon implicit request => retrieveDirectorName(mode, index) { directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorAddressId(index), addressViewModel(mode, index, directorName, returnLink), mode) - } + post(DirectorAddressId(index), addressViewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/company/directors/DirectorAddressYearsController.scala b/app/controllers/register/company/directors/DirectorAddressYearsController.scala index 8f2318a61..c81abf2a2 100644 --- a/app/controllers/register/company/directors/DirectorAddressYearsController.scala +++ b/app/controllers/register/company/directors/DirectorAddressYearsController.scala @@ -17,13 +17,12 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.AddressYearsController import forms.address.AddressYearsFormProvider import identifiers.register.company.directors.{DirectorAddressYearsId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{AddressYears, Index, Mode} import play.api.data.Form @@ -47,8 +46,7 @@ class DirectorAddressYearsController @Inject()(@CompanyDirector override val nav requireData: DataRequiredAction, formProvider: AddressYearsFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressYears, - featureToggleConnector: FeatureToggleConnector + val view: addressYears )(implicit val executionContext: ExecutionContext) extends AddressYearsController with Retrievals with I18nSupport { @@ -59,20 +57,14 @@ class DirectorAddressYearsController @Inject()(@CompanyDirector override val nav (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorAddressYearsId(index), form(directorName), viewModel(mode, index, directorName, returnLink), mode) - } + get(DirectorAddressYearsId(index), form(directorName), viewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorAddressYearsId(index), mode, form(directorName), viewModel(mode, index, directorName, returnLink)) - } + post(DirectorAddressYearsId(index), mode, form(directorName), viewModel(mode, index, directorName, Some(companyTaskListUrl()))) } private def entityName(index: Int) diff --git a/app/controllers/register/company/directors/DirectorDOBController.scala b/app/controllers/register/company/directors/DirectorDOBController.scala index 59c6bd1eb..08199d150 100644 --- a/app/controllers/register/company/directors/DirectorDOBController.scala +++ b/app/controllers/register/company/directors/DirectorDOBController.scala @@ -17,12 +17,11 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.{DOBController, Retrievals} import identifiers.register.BusinessNameId import identifiers.register.company.directors.{DirectorDOBId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import utils.Navigator @@ -41,8 +40,7 @@ class DirectorDOBController @Inject()(val appConfig: FrontendAppConfig, getData: DataRetrievalAction, requireData: DataRequiredAction, val controllerComponents: MessagesControllerComponents, - val view: dob, - featureToggleConnector: FeatureToggleConnector + val view: dob )(implicit val executionContext: ExecutionContext) extends DOBController with Retrievals { private[directors] def viewModel(mode: Mode, @@ -68,10 +66,7 @@ class DirectorDOBController @Inject()(val appConfig: FrontendAppConfig, implicit request => (BusinessNameId and DirectorNameId(index)).retrieve.map { case psaName ~ directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future(get(id(index), viewModel(mode, index, psaName, directorName.fullName, returnLink))) - } + Future(get(id(index), viewModel(mode, index, psaName, directorName.fullName, Some(companyTaskListUrl())))) } } @@ -79,10 +74,7 @@ class DirectorDOBController @Inject()(val appConfig: FrontendAppConfig, implicit request => (BusinessNameId and DirectorNameId(index)).retrieve.map { case psaName ~ directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(id(index), viewModel(mode, index, psaName, directorName.fullName, returnLink)) - } + post(id(index), viewModel(mode, index, psaName, directorName.fullName, Some(companyTaskListUrl()))) } } } diff --git a/app/controllers/register/company/directors/DirectorEmailController.scala b/app/controllers/register/company/directors/DirectorEmailController.scala index 22183b2b2..d097d608b 100644 --- a/app/controllers/register/company/directors/DirectorEmailController.scala +++ b/app/controllers/register/company/directors/DirectorEmailController.scala @@ -17,15 +17,12 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.EmailAddressController import forms.EmailFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.directors.{DirectorEmailId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.requests.DataRequest import models.{Index, Mode} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -34,6 +31,7 @@ import utils.annotations.CompanyDirector import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.email +import javax.inject.Inject import scala.concurrent.ExecutionContext class DirectorEmailController @Inject()(@CompanyDirector val navigator: Navigator, @@ -45,8 +43,7 @@ class DirectorEmailController @Inject()(@CompanyDirector val navigator: Navigato requireData: DataRequiredAction, formProvider: EmailFormProvider, val controllerComponents: MessagesControllerComponents, - val view: email, - featureToggleConnector: FeatureToggleConnector + val view: email )(implicit val executionContext: ExecutionContext) extends EmailAddressController { private val form = formProvider() @@ -54,18 +51,12 @@ class DirectorEmailController @Inject()(@CompanyDirector val navigator: Navigato def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLinkCompanyName = if (feature.isEnabled) Some(companyTaskListUrl()) else None - get(DirectorEmailId(index), form, viewModel(mode, index, entityName(index), returnLinkCompanyName)) - } + get(DirectorEmailId(index), form, viewModel(mode, index, entityName(index), Some(companyTaskListUrl()) )) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLinkCompanyName = if (feature.isEnabled) Some(companyName) else None - post(DirectorEmailId(index), mode, form, viewModel(mode, index, entityName(index), returnLinkCompanyName)) - } + post(DirectorEmailId(index), mode, form, viewModel(mode, index, entityName(index), Some(companyName))) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/DirectorEnterNINOController.scala b/app/controllers/register/company/directors/DirectorEnterNINOController.scala index 42b2b4f26..420fe675b 100644 --- a/app/controllers/register/company/directors/DirectorEnterNINOController.scala +++ b/app/controllers/register/company/directors/DirectorEnterNINOController.scala @@ -17,12 +17,11 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.NINOController import forms.register.NINOFormProvider import identifiers.register.company.directors.{DirectorEnterNINOId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode, ReferenceValue} import play.api.data.Form @@ -44,8 +43,7 @@ class DirectorEnterNINOController @Inject()(@CompanyDirector val navigator: Navi requireData: DataRequiredAction, formProvider: NINOFormProvider, val controllerComponents: MessagesControllerComponents, - val view: enterNINO, - featureToggleConnector: FeatureToggleConnector + val view: enterNINO )(implicit val executionContext: ExecutionContext) extends NINOController { private def form(directorName: String) @@ -55,19 +53,14 @@ class DirectorEnterNINOController @Inject()(@CompanyDirector val navigator: Navi (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorEnterNINOId(index), form(directorName), viewModel(mode, index, directorName, returnLink)) - } + get(DirectorEnterNINOId(index), form(directorName), viewModel(mode, index, directorName, Some(companyTaskListUrl()))) + } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorEnterNINOId(index), mode, form(directorName), viewModel(mode, index, directorName, returnLink)) - } + post(DirectorEnterNINOId(index), mode, form(directorName), viewModel(mode, index, directorName, Some(companyTaskListUrl()))) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/DirectorEnterUTRController.scala b/app/controllers/register/company/directors/DirectorEnterUTRController.scala index 268530b11..9e6fa4ff9 100644 --- a/app/controllers/register/company/directors/DirectorEnterUTRController.scala +++ b/app/controllers/register/company/directors/DirectorEnterUTRController.scala @@ -17,13 +17,12 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.EnterUTRController import controllers.actions._ import controllers.register.company.directors.routes.DirectorEnterUTRController import forms.EnterUTRFormProvider import identifiers.register.company.directors.{DirectorEnterUTRId, DirectorNameId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode, ReferenceValue} import play.api.data.Form @@ -45,8 +44,7 @@ class DirectorEnterUTRController @Inject()(@CompanyDirector val navigator: Navig requireData: DataRequiredAction, formProvider: EnterUTRFormProvider, val controllerComponents: MessagesControllerComponents, - val view: enterUTR, - featureToggleConnector: FeatureToggleConnector + val view: enterUTR )(implicit val executionContext: ExecutionContext) extends EnterUTRController { private def form(directorName: String) (implicit request: DataRequest[AnyContent]): Form[ReferenceValue] = formProvider(directorName) @@ -55,19 +53,13 @@ class DirectorEnterUTRController @Inject()(@CompanyDirector val navigator: Navig (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorEnterUTRId(index), form(directorName), viewModel(mode, index, directorName, returnLink)) - } + get(DirectorEnterUTRId(index), form(directorName), viewModel(mode, index, directorName, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorEnterUTRId(index), mode, form(directorName), viewModel(mode, index, directorName, returnLink)) - } + post(DirectorEnterUTRId(index), mode, form(directorName), viewModel(mode, index, directorName, Some(companyTaskListUrl()))) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/DirectorNameController.scala b/app/controllers/register/company/directors/DirectorNameController.scala index 3d9af2a5f..5e664a4c4 100644 --- a/app/controllers/register/company/directors/DirectorNameController.scala +++ b/app/controllers/register/company/directors/DirectorNameController.scala @@ -17,14 +17,11 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.{PersonNameController, Retrievals} import identifiers.register.BusinessNameId import identifiers.register.company.directors.DirectorNameId -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.{Index, Mode} import play.api.i18n.I18nSupport import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -33,6 +30,7 @@ import utils.annotations.CompanyDirector import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.personName +import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} class DirectorNameController @Inject()(val appConfig: FrontendAppConfig, @@ -43,8 +41,7 @@ class DirectorNameController @Inject()(val appConfig: FrontendAppConfig, getData: DataRetrievalAction, requireData: DataRequiredAction, val controllerComponents: MessagesControllerComponents, - val view: personName, - featureToggleConnector: FeatureToggleConnector + val view: personName )(implicit val executionContext: ExecutionContext) extends PersonNameController with Retrievals with I18nSupport { private[directors] def viewModel(mode: Mode, index: Index, name: String, returnLink: Option[String]) = @@ -65,20 +62,14 @@ class DirectorNameController @Inject()(val appConfig: FrontendAppConfig, def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => BusinessNameId.retrieve.map { name => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(get(id(index), viewModel(mode, index, name, returnLink), mode)) - } + Future.successful(get(id(index), viewModel(mode, index, name, Some(companyTaskListUrl())), mode)) } } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => BusinessNameId.retrieve.map { name => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(id(index), viewModel(mode, index, name, returnLink), mode) - } + post(id(index), viewModel(mode, index, name, Some(companyTaskListUrl())), mode) } } } diff --git a/app/controllers/register/company/directors/DirectorNoNINOReasonController.scala b/app/controllers/register/company/directors/DirectorNoNINOReasonController.scala index 96798bedd..7f7d997f2 100644 --- a/app/controllers/register/company/directors/DirectorNoNINOReasonController.scala +++ b/app/controllers/register/company/directors/DirectorNoNINOReasonController.scala @@ -17,12 +17,11 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.ReasonController import controllers.actions._ import forms.ReasonFormProvider import identifiers.register.company.directors.{DirectorNameId, DirectorNoNINOReasonId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode} import play.api.data.Form @@ -44,8 +43,7 @@ class DirectorNoNINOReasonController @Inject()(@CompanyDirector val navigator: N requireData: DataRequiredAction, formProvider: ReasonFormProvider, val controllerComponents: MessagesControllerComponents, - val view: reason, - val featureToggleConnector: FeatureToggleConnector + val view: reason )(implicit val executionContext: ExecutionContext) extends ReasonController { private def form(directorName: String) @@ -55,19 +53,13 @@ class DirectorNoNINOReasonController @Inject()(@CompanyDirector val navigator: N (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorNoNINOReasonId(index), viewModel(mode, index, returnLink), form(directorName)) - } + get(DirectorNoNINOReasonId(index), viewModel(mode, index, Some(companyTaskListUrl())), form(directorName)) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorNoNINOReasonId(index), mode, viewModel(mode, index, returnLink), form(directorName)) - } + post(DirectorNoNINOReasonId(index), mode, viewModel(mode, index, Some(companyTaskListUrl())), form(directorName)) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/DirectorNoUTRReasonController.scala b/app/controllers/register/company/directors/DirectorNoUTRReasonController.scala index 9cabe82b4..86375c0d5 100644 --- a/app/controllers/register/company/directors/DirectorNoUTRReasonController.scala +++ b/app/controllers/register/company/directors/DirectorNoUTRReasonController.scala @@ -17,15 +17,12 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.ReasonController import controllers.actions._ import controllers.register.company.directors.routes.DirectorNoUTRReasonController import forms.ReasonFormProvider import identifiers.register.company.directors.{DirectorNameId, DirectorNoUTRReasonId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.requests.DataRequest import models.{Index, Mode} import play.api.data.Form @@ -35,6 +32,7 @@ import utils.annotations.CompanyDirector import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.reason +import javax.inject.Inject import scala.concurrent.ExecutionContext class DirectorNoUTRReasonController @Inject()(@CompanyDirector val navigator: Navigator, @@ -46,8 +44,7 @@ class DirectorNoUTRReasonController @Inject()(@CompanyDirector val navigator: Na requireData: DataRequiredAction, formProvider: ReasonFormProvider, val controllerComponents: MessagesControllerComponents, - val view: reason, - featureToggleConnector: FeatureToggleConnector + val view: reason )(implicit val executionContext: ExecutionContext) extends ReasonController { private def form(directorName: String) @@ -57,19 +54,13 @@ class DirectorNoUTRReasonController @Inject()(@CompanyDirector val navigator: Na (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorNoUTRReasonId(index), viewModel(mode, index, returnLink), form(directorName)) - } + get(DirectorNoUTRReasonId(index), viewModel(mode, index, Some(companyTaskListUrl())), form(directorName)) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorNoUTRReasonId(index), mode, viewModel(mode, index, returnLink), form(directorName)) - } + post(DirectorNoUTRReasonId(index), mode, viewModel(mode, index, Some(companyTaskListUrl())), form(directorName)) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/DirectorPhoneController.scala b/app/controllers/register/company/directors/DirectorPhoneController.scala index a82341933..fb65930a6 100644 --- a/app/controllers/register/company/directors/DirectorPhoneController.scala +++ b/app/controllers/register/company/directors/DirectorPhoneController.scala @@ -17,12 +17,11 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions._ import controllers.register.PhoneController import forms.PhoneFormProvider import identifiers.register.company.directors.{DirectorNameId, DirectorPhoneId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -43,8 +42,7 @@ class DirectorPhoneController @Inject()(@CompanyDirector val navigator: Navigato requireData: DataRequiredAction, formProvider: PhoneFormProvider, val controllerComponents: MessagesControllerComponents, - val view: phone, - featureToggleConnector: FeatureToggleConnector + val view: phone )(implicit val executionContext: ExecutionContext) extends PhoneController { private val form = formProvider() @@ -52,18 +50,12 @@ class DirectorPhoneController @Inject()(@CompanyDirector val navigator: Navigato def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - get(DirectorPhoneId(index), form, viewModel(mode, index, entityName(index), returnLink)) - } + get(DirectorPhoneId(index), form, viewModel(mode, index, entityName(index), Some(companyTaskListUrl()))) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.get(PsaRegistration.asString).flatMap { feature => - val returnLink = if (feature.isEnabled) Some(companyTaskListUrl()) else None - post(DirectorPhoneId(index), mode, form, viewModel(mode, index, entityName(index), returnLink)) - } + post(DirectorPhoneId(index), mode, form, viewModel(mode, index, entityName(index), Some(companyTaskListUrl()))) } private def entityName(index: Index)(implicit request: DataRequest[AnyContent]): String = diff --git a/app/controllers/register/company/directors/DirectorPreviousAddressController.scala b/app/controllers/register/company/directors/DirectorPreviousAddressController.scala index 880435e18..93be06d07 100644 --- a/app/controllers/register/company/directors/DirectorPreviousAddressController.scala +++ b/app/controllers/register/company/directors/DirectorPreviousAddressController.scala @@ -19,12 +19,11 @@ package controllers.register.company.directors import audit.AuditService import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.ManualAddressController import forms.AddressFormProvider import identifiers.register.company.directors.{DirectorPreviousAddressId, DirectorPreviousAddressListId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Address, Index, Mode} import play.api.data.Form @@ -49,8 +48,7 @@ class DirectorPreviousAddressController @Inject()(override val appConfig: Fronte countryOptions: CountryOptions, val auditService: AuditService, val controllerComponents: MessagesControllerComponents, - val view: manualAddress, - featureToggleConnector: FeatureToggleConnector + val view: manualAddress )(implicit val executionContext: ExecutionContext) extends ManualAddressController { override protected val form: Form[Address] = formProvider() @@ -59,10 +57,8 @@ class DirectorPreviousAddressController @Inject()(override val appConfig: Fronte implicit request => retrieveDirectorName(mode, index) { directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(DirectorPreviousAddressId(index), DirectorPreviousAddressListId(index), addressViewModel(mode, index, directorName, returnLink), mode) - } + get(DirectorPreviousAddressId(index), DirectorPreviousAddressListId(index), + addressViewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } } @@ -70,10 +66,7 @@ class DirectorPreviousAddressController @Inject()(override val appConfig: Fronte implicit request => retrieveDirectorName(mode, index) { directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorPreviousAddressId(index), addressViewModel(mode, index, directorName, returnLink), mode) - } + post(DirectorPreviousAddressId(index), addressViewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/company/directors/DirectorPreviousAddressListController.scala b/app/controllers/register/company/directors/DirectorPreviousAddressListController.scala index df51c6d17..0136cbdbf 100644 --- a/app/controllers/register/company/directors/DirectorPreviousAddressListController.scala +++ b/app/controllers/register/company/directors/DirectorPreviousAddressListController.scala @@ -18,13 +18,12 @@ package controllers.register.company.directors import com.google.inject.Inject import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.AddressListController import forms.address.AddressListFormProvider import identifiers.register.company.directors._ -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode, TolerantAddress} import play.api.data.Form @@ -46,8 +45,7 @@ class DirectorPreviousAddressListController @Inject()(override val appConfig: Fr requireData: DataRequiredAction, formProvider: AddressListFormProvider, val controllerComponents: MessagesControllerComponents, - val view: addressList, - featureToggleConnector: FeatureToggleConnector + val view: addressList )(implicit val executionContext: ExecutionContext) extends AddressListController with Retrievals { def form(addresses: Seq[TolerantAddress], name: String)(implicit request: DataRequest[AnyContent]): Form[Int] = @@ -55,23 +53,17 @@ class DirectorPreviousAddressListController @Inject()(override val appConfig: Fr def onPageLoad(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, index, returnLink).map(vm => - get(vm, mode, form(vm.addresses, entityName(index))) - ) - } + viewModel(mode, index, Some(companyTaskListUrl()) ).map(vm => + get(vm, mode, form(vm.addresses, entityName(index))) + ) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - viewModel(mode, index, returnLink).map(vm => - post(vm, DirectorPreviousAddressId(index), DirectorPreviousAddressListId(index), DirectorPreviousAddressPostCodeLookupId(index), - mode, form(vm.addresses, entityName(index))) - ) - } + viewModel(mode, index, Some(companyTaskListUrl())).map(vm => + post(vm, DirectorPreviousAddressId(index), DirectorPreviousAddressListId(index), DirectorPreviousAddressPostCodeLookupId(index), + mode, form(vm.addresses, entityName(index))) + ) } private def viewModel(mode: Mode, index: Index, returnLink: Option[String]) diff --git a/app/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupController.scala b/app/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupController.scala index f7cdbdf03..857f99063 100644 --- a/app/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupController.scala +++ b/app/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupController.scala @@ -19,13 +19,12 @@ package controllers.register.company.directors import com.google.inject.Inject import config.FrontendAppConfig import connectors.AddressLookupConnector -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.Retrievals import controllers.actions.{AllowAccessActionProvider, AuthAction, DataRequiredAction, DataRetrievalAction} import controllers.address.PostcodeLookupController import forms.address.PostCodeLookupFormProvider import identifiers.register.company.directors.DirectorPreviousAddressPostCodeLookupId -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode} import play.api.data.Form @@ -49,8 +48,7 @@ class DirectorPreviousAddressPostCodeLookupController @Inject()( requireData: DataRequiredAction, formProvider: PostCodeLookupFormProvider, val controllerComponents: MessagesControllerComponents, - val view: postcodeLookup, - featureToggleConnector: FeatureToggleConnector + val view: postcodeLookup )(implicit val executionContext: ExecutionContext) extends PostcodeLookupController with Retrievals { @@ -60,10 +58,7 @@ class DirectorPreviousAddressPostCodeLookupController @Inject()( implicit request => retrieveDirectorName(mode, index) { directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(viewModel(mode, index, directorName, returnLink), mode) - } + get(viewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } } @@ -71,10 +66,7 @@ class DirectorPreviousAddressPostCodeLookupController @Inject()( implicit request => retrieveDirectorName(mode, index) { directorName => - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(DirectorPreviousAddressPostCodeLookupId(index), viewModel(mode, index, directorName, returnLink), mode) - } + post(DirectorPreviousAddressPostCodeLookupId(index), viewModel(mode, index, directorName, Some(companyTaskListUrl())), mode) } } diff --git a/app/controllers/register/company/directors/HasDirectorNINOController.scala b/app/controllers/register/company/directors/HasDirectorNINOController.scala index 6b8fe27bf..c58beb147 100644 --- a/app/controllers/register/company/directors/HasDirectorNINOController.scala +++ b/app/controllers/register/company/directors/HasDirectorNINOController.scala @@ -17,14 +17,11 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.HasReferenceNumberController import controllers.actions._ import forms.HasReferenceNumberFormProvider import identifiers.register.company.directors.{DirectorNameId, HasDirectorNINOId} -import models.FeatureToggleName.PsaRegistration - -import javax.inject.Inject import models.requests.DataRequest import models.{Index, Mode} import play.api.data.Form @@ -35,6 +32,7 @@ import utils.annotations.CompanyDirector import viewmodels.{CommonFormWithHintViewModel, Message} import views.html.hasReferenceNumber +import javax.inject.Inject import scala.concurrent.ExecutionContext class HasDirectorNINOController @Inject()(override val appConfig: FrontendAppConfig, @@ -46,8 +44,7 @@ class HasDirectorNINOController @Inject()(override val appConfig: FrontendAppCon requireData: DataRequiredAction, formProvider: HasReferenceNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: hasReferenceNumber, - featureToggleConnector: FeatureToggleConnector + val view: hasReferenceNumber )(implicit val executionContext: ExecutionContext) extends HasReferenceNumberController with I18nSupport { private def viewModel(mode: Mode, entityName: String, index: Index, returnLink: Option[String]) @@ -72,20 +69,13 @@ class HasDirectorNINOController @Inject()(override val appConfig: FrontendAppCon (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(HasDirectorNINOId(index), form(directorName), viewModel(mode, directorName, index, returnLink)) - } - + get(HasDirectorNINOId(index), form(directorName), viewModel(mode, directorName, index, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(HasDirectorNINOId(index), mode, form(directorName), viewModel(mode, directorName, index, returnLink)) - } + post(HasDirectorNINOId(index), mode, form(directorName), viewModel(mode, directorName, index, Some(companyTaskListUrl()))) } } diff --git a/app/controllers/register/company/directors/HasDirectorUTRController.scala b/app/controllers/register/company/directors/HasDirectorUTRController.scala index 20673efd3..24c254334 100644 --- a/app/controllers/register/company/directors/HasDirectorUTRController.scala +++ b/app/controllers/register/company/directors/HasDirectorUTRController.scala @@ -17,13 +17,12 @@ package controllers.register.company.directors import config.FrontendAppConfig -import connectors.cache.{FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.UserAnswersCacheConnector import controllers.HasReferenceNumberController import controllers.actions._ import controllers.register.company.directors.routes.HasDirectorUTRController import forms.HasReferenceNumberFormProvider import identifiers.register.company.directors.{DirectorNameId, HasDirectorUTRId} -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{Index, Mode} import play.api.data.Form @@ -46,8 +45,7 @@ class HasDirectorUTRController @Inject()(override val appConfig: FrontendAppConf requireData: DataRequiredAction, formProvider: HasReferenceNumberFormProvider, val controllerComponents: MessagesControllerComponents, - val view: hasReferenceNumber, - featureToggleConnector: FeatureToggleConnector + val view: hasReferenceNumber )(implicit val executionContext: ExecutionContext) extends HasReferenceNumberController with I18nSupport { private def viewModel(mode: Mode, entityName: String, index: Index, returnLink: Option[String]) @@ -72,20 +70,13 @@ class HasDirectorUTRController @Inject()(override val appConfig: FrontendAppConf (authenticate andThen allowAccess(mode) andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - get(HasDirectorUTRId(index), form(directorName), viewModel(mode, directorName, index, returnLink)) - } - + get(HasDirectorUTRId(index), form(directorName), viewModel(mode, directorName, index, Some(companyTaskListUrl()))) } def onSubmit(mode: Mode, index: Index): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val directorName = entityName(index) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - post(HasDirectorUTRId(index), mode, form(directorName), viewModel(mode, directorName, index, returnLink)) - } + post(HasDirectorUTRId(index), mode, form(directorName), viewModel(mode, directorName, index, Some(companyTaskListUrl()))) } } diff --git a/app/controllers/register/company/workingknowledge/WhatYouWillNeedController.scala b/app/controllers/register/company/workingknowledge/WhatYouWillNeedController.scala index 7761c480e..a69e340dc 100644 --- a/app/controllers/register/company/workingknowledge/WhatYouWillNeedController.scala +++ b/app/controllers/register/company/workingknowledge/WhatYouWillNeedController.scala @@ -16,10 +16,8 @@ package controllers.register.company.workingknowledge -import connectors.cache.FeatureToggleConnector import controllers.Retrievals import controllers.actions._ -import models.FeatureToggleName.PsaRegistration import models.NormalMode import play.api.i18n.I18nSupport import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -27,22 +25,18 @@ import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import views.html.register.workingknowledge.whatYouWillNeed import javax.inject.Inject -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.Future class WhatYouWillNeedController @Inject()(authenticate: AuthAction, getData: DataRetrievalAction, requireData: DataRequiredAction, val controllerComponents: MessagesControllerComponents, - view: whatYouWillNeed, - featureToggleConnector: FeatureToggleConnector - )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport with Retrievals { + view: whatYouWillNeed + ) extends FrontendBaseController with I18nSupport with Retrievals { def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData).async { implicit request => val href = controllers.register.adviser.routes.AdviserNameController.onPageLoad(NormalMode) - featureToggleConnector.enabled(PsaRegistration).flatMap { featureEnabled => - val returnLink = if (featureEnabled) Some(companyTaskListUrl()) else None - Future.successful(Ok(view(href, psaName(), returnLink))) - } + Future.successful(Ok(view(href, psaName(), Some(companyTaskListUrl())))) } } diff --git a/app/models/FeatureToggle.scala b/app/models/FeatureToggle.scala deleted file mode 100644 index d69065664..000000000 --- a/app/models/FeatureToggle.scala +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2024 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package models - -import play.api.libs.functional.syntax._ -import play.api.libs.json._ -import play.api.mvc.PathBindable - -sealed trait FeatureToggle { - def name: FeatureToggleName - - def isEnabled: Boolean -} - -sealed trait FeatureToggleName { - def asString: String -} - -object FeatureToggleName { - - case object PsaRegistration extends FeatureToggleName { - val asString = "psa-registration" - } - - implicit val reads: Reads[FeatureToggleName] = Reads { - case JsString(PsaRegistration.asString) => JsSuccess(PsaRegistration) - case _ => JsError("Unrecognised feature toggle name") - } - - implicit val writes: Writes[FeatureToggleName] = Writes(value => JsString(value.asString)) - - implicit def pathBindable: PathBindable[FeatureToggleName] = - new PathBindable[FeatureToggleName] { - - override def bind(key: String, value: String): Either[String, FeatureToggleName] = - JsString(value).validate[FeatureToggleName] match { - case JsSuccess(name, _) => Right(name) - case _ => Left("invalid feature toggle name") - } - - override def unbind(key: String, value: FeatureToggleName): String = - value.asString - } - -} - -object FeatureToggle { - - case class Enabled(name: FeatureToggleName) extends FeatureToggle { - val isEnabled = true - } - - case class Disabled(name: FeatureToggleName) extends FeatureToggle { - val isEnabled = false - } - - def apply(name: FeatureToggleName, enabled: Boolean): FeatureToggle = - if (enabled) Enabled(name) else Disabled(name) - - implicit val reads: Reads[FeatureToggle] = - (__ \ "isEnabled").read[Boolean].flatMap { - case true => (__ \ "name").read[FeatureToggleName].map(Enabled(_).asInstanceOf[FeatureToggle]) - case false => (__ \ "name").read[FeatureToggleName].map(Disabled(_).asInstanceOf[FeatureToggle]) - } - - implicit val writes: Writes[FeatureToggle] = - ((__ \ "name").write[FeatureToggleName] and - (__ \ "isEnabled").write[Boolean]).apply(ft => (ft.name, ft.isEnabled)) -} diff --git a/app/utils/Toggles.scala b/app/utils/Toggles.scala deleted file mode 100644 index 83c0ae3f0..000000000 --- a/app/utils/Toggles.scala +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2024 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package utils - -object Toggles { -} diff --git a/conf/application.conf b/conf/application.conf index 7e3709886..2b0bf3ffb 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -133,7 +133,6 @@ urls { tellHMRCChanges = "https://www.gov.uk/tell-hmrc-change-of-details" companyChangesCompaniesHouse = "https://www.gov.uk/file-changes-to-a-company-with-companies-house" companyChangesHMRC = "https://www.gov.uk/running-a-limited-company/company-changes-you-must-report" - featureToggle = "/admin/feature-toggles/%s" pensions-scheme-frontend { registerScheme = "http://localhost:8200/register-pension-scheme/" diff --git a/test/controllers/actions/FakeFeatureToggleConnector.scala b/test/controllers/actions/FakeFeatureToggleConnector.scala deleted file mode 100644 index 04c384613..000000000 --- a/test/controllers/actions/FakeFeatureToggleConnector.scala +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package controllers.actions - -import connectors.cache.FeatureToggleConnector -import models.FeatureToggle -import models.FeatureToggle.Disabled -import models.FeatureToggleName.PsaRegistration -import uk.gov.hmrc.http.HeaderCarrier - -import scala.concurrent.{ExecutionContext, Future} - -object FakeFeatureToggleConnector { - - def returns(featureToggle: FeatureToggle): FeatureToggleConnector = new FeatureToggleConnector { - override def get(name: String)(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[FeatureToggle] = - Future.successful(featureToggle) - } - - val disabled: FeatureToggleConnector = new FeatureToggleConnector { - override def get(name: String)(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[FeatureToggle] = - Future.successful(Disabled(PsaRegistration)) - } -} diff --git a/test/controllers/register/BusinessTypeControllerSpec.scala b/test/controllers/register/BusinessTypeControllerSpec.scala index ee2e6d06d..2d22f09bb 100644 --- a/test/controllers/register/BusinessTypeControllerSpec.scala +++ b/test/controllers/register/BusinessTypeControllerSpec.scala @@ -16,24 +16,19 @@ package controllers.register -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.register.BusinessTypeFormProvider import identifiers.register.BusinessTypeId -import models.FeatureToggle.Disabled -import models.FeatureToggleName.PsaRegistration import models.NormalMode import models.register.BusinessType -import org.mockito.ArgumentMatchers.any import play.api.data.Form import play.api.libs.json._ import play.api.test.Helpers._ import utils.FakeNavigator import views.html.register.businessType -import scala.concurrent.Future - class BusinessTypeControllerSpec extends ControllerSpecBase { private def onwardRoute = controllers.routes.IndexController.onPageLoad @@ -44,14 +39,7 @@ class BusinessTypeControllerSpec extends ControllerSpecBase { val view: businessType = app.injector.instanceOf[businessType] - private val defaultFeatureToggleConnector = { - val mockFeatureToggleConnector = mock[FeatureToggleConnector] - when(mockFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Disabled(PsaRegistration))) - mockFeatureToggleConnector - } - - private def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData, - featureToggleConnector: FeatureToggleConnector = defaultFeatureToggleConnector, + private def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData ) = new BusinessTypeController( frontendAppConfig, @@ -64,7 +52,6 @@ class BusinessTypeControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - featureToggleConnector, view ) diff --git a/test/controllers/register/DeclarationWorkingKnowledgeControllerSpec.scala b/test/controllers/register/DeclarationWorkingKnowledgeControllerSpec.scala index 35bd6377b..a923ca0e0 100644 --- a/test/controllers/register/DeclarationWorkingKnowledgeControllerSpec.scala +++ b/test/controllers/register/DeclarationWorkingKnowledgeControllerSpec.scala @@ -16,15 +16,13 @@ package controllers.register -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.register.DeclarationWorkingKnowledgeFormProvider import identifiers.register.DeclarationWorkingKnowledgeId -import models.FeatureToggleName.PsaRegistration +import models.NormalMode import models.register.DeclarationWorkingKnowledge -import models.{FeatureToggle, NormalMode} -import org.mockito.ArgumentMatchers.any import org.mockito.MockitoSugar import play.api.data.Form import play.api.libs.json._ @@ -33,8 +31,6 @@ import play.api.test.Helpers._ import utils.FakeNavigator import views.html.register.declarationWorkingKnowledge -import scala.concurrent.Future - class DeclarationWorkingKnowledgeControllerSpec extends ControllerSpecBase with MockitoSugar { def onwardRoute: Call = controllers.routes.IndexController.onPageLoad @@ -42,12 +38,6 @@ class DeclarationWorkingKnowledgeControllerSpec extends ControllerSpecBase with val formProvider = new DeclarationWorkingKnowledgeFormProvider() val form: Form[Boolean] = formProvider() - val defaultFeatureToggleConnector = { - val mockFeatureToggleConnector:FeatureToggleConnector = mock[FeatureToggleConnector] - when(mockFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(FeatureToggle.Enabled(PsaRegistration))) - mockFeatureToggleConnector - } - val view: declarationWorkingKnowledge = app.injector.instanceOf[declarationWorkingKnowledge] @@ -60,8 +50,7 @@ class DeclarationWorkingKnowledgeControllerSpec extends ControllerSpecBase with new DataRequiredActionImpl, formProvider, controllerComponents, - view, - defaultFeatureToggleConnector + view ) def viewAsString(form: Form[_] = form): String = view(form, NormalMode)(fakeRequest, messages).toString diff --git a/test/controllers/register/RegisterAsBusinessControllerSpec.scala b/test/controllers/register/RegisterAsBusinessControllerSpec.scala index 27006ea3f..cfc4bace1 100644 --- a/test/controllers/register/RegisterAsBusinessControllerSpec.scala +++ b/test/controllers/register/RegisterAsBusinessControllerSpec.scala @@ -17,15 +17,12 @@ package controllers.register import audit.testdoubles.StubSuccessfulAuditService -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.actions._ import controllers.behaviours.ControllerWithQuestionPageBehaviours import forms.register.RegisterAsBusinessFormProvider import identifiers.register.RegisterAsBusinessId -import models.FeatureToggle.{Disabled, Enabled} -import models.FeatureToggleName.PsaRegistration import models.NormalMode -import org.mockito.ArgumentMatchers.any import org.mockito.MockitoSugar import play.api.data.Form import play.api.mvc.{Action, AnyContent, AnyContentAsFormUrlEncoded} @@ -35,8 +32,6 @@ import utils.testhelpers.DataCompletionBuilder._ import utils.{Navigator, UserAnswers} import views.html.register.registerAsBusiness -import scala.concurrent.Future - class RegisterAsBusinessControllerSpec extends ControllerWithQuestionPageBehaviours with MockitoSugar { val form: Form[Boolean] = new RegisterAsBusinessFormProvider().apply() @@ -50,12 +45,6 @@ class RegisterAsBusinessControllerSpec extends ControllerWithQuestionPageBehavio val postRequestTrue: FakeRequest[AnyContentAsFormUrlEncoded] = FakeRequest().withFormUrlEncodedBody(("value", true.toString)) val postRequestFalse: FakeRequest[AnyContentAsFormUrlEncoded] = FakeRequest().withFormUrlEncodedBody(("value", false.toString)) - private val defaultFeatureToggleConnector = { - val mockFeatureToggleConnector: FeatureToggleConnector = mock[FeatureToggleConnector] - when(mockFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Disabled(PsaRegistration))) - mockFeatureToggleConnector - } - "RegisterAsBusinessController" must { behave like controllerWithOnPageLoadMethod( @@ -117,12 +106,9 @@ class RegisterAsBusinessControllerSpec extends ControllerWithQuestionPageBehavio "when feature toggle is enabled and the registration is for a company / partnership" must { "route to 'continue with registration' page when the registration is for a UK company or partnership" in { - val mockFeatureToggleConnector = mock[FeatureToggleConnector] - when(mockFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val userAnswers = validData.completeCompanyDetailsUK - val result = controller(userAnswers.dataRetrievalAction, FakeAuthAction, FakeUserAnswersCacheConnector, mockFeatureToggleConnector). + val result = controller(userAnswers.dataRetrievalAction, FakeAuthAction, FakeUserAnswersCacheConnector). onSubmit(NormalMode)(postRequestTrue) status(result) mustBe SEE_OTHER @@ -130,12 +116,9 @@ class RegisterAsBusinessControllerSpec extends ControllerWithQuestionPageBehavio } "route to the company 'before you start' page when the registration is for a non-UK company" in { - val mockFeatureToggleConnector = mock[FeatureToggleConnector] - when(mockFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val userAnswers = validData.completeCompanyDetailsNonUKCustomer - val result = controller(userAnswers.dataRetrievalAction, FakeAuthAction, FakeUserAnswersCacheConnector, mockFeatureToggleConnector). + val result = controller(userAnswers.dataRetrievalAction, FakeAuthAction, FakeUserAnswersCacheConnector). onSubmit(NormalMode)(postRequestTrue) status(result) mustBe SEE_OTHER @@ -160,8 +143,7 @@ class RegisterAsBusinessControllerSpec extends ControllerWithQuestionPageBehavio private def controller( dataRetrievalAction: DataRetrievalAction = getEmptyData, authAction: AuthAction = FakeAuthAction, - cache: UserAnswersCacheConnector = FakeUserAnswersCacheConnector, - featureToggleConnector: FeatureToggleConnector = defaultFeatureToggleConnector + cache: UserAnswersCacheConnector = FakeUserAnswersCacheConnector ): RegisterAsBusinessController = new RegisterAsBusinessController( frontendAppConfig, @@ -170,7 +152,6 @@ class RegisterAsBusinessControllerSpec extends ControllerWithQuestionPageBehavio FakeAllowAccessProvider(config = frontendAppConfig), dataRetrievalAction, cache, - featureToggleConnector, auditService, controllerComponents, view diff --git a/test/controllers/register/adviser/AdviserAddressControllerSpec.scala b/test/controllers/register/adviser/AdviserAddressControllerSpec.scala index 56df7a7eb..7a9c53156 100644 --- a/test/controllers/register/adviser/AdviserAddressControllerSpec.scala +++ b/test/controllers/register/adviser/AdviserAddressControllerSpec.scala @@ -22,8 +22,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.AddressFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Address, NormalMode, TolerantAddress} import org.mockito.MockitoSugar import org.scalatest.OptionValues @@ -172,8 +170,7 @@ class AdviserAddressControllerSpec extends ControllerSpecBase with MockitoSugar countryOptions, fakeAuditService, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) def viewAsString(form: Form[_] = form): String = view(form, addressViewModel, NormalMode)(fakeRequest, messages).toString diff --git a/test/controllers/register/adviser/AdviserAddressListControllerSpec.scala b/test/controllers/register/adviser/AdviserAddressListControllerSpec.scala index 69cba11b9..9d0ba6a1e 100644 --- a/test/controllers/register/adviser/AdviserAddressListControllerSpec.scala +++ b/test/controllers/register/adviser/AdviserAddressListControllerSpec.scala @@ -16,13 +16,11 @@ package controllers.register.adviser -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ import forms.address.AddressListFormProvider import identifiers.register.adviser.{AdviserAddressPostCodeLookupId, AdviserNameId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{NormalMode, TolerantAddress} import play.api.Application import play.api.inject.bind @@ -120,8 +118,7 @@ class AdviserAddressListControllerSpec extends ControllerSpecBase { "redirect to the next page on POST of valid data" in { running(_.overrides(modules(dataRetrievalAction)++ Seq[GuiceableModule]( - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))):_*)) { + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector)):_*)) { app => val controller = app.injector.instanceOf[AdviserAddressListController] val request = FakeRequest().withFormUrlEncodedBody("value" -> "0") @@ -137,8 +134,7 @@ class AdviserAddressListControllerSpec extends ControllerSpecBase { "redirect to Session Expired controller when no session data exists on a POST request" in { running(_.overrides(modules(dontGetAnyData)++ Seq[GuiceableModule]( - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))):_*)) { + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector)):_*)) { app => val controller = app.injector.instanceOf[AdviserAddressListController] val request = FakeRequest().withFormUrlEncodedBody("value" -> "0") @@ -154,8 +150,7 @@ class AdviserAddressListControllerSpec extends ControllerSpecBase { "redirect to Adviser Address Post Code Lookup if no address data on a POST request" in { running(_.overrides(modules(getEmptyData)++ Seq[GuiceableModule]( - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))):_*)) { + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector)):_*)) { app => val controller = app.injector.instanceOf[AdviserAddressListController] val request = FakeRequest().withFormUrlEncodedBody("value" -> "0") @@ -187,7 +182,6 @@ class AdviserAddressListControllerSpec extends ControllerSpecBase { bind[DataRetrievalAction].toInstance(dataRetrievalAction), bind[MessagesControllerComponents].to(controllerComponents), bind[Navigator].toInstance(new FakeNavigator(onwardRoute)), - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector) ).build() } diff --git a/test/controllers/register/adviser/AdviserAddressPostCodeLookupControllerSpec.scala b/test/controllers/register/adviser/AdviserAddressPostCodeLookupControllerSpec.scala index 668a70656..34819d834 100644 --- a/test/controllers/register/adviser/AdviserAddressPostCodeLookupControllerSpec.scala +++ b/test/controllers/register/adviser/AdviserAddressPostCodeLookupControllerSpec.scala @@ -17,12 +17,9 @@ package controllers.register.adviser import connectors.AddressLookupConnector -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase -import controllers.actions.FakeFeatureToggleConnector import forms.address.PostCodeLookupFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode, TolerantAddress} import org.mockito.ArgumentMatchers.any import org.mockito.MockitoSugar @@ -77,8 +74,7 @@ class AdviserAddressPostCodeLookupControllerSpec extends ControllerSpecBase with running(_.overrides(modules(getEmptyData)++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[Adviser]).toInstance(new FakeNavigator(onwardRoute)), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[AddressLookupConnector].toInstance(mockAddressLookupConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[AddressLookupConnector].toInstance(mockAddressLookupConnector) ):_*)) { app => when(mockAddressLookupConnector.addressLookupByPostCode(any())(any(), any())) thenReturn Future.successful(Seq(address)) @@ -110,7 +106,6 @@ class AdviserAddressPostCodeLookupControllerSpec extends ControllerSpecBase with override lazy val app: Application = applicationBuilder(getCompanyAndAdvisor).overrides( bind[AddressLookupConnector].toInstance(mockAddressLookupConnector), - bind[Navigator].qualifiedWith(classOf[Adviser]).toInstance(new FakeNavigator(onwardRoute)), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[Navigator].qualifiedWith(classOf[Adviser]).toInstance(new FakeNavigator(onwardRoute)) ).build() } diff --git a/test/controllers/register/adviser/AdviserEmailControllerSpec.scala b/test/controllers/register/adviser/AdviserEmailControllerSpec.scala index 843032e74..ae5ac7cd7 100644 --- a/test/controllers/register/adviser/AdviserEmailControllerSpec.scala +++ b/test/controllers/register/adviser/AdviserEmailControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.EmailFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -45,8 +43,7 @@ class AdviserEmailControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def emailView(form: Form[_]): String = view(form, viewModel(NormalMode, index), None)(fakeRequest, messages).toString diff --git a/test/controllers/register/adviser/AdviserNameControllerSpec.scala b/test/controllers/register/adviser/AdviserNameControllerSpec.scala index cffe33bf3..e04b74b3e 100644 --- a/test/controllers/register/adviser/AdviserNameControllerSpec.scala +++ b/test/controllers/register/adviser/AdviserNameControllerSpec.scala @@ -20,9 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithQuestionPageBehaviours import forms.register.adviser.AdviserNameFormProvider -import identifiers.register.adviser.AdviserNameId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.RegistrationCustomerType.UK import models.RegistrationLegalStatus.LimitedCompany import models.{NormalMode, RegistrationIdType, RegistrationInfo} @@ -47,8 +44,7 @@ class AdviserNameControllerSpec extends ControllerWithQuestionPageBehaviours { new AdviserNameController( frontendAppConfig, fakeAuth, new FakeNavigator(onwardRoute), dataRetrievalAction, requiredDataAction, formProvider, FakeUserAnswersCacheConnector, - controllerComponents, view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + controllerComponents, view ).onPageLoad(NormalMode) } @@ -58,8 +54,7 @@ class AdviserNameControllerSpec extends ControllerWithQuestionPageBehaviours { new AdviserNameController( frontendAppConfig, fakeAuth, navigator, dataRetrievalAction, requiredDataAction, formProvider, FakeUserAnswersCacheConnector, - controllerComponents, view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + controllerComponents, view ).onSubmit(NormalMode) } diff --git a/test/controllers/register/adviser/AdviserPhoneControllerSpec.scala b/test/controllers/register/adviser/AdviserPhoneControllerSpec.scala index 68a1d0340..ff79e7283 100644 --- a/test/controllers/register/adviser/AdviserPhoneControllerSpec.scala +++ b/test/controllers/register/adviser/AdviserPhoneControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.PhoneFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -47,8 +45,7 @@ class AdviserPhoneControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def phoneView(form: Form[_]): String = view(form, viewModel(NormalMode), None)(fakeRequest, messages).toString diff --git a/test/controllers/register/adviser/CheckYourAnswersControllerSpec.scala b/test/controllers/register/adviser/CheckYourAnswersControllerSpec.scala index bf72b3f3f..a54af5f4e 100644 --- a/test/controllers/register/adviser/CheckYourAnswersControllerSpec.scala +++ b/test/controllers/register/adviser/CheckYourAnswersControllerSpec.scala @@ -16,7 +16,6 @@ package controllers.register.adviser -import connectors.cache.FeatureToggleConnector import controllers.ControllerSpecBase import controllers.actions._ import identifiers.register.adviser.{AdviserAddressId, AdviserEmailId, AdviserNameId, AdviserPhoneId} @@ -36,8 +35,7 @@ class CheckYourAnswersControllerSpec extends ControllerSpecBase with BeforeAndAf private def sections: Seq[AnswerSection] = Seq(AnswerSection(None, adviserDetails)) private val mockDataCompletion = mock[DataCompletion] - private def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + private def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData) = new CheckYourAnswersController( frontendAppConfig, @@ -48,8 +46,7 @@ class CheckYourAnswersControllerSpec extends ControllerSpecBase with BeforeAndAf mockDataCompletion, countryOptions, controllerComponents, - view, - featureToggleConnector + view ) private def viewAsString(isComplete: Boolean = true): String = diff --git a/test/controllers/register/company/AddCompanyDirectorsControllerSpec.scala b/test/controllers/register/company/AddCompanyDirectorsControllerSpec.scala index 1979b374c..8533ff7d9 100644 --- a/test/controllers/register/company/AddCompanyDirectorsControllerSpec.scala +++ b/test/controllers/register/company/AddCompanyDirectorsControllerSpec.scala @@ -16,17 +16,14 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.register.company.AddCompanyDirectorsFormProvider import identifiers.register.company.AddCompanyDirectorsId import identifiers.register.company.directors.DirectorNameId -import models.FeatureToggle.{Disabled, Enabled} -import models.FeatureToggleName.PsaRegistration import models._ import models.requests.DataRequest -import org.mockito.ArgumentMatchers.any import org.scalatest.BeforeAndAfterEach import play.api.data.Form import play.api.libs.json._ @@ -38,30 +35,16 @@ import utils.{FakeNavigator, UserAnswers} import viewmodels.Person import views.html.register.company.{addCompanyDirectors, addCompanyDirectorsv2} -import scala.concurrent.Future - class AddCompanyDirectorsControllerSpec extends ControllerSpecBase with BeforeAndAfterEach { import AddCompanyDirectorsControllerSpec._ - override def beforeEach(): Unit = { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Disabled(PsaRegistration))) - } - override def fakeRequest: FakeRequest[AnyContent] = FakeRequest("", "/") "AddCompanyDirectors Controller" must { "return OK and the correct view for a GET" in { val result = controller().onPageLoad(NormalMode)(fakeRequest) - status(result) mustBe OK - contentAsString(result) mustBe viewAsString() - } - - "return OK and the correct view for a GET when toggle on" in { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val result = controller().onPageLoad(NormalMode)(fakeRequest) - status(result) mustBe OK contentAsString(result) mustBe viewAsStringV2() } @@ -70,15 +53,6 @@ class AddCompanyDirectorsControllerSpec extends ControllerSpecBase with BeforeAn val directors = Seq(Person(0, "first0 last0", deleteLink(0), editLink(0), isDeleted = false, isComplete = true)) val getRelevantData = UserAnswers().completeDirector(index = 0).dataRetrievalAction - val result = controller(getRelevantData).onPageLoad(NormalMode)(fakeRequest) - contentAsString(result) mustBe viewAsString(form, directors) - } - - "not populate the view on a GET when the question has previously been answered when toggle on" in { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val directors = Seq(Person(0, "first0 last0", deleteLink(0), editLink(0), isDeleted = false, isComplete = true)) - val getRelevantData = UserAnswers().completeDirector(index = 0).dataRetrievalAction - val result = controller(getRelevantData).onPageLoad(NormalMode)(fakeRequest) contentAsString(result) mustBe viewAsStringV2(form, directors) } @@ -90,31 +64,7 @@ class AddCompanyDirectorsControllerSpec extends ControllerSpecBase with BeforeAn redirectLocation(result) mustBe Some(onwardRoute.url) } - "redirect to the next page when less than maximum directors exist and valid data is submitted if PSA registration toggle is off" in { - val getRelevantData = dataRetrievalAction(Seq.fill(maxDirectors - 1)(johnDoe): _*) - - val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "false")) - - val result = controller(getRelevantData).onSubmit(NormalMode)(postRequest) - - status(result) mustBe SEE_OTHER - redirectLocation(result) mustBe Some("/register-as-pension-scheme-administrator/register/company/review") - } - - "redirect to the next page when less than maximum directors exist with UpdateMode and valid data is submitted if PSA registration toggle is off" in { - val getRelevantData = dataRetrievalAction(Seq.fill(maxDirectors - 1)(johnDoe): _*) - - val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "false")) - - val result = controller(getRelevantData).onSubmit(UpdateMode)(postRequest) - - status(result) mustBe SEE_OTHER - redirectLocation(result) mustBe Some("/register-as-pension-scheme-administrator/register/make-more-changes") - } - "redirect to the task list page when less than maximum directors exist and valid data is submitted if PSA registration toggle is on" in { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val getRelevantData = dataRetrievalAction(Seq.fill(maxDirectors - 1)(johnDoe): _*) val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "false")) @@ -126,22 +76,6 @@ class AddCompanyDirectorsControllerSpec extends ControllerSpecBase with BeforeAn } "return a Bad Request and errors when less than maximum directors exist and invalid data is submitted" in { - - val getRelevantData = UserAnswers().completeDirector(index = 0).completeDirector(1).dataRetrievalAction - val directorAsPerson = Seq(person(0), person(1)) - - val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "invalid value")) - val boundForm = form.bind(Map("value" -> "invalid value")) - - val result = controller(getRelevantData).onSubmit(NormalMode)(postRequest) - - status(result) mustBe BAD_REQUEST - contentAsString(result) mustBe viewAsString(boundForm, directorAsPerson) - } - - "return a Bad Request and errors when less than maximum directors exist and invalid data is submitted when toggle on" in { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val getRelevantData = UserAnswers().completeDirector(index = 0).completeDirector(1).dataRetrievalAction val directorAsPerson = Seq(person(0), person(1)) @@ -191,15 +125,6 @@ class AddCompanyDirectorsControllerSpec extends ControllerSpecBase with BeforeAn val getRelevantData = UserAnswers().completeDirector(index = 0).completeDirector(index = 1).dataRetrievalAction val result = controller(getRelevantData).onPageLoad(NormalMode)(fakeRequest) - contentAsString(result) mustBe viewAsString(form, directorsAsPerson) - } - - "populate the view with directors when they exist when toggle on" in { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val directorsAsPerson = Seq(person(0), person(1)) - val getRelevantData = UserAnswers().completeDirector(index = 0).completeDirector(index = 1).dataRetrievalAction - val result = controller(getRelevantData).onPageLoad(NormalMode)(fakeRequest) - contentAsString(result) mustBe viewAsStringV2(form, directorsAsPerson) } @@ -207,14 +132,6 @@ class AddCompanyDirectorsControllerSpec extends ControllerSpecBase with BeforeAn val getRelevantData = UserAnswers().completeDirector(0).completeDirector(1, isDeleted = true).dataRetrievalAction val result = controller(getRelevantData).onPageLoad(NormalMode)(fakeRequest) - contentAsString(result) mustBe viewAsString(form, Seq(person(0))) - } - - "exclude the deleted directors from the list when toggle on" in { - when(defaultFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Enabled(PsaRegistration))) - val getRelevantData = UserAnswers().completeDirector(0).completeDirector(1, isDeleted = true).dataRetrievalAction - val result = controller(getRelevantData).onPageLoad(NormalMode)(fakeRequest) - contentAsString(result) mustBe viewAsStringV2(form, Seq(person(0))) } @@ -247,12 +164,6 @@ object AddCompanyDirectorsControllerSpec extends AddCompanyDirectorsControllerSp protected def fakeNavigator() = new FakeNavigator(desiredRoute = onwardRoute) - private val defaultFeatureToggleConnector = { - val mockFeatureToggleConnector = mock[FeatureToggleConnector] - when(mockFeatureToggleConnector.get(any())(any(), any())).thenReturn(Future.successful(Disabled(PsaRegistration))) - mockFeatureToggleConnector - } - protected def controller( dataRetrievalAction: DataRetrievalAction = getEmptyData, navigator: FakeNavigator = fakeNavigator() @@ -267,16 +178,12 @@ object AddCompanyDirectorsControllerSpec extends AddCompanyDirectorsControllerSp formProvider, controllerComponents, view, - viewv2, - defaultFeatureToggleConnector + viewv2 ) val request: DataRequest[AnyContent] = DataRequest(FakeRequest(), "cacheId", PSAUser(UserType.Organisation, None, isExistingPSA = false, None, None), UserAnswers(Json.obj())) - private def viewAsString(form: Form[_] = form, directors: Seq[Person] = Nil) = - view(form, NormalMode, directors, None)(request, messages).toString - private def viewAsStringV2(form: Form[_] = form, directorsComplete: Seq[Person] = Nil, directorsInComplete: Seq[Person] = Nil) = viewv2(form, NormalMode, directorsComplete,directorsInComplete, None)(request, messages).toString diff --git a/test/controllers/register/company/AddressControllerSpec.scala b/test/controllers/register/company/AddressControllerSpec.scala index b2d77d815..bdaaeb804 100644 --- a/test/controllers/register/company/AddressControllerSpec.scala +++ b/test/controllers/register/company/AddressControllerSpec.scala @@ -16,7 +16,7 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.UKAddressFormProvider @@ -36,14 +36,12 @@ class AddressControllerSpec extends ControllerSpecBase { private def onwardRoute: Call = controllers.routes.IndexController.onPageLoad val addressHelper: AddressHelper = inject[AddressHelper] - def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData) = new AddressController( FakeAuthAction, FakeUserAnswersCacheConnector, controllerComponents, countryOptions, - featureToggleConnector, formProvider, dataRetrievalAction, new FakeNavigator(desiredRoute = onwardRoute), diff --git a/test/controllers/register/company/CompanyAddressListControllerSpec.scala b/test/controllers/register/company/CompanyAddressListControllerSpec.scala index c47f175a6..7a8a85128 100644 --- a/test/controllers/register/company/CompanyAddressListControllerSpec.scala +++ b/test/controllers/register/company/CompanyAddressListControllerSpec.scala @@ -16,7 +16,7 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.address.AddressListFormProvider @@ -58,8 +58,7 @@ class CompanyAddressListControllerSpec extends ControllerSpecBase { val form: Form[Int] = formProvider(Seq(0), "error.required") - def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + def controller(dataRetrievalAction: DataRetrievalAction = getEmptyData) = new CompanyAddressListController( frontendAppConfig, FakeUserAnswersCacheConnector, @@ -71,8 +70,7 @@ class CompanyAddressListControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) private lazy val viewModel = AddressListViewModel( diff --git a/test/controllers/register/company/CompanyAddressYearsControllerSpec.scala b/test/controllers/register/company/CompanyAddressYearsControllerSpec.scala index f695e14f4..b065ef59a 100644 --- a/test/controllers/register/company/CompanyAddressYearsControllerSpec.scala +++ b/test/controllers/register/company/CompanyAddressYearsControllerSpec.scala @@ -16,18 +16,16 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ import forms.address.AddressYearsFormProvider import identifiers.register.{BusinessNameId, BusinessUTRId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{AddressYears, NormalMode} import play.api.Application import play.api.inject.bind import play.api.inject.guice.{GuiceApplicationBuilder, GuiceableModule} -import play.api.mvc.MessagesControllerComponents +import play.api.mvc.{Call, MessagesControllerComponents} import play.api.test.CSRFTokenHelper.addCSRFToken import play.api.test.FakeRequest import play.api.test.Helpers._ @@ -51,8 +49,7 @@ class CompanyAddressYearsControllerSpec extends ControllerSpecBase { "redirect to the next page on a POST request" in { running(_.overrides(modules(dataRetrieval) ++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(FakeNavigator), - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.disabled) + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector) ): _*)) { app => val controller = app.injector.instanceOf[CompanyAddressYearsController] @@ -61,7 +58,7 @@ class CompanyAddressYearsControllerSpec extends ControllerSpecBase { val result = controller.onSubmit(NormalMode)(request) status(result) mustBe SEE_OTHER - redirectLocation(result) mustBe Some(FakeNavigator.desiredRoute.url) + redirectLocation(result) mustBe Some(onwardRoute.url) } } } @@ -78,11 +75,12 @@ object CompanyAddressYearsControllerSpec extends CompanyAddressYearsControllerSp routes.CompanyAddressYearsController.onSubmit(NormalMode), title = Message("addressYears.heading", Message("theCompany")), heading = Message("addressYears.heading", companyName), - legend = Message("addressYears.heading", companyName) + legend = Message("addressYears.heading", companyName), + returnLink = Some(controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad().url) ) val form = new AddressYearsFormProvider()(companyName) - + private def onwardRoute: Call = controllers.register.company.routes.CompanyEmailController.onPageLoad(NormalMode) def application: Application = new GuiceApplicationBuilder() .overrides( bind[AuthAction].to(FakeAuthAction), @@ -90,8 +88,7 @@ object CompanyAddressYearsControllerSpec extends CompanyAddressYearsControllerSp bind[DataRetrievalAction].toInstance(dataRetrieval), bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(FakeNavigator), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[MessagesControllerComponents].to(controllerComponents), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[MessagesControllerComponents].to(controllerComponents) ).build() } diff --git a/test/controllers/register/company/CompanyContactAddressControllerSpec.scala b/test/controllers/register/company/CompanyContactAddressControllerSpec.scala index c163e3f35..9baa45aac 100644 --- a/test/controllers/register/company/CompanyContactAddressControllerSpec.scala +++ b/test/controllers/register/company/CompanyContactAddressControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.UKAddressFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models._ import org.scalatest.concurrent.ScalaFutures import play.api.data.Form @@ -56,8 +54,7 @@ class CompanyContactAddressControllerSpec extends ControllerSpecBase with ScalaF formProvider, countryOptions, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private lazy val viewModel = ManualAddressViewModel( diff --git a/test/controllers/register/company/CompanyContactAddressListControllerSpec.scala b/test/controllers/register/company/CompanyContactAddressListControllerSpec.scala index 7b94f742b..f1a258952 100644 --- a/test/controllers/register/company/CompanyContactAddressListControllerSpec.scala +++ b/test/controllers/register/company/CompanyContactAddressListControllerSpec.scala @@ -16,12 +16,10 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase -import controllers.actions.{DataRetrievalAction, FakeFeatureToggleConnector} +import controllers.actions.DataRetrievalAction import forms.address.AddressListFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{NormalMode, TolerantAddress} import play.api.Application import play.api.inject.bind @@ -83,7 +81,7 @@ class CompanyContactAddressListControllerSpec extends ControllerSpecBase { "return Ok and the correct view on a GET request" in { running(_.overrides(modules(dataRetrievalAction) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _*)) { + Seq[GuiceableModule](): _*)) { app => val controller = app.injector.instanceOf[CompanyContactAddressListController] val result = controller.onPageLoad(NormalMode)(fakeRequest) @@ -97,7 +95,7 @@ class CompanyContactAddressListControllerSpec extends ControllerSpecBase { "redirect to Company Address Post Code Lookup if no address data on a GET request" in { running(_.overrides(modules(getEmptyData) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _*)) { + Seq[GuiceableModule](): _*)) { app => val controller = app.injector.instanceOf[CompanyContactAddressListController] val result = controller.onPageLoad(NormalMode)(fakeRequest) @@ -109,7 +107,7 @@ class CompanyContactAddressListControllerSpec extends ControllerSpecBase { "redirect to Session Expired controller when no session data exists on a GET request" in { running(_.overrides(modules(dontGetAnyData) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _*)) { + Seq[GuiceableModule](): _*)) { app => val controller = app.injector.instanceOf[CompanyContactAddressListController] val result = controller.onPageLoad(NormalMode)(fakeRequest) @@ -122,7 +120,6 @@ class CompanyContactAddressListControllerSpec extends ControllerSpecBase { "redirect to the next page on POST of valid data" in { running(_.overrides(modules(dataRetrievalAction) ++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(onwardRoute)), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector)):_*)) { app => val controller = app.injector.instanceOf[CompanyContactAddressListController] @@ -149,7 +146,6 @@ class CompanyContactAddressListControllerSpec extends ControllerSpecBase { "redirect to Company Address Post Code Lookup if no address data on a POST request" in { running(_.overrides(modules(getEmptyData)++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(onwardRoute)), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector)):_*)) { app => val controller = app.injector.instanceOf[CompanyContactAddressListController] diff --git a/test/controllers/register/company/CompanyContactAddressPostCodeLookupControllerSpec.scala b/test/controllers/register/company/CompanyContactAddressPostCodeLookupControllerSpec.scala index 35c6753da..688cf9c4f 100644 --- a/test/controllers/register/company/CompanyContactAddressPostCodeLookupControllerSpec.scala +++ b/test/controllers/register/company/CompanyContactAddressPostCodeLookupControllerSpec.scala @@ -17,13 +17,11 @@ package controllers.register.company import connectors.AddressLookupConnector -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ import forms.address.PostCodeLookupFormProvider import identifiers.register.BusinessNameId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{NormalMode, TolerantAddress} import play.api.Application import play.api.inject.bind @@ -92,8 +90,7 @@ class CompanyContactAddressPostCodeLookupControllerSpec extends ControllerSpecBa running(_.overrides(modules(dataRetrieval) ++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(onwardRoute)), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[AddressLookupConnector].toInstance(fakeAddressLookupConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[AddressLookupConnector].toInstance(fakeAddressLookupConnector) ): _*)) { app => val controller = app.injector.instanceOf[CompanyContactAddressPostCodeLookupController] @@ -114,8 +111,7 @@ class CompanyContactAddressPostCodeLookupControllerSpec extends ControllerSpecBa bind[AddressLookupConnector].toInstance(fakeAddressLookupConnector), bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(onwardRoute)), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[MessagesControllerComponents].to(controllerComponents), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[MessagesControllerComponents].to(controllerComponents) ).build() } diff --git a/test/controllers/register/company/CompanyEmailControllerSpec.scala b/test/controllers/register/company/CompanyEmailControllerSpec.scala index bf05ac0bc..9b1c79ba1 100644 --- a/test/controllers/register/company/CompanyEmailControllerSpec.scala +++ b/test/controllers/register/company/CompanyEmailControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.EmailFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -50,8 +48,7 @@ class CompanyEmailControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def emailView(form: Form[_]): String = view(form, viewModel(NormalMode), Some(companyName))(fakeRequest, messages).toString diff --git a/test/controllers/register/company/CompanyEnterPAYEControllerSpec.scala b/test/controllers/register/company/CompanyEnterPAYEControllerSpec.scala index f5e2e483d..7c3e181e9 100644 --- a/test/controllers/register/company/CompanyEnterPAYEControllerSpec.scala +++ b/test/controllers/register/company/CompanyEnterPAYEControllerSpec.scala @@ -16,13 +16,10 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase -import controllers.actions.FakeFeatureToggleConnector import forms.EnterPAYEFormProvider import identifiers.register.EnterPAYEId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.NormalMode import play.api.data.Form import play.api.inject.bind @@ -37,7 +34,7 @@ import views.html.enterPAYE class CompanyEnterPAYEControllerSpec extends ControllerSpecBase { - private def onwardRoute: Call = controllers.routes.IndexController.onPageLoad + private def onwardRoute: Call = controllers.register.routes.NonUKAdministratorController.onPageLoad() private val formProvider = new EnterPAYEFormProvider() private val form = formProvider(companyName) @@ -67,7 +64,7 @@ class CompanyEnterPAYEControllerSpec extends ControllerSpecBase { "on a GET" must { "return OK and the correct view for a GET" in { running(_.overrides(modules(UserAnswers().businessName(companyName).dataRetrievalAction) - ++ Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _* + ++ Seq[GuiceableModule](): _* )) { app => val controller = app.injector.instanceOf[CompanyEnterPAYEController] @@ -96,7 +93,6 @@ class CompanyEnterPAYEControllerSpec extends ControllerSpecBase { "return a redirect when the submitted data is valid" in { running(_.overrides(modules(UserAnswers().businessName().dataRetrievalAction) ++ Seq[GuiceableModule](bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.disabled), bind(classOf[Navigator]).qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(onwardRoute))): _* )) { app => @@ -113,7 +109,7 @@ class CompanyEnterPAYEControllerSpec extends ControllerSpecBase { "redirect to Session Expired if no existing data is found" in { running( _.overrides(modules(dontGetAnyData) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.disabled)): _*) + Seq[GuiceableModule](): _*) ) { app => val request = FakeRequest().withFormUrlEncodedBody(("value", payeNumber)) diff --git a/test/controllers/register/company/CompanyEnterVATControllerSpec.scala b/test/controllers/register/company/CompanyEnterVATControllerSpec.scala index c36c2565d..f3b8ee34f 100644 --- a/test/controllers/register/company/CompanyEnterVATControllerSpec.scala +++ b/test/controllers/register/company/CompanyEnterVATControllerSpec.scala @@ -16,13 +16,11 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.register.EnterVATFormProvider import identifiers.register.{BusinessNameId, EnterVATId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.NormalMode import play.api.data.Form import play.api.libs.json.{JsString, Json} @@ -34,15 +32,14 @@ import views.html.enterVAT class CompanyEnterVATControllerSpec extends ControllerSpecBase { - def onwardRoute: Call = controllers.routes.IndexController.onPageLoad + def onwardRoute: Call = companydetails.routes.CheckYourAnswersController.onPageLoad() val view: enterVAT = app.injector.instanceOf[enterVAT] val formProvider = new EnterVATFormProvider() val form: Form[String] = formProvider(companyName) - def controller(dataRetrievalAction: DataRetrievalAction = getCompany, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + def controller(dataRetrievalAction: DataRetrievalAction = getCompany) = new CompanyEnterVATController( frontendAppConfig, FakeUserAnswersCacheConnector, @@ -53,8 +50,7 @@ class CompanyEnterVATControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) private def viewModel: CommonFormWithHintViewModel = @@ -63,7 +59,8 @@ class CompanyEnterVATControllerSpec extends ControllerSpecBase { title = Message("enterVAT.title", Message("theCompany")), heading = Message("enterVAT.heading", companyName), mode = NormalMode, - entityName = companyName + entityName = companyName, + returnLink = Some(routes.CompanyRegistrationTaskListController.onPageLoad().url) ) def viewAsString(form: Form[_] = form): String = view( @@ -105,8 +102,7 @@ class CompanyEnterVATControllerSpec extends ControllerSpecBase { "redirect to the task list page when the feature toggle is enabled" in { val postRequest = fakeRequest.withFormUrlEncodedBody(("value", testAnswer)) - val featureToggleConnector = FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) - val result = controller(featureToggleConnector = featureToggleConnector).onSubmit(NormalMode)(postRequest) + val result = controller().onSubmit(NormalMode)(postRequest) status(result) mustBe SEE_OTHER redirectLocation(result) mustBe Some(companydetails.routes.CheckYourAnswersController.onPageLoad().url) diff --git a/test/controllers/register/company/CompanyPhoneControllerSpec.scala b/test/controllers/register/company/CompanyPhoneControllerSpec.scala index 754687814..efca25f6e 100644 --- a/test/controllers/register/company/CompanyPhoneControllerSpec.scala +++ b/test/controllers/register/company/CompanyPhoneControllerSpec.scala @@ -16,12 +16,10 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.PhoneFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -34,13 +32,11 @@ import views.html.phone class CompanyPhoneControllerSpec extends ControllerWithCommonBehaviour { import CompanyPhoneControllerSpec._ - - override val onwardRoute: Call = controllers.routes.IndexController.onPageLoad + override def onwardRoute: Call = controllers.register.company.contactdetails.routes.CheckYourAnswersController.onPageLoad() val view: phone = app.injector.instanceOf[phone] - private def controller(dataRetrievalAction: DataRetrievalAction, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + private def controller(dataRetrievalAction: DataRetrievalAction) = new CompanyPhoneController( new FakeNavigator(onwardRoute), frontendAppConfig, @@ -51,11 +47,10 @@ class CompanyPhoneControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) - private def phoneView(form: Form[_]): String = view(form, viewModel(NormalMode), Some("psaName"))(fakeRequest, messages).toString + private def phoneView(form: Form[_]): String = view(form, viewModel(NormalMode), Some("Test Company Name"))(fakeRequest, messages).toString "CompanyPhoneController" must { @@ -68,11 +63,11 @@ class CompanyPhoneControllerSpec extends ControllerWithCommonBehaviour { request = postRequest ) - "redirect to the task list page if feature toggle is enabled" in { - val featureToggle = FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) - val result = controller(getCompany, featureToggle).onSubmit(NormalMode)(postRequest) + "redirect to the task list page" in { + val result = controller(getCompany).onSubmit(NormalMode)(postRequest) status(result) mustBe SEE_OTHER + redirectLocation(result) mustBe Some(contactdetails.routes.CheckYourAnswersController.onPageLoad().url) } } @@ -91,7 +86,8 @@ object CompanyPhoneControllerSpec { title = Message("phone.title", Message("theCompany")), heading = Message("phone.title", companyName), mode = mode, - entityName = companyName + entityName = companyName, + returnLink = Some(routes.CompanyRegistrationTaskListController.onPageLoad().url) ) } diff --git a/test/controllers/register/company/CompanyPreviousAddressControllerSpec.scala b/test/controllers/register/company/CompanyPreviousAddressControllerSpec.scala index 70346ab23..e1828eab7 100644 --- a/test/controllers/register/company/CompanyPreviousAddressControllerSpec.scala +++ b/test/controllers/register/company/CompanyPreviousAddressControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.UKAddressFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models._ import org.scalatest.concurrent.ScalaFutures import play.api.data.Form @@ -56,8 +54,7 @@ class CompanyPreviousAddressControllerSpec extends ControllerSpecBase with Scala formProvider, countryOptions, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private lazy val viewModel = ManualAddressViewModel( diff --git a/test/controllers/register/company/CompanyPreviousAddressPostCodeLookupControllerSpec.scala b/test/controllers/register/company/CompanyPreviousAddressPostCodeLookupControllerSpec.scala index 5bafafa8b..1e6ddd62d 100644 --- a/test/controllers/register/company/CompanyPreviousAddressPostCodeLookupControllerSpec.scala +++ b/test/controllers/register/company/CompanyPreviousAddressPostCodeLookupControllerSpec.scala @@ -23,8 +23,6 @@ import controllers.actions._ import forms.address.PostCodeLookupFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.CompanyPreviousAddressPostCodeLookupId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode, TolerantAddress} import org.mockito.{ArgumentMatchers, MockitoSugar} import play.api.data.{Form, FormError} @@ -60,8 +58,7 @@ class CompanyPreviousAddressPostCodeLookupControllerSpec extends ControllerSpecB new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def viewAsString(form: Form[_] = form) = diff --git a/test/controllers/register/company/CompanyRegistrationNumberControllerSpec.scala b/test/controllers/register/company/CompanyRegistrationNumberControllerSpec.scala index a5b894f31..b6ae49945 100644 --- a/test/controllers/register/company/CompanyRegistrationNumberControllerSpec.scala +++ b/test/controllers/register/company/CompanyRegistrationNumberControllerSpec.scala @@ -16,7 +16,7 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.register.company.CompanyRegistrationNumberFormProvider @@ -40,8 +40,7 @@ class CompanyRegistrationNumberControllerSpec extends ControllerSpecBase { val view: enterNumber = app.injector.instanceOf[enterNumber] - def controller(dataRetrievalAction: DataRetrievalAction = getCompany, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + def controller(dataRetrievalAction: DataRetrievalAction = getCompany) = new CompanyRegistrationNumberController( frontendAppConfig, FakeUserAnswersCacheConnector, @@ -53,8 +52,7 @@ class CompanyRegistrationNumberControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) private def viewModel: CommonFormWithHintViewModel = @@ -64,7 +62,8 @@ class CompanyRegistrationNumberControllerSpec extends ControllerSpecBase { heading = Message("companyRegistrationNumber.heading", companyName), hint = Some(Message("companyRegistrationNumber.hint")), mode = NormalMode, - entityName = companyName + entityName = companyName, + returnLink = Some(routes.CompanyRegistrationTaskListController.onPageLoad().url) ) def viewAsString(form: Form[_] = form): String = view( diff --git a/test/controllers/register/company/CompanySameContactAddressControllerSpec.scala b/test/controllers/register/company/CompanySameContactAddressControllerSpec.scala index 667c05d3b..39073ecb1 100644 --- a/test/controllers/register/company/CompanySameContactAddressControllerSpec.scala +++ b/test/controllers/register/company/CompanySameContactAddressControllerSpec.scala @@ -16,14 +16,12 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ import forms.address.SameContactAddressFormProvider import identifiers.register.BusinessNameId import identifiers.register.company.CompanyAddressId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{NormalMode, TolerantAddress} import play.api.Application import play.api.inject.bind @@ -78,7 +76,6 @@ class CompanySameContactAddressControllerSpec extends ControllerSpecBase { "redirect to the next page on a POST request" in { running(_.overrides(modules(dataRetrieval) ++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(postCall)), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector) ): _*)) { app => @@ -98,8 +95,7 @@ class CompanySameContactAddressControllerSpec extends ControllerSpecBase { bind[AuthAction].to(FakeAuthAction), bind[DataRetrievalAction].toInstance(dataRetrieval), bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(postCall)), - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector) ).build() } diff --git a/test/controllers/register/company/CompanyTradingOverAYearControllerSpec.scala b/test/controllers/register/company/CompanyTradingOverAYearControllerSpec.scala index 471acb083..76f2c180e 100644 --- a/test/controllers/register/company/CompanyTradingOverAYearControllerSpec.scala +++ b/test/controllers/register/company/CompanyTradingOverAYearControllerSpec.scala @@ -16,7 +16,7 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import controllers.register.company.routes._ @@ -31,7 +31,7 @@ import views.html.hasReferenceNumber class CompanyTradingOverAYearControllerSpec extends ControllerSpecBase { - def onwardRoute: Call = controllers.routes.IndexController.onPageLoad + def onwardRoute: Call = routes.CompanyRegistrationTaskListController.onPageLoad() private val formProvider = new HasReferenceNumberFormProvider() private val form = formProvider("trading.error.required", companyName) @@ -45,11 +45,11 @@ class CompanyTradingOverAYearControllerSpec extends ControllerSpecBase { heading = Message("trading.title", companyName), mode = NormalMode, hint = None, - entityName = companyName + entityName = companyName, + returnLink = Some(routes.CompanyRegistrationTaskListController.onPageLoad().url) ) - private def controller(dataRetrievalAction: DataRetrievalAction = getCompany, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + private def controller(dataRetrievalAction: DataRetrievalAction = getCompany) = new CompanyTradingOverAYearController(frontendAppConfig, FakeUserAnswersCacheConnector, new FakeNavigator(desiredRoute = onwardRoute), @@ -60,8 +60,7 @@ class CompanyTradingOverAYearControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) private def viewAsString(form: Form[_] = form, mode: Mode = NormalMode): String = diff --git a/test/controllers/register/company/ConfirmCompanyDetailsControllerSpec.scala b/test/controllers/register/company/ConfirmCompanyDetailsControllerSpec.scala index f7fe7f364..90c248628 100644 --- a/test/controllers/register/company/ConfirmCompanyDetailsControllerSpec.scala +++ b/test/controllers/register/company/ConfirmCompanyDetailsControllerSpec.scala @@ -16,7 +16,7 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ import forms.AddressFormProvider @@ -281,7 +281,7 @@ class ConfirmCompanyDetailsControllerSpec extends ControllerSpecBase with Before } - private def onwardRoute: Call = controllers.routes.IndexController.onPageLoad + private def onwardRoute: Call = controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad() @@ -318,8 +318,7 @@ class ConfirmCompanyDetailsControllerSpec extends ControllerSpecBase with Before private def controller( dataRetrievalAction: DataRetrievalAction, - dataCacheConnector: UserAnswersCacheConnector = FakeUserAnswersCacheConnector, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled + dataCacheConnector: UserAnswersCacheConnector = FakeUserAnswersCacheConnector ) = new ConfirmCompanyDetailsController( dataCacheConnector, @@ -334,7 +333,6 @@ class ConfirmCompanyDetailsControllerSpec extends ControllerSpecBase with Before countryOptions, controllerComponents, view, - featureToggleConnector, addressHelper ) diff --git a/test/controllers/register/company/HasCompanyCRNControllerSpec.scala b/test/controllers/register/company/HasCompanyCRNControllerSpec.scala index 935d621ba..99229add3 100644 --- a/test/controllers/register/company/HasCompanyCRNControllerSpec.scala +++ b/test/controllers/register/company/HasCompanyCRNControllerSpec.scala @@ -16,7 +16,7 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.HasReferenceNumberFormProvider @@ -50,8 +50,7 @@ class HasCompanyCRNControllerSpec extends ControllerSpecBase { entityName = companyName ) - private def controller(dataRetrievalAction: DataRetrievalAction = getCompany, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + private def controller(dataRetrievalAction: DataRetrievalAction = getCompany) = new HasCompanyCRNController(frontendAppConfig, FakeUserAnswersCacheConnector, new FakeNavigator(desiredRoute = onwardRoute), @@ -62,8 +61,7 @@ class HasCompanyCRNControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) private def viewAsString(form: Form[_] = form, mode:Mode = NormalMode): String = diff --git a/test/controllers/register/company/HasCompanyPAYEControllerSpec.scala b/test/controllers/register/company/HasCompanyPAYEControllerSpec.scala index d57667f54..2bc81f070 100644 --- a/test/controllers/register/company/HasCompanyPAYEControllerSpec.scala +++ b/test/controllers/register/company/HasCompanyPAYEControllerSpec.scala @@ -16,13 +16,10 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase -import controllers.actions.FakeFeatureToggleConnector import forms.HasReferenceNumberFormProvider import identifiers.register.HasPAYEId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode} import play.api.data.Form import play.api.inject.bind @@ -61,7 +58,7 @@ class HasCompanyPAYEControllerSpec extends ControllerSpecBase { "on a GET" must { "return OK and the correct view" in { running(_.overrides(modules(UserAnswers().businessName(companyName).dataRetrievalAction) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _*)) { + Seq[GuiceableModule](): _*)) { app => val controller = app.injector.instanceOf[HasCompanyPAYEController] val result = controller.onPageLoad(NormalMode)(fakeRequest) @@ -73,7 +70,7 @@ class HasCompanyPAYEControllerSpec extends ControllerSpecBase { "populate the view correctly when the question has previously been answered" in { val validData = UserAnswers().businessName(companyName).set(HasPAYEId)(value = true).asOpt.value.dataRetrievalAction running(_.overrides(modules(validData) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _*)) { + Seq[GuiceableModule](): _*)) { app => val controller = app.injector.instanceOf[HasCompanyPAYEController] val result = controller.onPageLoad(NormalMode)(fakeRequest) @@ -97,7 +94,6 @@ class HasCompanyPAYEControllerSpec extends ControllerSpecBase { running(_.overrides( modules(UserAnswers().businessName(companyName).dataRetrievalAction) ++ Seq[GuiceableModule](bind[Navigator].qualifiedWith(classOf[RegisterCompany]).toInstance(new FakeNavigator(onwardRoute)), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))), bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector)): _*)) { app => val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "true")) @@ -111,7 +107,7 @@ class HasCompanyPAYEControllerSpec extends ControllerSpecBase { "return a Bad Request and errors when invalid data is submitted" in { running(_.overrides(modules(UserAnswers().businessName(companyName).dataRetrievalAction) ++ - Seq[GuiceableModule](bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)))): _*)) { + Seq[GuiceableModule](): _*)) { app => val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "invalid value")) val boundForm = form.bind(Map("value" -> "invalid value")) diff --git a/test/controllers/register/company/HasCompanyVATControllerSpec.scala b/test/controllers/register/company/HasCompanyVATControllerSpec.scala index 33a7e10b4..6c5bf1098 100644 --- a/test/controllers/register/company/HasCompanyVATControllerSpec.scala +++ b/test/controllers/register/company/HasCompanyVATControllerSpec.scala @@ -16,13 +16,11 @@ package controllers.register.company -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector} +import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.HasReferenceNumberFormProvider import identifiers.register.{BusinessNameId, HasVATId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Mode, NormalMode} import play.api.data.Form import play.api.libs.json._ @@ -34,7 +32,7 @@ import views.html.hasReferenceNumber class HasCompanyVATControllerSpec extends ControllerSpecBase { - def onwardRoute: Call = controllers.routes.IndexController.onPageLoad + def onwardRoute: Call = routes.CompanyRegistrationTaskListController.onPageLoad() private val formProvider = new HasReferenceNumberFormProvider() private val form = formProvider("hasVAT.error.required", companyName) @@ -48,11 +46,11 @@ class HasCompanyVATControllerSpec extends ControllerSpecBase { heading = Message("hasVAT.heading", companyName), mode = NormalMode, hint = None, - entityName = companyName + entityName = companyName, + returnLink = Some(controllers.register.company.routes.CompanyRegistrationTaskListController.onPageLoad().url) ) - private def controller(dataRetrievalAction: DataRetrievalAction = getCompany, - featureToggleConnector: FeatureToggleConnector = FakeFeatureToggleConnector.disabled) = + private def controller(dataRetrievalAction: DataRetrievalAction = getCompany) = new HasCompanyVATController(frontendAppConfig, FakeUserAnswersCacheConnector, new FakeNavigator(desiredRoute = onwardRoute), @@ -62,8 +60,7 @@ class HasCompanyVATControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - featureToggleConnector + view ) private def viewAsString(form: Form[_] = form, mode:Mode = NormalMode): String = @@ -102,8 +99,7 @@ class HasCompanyVATControllerSpec extends ControllerSpecBase { "redirect to the 'company task list' page when user selection is no and feature flag is enabled" in { val postRequest = fakeRequest.withFormUrlEncodedBody(("value", "false")) - val enabledFeatureFlag = FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) - val result = controller(featureToggleConnector = enabledFeatureFlag).onSubmit(NormalMode)(postRequest) + val result = controller().onSubmit(NormalMode)(postRequest) status(result) mustBe SEE_OTHER redirectLocation(result) mustBe Some(companydetails.routes.CheckYourAnswersController.onPageLoad().url) diff --git a/test/controllers/register/company/directors/CheckYourAnswersControllerSpec.scala b/test/controllers/register/company/directors/CheckYourAnswersControllerSpec.scala index 0f7c336b4..4a2f548bb 100644 --- a/test/controllers/register/company/directors/CheckYourAnswersControllerSpec.scala +++ b/test/controllers/register/company/directors/CheckYourAnswersControllerSpec.scala @@ -21,8 +21,6 @@ import controllers.ControllerSpecBase import controllers.actions._ import controllers.register.company.directors.routes._ import identifiers.register.DirectorsOrPartnersChangedId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.Mode.{checkMode, _} import models._ import org.mockito.ArgumentMatchers.any @@ -63,8 +61,7 @@ class CheckYourAnswersControllerSpec FakeUserAnswersCacheConnector, countryOptions, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def testRenderedView( diff --git a/test/controllers/register/company/directors/CompanyDirectorAddressListControllerSpec.scala b/test/controllers/register/company/directors/CompanyDirectorAddressListControllerSpec.scala index b0f9d4b37..bd2fbefe0 100644 --- a/test/controllers/register/company/directors/CompanyDirectorAddressListControllerSpec.scala +++ b/test/controllers/register/company/directors/CompanyDirectorAddressListControllerSpec.scala @@ -21,8 +21,6 @@ import controllers.ControllerSpecBase import controllers.actions._ import forms.address.AddressListFormProvider import identifiers.register.company.directors.{CompanyDirectorAddressPostCodeLookupId, DirectorNameId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{NormalMode, PersonName, TolerantAddress} import play.api.data.Form import play.api.libs.json._ @@ -79,8 +77,7 @@ class CompanyDirectorAddressListControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private lazy val viewModel = diff --git a/test/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupControllerSpec.scala b/test/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupControllerSpec.scala index 9397eefca..22157e27e 100644 --- a/test/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupControllerSpec.scala +++ b/test/controllers/register/company/directors/CompanyDirectorAddressPostCodeLookupControllerSpec.scala @@ -22,8 +22,6 @@ import controllers.ControllerSpecBase import controllers.actions._ import forms.address.PostCodeLookupFormProvider import identifiers.register.company.directors.{CompanyDirectorAddressPostCodeLookupId, DirectorNameId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models._ import org.mockito.{ArgumentMatchers, MockitoSugar} import play.api.data.{Form, FormError} @@ -71,8 +69,7 @@ class CompanyDirectorAddressPostCodeLookupControllerSpec extends ControllerSpecB new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private lazy val viewModel = PostcodeLookupViewModel( diff --git a/test/controllers/register/company/directors/ConfirmDeleteDirectorControllerSpec.scala b/test/controllers/register/company/directors/ConfirmDeleteDirectorControllerSpec.scala index 9ff2036d2..492394964 100644 --- a/test/controllers/register/company/directors/ConfirmDeleteDirectorControllerSpec.scala +++ b/test/controllers/register/company/directors/ConfirmDeleteDirectorControllerSpec.scala @@ -17,13 +17,11 @@ package controllers.register.company.directors import base.SpecBase -import connectors.cache.{FakeUserAnswersCacheConnector, FeatureToggleConnector, UserAnswersCacheConnector} +import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ import forms.ConfirmDeleteFormProvider import identifiers.register.company.directors.DirectorNameId -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, NormalMode, PersonName} import play.api.Application import play.api.inject.bind @@ -51,8 +49,7 @@ class ConfirmDeleteDirectorControllerSpec extends ControllerSpecBase { running(_.overrides(modules(dataRetrieval) ++ Seq[GuiceableModule](bind[Navigator].toInstance( new FakeNavigator(controllers.register.company.routes.AddCompanyDirectorsController.onPageLoad(NormalMode))), - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector) ): _*)) { app => val controller = app.injector.instanceOf[ConfirmDeleteDirectorController] @@ -93,7 +90,6 @@ object ConfirmDeleteDirectorControllerSpec extends SpecBase { .overrides( bind[AuthAction].to(FakeAuthAction), bind[DataRetrievalAction].toInstance(dataRetrieval), - bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector), - bind[FeatureToggleConnector].toInstance(FakeFeatureToggleConnector.returns(Enabled(PsaRegistration))) + bind[UserAnswersCacheConnector].toInstance(FakeUserAnswersCacheConnector) ).build() } diff --git a/test/controllers/register/company/directors/DirectorAddressControllerSpec.scala b/test/controllers/register/company/directors/DirectorAddressControllerSpec.scala index 5a827a1d2..0f826f6da 100644 --- a/test/controllers/register/company/directors/DirectorAddressControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorAddressControllerSpec.scala @@ -22,8 +22,6 @@ import controllers.actions._ import forms.AddressFormProvider import identifiers.register.company.directors.DirectorNameId import identifiers.register.{BusinessNameId, DirectorsOrPartnersChangedId, RegistrationInfoId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.RegistrationCustomerType.UK import models.RegistrationLegalStatus.LimitedCompany import models._ @@ -80,8 +78,7 @@ class DirectorAddressControllerSpec extends ControllerSpecBase with ScalaFutures formProvider, countryOptions, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private val viewModel = ManualAddressViewModel( diff --git a/test/controllers/register/company/directors/DirectorAddressYearsControllerSpec.scala b/test/controllers/register/company/directors/DirectorAddressYearsControllerSpec.scala index fed034f5b..624d593e7 100644 --- a/test/controllers/register/company/directors/DirectorAddressYearsControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorAddressYearsControllerSpec.scala @@ -22,8 +22,6 @@ import controllers.actions._ import forms.address.AddressYearsFormProvider import identifiers.register.DirectorsOrPartnersChangedId import identifiers.register.company.directors.{DirectorAddressYearsId, DirectorNameId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models._ import play.api.data.Form import play.api.libs.json._ @@ -69,8 +67,7 @@ class DirectorAddressYearsControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private lazy val viewModel = diff --git a/test/controllers/register/company/directors/DirectorDOBControllerSpec.scala b/test/controllers/register/company/directors/DirectorDOBControllerSpec.scala index 88cf0ee59..acf2aa38e 100644 --- a/test/controllers/register/company/directors/DirectorDOBControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorDOBControllerSpec.scala @@ -19,8 +19,6 @@ package controllers.register.company.directors import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.ControllerSpecBase import controllers.actions._ -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.NormalMode import play.api.test.Helpers._ import utils.{FakeNavigator, Navigator} @@ -67,8 +65,7 @@ class DirectorDOBControllerSpec extends ControllerSpecBase { getData = dataRetrievalAction, requireData = new DataRequiredActionImpl(), controllerComponents = controllerComponents, - view = view, - featureToggleConnector = FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view = view ) } diff --git a/test/controllers/register/company/directors/DirectorEmailControllerSpec.scala b/test/controllers/register/company/directors/DirectorEmailControllerSpec.scala index 0f868c727..9e8e58c21 100644 --- a/test/controllers/register/company/directors/DirectorEmailControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorEmailControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.EmailFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -51,8 +49,7 @@ class DirectorEmailControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def emailView(form: Form[_]): String = view(form, viewModel(NormalMode, index), None)(fakeRequest, messages).toString diff --git a/test/controllers/register/company/directors/DirectorEnterNINOControllerSpec.scala b/test/controllers/register/company/directors/DirectorEnterNINOControllerSpec.scala index 84da3aec8..0fa294145 100644 --- a/test/controllers/register/company/directors/DirectorEnterNINOControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorEnterNINOControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.register.NINOFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -47,8 +45,7 @@ class DirectorEnterNINOControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def enterNINOView(form: Form[_]): String = view(form, viewModel(NormalMode, index))(fakeRequest, messages).toString diff --git a/test/controllers/register/company/directors/DirectorEnterUTRControllerSpec.scala b/test/controllers/register/company/directors/DirectorEnterUTRControllerSpec.scala index 7eca503a9..a24b15e22 100644 --- a/test/controllers/register/company/directors/DirectorEnterUTRControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorEnterUTRControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.EnterUTRFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -48,8 +46,7 @@ class DirectorEnterUTRControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def enterUTRView(form: Form[_]): String = view(form, viewModel(NormalMode, index))(fakeRequest, messages).toString diff --git a/test/controllers/register/company/directors/DirectorNameControllerSpec.scala b/test/controllers/register/company/directors/DirectorNameControllerSpec.scala index 97d6f2bed..7253de81f 100644 --- a/test/controllers/register/company/directors/DirectorNameControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorNameControllerSpec.scala @@ -19,8 +19,6 @@ package controllers.register.company.directors import connectors.cache.{FakeUserAnswersCacheConnector, UserAnswersCacheConnector} import controllers.actions._ import controllers.{ControllerSpecBase, PersonNameControllerBehaviour} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.requests.DataRequest import models.{NormalMode, PSAUser, UserType} import play.api.mvc.AnyContent @@ -81,8 +79,7 @@ class DirectorNameControllerSpec extends ControllerSpecBase with PersonNameContr getData = dataRetrievalAction, requireData = new DataRequiredActionImpl(), controllerComponents = controllerComponents, - view = view, - featureToggleConnector = FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view = view ) } diff --git a/test/controllers/register/company/directors/DirectorNoNINOReasonControllerSpec.scala b/test/controllers/register/company/directors/DirectorNoNINOReasonControllerSpec.scala index f33fa5573..573167502 100644 --- a/test/controllers/register/company/directors/DirectorNoNINOReasonControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorNoNINOReasonControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.ReasonFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -48,8 +46,7 @@ class DirectorNoNINOReasonControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def reasonView(form: Form[_]): String = view(form, viewModel(NormalMode, index))(fakeRequest, messages).toString diff --git a/test/controllers/register/company/directors/DirectorNoUTRReasonControllerSpec.scala b/test/controllers/register/company/directors/DirectorNoUTRReasonControllerSpec.scala index 3c05780c7..2711481f3 100644 --- a/test/controllers/register/company/directors/DirectorNoUTRReasonControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorNoUTRReasonControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.ReasonFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -50,8 +48,7 @@ class DirectorNoUTRReasonControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def reasonView(form: Form[_]): String = view(form, viewModel(NormalMode, index))(fakeRequest, messages).toString diff --git a/test/controllers/register/company/directors/DirectorPhoneControllerSpec.scala b/test/controllers/register/company/directors/DirectorPhoneControllerSpec.scala index 4890e38b1..071f410b4 100644 --- a/test/controllers/register/company/directors/DirectorPhoneControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorPhoneControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.PhoneFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -41,8 +39,7 @@ class DirectorPhoneControllerSpec extends ControllerWithCommonBehaviour { private def controller(dataRetrievalAction: DataRetrievalAction) = new DirectorPhoneController( new FakeNavigator(onwardRoute), frontendAppConfig, FakeUserAnswersCacheConnector, FakeAuthAction, FakeAllowAccessProvider(config = frontendAppConfig), dataRetrievalAction, new DataRequiredActionImpl, formProvider, - controllerComponents, view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + controllerComponents, view ) private def phoneView(form: Form[_]): String = view(form, viewModel(NormalMode, index), None)(fakeRequest, messages).toString diff --git a/test/controllers/register/company/directors/DirectorPreviousAddressControllerSpec.scala b/test/controllers/register/company/directors/DirectorPreviousAddressControllerSpec.scala index 8eaec344d..7256e54a8 100644 --- a/test/controllers/register/company/directors/DirectorPreviousAddressControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorPreviousAddressControllerSpec.scala @@ -22,8 +22,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.ControllerSpecBase import controllers.actions._ import forms.AddressFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models._ import org.scalatest.concurrent.ScalaFutures import play.api.data.Form @@ -61,8 +59,7 @@ class DirectorPreviousAddressControllerSpec extends ControllerSpecBase with Scal new FakeCountryOptions(environment, frontendAppConfig), auditService, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private val viewModel = diff --git a/test/controllers/register/company/directors/DirectorPreviousAddressListControllerSpec.scala b/test/controllers/register/company/directors/DirectorPreviousAddressListControllerSpec.scala index 97bf469c0..42baa75e8 100644 --- a/test/controllers/register/company/directors/DirectorPreviousAddressListControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorPreviousAddressListControllerSpec.scala @@ -21,8 +21,6 @@ import controllers.ControllerSpecBase import controllers.actions._ import forms.address.AddressListFormProvider import identifiers.register.company.directors.{DirectorNameId, DirectorPreviousAddressPostCodeLookupId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{NormalMode, PersonName, TolerantAddress} import play.api.data.Form import play.api.libs.json._ @@ -78,8 +76,7 @@ class DirectorPreviousAddressListControllerSpec extends ControllerSpecBase { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private lazy val viewModel = diff --git a/test/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupControllerSpec.scala b/test/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupControllerSpec.scala index bb71885ca..98cd1b8e3 100644 --- a/test/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupControllerSpec.scala +++ b/test/controllers/register/company/directors/DirectorPreviousAddressPostCodeLookupControllerSpec.scala @@ -22,8 +22,6 @@ import controllers.ControllerSpecBase import controllers.actions._ import forms.address.PostCodeLookupFormProvider import identifiers.register.company.directors.{DirectorNameId, DirectorPreviousAddressPostCodeLookupId} -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models._ import org.mockito.{ArgumentMatchers, MockitoSugar} import play.api.data.Form @@ -62,8 +60,7 @@ class DirectorPreviousAddressPostCodeLookupControllerSpec extends ControllerSpec new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private val testAnswer = "AB12 1AB" diff --git a/test/controllers/register/company/directors/HasDirectorNINOControllerSpec.scala b/test/controllers/register/company/directors/HasDirectorNINOControllerSpec.scala index d704d68d3..bd8966176 100644 --- a/test/controllers/register/company/directors/HasDirectorNINOControllerSpec.scala +++ b/test/controllers/register/company/directors/HasDirectorNINOControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.HasReferenceNumberFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -48,8 +46,7 @@ class HasDirectorNINOControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def hasReferenceNumberView(form: Form[_]): String = diff --git a/test/controllers/register/company/directors/HasDirectorUTRControllerSpec.scala b/test/controllers/register/company/directors/HasDirectorUTRControllerSpec.scala index d577516e5..090bba0a8 100644 --- a/test/controllers/register/company/directors/HasDirectorUTRControllerSpec.scala +++ b/test/controllers/register/company/directors/HasDirectorUTRControllerSpec.scala @@ -20,8 +20,6 @@ import connectors.cache.FakeUserAnswersCacheConnector import controllers.actions._ import controllers.behaviours.ControllerWithCommonBehaviour import forms.HasReferenceNumberFormProvider -import models.FeatureToggle.Enabled -import models.FeatureToggleName.PsaRegistration import models.{Index, Mode, NormalMode} import play.api.data.Form import play.api.mvc.Call @@ -48,8 +46,7 @@ class HasDirectorUTRControllerSpec extends ControllerWithCommonBehaviour { new DataRequiredActionImpl, formProvider, controllerComponents, - view, - FakeFeatureToggleConnector.returns(Enabled(PsaRegistration)) + view ) private def hasReferenceNumberView(form: Form[_]): String = From cf4987ee53a0c73179985be6ff149d29cc46ddc6 Mon Sep 17 00:00:00 2001 From: jamdade-sharad Date: Wed, 18 Sep 2024 10:11:31 +0100 Subject: [PATCH 2/2] PODS-9772 - Removed extra comma --- .../company/contactdetails/WhatYouWillNeedController.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala b/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala index af297bbe6..d7378cf77 100644 --- a/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala +++ b/app/controllers/register/company/contactdetails/WhatYouWillNeedController.scala @@ -34,7 +34,7 @@ class WhatYouWillNeedController @Inject()( @AuthWithNoIV authenticate: AuthAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - whatYouWillNeedView: contactdetails.whatYouWillNeed, + whatYouWillNeedView: contactdetails.whatYouWillNeed ) extends FrontendBaseController with I18nSupport { def onPageLoad(): Action[AnyContent] = (authenticate andThen getData andThen requireData) { implicit request => Ok(whatYouWillNeedView(companyName, Some(companyName)))