Skip to content

Commit

Permalink
Tgp 2609/remove goods description question page (#490)
Browse files Browse the repository at this point in the history
* TGP-2609: remove goods description question page in the create record journey and remove question row on the check your answers page
  • Loading branch information
omotrium authored Oct 4, 2024
1 parent f92a873 commit 680eb7d
Show file tree
Hide file tree
Showing 27 changed files with 42 additions and 838 deletions.
1 change: 0 additions & 1 deletion app/controllers/CyaCreateRecordController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class CyaCreateRecordController @Inject() (
val list = SummaryListViewModel(
rows = Seq(
TraderReferenceSummary.row(userAnswers),
UseTraderReferenceSummary.row(userAnswers),
GoodsDescriptionSummary.row(userAnswers),
CountryOfOriginSummary.row(userAnswers, countries),
CommodityCodeSummary.row(userAnswers)
Expand Down
79 changes: 0 additions & 79 deletions app/controllers/UseTraderReferenceController.scala

This file was deleted.

8 changes: 5 additions & 3 deletions app/factories/AuditEventFactory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,18 @@ case class AuditEventFactory() {
def createSubmitGoodsRecordEventForCreateRecord(
affinityGroup: AffinityGroup,
journey: Journey,
goodsRecord: GoodsRecord,
isUsingGoodsDescription: Boolean
goodsRecord: GoodsRecord
)(implicit hc: HeaderCarrier): DataEvent = {
val auditDetails = Map(
"eori" -> goodsRecord.eori,
"affinityGroup" -> affinityGroup.toString,
"journey" -> journey.toString,
"traderReference" -> goodsRecord.traderRef,
"goodsDescription" -> goodsRecord.goodsDescription,
"countryOfOrigin" -> goodsRecord.countryOfOrigin,
"commodityCode" -> goodsRecord.commodity.commodityCode,
traderReferenceKey -> goodsRecord.traderRef,
goodsDescriptionKey -> goodsRecord.goodsDescription,
"specifiedGoodsDescription" -> isUsingGoodsDescription.toString,
countryOfOriginKey -> goodsRecord.countryOfOrigin,
commodityCodeKey -> goodsRecord.commodity.commodityCode,
"commodityDescription" -> goodsRecord.commodity.descriptions.headOption.getOrElse("null"),
Expand Down
30 changes: 0 additions & 30 deletions app/forms/UseTraderReferenceFormProvider.scala

This file was deleted.

9 changes: 1 addition & 8 deletions app/models/GoodsRecord.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object GoodsRecord {
answers.getPageValue(TraderReferencePage),
getCommodity(answers),
answers.getPageValue(CountryOfOriginPage),
getGoodsDescription(answers)
answers.getPageValue(GoodsDescriptionPage)
).parMapN((eori, traderReference, commodity, countryOfOrigin, goodsDescription) =>
GoodsRecord(
eori,
Expand All @@ -51,13 +51,6 @@ object GoodsRecord {
)
)

private def getGoodsDescription(answers: UserAnswers): EitherNec[ValidationError, String] =
answers.getOppositeOptionalPageValue(answers, UseTraderReferencePage, GoodsDescriptionPage) match {
case Right(Some(data)) => Right(data)
case Right(None) => answers.getPageValue(TraderReferencePage)
case Left(errors) => Left(errors)
}

private def getCommodity(answers: UserAnswers): EitherNec[ValidationError, Commodity] =
answers.getPageValue(CommodityCodePage) match {
case Right(code) =>
Expand Down
11 changes: 0 additions & 11 deletions app/models/UserAnswers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ final case class UserAnswers(
case Left(errors) => Left(errors)
}

def getOppositeOptionalPageValue(
answers: UserAnswers,
questionPage: QuestionPage[Boolean],
optionalPage: QuestionPage[String]
): EitherNec[ValidationError, Option[String]] =
getPageValue(questionPage) match {
case Right(false) => getPageValue(optionalPage).map(Some(_))
case Right(true) => unexpectedValueDefined(answers, optionalPage)
case Left(errors) => Left(errors)
}

def getOptionalPageValueForOptionalBooleanPage[A](
answers: UserAnswers,
questionPage: QuestionPage[Boolean],
Expand Down
1 change: 0 additions & 1 deletion app/models/helper/Journey.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ case object CreateRecordJourney extends Journey {
val pages: Seq[String] =
Seq(
traderReferencePage,
useTraderReferencePage,
goodsDescriptionPage,
countryOfOriginPage,
commodityCodePage,
Expand Down
27 changes: 1 addition & 26 deletions app/navigation/Navigator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ class Navigator @Inject() (categorisationService: CategorisationService) {
case RemoveNiphlPage => navigateFromRemoveNiphlPage
case CyaMaintainProfilePage => _ => routes.ProfileController.onPageLoad()
case CreateRecordStartPage => _ => routes.TraderReferenceController.onPageLoadCreate(NormalMode)
case TraderReferencePage => _ => routes.UseTraderReferenceController.onPageLoad(NormalMode)
case TraderReferencePage => _ => routes.GoodsDescriptionController.onPageLoadCreate(NormalMode)
case p: TraderReferenceUpdatePage => _ => routes.CyaUpdateRecordController.onPageLoadTraderReference(p.recordId)
case UseTraderReferencePage => navigateFromUseTraderReference
case GoodsDescriptionPage => _ => routes.CountryOfOriginController.onPageLoadCreate(NormalMode)
case p: GoodsDescriptionUpdatePage => _ => routes.CyaUpdateRecordController.onPageLoadGoodsDescription(p.recordId)
case CountryOfOriginPage => _ => routes.CommodityCodeController.onPageLoadCreate(NormalMode)
Expand Down Expand Up @@ -160,15 +159,6 @@ class Navigator @Inject() (categorisationService: CategorisationService) {
.getOrElse(routes.JourneyRecoveryController.onPageLoad(Some(continueUrl)))
}

private def navigateFromUseTraderReference(answers: UserAnswers): Call =
answers
.get(UseTraderReferencePage)
.map {
case false => routes.GoodsDescriptionController.onPageLoadCreate(NormalMode)
case true => routes.CountryOfOriginController.onPageLoadCreate(NormalMode)
}
.getOrElse(routes.JourneyRecoveryController.onPageLoad())

private def navigateFromHasCorrectGoods(answers: UserAnswers): Call =
answers
.get(HasCorrectGoodsPage)
Expand Down Expand Up @@ -465,7 +455,6 @@ class Navigator @Inject() (categorisationService: CategorisationService) {
case UkimsNumberUpdatePage => _ => routes.CyaMaintainProfileController.onPageLoadUkimsNumber
case TraderReferencePage => _ => routes.CyaCreateRecordController.onPageLoad
case p: TraderReferenceUpdatePage => _ => routes.CyaUpdateRecordController.onPageLoadTraderReference(p.recordId)
case UseTraderReferencePage => navigateFromUseTraderReferenceCheck
case GoodsDescriptionPage => _ => routes.CyaCreateRecordController.onPageLoad
case p: GoodsDescriptionUpdatePage => _ => routes.CyaUpdateRecordController.onPageLoadGoodsDescription(p.recordId)
case CountryOfOriginPage => _ => routes.CyaCreateRecordController.onPageLoad
Expand Down Expand Up @@ -520,20 +509,6 @@ class Navigator @Inject() (categorisationService: CategorisationService) {
}
.getOrElse(routes.JourneyRecoveryController.onPageLoad())

private def navigateFromUseTraderReferenceCheck(answers: UserAnswers): Call =
answers
.get(UseTraderReferencePage)
.map {
case false =>
if (answers.isDefined(GoodsDescriptionPage)) {
routes.CyaCreateRecordController.onPageLoad
} else {
routes.GoodsDescriptionController.onPageLoadCreate(CheckMode)
}
case true => routes.CyaCreateRecordController.onPageLoad
}
.getOrElse(routes.JourneyRecoveryController.onPageLoad())

private def navigateFromHasCorrectGoodsCheck(answers: UserAnswers): Call =
answers
.get(HasCorrectGoodsPage)
Expand Down
39 changes: 0 additions & 39 deletions app/pages/UseTraderReferencePage.scala

This file was deleted.

6 changes: 2 additions & 4 deletions app/services/AuditService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package services

import cats.implicits.catsSyntaxTuple4Parallel
import cats.implicits.catsSyntaxTuple3Parallel
import com.google.inject.Inject
import factories.AuditEventFactory
import models.audits.{AuditGetCategorisationAssessment, AuditValidateCommodityCode, OttAuditData}
Expand All @@ -25,7 +25,6 @@ import models.ott.CategorisationInfo
import models.ott.response.OttResponse
import models.{AdviceRequest, CategoryRecord, GoodsRecord, SupplementaryRequest, TraderProfile, UpdateGoodsRecord, UserAnswers}
import org.apache.pekko.Done
import pages.UseTraderReferencePage
import play.api.Logging
import uk.gov.hmrc.auth.core.AffinityGroup
import uk.gov.hmrc.http.HeaderCarrier
Expand Down Expand Up @@ -105,8 +104,7 @@ class AuditService @Inject() (auditConnector: AuditConnector, auditEventFactory:
val buildEvent = (
Right(affinityGroup),
Right(CreateRecordJourney),
GoodsRecord.build(userAnswers, eori),
userAnswers.getPageValue(UseTraderReferencePage).map(!_)
GoodsRecord.build(userAnswers, eori)
).parMapN(auditEventFactory.createSubmitGoodsRecordEventForCreateRecord)

buildEvent match {
Expand Down
1 change: 0 additions & 1 deletion app/utils/SessionData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ case object SessionData {
val nirmsNumberUpdatePage: String = "NIRMS"
val niphlNumberUpdatePage: String = "NIPHL"
val traderReferencePage: String = traderReferenceKey
val useTraderReferencePage: String = "useTraderReference"
val goodsDescriptionPage: String = goodsDescriptionKey
val countryOfOriginPage: String = countryOfOriginKey
val commodityCodePage: String = commodityCodeKey
Expand Down
42 changes: 0 additions & 42 deletions app/viewmodels/checkAnswers/UseTraderReferenceSummary.scala

This file was deleted.

Loading

0 comments on commit 680eb7d

Please sign in to comment.