Skip to content

Commit 55d194b

Browse files
DTR-3651: Makes content changes and ordering PR-9 (#206)
1 parent 4a2adbf commit 55d194b

14 files changed

+95
-64
lines changed

app/models/purchaser/PurchaserReturnRequests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ object CreateCompanyDetailsRequest {
252252
vatReference = purchaserCurrent.registrationNumber,
253253
compTypeBank = purchaserCurrent.purchaserTypeOfCompany.map(_.bank),
254254
compTypeBuilder = purchaserCurrent.purchaserTypeOfCompany.map(_.unincorporatedBuilder),
255-
compTypeBuildsoc = purchaserCurrent.purchaserTypeOfCompany.map(_.buildingAssociation),
255+
compTypeBuildsoc = purchaserCurrent.purchaserTypeOfCompany.map(_.buildingSociety),
256256
compTypeCentgov = purchaserCurrent.purchaserTypeOfCompany.map(_.centralGovernment),
257257
compTypeIndividual = purchaserCurrent.purchaserTypeOfCompany.map(_.individualOther),
258258
compTypeInsurance = purchaserCurrent.purchaserTypeOfCompany.map(_.insuranceAssurance),
@@ -322,7 +322,7 @@ object UpdateCompanyDetailsRequest {
322322
vatReference = purchaserCurrent.registrationNumber,
323323
compTypeBank = purchaserCurrent.purchaserTypeOfCompany.map(_.bank),
324324
compTypeBuilder = purchaserCurrent.purchaserTypeOfCompany.map(_.unincorporatedBuilder),
325-
compTypeBuildsoc = purchaserCurrent.purchaserTypeOfCompany.map(_.buildingAssociation),
325+
compTypeBuildsoc = purchaserCurrent.purchaserTypeOfCompany.map(_.buildingSociety),
326326
compTypeCentgov = purchaserCurrent.purchaserTypeOfCompany.map(_.centralGovernment),
327327
compTypeIndividual = purchaserCurrent.purchaserTypeOfCompany.map(_.individualOther),
328328
compTypeInsurance = purchaserCurrent.purchaserTypeOfCompany.map(_.insuranceAssurance),

app/models/purchaser/PurchaserTypeOfCompany.scala

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,61 @@ import uk.gov.hmrc.govukfrontend.views.viewmodels.checkboxes.CheckboxItem
2222
import uk.gov.hmrc.govukfrontend.views.viewmodels.content.Text
2323
import viewmodels.govuk.checkbox.*
2424

25-
sealed trait PurchaserTypeOfCompany
25+
sealed trait PurchaserTypeOfCompany {
26+
def order: Int
27+
}
2628

2729
object PurchaserTypeOfCompany extends Enumerable.Implicits {
2830

29-
case object Bank extends WithName("bank") with PurchaserTypeOfCompany
30-
case object BuildingAssociation extends WithName("buildingAssociation") with PurchaserTypeOfCompany
31-
case object CentralGovernment extends WithName("centralGovernment") with PurchaserTypeOfCompany
32-
case object IndividualOther extends WithName("individualOther") with PurchaserTypeOfCompany
33-
case object InsuranceAssurance extends WithName("insuranceAssurance") with PurchaserTypeOfCompany
34-
case object LocalAuthority extends WithName("localAuthority") with PurchaserTypeOfCompany
35-
case object Partnership extends WithName("partnership") with PurchaserTypeOfCompany
36-
case object PropertyCompany extends WithName("propertyCompany") with PurchaserTypeOfCompany
37-
case object PublicCorporation extends WithName("publicCorporation") with PurchaserTypeOfCompany
38-
case object OtherCompany extends WithName("otherCompany") with PurchaserTypeOfCompany
39-
case object OtherFinancialInstitute extends WithName("otherFinancialInstitute") with PurchaserTypeOfCompany
40-
case object OtherIncludingCharity extends WithName("otherIncludingCharity") with PurchaserTypeOfCompany
41-
case object SuperannuationOrPensionFund extends WithName("superannuationOrPensionFund") with PurchaserTypeOfCompany
42-
case object UnincorporatedBuilder extends WithName("unincorporatedBuilder") with PurchaserTypeOfCompany
43-
case object UnincorporatedSoleTrader extends WithName("unincorporatedSoleTrader") with PurchaserTypeOfCompany
31+
case object UnincorporatedBuilder extends WithName("unincorporatedBuilder") with PurchaserTypeOfCompany {
32+
val order = 1
33+
}
34+
case object UnincorporatedSoleTrader extends WithName("unincorporatedSoleTrader") with PurchaserTypeOfCompany {
35+
val order = 2
36+
}
37+
case object IndividualOther extends WithName("individualOther") with PurchaserTypeOfCompany {
38+
val order = 3
39+
}
40+
case object Partnership extends WithName("partnership") with PurchaserTypeOfCompany {
41+
val order = 4
42+
}
43+
case object LocalAuthority extends WithName("localAuthority") with PurchaserTypeOfCompany {
44+
val order = 5
45+
}
46+
case object CentralGovernment extends WithName("centralGovernment") with PurchaserTypeOfCompany {
47+
val order = 6
48+
}
49+
case object PublicCorporation extends WithName("publicCorporation") with PurchaserTypeOfCompany {
50+
val order = 7
51+
}
52+
case object PropertyCompany extends WithName("propertyCompany") with PurchaserTypeOfCompany {
53+
val order = 8
54+
}
55+
case object Bank extends WithName("bank") with PurchaserTypeOfCompany {
56+
val order = 9
57+
}
58+
case object BuildingSociety extends WithName("buildingSociety") with PurchaserTypeOfCompany {
59+
val order = 10
60+
}
61+
case object InsuranceAssurance extends WithName("insuranceAssurance") with PurchaserTypeOfCompany {
62+
val order = 11
63+
}
64+
case object SuperannuationOrPensionFund extends WithName("superannuationOrPensionFund") with PurchaserTypeOfCompany {
65+
val order = 12
66+
}
67+
case object OtherFinancialInstitute extends WithName("otherFinancialInstitute") with PurchaserTypeOfCompany {
68+
val order = 13
69+
}
70+
case object OtherCompany extends WithName("otherCompany") with PurchaserTypeOfCompany {
71+
val order = 14
72+
}
73+
case object OtherIncludingCharity extends WithName("otherIncludingCharity") with PurchaserTypeOfCompany {
74+
val order = 15
75+
}
4476

4577
val values: Seq[PurchaserTypeOfCompany] = Seq(
4678
Bank,
47-
BuildingAssociation,
79+
BuildingSociety,
4880
CentralGovernment,
4981
IndividualOther,
5082
InsuranceAssurance,
@@ -58,7 +90,7 @@ object PurchaserTypeOfCompany extends Enumerable.Implicits {
5890
SuperannuationOrPensionFund,
5991
UnincorporatedBuilder,
6092
UnincorporatedSoleTrader
61-
)
93+
).sortBy(_.order)
6294

6395
def checkboxItems(implicit messages: Messages): Seq[CheckboxItem] =
6496
values.zipWithIndex.map {

app/models/purchaser/PurchaserTypeOfCompanyAnswers.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import play.api.libs.json.{Format, Json}
2222

2323
case class PurchaserTypeOfCompanyAnswers(
2424
bank: String,
25-
buildingAssociation: String,
25+
buildingSociety: String,
2626
centralGovernment: String,
2727
individualOther: String,
2828
insuranceAssurance: String,
@@ -44,7 +44,7 @@ object PurchaserTypeOfCompanyAnswers {
4444
def fromSet(selected: Set[PurchaserTypeOfCompany]): PurchaserTypeOfCompanyAnswers = {
4545
PurchaserTypeOfCompanyAnswers(
4646
bank = if (selected.contains(Bank)) "YES" else "NO",
47-
buildingAssociation = if (selected.contains(BuildingAssociation)) "YES" else "NO",
47+
buildingSociety = if (selected.contains(BuildingSociety)) "YES" else "NO",
4848
centralGovernment = if (selected.contains(CentralGovernment)) "YES" else "NO",
4949
individualOther = if (selected.contains(IndividualOther)) "YES" else "NO",
5050
insuranceAssurance = if (selected.contains(InsuranceAssurance)) "YES" else "NO",
@@ -64,7 +64,7 @@ object PurchaserTypeOfCompanyAnswers {
6464
def toSet(answers: PurchaserTypeOfCompanyAnswers): Set[PurchaserTypeOfCompany] = {
6565
val allValues: Map[PurchaserTypeOfCompany, String] = Map(
6666
Bank -> answers.bank,
67-
BuildingAssociation -> answers.buildingAssociation,
67+
BuildingSociety -> answers.buildingSociety,
6868
CentralGovernment -> answers.centralGovernment,
6969
IndividualOther -> answers.individualOther,
7070
InsuranceAssurance -> answers.insuranceAssurance,

app/viewmodels/checkAnswers/purchaser/PurchaserTypeOfCompanySummary.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ object PurchaserTypeOfCompanySummary {
3232
answers.flatMap(_.get(PurchaserTypeOfCompanyPage)).map {
3333
answersObject =>
3434

35-
val selectedItems = PurchaserTypeOfCompanyAnswers.toSet(answersObject)
35+
val selectedItems = PurchaserTypeOfCompanyAnswers.toSet(answersObject).toSeq.sortBy(_.order)
3636
.map(_.toString)
37-
.toSeq.sorted
3837

3938
val value = ValueViewModel(
4039
HtmlContent(

conf/messages.en

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -665,21 +665,21 @@ purchaser.companyFormOfId.countryIssued.change.hidden
665665
purchaser.purchaserTypeOfCompany.title = What type of company is the purchaser? - About the purchaser
666666
purchaser.purchaserTypeOfCompany.heading = What type of company is {0}?
667667
purchaser.purchaserTypeOfCompany.hint = Select up to four
668-
purchaser.purchaserTypeOfCompany.bank = Bank
669-
purchaser.purchaserTypeOfCompany.buildingAssociation = Building association
670-
purchaser.purchaserTypeOfCompany.centralGovernment = Central government
671-
purchaser.purchaserTypeOfCompany.individualOther = Individual other than sole trader
672-
purchaser.purchaserTypeOfCompany.insuranceAssurance = Insurance/Assurance company
673-
purchaser.purchaserTypeOfCompany.localAuthority = Local authority
674-
purchaser.purchaserTypeOfCompany.partnership = Partnership
675-
purchaser.purchaserTypeOfCompany.propertyCompany = Property company
676-
purchaser.purchaserTypeOfCompany.publicCorporation = Public corporation
677-
purchaser.purchaserTypeOfCompany.otherCompany = Other company
678-
purchaser.purchaserTypeOfCompany.otherFinancialInstitute = Other financial institute
679-
purchaser.purchaserTypeOfCompany.otherIncludingCharity = Other, including charity
680-
purchaser.purchaserTypeOfCompany.superannuationOrPensionFund = Superannuation or pension fund
681-
purchaser.purchaserTypeOfCompany.unincorporatedBuilder = Unincorporated builder
682-
purchaser.purchaserTypeOfCompany.unincorporatedSoleTrader = Unincorporated sole trader other than builder
668+
purchaser.purchaserTypeOfCompany.bank = 09 - Bank
669+
purchaser.purchaserTypeOfCompany.buildingSociety = 10 - Building society
670+
purchaser.purchaserTypeOfCompany.centralGovernment = 06 - Central government
671+
purchaser.purchaserTypeOfCompany.individualOther = 03 - Individual other than sole trader
672+
purchaser.purchaserTypeOfCompany.insuranceAssurance = 11 - Insurance or assurance company
673+
purchaser.purchaserTypeOfCompany.localAuthority = 05 - Local authority
674+
purchaser.purchaserTypeOfCompany.partnership = 04 - Partnership
675+
purchaser.purchaserTypeOfCompany.propertyCompany = 08 - Property company
676+
purchaser.purchaserTypeOfCompany.publicCorporation = 07 - Public corporation
677+
purchaser.purchaserTypeOfCompany.otherCompany = 14 - Other company
678+
purchaser.purchaserTypeOfCompany.otherFinancialInstitute = 13 - Other financial institute
679+
purchaser.purchaserTypeOfCompany.otherIncludingCharity = 15 - Other, including charity
680+
purchaser.purchaserTypeOfCompany.superannuationOrPensionFund = 12 - Superannuation or pension fund
681+
purchaser.purchaserTypeOfCompany.unincorporatedBuilder = 01 - Unincorporated builder
682+
purchaser.purchaserTypeOfCompany.unincorporatedSoleTrader = 02 - Unincorporated sole trader other than builder
683683
purchaser.purchaserTypeOfCompany.checkYourAnswersLabel = Type of company
684684
purchaser.purchaserTypeOfCompany.error.required = Select type of company
685685
purchaser.purchaserTypeOfCompany.change.hidden = Type of company

test/controllers/purchaser/PurchaserCheckYourAnswersControllerSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class PurchaserCheckYourAnswersControllerSpec extends SpecBase with SummaryListF
9292
"purchaserFormOfIdCompany" -> JsNull,
9393
"purchaserTypeOfCompany" -> Json.obj(
9494
"bank" -> "YES",
95-
"buildingAssociation" -> "NO",
95+
"buildingSociety" -> "NO",
9696
"centralGovernment" -> "NO",
9797
"individualOther" -> "NO",
9898
"insuranceAssurance" -> "NO",

test/controllers/purchaser/PurchaserTypeOfCompanyControllerSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class PurchaserTypeOfCompanyControllerSpec extends SpecBase with MockitoSugar {
104104
"must populate the view correctly on a GET when the question has previously been answered" in {
105105

106106
val userAnswers = testUserAnswersCompany.set(PurchaserTypeOfCompanyPage, PurchaserTypeOfCompanyAnswers(bank = "YES",
107-
buildingAssociation = "YES",
107+
buildingSociety = "YES",
108108
centralGovernment = "NO",
109109
individualOther = "NO",
110110
insuranceAssurance = "NO",
@@ -129,7 +129,7 @@ class PurchaserTypeOfCompanyControllerSpec extends SpecBase with MockitoSugar {
129129
val result = route(application, request).value
130130

131131
status(result) mustEqual OK
132-
contentAsString(result) mustEqual view(form.fill(Set(PurchaserTypeOfCompany.Bank, PurchaserTypeOfCompany.BuildingAssociation)), NormalMode, "John Middle Doe")(request, messages(application)).toString
132+
contentAsString(result) mustEqual view(form.fill(Set(PurchaserTypeOfCompany.Bank, PurchaserTypeOfCompany.BuildingSociety)), NormalMode, "John Middle Doe")(request, messages(application)).toString
133133
}
134134
}
135135

test/models/FullReturnSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class FullReturnSpec extends AnyFreeSpec with Matchers with EitherValues with Op
230230
"purchaserFormOfIdCompany" -> JsNull,
231231
"purchaserTypeOfCompany" -> Json.obj(
232232
"bank" -> "YES",
233-
"buildingAssociation" -> "YES",
233+
"buildingSociety" -> "YES",
234234
"centralGovernment" -> "NO",
235235
"individualOther" -> "NO",
236236
"insuranceAssurance" -> "NO",

test/models/purchaser/PurchaserReturnRequestsSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class PurchaserReturnRequestsSpec extends AnyFreeSpec with Matchers with EitherV
401401
"purchaserFormOfIdCompany" -> JsNull,
402402
"purchaserTypeOfCompany" -> Json.obj(
403403
"bank" -> "NO",
404-
"buildingAssociation" -> "NO",
404+
"buildingSociety" -> "NO",
405405
"centralGovernment" -> "NO",
406406
"individualOther" -> "NO",
407407
"insuranceAssurance" -> "NO",

test/models/purchaser/PurchaserSessionQuestionsSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class PurchaserSessionQuestionsSpec extends AnyFreeSpec with Matchers with Eithe
7272
),
7373
"purchaserTypeOfCompany" -> Json.obj(
7474
"bank" -> "YES",
75-
"buildingAssociation" -> "NO",
75+
"buildingSociety" -> "NO",
7676
"centralGovernment" -> "NO",
7777
"individualOther" -> "NO",
7878
"insuranceAssurance" -> "NO",
@@ -171,7 +171,7 @@ class PurchaserSessionQuestionsSpec extends AnyFreeSpec with Matchers with Eithe
171171
purchaserTypeOfCompany = Some(
172172
PurchaserTypeOfCompanyAnswers(
173173
bank = "YES",
174-
buildingAssociation = "NO",
174+
buildingSociety = "NO",
175175
centralGovernment = "NO",
176176
individualOther = "NO",
177177
insuranceAssurance = "NO",

0 commit comments

Comments
 (0)