Skip to content

Commit

Permalink
DDCE-4769: Remove options at ReviewGoods page for exceeded allowances (
Browse files Browse the repository at this point in the history
…#513)

* DDCE-4769: Remove options at ReviewGoods page for exceeded allowances

* DDCE-4769: Update dependencies and fix warnings

* DDCE-4769: Platform Mongo 5.0 TTL index change
  • Loading branch information
EdCope authored Nov 15, 2023
1 parent 8ecc3f6 commit 73f2ebb
Show file tree
Hide file tree
Showing 8 changed files with 380 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
package uk.gov.hmrc.merchandiseinbaggage.controllers

import cats.data.OptionT
import javax.inject.{Inject, Singleton}
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents, Result}
import play.api.mvc.{Action, AnyContent, Call, MessagesControllerComponents, Result}
import uk.gov.hmrc.http.HeaderCarrier
import uk.gov.hmrc.merchandiseinbaggage.config.AppConfig
import uk.gov.hmrc.merchandiseinbaggage.controllers.DeclarationJourneyController.{declarationNotFoundMessage, goodsDeclarationIncompleteMessage}
import uk.gov.hmrc.merchandiseinbaggage.controllers.routes._
import uk.gov.hmrc.merchandiseinbaggage.forms.ReviewGoodsForm.form
import uk.gov.hmrc.merchandiseinbaggage.model.api.DeclarationType.{Export, Import}
import uk.gov.hmrc.merchandiseinbaggage.model.api.YesNo
import uk.gov.hmrc.merchandiseinbaggage.model.api.calculation.{CalculationResponse, CalculationResults, WithinThreshold}
import uk.gov.hmrc.merchandiseinbaggage.model.api.YesNo.No
import uk.gov.hmrc.merchandiseinbaggage.model.api.calculation.{CalculationResponse, CalculationResults, OverThreshold, WithinThreshold}
import uk.gov.hmrc.merchandiseinbaggage.model.core.DeclarationJourney
import uk.gov.hmrc.merchandiseinbaggage.navigation.ReviewGoodsRequest
import uk.gov.hmrc.merchandiseinbaggage.repositories.DeclarationJourneyRepository
import uk.gov.hmrc.merchandiseinbaggage.service.MibService
import uk.gov.hmrc.merchandiseinbaggage.views.html.ReviewGoodsView

import javax.inject.{Inject, Singleton}
import scala.concurrent.{ExecutionContext, Future}

