Skip to content

Commit

Permalink
Merge pull request #12 from hmrc/MIBM-77-copy
Browse files Browse the repository at this point in the history
[PH][MIBM-77] correct copy on check-your-answers
  • Loading branch information
PaulHodgson authored Sep 29, 2020
2 parents 3bb5a39 + 17a936b commit 688fdfe
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ class TestOnlyController @Inject()(mcc: MessagesControllerComponents,
GoodsEntry(
"wine",
Some("France"),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(100.00)), "EUR")),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(100.00)), Currency("Euros", "EUR"))),
Some(CurrencyAmount(BigDecimal(10.00)))),
GoodsEntry(
"cheese",
Some("France"),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(200.00)), "EUR")),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(200.00)), Currency("Euros", "EUR"))),
Some(CurrencyAmount(BigDecimal(20.00))))),
maybeName = Some(Name("Terry", "Test")),
maybeAddress = Some(Address("1 Terry Terrace", "Terry Town", "T11 11T")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package uk.gov.hmrc.merchandiseinbaggagefrontend.model.declaration

import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.UUID.randomUUID

import play.api.libs.json.{Format, Json, OFormat}
Expand All @@ -38,8 +39,16 @@ object CurrencyAmount {
implicit val format: OFormat[CurrencyAmount] = Json.format[CurrencyAmount]
}

case class PriceOfGoods(amount: CurrencyAmount, currency: String) {
override val toString = s"$amount $currency"
case class Currency(name: String, code: String) {
override val toString = s"$name ($code)"
}

object Currency {
implicit val format: OFormat[Currency] = Json.format[Currency]
}

case class PriceOfGoods(amount: CurrencyAmount, currency: Currency) {
override val toString = s"$amount, $currency"
}

object PriceOfGoods {
Expand Down Expand Up @@ -68,12 +77,7 @@ case class Address(maybeLine1: Option[String],
maybeTown: Option[String] = None,
maybeCounty: Option[String] = None,
postCode: String) {

override val toString: String = {
def lineString(maybeLine: Option[String]) = maybeLine.fold("")(line => s"$line, ")

s"${lineString(maybeLine1)}${lineString(maybeLine2)}${lineString(maybeTown)}${lineString(maybeCounty)}$postCode"
}
val populatedAddressLines: Seq[String] = Seq(maybeLine1, maybeLine2, maybeTown, maybeCounty).flatten
}

object Address {
Expand All @@ -90,7 +94,9 @@ object Eori {
implicit val format: OFormat[Eori] = Json.format[Eori]
}

case class JourneyDetails(placeOfArrival: String, dateOfArrival: LocalDate)
case class JourneyDetails(placeOfArrival: String, dateOfArrival: LocalDate) {
val formattedDateOfArrival: String = DateTimeFormatter.ofPattern("dd MMM yyyy").format(dateOfArrival)
}

object JourneyDetails {
implicit val format: OFormat[JourneyDetails] = Json.format[JourneyDetails]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h2 class="govuk-heading-m" id="main-message">@messages("checkYourAnswers.detail
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">@messages("checkYourAnswers.detailsOfTheGoods.taxDue")</dt>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">@goods.taxDue</dd>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">£@goods.taxDue</dd>
</div>
</dl>
}
Expand All @@ -56,7 +56,14 @@ <h2 class="govuk-heading-m" id="main-message">@messages("checkYourAnswers.person
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">@messages("checkYourAnswers.personalDetails.address")</dt>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">@declaration.address</dd>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">
@for(addressLine <- declaration.address.populatedAddressLines) {
@addressLine
<br>
}

@declaration.address.postCode
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">@messages("checkYourAnswers.personalDetails.eori")</dt>
Expand All @@ -73,13 +80,13 @@ <h2 class="govuk-heading-m" id="main-message">@messages("checkYourAnswers.journe
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">@messages("checkYourAnswers.journeyDetails.dateOfArrival")</dt>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">@declaration.journeyDetails.dateOfArrival</dd>
<dd class="govuk-summary-list__value" style="text-transform: capitalize">@declaration.journeyDetails.formattedDateOfArrival</dd>
</div>
</dl>

<h2 class="govuk-heading-m" id="main-message">@messages("checkYourAnswers.sendDeclaration")</h2>

<p>@messages("checkYourAnswers.sendDeclaration.acknowledgement")</p>
<p class="govuk-!-font-size-19">@messages("checkYourAnswers.sendDeclaration.acknowledgement")</p>

<ul class="govuk-list govuk-list--bullet">
<li>@messages("checkYourAnswers.sendDeclaration.acknowledgement.1")</li>
Expand Down
2 changes: 1 addition & 1 deletion conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ checkYourAnswers.journeyDetails.placeOfArrival = Place of arrival
checkYourAnswers.journeyDetails.dateOfArrival = Date of arrival
checkYourAnswers.sendDeclaration = Now send your declaration
checkYourAnswers.sendDeclaration.acknowledgement = I understand that:
checkYourAnswers.sendDeclaration.acknowledgement.1 = I must pay Customs Duty and VAT on goods I bring them into the UK for trade or business use.
checkYourAnswers.sendDeclaration.acknowledgement.1 = I must pay Customs Duty and VAT on goods I bring into the UK for trade or business use.
checkYourAnswers.sendDeclaration.acknowledgement.2 = I will need to show my declaration and invoices if I am stopped by Border Force.
checkYourAnswers.sendDeclaration.warning = Warning
checkYourAnswers.sendDeclaration.warning.message = If you do not declare all your goods before entering the UK you may be fined a penalty and have your goods detained by Border Force.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package uk.gov.hmrc.merchandiseinbaggagefrontend
import java.time.LocalDate.now

import uk.gov.hmrc.merchandiseinbaggagefrontend.model.api.{AmountInPence, MerchandiseDetails, MibReference, PayApitRequest, TraderDetails}
import uk.gov.hmrc.merchandiseinbaggagefrontend.model.declaration.{Address, CurrencyAmount, Declaration, DeclarationJourney, Eori, GoodsEntry, JourneyDetails, Name, PriceOfGoods, SessionId}
import uk.gov.hmrc.merchandiseinbaggagefrontend.model.declaration.{Address, Currency, CurrencyAmount, Declaration, DeclarationJourney, Eori, GoodsEntry, JourneyDetails, Name, PriceOfGoods, SessionId}

trait CoreTestData {

Expand All @@ -40,7 +40,7 @@ trait CoreTestData {
GoodsEntry(
"wine",
Some("France"),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(100.00)), "EUR")),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(100.00)), Currency("Euros", "EUR"))),
Some(CurrencyAmount(BigDecimal(10.00))))

val completedDeclarationJourney: DeclarationJourney =
Expand All @@ -52,7 +52,7 @@ trait CoreTestData {
GoodsEntry(
"cheese",
Some("France"),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(200.00)), "EUR")),
Some(PriceOfGoods(CurrencyAmount(BigDecimal(200.00)), Currency("Euros", "EUR"))),
Some(CurrencyAmount(BigDecimal(20.00))))),
maybeName = Some(Name("Terry", "Test")),
maybeAddress = Some(Address("1 Terry Terrace", "Terry Town", "T11 11T")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,31 @@ class CheckYourAnswersControllerSpec extends DeclarationJourneyControllerSpec {
content must include("Country")
content must include("France")
content must include("Price")
content must include("100.00 EUR")
content must include("200.00 EUR")
content must include("100.00, Euros (EUR)")
content must include("200.00, Euros (EUR)")
content must include("Tax due")
content must include("10.00")
content must include("20.00")
content must include("£10.00")
content must include("£20.00")

content must include("Personal details")
content must include("Name")
content must include("Terry Test")
content must include("Address")
content must include("1 Terry Terrace, Terry Town, T11 11T")
content must include("1 Terry Terrace")
content must include("Terry Town")
content must include("T11 11T")
content must include("EORI number")
content must include("TerrysEori")

content must include("Journey details")
content must include("Place of arrival")
content must include("Dover")
content must include("Date of arrival")
content must include("28 Sep 2020")

content must include("Now send your declaration")
content must include("I understand that:")
content must include("I must pay Customs Duty and VAT on goods I bring them into the UK for trade or business use.")
content must include("I must pay Customs Duty and VAT on goods I bring into the UK for trade or business use.")
content must include("I will need to show my declaration and invoices if I am stopped by Border Force.")
content must include("Warning")
content must include("If you do not declare all your goods before entering the UK you may be fined a penalty and have your goods detained by Border Force.")
Expand Down

0 comments on commit 688fdfe

Please sign in to comment.