diff --git a/app/controllers/addFinancialInstitution/FirstContactEmailController.scala b/app/controllers/addFinancialInstitution/FirstContactEmailController.scala index 69b076e0..81b079aa 100644 --- a/app/controllers/addFinancialInstitution/FirstContactEmailController.scala +++ b/app/controllers/addFinancialInstitution/FirstContactEmailController.scala @@ -20,7 +20,7 @@ import controllers.actions._ import forms.addFinancialInstitution.FirstContactEmailFormProvider import models.Mode import navigation.Navigator -import pages.addFinancialInstitution.{ContactNamePage, FirstContactEmailPage} +import pages.addFinancialInstitution.{FirstContactEmailPage, FirstContactNamePage} import play.api.data.Form import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -58,7 +58,7 @@ class FirstContactEmailController @Inject() ( case None => form case Some(value) => form.fill(value) } - val contactName = ua.get(ContactNamePage) + val contactName = ua.get(FirstContactNamePage) contactName match { case None => Redirect(controllers.routes.IndexController.onPageLoad()) case Some(name) => Ok(view(preparedForm, mode, fi, name)) @@ -70,7 +70,7 @@ class FirstContactEmailController @Inject() ( val ua = request.userAnswers val fi = getFinancialInstitutionName(ua) - ua.get(ContactNamePage) + ua.get(FirstContactNamePage) .fold { Future.successful(Redirect(controllers.routes.IndexController.onPageLoad())) } { diff --git a/app/controllers/addFinancialInstitution/ContactHavePhoneController.scala b/app/controllers/addFinancialInstitution/FirstContactHavePhoneController.scala similarity index 79% rename from app/controllers/addFinancialInstitution/ContactHavePhoneController.scala rename to app/controllers/addFinancialInstitution/FirstContactHavePhoneController.scala index b45390f3..dcb8a27a 100644 --- a/app/controllers/addFinancialInstitution/ContactHavePhoneController.scala +++ b/app/controllers/addFinancialInstitution/FirstContactHavePhoneController.scala @@ -17,31 +17,31 @@ package controllers.addFinancialInstitution import controllers.actions._ -import forms.addFinancialInstitution.ContactHavePhoneFormProvider +import forms.addFinancialInstitution._ import models.Mode import navigation.Navigator -import pages.addFinancialInstitution.{ContactHavePhonePage, ContactNamePage} +import pages.addFinancialInstitution.{FirstContactHavePhonePage, FirstContactNamePage} import play.api.data.Form import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import repositories.SessionRepository import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import utils.ContactHelper -import views.html.addFinancialInstitution.ContactHavePhoneView +import views.html.addFinancialInstitution.FirstContactHavePhoneView import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} -class ContactHavePhoneController @Inject() ( +class FirstContactHavePhoneController @Inject() ( override val messagesApi: MessagesApi, sessionRepository: SessionRepository, navigator: Navigator, identify: IdentifierAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - formProvider: ContactHavePhoneFormProvider, + formProvider: FirstContactHavePhoneFormProvider, val controllerComponents: MessagesControllerComponents, - view: ContactHavePhoneView + view: FirstContactHavePhoneView )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport @@ -52,10 +52,10 @@ class ContactHavePhoneController @Inject() ( def onPageLoad(mode: Mode): Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => val ua = request.userAnswers - val contactName = ua.get(ContactNamePage) + val contactName = ua.get(FirstContactNamePage) val fi = getFinancialInstitutionName(ua) - val preparedForm = ua.get(ContactHavePhonePage) match { + val preparedForm = ua.get(FirstContactHavePhonePage) match { case None => form case Some(value) => form.fill(value) } @@ -76,9 +76,9 @@ class ContactHavePhoneController @Inject() ( formWithErrors => Future.successful(BadRequest(view(formWithErrors, mode, fi, getFirstContactName(ua)))), value => for { - updatedAnswers <- Future.fromTry(ua.set(ContactHavePhonePage, value)) + updatedAnswers <- Future.fromTry(ua.set(FirstContactHavePhonePage, value)) _ <- sessionRepository.set(updatedAnswers) - } yield Redirect(navigator.nextPage(ContactHavePhonePage, mode, updatedAnswers)) + } yield Redirect(navigator.nextPage(FirstContactHavePhonePage, mode, updatedAnswers)) ) } diff --git a/app/controllers/addFinancialInstitution/ContactNameController.scala b/app/controllers/addFinancialInstitution/FirstContactNameController.scala similarity index 81% rename from app/controllers/addFinancialInstitution/ContactNameController.scala rename to app/controllers/addFinancialInstitution/FirstContactNameController.scala index ce537ffe..80926788 100644 --- a/app/controllers/addFinancialInstitution/ContactNameController.scala +++ b/app/controllers/addFinancialInstitution/FirstContactNameController.scala @@ -17,30 +17,30 @@ package controllers.addFinancialInstitution import controllers.actions._ -import forms.addFinancialInstitution.ContactNameFormProvider +import forms.addFinancialInstitution.FirstContactNameFormProvider import models.Mode import navigation.Navigator -import pages.addFinancialInstitution.ContactNamePage +import pages.addFinancialInstitution.FirstContactNamePage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import repositories.SessionRepository import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController import utils.ContactHelper -import views.html.addFinancialInstitution.ContactNameView +import views.html.addFinancialInstitution.FirstContactNameView import javax.inject.Inject import scala.concurrent.{ExecutionContext, Future} -class ContactNameController @Inject() ( +class FirstContactNameController @Inject() ( override val messagesApi: MessagesApi, sessionRepository: SessionRepository, navigator: Navigator, identify: IdentifierAction, getData: DataRetrievalAction, requireData: DataRequiredAction, - formProvider: ContactNameFormProvider, + formProvider: FirstContactNameFormProvider, val controllerComponents: MessagesControllerComponents, - view: ContactNameView + view: FirstContactNameView )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport @@ -52,7 +52,7 @@ class ContactNameController @Inject() ( implicit request => val ua = request.userAnswers - val preparedForm = ua.get(ContactNamePage) match { + val preparedForm = ua.get(FirstContactNamePage) match { case None => form case Some(value) => form.fill(value) } @@ -69,11 +69,11 @@ class ContactNameController @Inject() ( value => for { updatedAnswers <- Future.fromTry( - request.userAnswers.set(ContactNamePage, value) + request.userAnswers.set(FirstContactNamePage, value) ) _ <- sessionRepository.set(updatedAnswers) - } yield Redirect(navigator.nextPage(ContactNamePage, mode, updatedAnswers)) + } yield Redirect(navigator.nextPage(FirstContactNamePage, mode, updatedAnswers)) ) } diff --git a/app/forms/addFinancialInstitution/ContactHavePhoneFormProvider.scala b/app/forms/addFinancialInstitution/FirstContactHavePhoneFormProvider.scala similarity index 84% rename from app/forms/addFinancialInstitution/ContactHavePhoneFormProvider.scala rename to app/forms/addFinancialInstitution/FirstContactHavePhoneFormProvider.scala index 6d8844df..4eb10903 100644 --- a/app/forms/addFinancialInstitution/ContactHavePhoneFormProvider.scala +++ b/app/forms/addFinancialInstitution/FirstContactHavePhoneFormProvider.scala @@ -21,11 +21,11 @@ import javax.inject.Inject import forms.mappings.Mappings import play.api.data.Form -class ContactHavePhoneFormProvider @Inject() extends Mappings { +class FirstContactHavePhoneFormProvider @Inject() extends Mappings { def apply(): Form[Boolean] = Form( - "value" -> boolean("contactHavePhone.error.required.business") + "value" -> boolean("firstContactHavePhone.error.required.business") ) } diff --git a/app/forms/addFinancialInstitution/ContactNameFormProvider.scala b/app/forms/addFinancialInstitution/FirstContactNameFormProvider.scala similarity index 81% rename from app/forms/addFinancialInstitution/ContactNameFormProvider.scala rename to app/forms/addFinancialInstitution/FirstContactNameFormProvider.scala index ae7cc22a..09501b6f 100644 --- a/app/forms/addFinancialInstitution/ContactNameFormProvider.scala +++ b/app/forms/addFinancialInstitution/FirstContactNameFormProvider.scala @@ -21,16 +21,16 @@ import forms.mappings.Mappings import play.api.data.Form import utils.RegexConstants -class ContactNameFormProvider @Inject() extends Mappings with RegexConstants { +class FirstContactNameFormProvider @Inject() extends Mappings with RegexConstants { val maxLength: Int = 35 def apply(): Form[String] = Form( "value" -> validatedText( - "contactName.error.required", - "contactName.error.invalid", - "contactName.error.length", + "firstContactName.error.required", + "firstContactName.error.invalid", + "firstContactName.error.length", orgNameRegex, maxLength ) diff --git a/app/navigation/Navigator.scala b/app/navigation/Navigator.scala index 79da37f3..23e099a1 100644 --- a/app/navigation/Navigator.scala +++ b/app/navigation/Navigator.scala @@ -70,14 +70,14 @@ class Navigator @Inject() () { routes.WhatIsUniqueTaxpayerReferenceController.onPageLoad(NormalMode), routes.SendReportsController.onPageLoad(NormalMode) ) - case ContactNamePage => + case FirstContactNamePage => _ => routes.FirstContactEmailController.onPageLoad(NormalMode) - case FirstContactEmailPage => _ => routes.ContactHavePhoneController.onPageLoad(NormalMode) - case ContactHavePhonePage => + case FirstContactEmailPage => _ => routes.FirstContactHavePhoneController.onPageLoad(NormalMode) + case FirstContactHavePhonePage => userAnswers => yesNoPage( userAnswers, - ContactHavePhonePage, + FirstContactHavePhonePage, routes.FirstContactPhoneNumberController.onPageLoad(NormalMode), routes.SecondContactExistsController.onPageLoad(NormalMode) ) @@ -104,13 +104,13 @@ class Navigator @Inject() () { ) case SecondContactPhoneNumberPage => _ => routes.CheckYourAnswersController.onPageLoad case PostcodePage => addressLookupNavigation(NormalMode) - case SelectAddressPage => _ => routes.ContactNameController.onPageLoad(NormalMode) + case SelectAddressPage => _ => routes.FirstContactNameController.onPageLoad(NormalMode) case IsThisAddressPage => userAnswers => yesNoPage( userAnswers, IsThisAddressPage, - routes.ContactNameController.onPageLoad(NormalMode), + routes.FirstContactNameController.onPageLoad(NormalMode), routes.UkAddressController.onPageLoad(NormalMode) ) case HaveGIINPage => @@ -141,8 +141,8 @@ class Navigator @Inject() () { routes.SendReportsController.onPageLoad(NormalMode), routes.NameOfFinancialInstitutionController.onPageLoad(NormalMode) ) - case UkAddressPage => _ => routes.ContactNameController.onPageLoad(NormalMode) - case NonUkAddressPage => _ => routes.ContactNameController.onPageLoad(NormalMode) + case UkAddressPage => _ => routes.FirstContactNameController.onPageLoad(NormalMode) + case NonUkAddressPage => _ => routes.FirstContactNameController.onPageLoad(NormalMode) case _ => _ => controllers.routes.IndexController.onPageLoad() } diff --git a/app/pages/addFinancialInstitution/ContactHavePhonePage.scala b/app/pages/addFinancialInstitution/FirstContactHavePhonePage.scala similarity index 85% rename from app/pages/addFinancialInstitution/ContactHavePhonePage.scala rename to app/pages/addFinancialInstitution/FirstContactHavePhonePage.scala index 3c5818eb..040c488f 100644 --- a/app/pages/addFinancialInstitution/ContactHavePhonePage.scala +++ b/app/pages/addFinancialInstitution/FirstContactHavePhonePage.scala @@ -19,9 +19,9 @@ package pages.addFinancialInstitution import pages.QuestionPage import play.api.libs.json.JsPath -case object ContactHavePhonePage extends QuestionPage[Boolean] { +case object FirstContactHavePhonePage extends QuestionPage[Boolean] { override def path: JsPath = JsPath \ toString - override def toString: String = "contactHavePhone" + override def toString: String = "firstContactHavePhone" } diff --git a/app/pages/addFinancialInstitution/ContactNamePage.scala b/app/pages/addFinancialInstitution/FirstContactNamePage.scala similarity index 86% rename from app/pages/addFinancialInstitution/ContactNamePage.scala rename to app/pages/addFinancialInstitution/FirstContactNamePage.scala index 4241fcda..e8cc5a39 100644 --- a/app/pages/addFinancialInstitution/ContactNamePage.scala +++ b/app/pages/addFinancialInstitution/FirstContactNamePage.scala @@ -19,9 +19,9 @@ package pages.addFinancialInstitution import pages.QuestionPage import play.api.libs.json.JsPath -case object ContactNamePage extends QuestionPage[String] { +case object FirstContactNamePage extends QuestionPage[String] { override def path: JsPath = JsPath \ toString - override def toString: String = "contactName" + override def toString: String = "firstContactName" } diff --git a/app/utils/ContactHelper.scala b/app/utils/ContactHelper.scala index ac680d6d..e7d12f74 100644 --- a/app/utils/ContactHelper.scala +++ b/app/utils/ContactHelper.scala @@ -17,14 +17,14 @@ package utils import models.UserAnswers -import pages.addFinancialInstitution.{ContactNamePage, NameOfFinancialInstitutionPage, SecondContactNamePage} +import pages.addFinancialInstitution.{FirstContactNamePage, NameOfFinancialInstitutionPage, SecondContactNamePage} import play.api.i18n.Messages trait ContactHelper { def getFirstContactName(userAnswers: UserAnswers)(implicit messages: Messages): String = userAnswers - .get(ContactNamePage) + .get(FirstContactNamePage) .fold(messages("default.firstContact.name"))( contactName => contactName ) diff --git a/app/viewmodels/checkAnswers/ContactHavePhoneSummary.scala b/app/viewmodels/checkAnswers/FirstContactHavePhoneSummary.scala similarity index 75% rename from app/viewmodels/checkAnswers/ContactHavePhoneSummary.scala rename to app/viewmodels/checkAnswers/FirstContactHavePhoneSummary.scala index 0d7cbd9a..3776d9c8 100644 --- a/app/viewmodels/checkAnswers/ContactHavePhoneSummary.scala +++ b/app/viewmodels/checkAnswers/FirstContactHavePhoneSummary.scala @@ -17,25 +17,25 @@ package viewmodels.checkAnswers import models.{CheckMode, UserAnswers} -import pages.addFinancialInstitution.ContactHavePhonePage +import pages.addFinancialInstitution.FirstContactHavePhonePage import play.api.i18n.Messages import uk.gov.hmrc.govukfrontend.views.viewmodels.summarylist.SummaryListRow import viewmodels.govuk.summarylist._ import viewmodels.implicits._ -object ContactHavePhoneSummary { +object FirstContactHavePhoneSummary { def row(answers: UserAnswers)(implicit messages: Messages): Option[SummaryListRow] = - answers.get(ContactHavePhonePage).map { + answers.get(FirstContactHavePhonePage).map { answer => val value = if (answer) "site.yes" else "site.no" SummaryListRowViewModel( - key = "contactHavePhone.checkYourAnswersLabel", + key = "firstContactHavePhone.checkYourAnswersLabel", value = ValueViewModel(value), actions = Seq( - ActionItemViewModel("site.change", controllers.addFinancialInstitution.routes.ContactHavePhoneController.onPageLoad(CheckMode).url) - .withVisuallyHiddenText(messages("contactHavePhone.change.hidden")) + ActionItemViewModel("site.change", controllers.addFinancialInstitution.routes.FirstContactHavePhoneController.onPageLoad(CheckMode).url) + .withVisuallyHiddenText(messages("firstContactHavePhone.change.hidden")) ) ) } diff --git a/app/viewmodels/checkAnswers/ContactNameSummary.scala b/app/viewmodels/checkAnswers/FirstContactNameSummary.scala similarity index 77% rename from app/viewmodels/checkAnswers/ContactNameSummary.scala rename to app/viewmodels/checkAnswers/FirstContactNameSummary.scala index 0946c014..87239bb1 100644 --- a/app/viewmodels/checkAnswers/ContactNameSummary.scala +++ b/app/viewmodels/checkAnswers/FirstContactNameSummary.scala @@ -17,24 +17,24 @@ package viewmodels.checkAnswers import models.{CheckMode, UserAnswers} -import pages.addFinancialInstitution.ContactNamePage +import pages.addFinancialInstitution.FirstContactNamePage import play.api.i18n.Messages import play.twirl.api.HtmlFormat import uk.gov.hmrc.govukfrontend.views.viewmodels.summarylist.SummaryListRow import viewmodels.govuk.summarylist._ import viewmodels.implicits._ -object ContactNameSummary { +object FirstContactNameSummary { def row(answers: UserAnswers)(implicit messages: Messages): Option[SummaryListRow] = - answers.get(ContactNamePage).map { + answers.get(FirstContactNamePage).map { answer => SummaryListRowViewModel( - key = "contactName.checkYourAnswersLabel", + key = "firstContactName.checkYourAnswersLabel", value = ValueViewModel(HtmlFormat.escape(answer).toString), actions = Seq( - ActionItemViewModel("site.change", controllers.addFinancialInstitution.routes.ContactNameController.onPageLoad(CheckMode).url) - .withVisuallyHiddenText(messages("contactName.change.hidden")) + ActionItemViewModel("site.change", controllers.addFinancialInstitution.routes.FirstContactNameController.onPageLoad(CheckMode).url) + .withVisuallyHiddenText(messages("firstContactName.change.hidden")) ) ) } diff --git a/app/views/addFinancialInstitution/ContactHavePhoneView.scala.html b/app/views/addFinancialInstitution/FirstContactHavePhoneView.scala.html similarity index 72% rename from app/views/addFinancialInstitution/ContactHavePhoneView.scala.html rename to app/views/addFinancialInstitution/FirstContactHavePhoneView.scala.html index b518169f..6a148a4a 100644 --- a/app/views/addFinancialInstitution/ContactHavePhoneView.scala.html +++ b/app/views/addFinancialInstitution/FirstContactHavePhoneView.scala.html @@ -24,21 +24,21 @@ @(form: Form[_], mode: Mode , finInstitution: String , contactName: String)(implicit request: Request[_], messages: Messages) -@layout(pageTitle = title(form, messages("contactHavePhone.title.business"))) { +@layout(pageTitle = title(form, messages("firstContactHavePhone.title.business"))) { - @formHelper(action = controllers.addFinancialInstitution.routes.ContactHavePhoneController.onSubmit(mode), Symbol("autoComplete") -> "off") { + @formHelper(action = controllers.addFinancialInstitution.routes.FirstContactHavePhoneController.onSubmit(mode), Symbol("autoComplete") -> "off") { @if(form.errors.nonEmpty) { @govukErrorSummary(ErrorSummaryViewModel(form)) } -

@messages(messages(s"contactHavePhone.heading.business" , contactName))

-

@messages("contactHavePhone.p1" , finInstitution)

+

@messages(messages(s"firstContactHavePhone.heading.business" , contactName))

+

@messages("firstContactHavePhone.p1" , finInstitution)

@govukRadios( RadiosViewModel.yesNo( field = form("value"), - legend = LegendViewModel(messages("contactHavePhone.heading.business")).withCssClass("govuk-visually-hidden") + legend = LegendViewModel(messages("firstContactHavePhone.heading.business")).withCssClass("govuk-visually-hidden") ) ) diff --git a/app/views/addFinancialInstitution/ContactNameView.scala.html b/app/views/addFinancialInstitution/FirstContactNameView.scala.html similarity index 81% rename from app/views/addFinancialInstitution/ContactNameView.scala.html rename to app/views/addFinancialInstitution/FirstContactNameView.scala.html index 01ba2838..947e5a4e 100644 --- a/app/views/addFinancialInstitution/ContactNameView.scala.html +++ b/app/views/addFinancialInstitution/FirstContactNameView.scala.html @@ -26,9 +26,9 @@ @(form: Form[_], mode: Mode, fiName: String)(implicit request: Request[_], messages: Messages) -@layout(pageTitle = title(form, messages("contactName.title"))) { +@layout(pageTitle = title(form, messages("firstContactName.title"))) { - @formHelper(action = controllers.addFinancialInstitution.routes.ContactNameController.onSubmit(mode)) { + @formHelper(action = controllers.addFinancialInstitution.routes.FirstContactNameController.onSubmit(mode)) { @if(form.errors.nonEmpty) { @govukErrorSummary(ErrorSummaryViewModel(form)) @@ -37,8 +37,8 @@ @govukInput( InputViewModel( field = form("value"), - label = LabelViewModel(messages("contactName.heading", fiName)).asPageHeading() - ).withHint(HintViewModel(Text(messages("contactName.hint")))) + label = LabelViewModel(messages("firstContactName.heading", fiName)).asPageHeading() + ).withHint(HintViewModel(Text(messages("firstContactName.hint")))) .withWidth(ThreeQuarters) ) diff --git a/conf/app.routes b/conf/app.routes index 46294eb4..fa59cc83 100644 --- a/conf/app.routes +++ b/conf/app.routes @@ -21,10 +21,10 @@ GET /account/signed-out controllers.auth.Signed GET /unauthorised controllers.UnauthorisedController.onPageLoad -GET /contact-name controllers.addFinancialInstitution.ContactNameController.onPageLoad(mode: Mode = NormalMode) -POST /contact-name controllers.addFinancialInstitution.ContactNameController.onSubmit(mode: Mode = NormalMode) -GET /change/contact-name controllers.addFinancialInstitution.ContactNameController.onPageLoad(mode: Mode = CheckMode) -POST /change/contact-name controllers.addFinancialInstitution.ContactNameController.onSubmit(mode: Mode = CheckMode) +GET /contact-name controllers.addFinancialInstitution.FirstContactNameController.onPageLoad(mode: Mode = NormalMode) +POST /contact-name controllers.addFinancialInstitution.FirstContactNameController.onSubmit(mode: Mode = NormalMode) +GET /change/contact-name controllers.addFinancialInstitution.FirstContactNameController.onPageLoad(mode: Mode = CheckMode) +POST /change/contact-name controllers.addFinancialInstitution.FirstContactNameController.onSubmit(mode: Mode = CheckMode) GET /email controllers.addFinancialInstitution.FirstContactEmailController.onPageLoad(mode: Mode = NormalMode) POST /email controllers.addFinancialInstitution.FirstContactEmailController.onSubmit(mode: Mode = NormalMode) @@ -61,10 +61,10 @@ POST /second-contact-phone controllers.addFinancia GET /change-second-contact-phone controllers.addFinancialInstitution.SecondContactPhoneNumberController.onPageLoad(mode: Mode = CheckMode) POST /change-second-contact-phone controllers.addFinancialInstitution.SecondContactPhoneNumberController.onSubmit(mode: Mode = CheckMode) -GET /have-phone controllers.addFinancialInstitution.ContactHavePhoneController.onPageLoad(mode: models.Mode = models.NormalMode) -POST /have-phone controllers.addFinancialInstitution.ContactHavePhoneController.onSubmit(mode: models.Mode = models.NormalMode) -GET /change-have-phone controllers.addFinancialInstitution.ContactHavePhoneController.onPageLoad(mode: models.Mode = models.CheckMode) -POST /change-have-phone controllers.addFinancialInstitution.ContactHavePhoneController.onSubmit(mode: models.Mode = models.CheckMode) +GET /have-phone controllers.addFinancialInstitution.FirstContactHavePhoneController.onPageLoad(mode: models.Mode = models.NormalMode) +POST /have-phone controllers.addFinancialInstitution.FirstContactHavePhoneController.onSubmit(mode: models.Mode = models.NormalMode) +GET /change-have-phone controllers.addFinancialInstitution.FirstContactHavePhoneController.onPageLoad(mode: models.Mode = models.CheckMode) +POST /change-have-phone controllers.addFinancialInstitution.FirstContactHavePhoneController.onSubmit(mode: models.Mode = models.CheckMode) GET /have-utr controllers.addFinancialInstitution.HaveUniqueTaxpayerReferenceController.onPageLoad(mode: Mode = NormalMode) POST /have-utr controllers.addFinancialInstitution.HaveUniqueTaxpayerReferenceController.onSubmit(mode: Mode = NormalMode) diff --git a/conf/logback.xml b/conf/logback.xml index 90a18852..8508f305 100644 --- a/conf/logback.xml +++ b/conf/logback.xml @@ -14,12 +14,6 @@ - - - %date{ISO8601} level=[%level] logger=[%logger] thread=[%thread] rid=[not-available] user=[not-available] message=[%message] %replace(exception=[%xException]){'^exception=\[\]$',''}%n - - - logs/access.log @@ -39,10 +33,6 @@ - - - - diff --git a/conf/messages.en b/conf/messages.en index 6dcc4d5b..c9f16b19 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -134,13 +134,13 @@ contactName.error.invalid = The name must only include letters a to z, numbers 0 contactName.error.length = The name must be 35 characters or less contactName.change.hidden = ContactName -contactHavePhone.title.business = Can we contact the first contact by telephone? -contactHavePhone.heading.business = Can we contact {0} by telephone? -contactHavePhone.title.individual = Can we contact you by telephone? -contactHavePhone.heading.individual = Can we contact you by telephone? -contactHavePhone.p1 = We will call if we have any questions about reports for {0}. -contactHavePhone.error.required.individual = Select yes if we can contact you by telephone -contactHavePhone.error.required.business = Select yes if they can be contacted by telephone +firstContactHavePhone.title.business = Can we contact the first contact by telephone? +firstContactHavePhone.heading.business = Can we contact {0} by telephone? +firstContactHavePhone.title.individual = Can we contact you by telephone? +firstContactHavePhone.heading.individual = Can we contact you by telephone? +firstContactHavePhone.p1 = We will call if we have any questions about reports for {0}. +firstContactHavePhone.error.required.individual = Select yes if we can contact you by telephone +firstContactHavePhone.error.required.business = Select yes if they can be contacted by telephone haveUniqueTaxpayerReference.title = Is there a Unique Taxpayer Reference (UTR)? haveUniqueTaxpayerReference.heading = Does {0} have a Unique Taxpayer Reference (UTR)? diff --git a/project/plugins.sbt b/project/plugins.sbt index c23a3f55..2d01ca34 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,7 +10,7 @@ ThisBuild / libraryDependencySchemes ++= Seq( addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.21.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.22.0") addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0") diff --git a/test/controllers/addFinancialInstitution/FirstContactEmailControllerSpec.scala b/test/controllers/addFinancialInstitution/FirstContactEmailControllerSpec.scala index bc55d941..62833006 100644 --- a/test/controllers/addFinancialInstitution/FirstContactEmailControllerSpec.scala +++ b/test/controllers/addFinancialInstitution/FirstContactEmailControllerSpec.scala @@ -23,7 +23,7 @@ import navigation.{FakeNavigator, Navigator} import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when import org.scalatestplus.mockito.MockitoSugar -import pages.addFinancialInstitution.{ContactNamePage, FirstContactEmailPage, NameOfFinancialInstitutionPage} +import pages.addFinancialInstitution.{FirstContactEmailPage, FirstContactNamePage, NameOfFinancialInstitutionPage} import play.api.inject.bind import play.api.mvc.Call import play.api.test.FakeRequest @@ -46,7 +46,7 @@ class FirstContactEmailControllerSpec extends SpecBase with MockitoSugar { val financialInstitution = "Placeholder Financial Institution" private val ua = emptyUserAnswers - .withPage(ContactNamePage, contactName) + .withPage(FirstContactNamePage, contactName) .withPage(NameOfFinancialInstitutionPage, financialInstitution) "FirstContactEmail Controller" - { diff --git a/test/controllers/addFinancialInstitution/ContactHavePhoneControllerSpec.scala b/test/controllers/addFinancialInstitution/FirstContactHavePhoneControllerSpec.scala similarity index 87% rename from test/controllers/addFinancialInstitution/ContactHavePhoneControllerSpec.scala rename to test/controllers/addFinancialInstitution/FirstContactHavePhoneControllerSpec.scala index 05dea70e..06cd1b70 100644 --- a/test/controllers/addFinancialInstitution/ContactHavePhoneControllerSpec.scala +++ b/test/controllers/addFinancialInstitution/FirstContactHavePhoneControllerSpec.scala @@ -17,7 +17,7 @@ package controllers.addFinancialInstitution import base.SpecBase -import forms.addFinancialInstitution.ContactHavePhoneFormProvider +import forms.addFinancialInstitution.FirstContactHavePhoneFormProvider import models.NormalMode import navigation.{FakeNavigator, Navigator} import org.mockito.ArgumentMatchers.any @@ -29,24 +29,24 @@ import play.api.mvc.Call import play.api.test.FakeRequest import play.api.test.Helpers._ import repositories.SessionRepository -import views.html.addFinancialInstitution.ContactHavePhoneView +import views.html.addFinancialInstitution.FirstContactHavePhoneView import scala.concurrent.Future -class ContactHavePhoneControllerSpec extends SpecBase with MockitoSugar { +class FirstContactHavePhoneControllerSpec extends SpecBase with MockitoSugar { def onwardRoute = Call("GET", "/foo") - val formProvider = new ContactHavePhoneFormProvider() + val formProvider = new FirstContactHavePhoneFormProvider() val form = formProvider() - lazy val contactHavePhoneRoute = routes.ContactHavePhoneController.onPageLoad(NormalMode).url + lazy val contactHavePhoneRoute = routes.FirstContactHavePhoneController.onPageLoad(NormalMode).url val contactName = "Mr Test" val financialInstitution = "Placeholder Financial Institution" private val ua = emptyUserAnswers - .withPage(ContactNamePage, contactName) + .withPage(FirstContactNamePage, contactName) .withPage(NameOfFinancialInstitutionPage, financialInstitution) "ContactHavePhone Controller" - { @@ -60,7 +60,7 @@ class ContactHavePhoneControllerSpec extends SpecBase with MockitoSugar { val result = route(application, request).value - val view = application.injector.instanceOf[ContactHavePhoneView] + val view = application.injector.instanceOf[FirstContactHavePhoneView] status(result) mustEqual OK contentAsString(result) mustEqual view(form, NormalMode, financialInstitution, contactName)(request, messages(application)).toString @@ -68,14 +68,14 @@ class ContactHavePhoneControllerSpec extends SpecBase with MockitoSugar { } "must populate the view correctly on a GET when the question has previously been answered" in { - val userAnswers = ua.withPage(ContactHavePhonePage, true) + val userAnswers = ua.withPage(FirstContactHavePhonePage, true) val application = applicationBuilder(userAnswers = Some(userAnswers)).build() running(application) { val request = FakeRequest(GET, contactHavePhoneRoute) - val view = application.injector.instanceOf[ContactHavePhoneView] + val view = application.injector.instanceOf[FirstContactHavePhoneView] val result = route(application, request).value @@ -121,7 +121,7 @@ class ContactHavePhoneControllerSpec extends SpecBase with MockitoSugar { val boundForm = form.bind(Map("value" -> "")) - val view = application.injector.instanceOf[ContactHavePhoneView] + val view = application.injector.instanceOf[FirstContactHavePhoneView] val result = route(application, request).value diff --git a/test/controllers/addFinancialInstitution/ContactNameControllerSpec.scala b/test/controllers/addFinancialInstitution/FirstContactNameControllerSpec.scala similarity index 86% rename from test/controllers/addFinancialInstitution/ContactNameControllerSpec.scala rename to test/controllers/addFinancialInstitution/FirstContactNameControllerSpec.scala index c2295b2e..a29721db 100644 --- a/test/controllers/addFinancialInstitution/ContactNameControllerSpec.scala +++ b/test/controllers/addFinancialInstitution/FirstContactNameControllerSpec.scala @@ -17,29 +17,29 @@ package controllers.addFinancialInstitution import base.SpecBase -import forms.addFinancialInstitution.ContactNameFormProvider +import forms.addFinancialInstitution.FirstContactNameFormProvider import models.NormalMode import navigation.{FakeNavigator, Navigator} import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when import org.scalatestplus.mockito.MockitoSugar -import pages.addFinancialInstitution.{ContactNamePage, NameOfFinancialInstitutionPage} +import pages.addFinancialInstitution.{FirstContactNamePage, NameOfFinancialInstitutionPage} import play.api.inject.bind import play.api.mvc.Call import play.api.test.FakeRequest import play.api.test.Helpers._ import repositories.SessionRepository -import views.html.addFinancialInstitution.ContactNameView +import views.html.addFinancialInstitution.FirstContactNameView import scala.concurrent.Future -class ContactNameControllerSpec extends SpecBase with MockitoSugar { +class FirstContactNameControllerSpec extends SpecBase with MockitoSugar { def onwardRoute = Call("GET", "/foo") - val formProvider = new ContactNameFormProvider() + val formProvider = new FirstContactNameFormProvider() val form = formProvider() - lazy val contactNameRoute = routes.ContactNameController.onPageLoad(NormalMode).url + lazy val contactNameRoute = routes.FirstContactNameController.onPageLoad(NormalMode).url val fiName = "FI name" private val ua = emptyUserAnswers.set(NameOfFinancialInstitutionPage, fiName).get private val mockSessionRepository = mock[SessionRepository] @@ -56,7 +56,7 @@ class ContactNameControllerSpec extends SpecBase with MockitoSugar { val result = route(application, request).value - val view = application.injector.instanceOf[ContactNameView] + val view = application.injector.instanceOf[FirstContactNameView] status(result) mustEqual OK contentAsString(result) mustEqual view(form, NormalMode, "FI name")(request, messages(application)).toString @@ -65,14 +65,14 @@ class ContactNameControllerSpec extends SpecBase with MockitoSugar { "must populate the view correctly on a GET when the question has previously been answered" in { - val userAnswers = ua.set(ContactNamePage, "answer").success.value + val userAnswers = ua.set(FirstContactNamePage, "answer").success.value val application = applicationBuilder(userAnswers = Some(userAnswers)).build() running(application) { val request = FakeRequest(GET, contactNameRoute) - val view = application.injector.instanceOf[ContactNameView] + val view = application.injector.instanceOf[FirstContactNameView] val result = route(application, request).value @@ -114,7 +114,7 @@ class ContactNameControllerSpec extends SpecBase with MockitoSugar { val boundForm = form.bind(Map("value" -> "")) - val view = application.injector.instanceOf[ContactNameView] + val view = application.injector.instanceOf[FirstContactNameView] val result = route(application, request).value diff --git a/test/controllers/addFinancialInstitution/FirstContactPhoneNumberControllerSpec.scala b/test/controllers/addFinancialInstitution/FirstContactPhoneNumberControllerSpec.scala index bfd125b5..77199f16 100644 --- a/test/controllers/addFinancialInstitution/FirstContactPhoneNumberControllerSpec.scala +++ b/test/controllers/addFinancialInstitution/FirstContactPhoneNumberControllerSpec.scala @@ -23,7 +23,7 @@ import navigation.{FakeNavigator, Navigator} import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when import org.scalatestplus.mockito.MockitoSugar -import pages.addFinancialInstitution.{ContactNamePage, FirstContactPhoneNumberPage} +import pages.addFinancialInstitution.{FirstContactNamePage, FirstContactPhoneNumberPage} import play.api.inject.bind import play.api.mvc.Call import play.api.test.FakeRequest @@ -42,7 +42,7 @@ class FirstContactPhoneNumberControllerSpec extends SpecBase with MockitoSugar { val defaultName = "your first contact" val name = "Firstname Lastname" - val userAnswers = emptyUserAnswers.set(ContactNamePage, name).success.value + val userAnswers = emptyUserAnswers.set(FirstContactNamePage, name).success.value lazy val firstContactPhoneNumberRoute = routes.FirstContactPhoneNumberController.onPageLoad(NormalMode).url diff --git a/test/controllers/addFinancialInstitution/SecondContactExistsControllerSpec.scala b/test/controllers/addFinancialInstitution/SecondContactExistsControllerSpec.scala index ec8c1fb5..ae2c3ff0 100644 --- a/test/controllers/addFinancialInstitution/SecondContactExistsControllerSpec.scala +++ b/test/controllers/addFinancialInstitution/SecondContactExistsControllerSpec.scala @@ -23,7 +23,7 @@ import navigation.{FakeNavigator, Navigator} import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when import org.scalatestplus.mockito.MockitoSugar -import pages.addFinancialInstitution.{ContactNamePage, SecondContactExistsPage} +import pages.addFinancialInstitution.{FirstContactNamePage, SecondContactExistsPage} import play.api.inject.bind import play.api.mvc.Call import play.api.test.FakeRequest @@ -43,7 +43,7 @@ class SecondContactExistsControllerSpec extends SpecBase with MockitoSugar { val name: Name = Name(FirstName, LastName) val form = formProvider() val contactName = name.fullName - val userAnswers: UserAnswers = emptyUserAnswers.set(ContactNamePage, contactName).success.value + val userAnswers: UserAnswers = emptyUserAnswers.set(FirstContactNamePage, contactName).success.value lazy val secondContactExistsRoute = routes.SecondContactExistsController.onPageLoad(NormalMode).url diff --git a/test/forms/addFinancialInstitution/ContactHavePhoneFormProviderSpec.scala b/test/forms/addFinancialInstitution/FirstContactHavePhoneFormProviderSpec.scala similarity index 84% rename from test/forms/addFinancialInstitution/ContactHavePhoneFormProviderSpec.scala rename to test/forms/addFinancialInstitution/FirstContactHavePhoneFormProviderSpec.scala index 6fc39af6..b07bb60d 100644 --- a/test/forms/addFinancialInstitution/ContactHavePhoneFormProviderSpec.scala +++ b/test/forms/addFinancialInstitution/FirstContactHavePhoneFormProviderSpec.scala @@ -19,12 +19,12 @@ package forms.addFinancialInstitution import forms.behaviours.BooleanFieldBehaviours import play.api.data.FormError -class ContactHavePhoneFormProviderSpec extends BooleanFieldBehaviours { +class FirstContactHavePhoneFormProviderSpec extends BooleanFieldBehaviours { - val requiredKey = "contactHavePhone.error.required.business" + val requiredKey = "firstContactHavePhone.error.required.business" val invalidKey = "error.boolean" - val form = new ContactHavePhoneFormProvider()() + val form = new FirstContactHavePhoneFormProvider()() ".value" - { diff --git a/test/forms/addFinancialInstitution/ContactNameFormProviderSpec.scala b/test/forms/addFinancialInstitution/FirstContactNameFormProviderSpec.scala similarity index 81% rename from test/forms/addFinancialInstitution/ContactNameFormProviderSpec.scala rename to test/forms/addFinancialInstitution/FirstContactNameFormProviderSpec.scala index a890ff9b..b890034c 100644 --- a/test/forms/addFinancialInstitution/ContactNameFormProviderSpec.scala +++ b/test/forms/addFinancialInstitution/FirstContactNameFormProviderSpec.scala @@ -21,14 +21,14 @@ import play.api.data.FormError import utils.RegexConstants import wolfendale.scalacheck.regexp.RegexpGen -class ContactNameFormProviderSpec extends StringFieldBehaviours with RegexConstants { +class FirstContactNameFormProviderSpec extends StringFieldBehaviours with RegexConstants { - val requiredKey = "contactName.error.required" - val lengthKey = "contactName.error.length" - val invalidKey = "contactName.error.invalid" + val requiredKey = "firstContactName.error.required" + val lengthKey = "firstContactName.error.length" + val invalidKey = "firstContactName.error.invalid" val maxLength = 35 - val form = new ContactNameFormProvider()() + val form = new FirstContactNameFormProvider()() ".value" - { diff --git a/test/navigation/NavigatorSpec.scala b/test/navigation/NavigatorSpec.scala index 3f9b7d57..61a0a913 100644 --- a/test/navigation/NavigatorSpec.scala +++ b/test/navigation/NavigatorSpec.scala @@ -18,10 +18,10 @@ package navigation import base.SpecBase import controllers.addFinancialInstitution.routes -import pages.addFinancialInstitution._ -import pages._ import models._ +import pages._ import pages.addFinancialInstitution.IsRegisteredBusiness.{IsThisYourBusinessNamePage, ReportForRegisteredBusinessPage} +import pages.addFinancialInstitution._ class NavigatorSpec extends SpecBase { @@ -35,23 +35,23 @@ class NavigatorSpec extends SpecBase { case object UnknownPage extends Page navigator.nextPage(UnknownPage, NormalMode, UserAnswers("id")) mustBe controllers.routes.IndexController.onPageLoad } - "must go from ContactName page to FirstContactEmail" in { - navigator.nextPage(ContactNamePage, NormalMode, UserAnswers("id")) mustBe + "must go from FirstContactName page to FirstContactEmail" in { + navigator.nextPage(FirstContactNamePage, NormalMode, UserAnswers("id")) mustBe routes.FirstContactEmailController.onPageLoad(NormalMode) } - "must go from FirstContactEmail page to FirstContactCanWePhone" in { + "must go from FirstContactEmail page to FirstContactHavePhone" in { navigator.nextPage(FirstContactEmailPage, NormalMode, UserAnswers("id")) mustBe - routes.ContactHavePhoneController.onPageLoad(NormalMode) + routes.FirstContactHavePhoneController.onPageLoad(NormalMode) } - "must go from ContactHavePhonePage" - { + "must go from FirstContactHavePhonePage" - { " to FirstContactPhone if Yes" in { - val userAnswers = emptyUserAnswers.set(ContactHavePhonePage, true).get - navigator.nextPage(ContactHavePhonePage, NormalMode, userAnswers) mustBe + val userAnswers = emptyUserAnswers.set(FirstContactHavePhonePage, true).get + navigator.nextPage(FirstContactHavePhonePage, NormalMode, userAnswers) mustBe routes.FirstContactPhoneNumberController.onPageLoad(NormalMode) } " to SecondContactExists if No" in { - val userAnswers = emptyUserAnswers.set(ContactHavePhonePage, false).get - navigator.nextPage(ContactHavePhonePage, NormalMode, userAnswers) mustBe + val userAnswers = emptyUserAnswers.set(FirstContactHavePhonePage, false).get + navigator.nextPage(FirstContactHavePhonePage, NormalMode, userAnswers) mustBe routes.SecondContactExistsController.onPageLoad(NormalMode) } } @@ -125,7 +125,7 @@ class NavigatorSpec extends SpecBase { "must go from IsThisAddress page to ContactName page when user answers yes" in { val userAnswers = emptyUserAnswers.withPage(IsThisAddressPage, true) navigator.nextPage(IsThisAddressPage, NormalMode, userAnswers) mustBe - routes.ContactNameController.onPageLoad(NormalMode) + routes.FirstContactNameController.onPageLoad(NormalMode) } "must go from IsThisAddress page to ukAddress page when user answers no" in { @@ -198,14 +198,14 @@ class NavigatorSpec extends SpecBase { routes.NonUkAddressController.onPageLoad(NormalMode) } - "must go from UkAddress to ContactName" in { + "must go from UkAddress to FirstContactName" in { navigator.nextPage(UkAddressPage, NormalMode, emptyUserAnswers) mustBe - routes.ContactNameController.onPageLoad(NormalMode) + routes.FirstContactNameController.onPageLoad(NormalMode) } - "must go from NonUkAddress to ContactName" in { + "must go from NonUkAddress to FirstContactName" in { navigator.nextPage(NonUkAddressPage, NormalMode, emptyUserAnswers) mustBe - routes.ContactNameController.onPageLoad(NormalMode) + routes.FirstContactNameController.onPageLoad(NormalMode) } "must go from ReportForRegisteredBusiness" - { diff --git a/test/utils/CountryListFactorySpec.scala b/test/utils/CountryListFactorySpec.scala index b4293a58..e1f9f24d 100644 --- a/test/utils/CountryListFactorySpec.scala +++ b/test/utils/CountryListFactorySpec.scala @@ -38,7 +38,8 @@ class CountryListFactorySpec extends SpecBase with GuiceOneAppPerSuite with Befo private val conf = mock[FrontendAppConfig] private val env = mock[Environment] - override def beforeEach(): Unit = reset(conf, env) + override def beforeEach(): Unit = + reset(conf, env) "Country List Factory" - {