Skip to content

Commit

Permalink
MMCA-4919 | Made reasonForSecurity as an option (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neozxc authored Sep 12, 2024
1 parent 0d25f04 commit 19cd4df
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/TaxGroup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import play.api.libs.json.{Json, OFormat}

case class TaxGroup(taxGroupDescription: TaxGroupType, amount: BigDecimal, taxTypes: Seq[TaxType])

case class TaxType(reasonForSecurity: String, taxTypeID: String, amount: BigDecimal)
case class TaxType(reasonForSecurity: Option[String], taxTypeID: String, amount: BigDecimal)

object TaxType {
implicit val format: OFormat[TaxType] = Json.format[TaxType]
Expand Down
2 changes: 1 addition & 1 deletion test/models/DeclarationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DeclarationSpec extends SpecBase {
val declarantReference = "UCR12345"
val secureMovementReferenceNumber = "5a71a767-5c1c-4df8-8eef-2b83769b8fda"

val taxTypes: Seq[TaxType] = Seq(TaxType(reasonForSecurity = "Reason", taxTypeID = "50", amount = thousand))
val taxTypes: Seq[TaxType] = Seq(TaxType(reasonForSecurity = Some("Reason"), taxTypeID = "50", amount = thousand))

val declarations: Declaration = Declaration(
movementReferenceNumber = movementReferenceNumber,
Expand Down
4 changes: 2 additions & 2 deletions test/models/TaxGroupSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TaxGroupSpec extends SpecBase {

"serialize and deserialize TaxType correctly" in new Setup {

val expectedTaxType: TaxType = TaxType("Reason", "VAT", hundred)
val expectedTaxType: TaxType = TaxType(Some("Reason"), "VAT", hundred)
val serialized: JsValue = Json.toJson(expectedTaxType)
val deserialized: TaxType = serialized.as[TaxType]

Expand Down Expand Up @@ -88,7 +88,7 @@ class TaxGroupSpec extends SpecBase {
val twoHundred: BigDecimal = BigDecimal(200.50)
val fiveHundred: BigDecimal = BigDecimal(500.00)

val taxType: TaxType = TaxType("Reason", "VAT", hundred)
val taxType: TaxType = TaxType(Some("Reason"), "VAT", hundred)

val taxGroup: TaxGroup = TaxGroup(
taxGroupDescription = CustomsDuty,
Expand Down
19 changes: 17 additions & 2 deletions test/viewmodels/CashTransactionCsvRowSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ class CashTransactionCsvRowSpec extends SpecBase {
TaxGroup(ExciseDuty, -3.45, taxTypes))

val declarations: Seq[Declaration] =
Seq(Declaration("someMRN", Some("someImporterEORI"), "someEORI", None, dateWithDay4, -1234.56, taxGroups, Some(sMRN)))
Seq(
Declaration("someMRN",
Some("someImporterEORI"),
"someEORI",
None,
dateWithDay4,
-1234.56,
taxGroups,
Some(sMRN)
)
)

override val dailyStatement: CashDailyStatement =
CashDailyStatement(dateWithDay4, amountZero, amountZero, declarations, Nil)
Expand Down Expand Up @@ -198,7 +208,12 @@ class CashTransactionCsvRowSpec extends SpecBase {
val dateWithDay4: LocalDate = LocalDate.of(year2020, month3, day4)
val dateForDailyStatement: LocalDate = LocalDate.of(year2020, month3, day4)

val taxTypes: Seq[TaxType] = Seq(TaxType(reasonForSecurity = "Reason", taxTypeID = "50", amount = fiveHundred))
val taxTypes: Seq[TaxType] = Seq(
TaxType(
reasonForSecurity = Some("Reason"),
taxTypeID = "50",
amount = fiveHundred
))

val dailyStatement: CashDailyStatement =
CashDailyStatement(dateForDailyStatement, amountZero, amountZero, Nil, Seq(transferIn))
Expand Down
2 changes: 1 addition & 1 deletion test/viewmodels/DeclarationDetailViewModelSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class DeclarationDetailViewModelSpec extends SpecBase {
val declarantReference: Option[String] = Some("UCR12345")
val secureMovementReferenceNumber: Option[String] = Some("5a71a767-5c1c-4df8-8eef-2b83769b8fda")

val taxTypes: Seq[TaxType] = Seq(TaxType(reasonForSecurity = "Reason", taxTypeID = "50", amount = hundred))
val taxTypes: Seq[TaxType] = Seq(TaxType(reasonForSecurity = Some("Reason"), taxTypeID = "50", amount = hundred))

val declaration: Declaration = Declaration(
movementReferenceNumber = movementReferenceNumber,
Expand Down
7 changes: 6 additions & 1 deletion test/views/CashAccountDeclarationDetailsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ class CashAccountDeclarationDetailsSpec extends ViewTestHelper {
val declarantEori = "GB987654321000"
val declarantReference: Option[String] = Some("UCR12345")

val taxTypes: Seq[TaxType] = Seq(TaxType(reasonForSecurity = "Reason", taxTypeID = "50", amount = fourHundred))
val taxTypes: Seq[TaxType] = Seq(
TaxType(
reasonForSecurity = Some("Reason"),
taxTypeID = "50",
amount = fourHundred
))

val declaration: Declaration = Declaration(
movementReferenceNumber = movementReferenceNumber,
Expand Down

0 comments on commit 19cd4df

Please sign in to comment.