@Singleton
Expand All @@ -46,7 +47,7 @@ class ReviewGoodsController @Inject() (
)(implicit ec: ExecutionContext, appConfig: AppConfig)
extends DeclarationJourneyUpdateController {

private def backButtonUrl(implicit request: DeclarationJourneyRequest[_]) =
private def backButtonUrl(implicit request: DeclarationJourneyRequest[_]): Call =
request.declarationJourney.declarationType match {
case Import => GoodsVatRateController.onPageLoad(request.declarationJourney.goodsEntries.entries.size)
case Export => SearchGoodsCountryController.onPageLoad(request.declarationJourney.goodsEntries.entries.size)
Expand All @@ -70,9 +71,13 @@ class ReviewGoodsController @Inject() (
.bindFromRequest()
.fold(
formWithErrors =>
Future.successful(
BadRequest(view(formWithErrors, thresholdAllowance, backButtonUrl, declarationType, journeyType))
),
if (thresholdAllowance.currentStatus == OverThreshold) {
redirectTo(declareMoreGoods = No)
} else {
Future.successful(
BadRequest(view(formWithErrors, thresholdAllowance, backButtonUrl, declarationType, journeyType))
)
},
redirectTo
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package uk.gov.hmrc.merchandiseinbaggage.model.core

import uk.gov.hmrc.merchandiseinbaggage.model.api.calculation.CalculationResponse
import uk.gov.hmrc.merchandiseinbaggage.model.api.{DeclarationGoods, ExportGoods, Goods, GoodsDestination, ImportGoods}
import uk.gov.hmrc.merchandiseinbaggage.model.api.calculation.{CalculationResponse, ThresholdCheck}
import uk.gov.hmrc.merchandiseinbaggage.model.api._
import uk.gov.hmrc.merchandiseinbaggage.utils.DataModelEnriched._

import scala.util.Try
Expand All @@ -27,7 +27,9 @@ case class ThresholdAllowance(
allGoods: DeclarationGoods,
calculationResponse: CalculationResponse,
destination: GoodsDestination
)
) {
val currentStatus: ThresholdCheck = calculationResponse.thresholdCheck
}

object ThresholdAllowance {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@
case WithinThreshold => {
@h2(messages("reviewGoods.h2"), classes = Some("govuk-heading-m"))
<div class="govuk-inset-text">@messages("reviewGoods.allowance.declared")<span class="govuk-!-font-weight-bold"> @allowance.toUIString </span>@messages("reviewGoods.allowance.left")</div>

@inputYesNo(
form = form,
legend = messages(s"reviewGoods.h2"),
legendAsHeading = false,
classes = "govuk-visually-hidden"
)
}
case OverThreshold => {
<div class="govuk-inset-text">@messages("reviewGoods.allowance.over")</div>
}
}

@inputYesNo(
form = form,
legend = messages(s"reviewGoods.h2"),
legendAsHeading = false,
classes = "govuk-visually-hidden"
)

@button("site.continue", name = Some("continue"))
}
}
8 changes: 4 additions & 4 deletions project/AppDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import sbt.*
object AppDependencies {

private val pactVersion = "4.4.0"
private val bootstrapVersion = "7.22.0"
private val bootstrapVersion = "7.23.0"

val compile: Seq[ModuleID] = Seq(
"uk.gov.hmrc" %% "bootstrap-frontend-play-28" % bootstrapVersion,
"uk.gov.hmrc" %% "play-frontend-hmrc" % "7.24.0-play-28",
"uk.gov.hmrc" %% "play-frontend-hmrc" % "7.27.0-play-28",
"uk.gov.hmrc.mongo" %% "hmrc-mongo-play-28" % "1.3.0",
"com.github.pureconfig" %% "pureconfig" % "0.17.4",
"com.beachape" %% "enumeratum-play" % "1.7.0",
Expand All @@ -22,8 +22,8 @@ object AppDependencies {
"com.vladsch.flexmark" % "flexmark-all" % "0.64.8",
"org.scalatest" %% "scalatest" % "3.2.17",
"org.scalatestplus" %% "scalacheck-1-17" % "3.2.17.0",
"org.mockito" %% "mockito-scala-scalatest" % "1.17.27",
"org.wiremock" % "wiremock-standalone" % "3.2.0"
"org.mockito" %% "mockito-scala-scalatest" % "1.17.29",
"org.wiremock" % "wiremock-standalone" % "3.3.1"
) ++ pact).map(_ % Test)

private lazy val pact = Seq(
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resolvers += Resolver.url("HMRC-open-artefacts-ivy2", url("https://open.artefact
// Try to remove when sbt 1.8.0+ and scoverage is 2.0.7+
ThisBuild / libraryDependencySchemes ++= Seq("org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always)

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.14.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.15.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.2.0")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.20")
addSbtPlugin("io.github.irundaia" % "sbt-sassify" % "1.5.2")
Expand All @@ -16,4 +16,4 @@ addSbtPlugin("com.beautiful-scala" % "sbt-scalastyle" % "1.5.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
addSbtPlugin("com.itv" % "sbt-scalapact" % "3.3.1")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("uk.gov.hmrc" % "sbt-accessibility-linter" % "0.36.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-accessibility-linter" % "0.37.0")
Loading

0 comments on commit 73f2ebb

Please sign in to comment.