Skip to content

Commit 2715840

Browse files
authored
[APB-10746] Update shared models (#198)
* [APB-10746] Update shared models * [APB-10746] Dependency update * [APB-10746] Plugin update * [APB-10746] Review comments
1 parent 9ccefb5 commit 2715840

File tree

11 files changed

+175
-24
lines changed

11 files changed

+175
-24
lines changed

app/uk/gov/hmrc/agentregistration/shared/AgentApplication.scala

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ sealed trait AgentApplication:
4646
def hmrcStandardForAgentsAgreed: StateOfAgreement
4747
def numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals] // all applications require this, sole traders will have a list of one
4848
def hasOtherRelevantIndividuals: Option[Boolean]
49+
def vrns: Option[List[Vrn]]
50+
def payeRefs: Option[List[PayeRef]]
4951

5052
// /** Updates the application state to the next state */
5153
// def updateApplicationState: AgentApplication =
@@ -103,10 +105,6 @@ sealed trait AgentApplication:
103105
expectedDataNotDefinedError("numberOfRequiredKeyIndividuals")
104106
)
105107

106-
def getHasOtherRelevantIndividuals: Boolean = hasOtherRelevantIndividuals.getOrElse(
107-
expectedDataNotDefinedError("hasOtherRelevantIndividuals")
108-
)
109-
110108
private def as[T <: AgentApplication](using ct: reflect.ClassTag[T]): Option[T] =
111109
this match
112110
case t: T => Some(t)
@@ -140,14 +138,16 @@ final case class AgentApplicationSoleTrader(
140138
override val agentDetails: Option[AgentDetails],
141139
override val refusalToDealWithCheckResult: Option[CheckResult],
142140
deceasedCheckResult: Option[CheckResult],
143-
override val hmrcStandardForAgentsAgreed: StateOfAgreement
141+
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
142+
override val hasOtherRelevantIndividuals: Option[Boolean],
143+
override val vrns: Option[List[Vrn]],
144+
override val payeRefs: Option[List[PayeRef]]
144145
)
145146
extends AgentApplication:
146147

147148
override val businessType: BusinessType.SoleTrader.type = BusinessType.SoleTrader
148149
def getBusinessDetails: BusinessDetailsSoleTrader = businessDetails.getOrElse(expectedDataNotDefinedError("businessDetails"))
149150
override def numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals] = Some(AgentApplicationSoleTrader.numberOfRequiredKeyIndividuals)
150-
override def hasOtherRelevantIndividuals: Option[Boolean] = Some(false)
151151

152152
object AgentApplicationSoleTrader:
153153
val numberOfRequiredKeyIndividuals: NumberOfRequiredKeyIndividuals = FiveOrLess(1)
@@ -170,7 +170,9 @@ final case class AgentApplicationLlp(
170170
companyStatusCheckResult: Option[CheckResult],
171171
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
172172
override val numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals],
173-
override val hasOtherRelevantIndividuals: Option[Boolean]
173+
override val hasOtherRelevantIndividuals: Option[Boolean],
174+
override val vrns: Option[List[Vrn]],
175+
override val payeRefs: Option[List[PayeRef]]
174176
)
175177
extends AgentApplication:
176178

@@ -197,7 +199,9 @@ final case class AgentApplicationLimitedCompany(
197199
companyStatusCheckResult: Option[CheckResult],
198200
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
199201
override val numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals],
200-
override val hasOtherRelevantIndividuals: Option[Boolean]
202+
override val hasOtherRelevantIndividuals: Option[Boolean],
203+
override val vrns: Option[List[Vrn]],
204+
override val payeRefs: Option[List[PayeRef]]
201205
)
202206
extends AgentApplication:
203207

@@ -223,7 +227,9 @@ final case class AgentApplicationGeneralPartnership(
223227
override val refusalToDealWithCheckResult: Option[CheckResult],
224228
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
225229
override val numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals],
226-
override val hasOtherRelevantIndividuals: Option[Boolean]
230+
override val hasOtherRelevantIndividuals: Option[Boolean],
231+
override val vrns: Option[List[Vrn]],
232+
override val payeRefs: Option[List[PayeRef]]
227233
)
228234
extends AgentApplication:
229235

@@ -248,7 +254,9 @@ final case class AgentApplicationLimitedPartnership(
248254
companyStatusCheckResult: Option[CheckResult],
249255
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
250256
override val numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals],
251-
override val hasOtherRelevantIndividuals: Option[Boolean]
257+
override val hasOtherRelevantIndividuals: Option[Boolean],
258+
override val vrns: Option[List[Vrn]],
259+
override val payeRefs: Option[List[PayeRef]]
252260
)
253261
extends AgentApplication:
254262

@@ -273,7 +281,9 @@ final case class AgentApplicationScottishLimitedPartnership(
273281
companyStatusCheckResult: Option[CheckResult],
274282
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
275283
override val numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals],
276-
override val hasOtherRelevantIndividuals: Option[Boolean]
284+
override val hasOtherRelevantIndividuals: Option[Boolean],
285+
override val vrns: Option[List[Vrn]],
286+
override val payeRefs: Option[List[PayeRef]]
277287
)
278288
extends AgentApplication:
279289

@@ -297,7 +307,9 @@ final case class AgentApplicationScottishPartnership(
297307
override val refusalToDealWithCheckResult: Option[CheckResult],
298308
override val hmrcStandardForAgentsAgreed: StateOfAgreement,
299309
override val numberOfRequiredKeyIndividuals: Option[NumberOfRequiredKeyIndividuals],
300-
override val hasOtherRelevantIndividuals: Option[Boolean]
310+
override val hasOtherRelevantIndividuals: Option[Boolean],
311+
override val vrns: Option[List[Vrn]],
312+
override val payeRefs: Option[List[PayeRef]]
301313
)
302314
extends AgentApplication:
303315

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2025 HM Revenue & Customs
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package uk.gov.hmrc.agentregistration.shared
18+
19+
import play.api.libs.json.Format
20+
import uk.gov.hmrc.agentregistration.shared.util.JsonFormatsFactory
21+
22+
/** Paye Reference Number
23+
*/
24+
final case class PayeRef(value: String)
25+
26+
object PayeRef:
27+
given format: Format[PayeRef] = JsonFormatsFactory.makeValueClassFormat
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2025 HM Revenue & Customs
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package uk.gov.hmrc.agentregistration.shared
18+
19+
import play.api.libs.json.Format
20+
import uk.gov.hmrc.agentregistration.shared.util.JsonFormatsFactory
21+
22+
/** Vat Registration Number (Vrn)
23+
*/
24+
final case class Vrn(value: String)
25+
26+
object Vrn:
27+
given format: Format[Vrn] = JsonFormatsFactory.makeValueClassFormat

app/uk/gov/hmrc/agentregistration/shared/individual/IndividualProvidedDetails.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ package uk.gov.hmrc.agentregistration.shared.individual
1919
import play.api.libs.json.*
2020
import uk.gov.hmrc.agentregistration.shared.AgentApplicationId
2121
import uk.gov.hmrc.agentregistration.shared.InternalUserId
22+
import uk.gov.hmrc.agentregistration.shared.PayeRef
2223
import uk.gov.hmrc.agentregistration.shared.StateOfAgreement
2324
import uk.gov.hmrc.agentregistration.shared.TelephoneNumber
25+
import uk.gov.hmrc.agentregistration.shared.Vrn
2426
import uk.gov.hmrc.agentregistration.shared.lists.IndividualName
2527
import uk.gov.hmrc.agentregistration.shared.individual.ProvidedDetailsState.Finished
2628
import uk.gov.hmrc.agentregistration.shared.individual.ProvidedDetailsState.Precreated
@@ -45,7 +47,9 @@ final case class IndividualProvidedDetails(
4547
individualNino: Option[IndividualNino] = None,
4648
individualSaUtr: Option[IndividualSaUtr] = None,
4749
hmrcStandardForAgentsAgreed: StateOfAgreement = StateOfAgreement.NotSet,
48-
hasApprovedApplication: Option[Boolean] = None
50+
hasApprovedApplication: Option[Boolean] = None,
51+
vrns: Option[List[Vrn]] = None,
52+
payeRefs: Option[List[PayeRef]] = None
4953
):
5054

5155
val individualProvidedDetailsId: IndividualProvidedDetailsId = _id
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2026 HM Revenue & Customs
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package uk.gov.hmrc.agentregistration.shared.risking
18+
19+
import play.api.libs.json.Json
20+
import play.api.libs.json.OFormat
21+
import uk.gov.hmrc.agentregistration.shared.AgentApplication
22+
import uk.gov.hmrc.agentregistration.shared.AgentApplicationFormats
23+
import uk.gov.hmrc.agentregistration.shared.individual.IndividualProvidedDetails
24+
25+
final case class SubmitForRiskingRequest(
26+
agentApplication: AgentApplication,
27+
individuals: List[IndividualProvidedDetails]
28+
)
29+
30+
object SubmitForRiskingRequest:
31+
32+
import AgentApplicationFormats.format
33+
34+
given OFormat[SubmitForRiskingRequest] = Json.format[SubmitForRiskingRequest]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2026 HM Revenue & Customs
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package uk.gov.hmrc.agentregistration.shared.util
18+
19+
object OptionalListExtensions:
20+
21+
extension (s: Option[List[String]])
22+
23+
inline def transformToCommaSeparatedString: String = s.fold("")(_.mkString(","))

app/uk/gov/hmrc/agentregistrationfrontend/services/applicant/ApplicationFactory.scala

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ class ApplicationFactory @Inject() (
4848
agentDetails = None,
4949
refusalToDealWithCheckResult = None,
5050
deceasedCheckResult = None,
51-
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet
51+
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
52+
hasOtherRelevantIndividuals = None,
53+
vrns = None,
54+
payeRefs = None
5255
)
5356

5457
def makeNewAgentApplicationLlp(
@@ -71,7 +74,9 @@ class ApplicationFactory @Inject() (
7174
companyStatusCheckResult = None,
7275
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
7376
numberOfRequiredKeyIndividuals = None,
74-
hasOtherRelevantIndividuals = None
77+
hasOtherRelevantIndividuals = None,
78+
vrns = None,
79+
payeRefs = None
7580
)
7681

7782
def makeNewAgentApplicationLimitedCompany(
@@ -94,7 +99,9 @@ class ApplicationFactory @Inject() (
9499
companyStatusCheckResult = None,
95100
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
96101
numberOfRequiredKeyIndividuals = None,
97-
hasOtherRelevantIndividuals = None
102+
hasOtherRelevantIndividuals = None,
103+
vrns = None,
104+
payeRefs = None
98105
)
99106

100107
def makeNewAgentApplicationGeneralPartnership(
@@ -116,7 +123,9 @@ class ApplicationFactory @Inject() (
116123
refusalToDealWithCheckResult = None,
117124
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
118125
numberOfRequiredKeyIndividuals = None,
119-
hasOtherRelevantIndividuals = None
126+
hasOtherRelevantIndividuals = None,
127+
vrns = None,
128+
payeRefs = None
120129
)
121130

122131
def makeNewAgentApplicationLimitedPartnership(
@@ -139,7 +148,9 @@ class ApplicationFactory @Inject() (
139148
companyStatusCheckResult = None,
140149
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
141150
numberOfRequiredKeyIndividuals = None,
142-
hasOtherRelevantIndividuals = None
151+
hasOtherRelevantIndividuals = None,
152+
vrns = None,
153+
payeRefs = None
143154
)
144155

145156
def makeNewAgentApplicationScottishLimitedPartnership(
@@ -162,7 +173,9 @@ class ApplicationFactory @Inject() (
162173
companyStatusCheckResult = None,
163174
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
164175
numberOfRequiredKeyIndividuals = None,
165-
hasOtherRelevantIndividuals = None
176+
hasOtherRelevantIndividuals = None,
177+
vrns = None,
178+
payeRefs = None
166179
)
167180

168181
def makeNewAgentApplicationScottishPartnership(
@@ -184,5 +197,7 @@ class ApplicationFactory @Inject() (
184197
refusalToDealWithCheckResult = None,
185198
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
186199
numberOfRequiredKeyIndividuals = None,
187-
hasOtherRelevantIndividuals = None
200+
hasOtherRelevantIndividuals = None,
201+
vrns = None,
202+
payeRefs = None
188203
)

app/uk/gov/hmrc/agentregistrationfrontend/testsupport/testdata/agentapplication/TdAgentApplicationGeneralPartnership.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ trait TdAgentApplicationGeneralPartnership { dependencies: (TdBase & TdSectionAm
4949
refusalToDealWithCheckResult = None,
5050
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
5151
numberOfRequiredKeyIndividuals = None,
52-
hasOtherRelevantIndividuals = None
52+
hasOtherRelevantIndividuals = None,
53+
vrns = None,
54+
payeRefs = None
5355
)
5456

5557
val afterGrsDataReceived: AgentApplicationGeneralPartnership = afterStarted.copy(

app/uk/gov/hmrc/agentregistrationfrontend/testsupport/testdata/agentapplication/TdAgentApplicationLlp.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ trait TdAgentApplicationLlp { dependencies: (TdBase & TdSectionAmls & TdSectionC
4949
companyStatusCheckResult = None,
5050
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
5151
numberOfRequiredKeyIndividuals = None,
52-
hasOtherRelevantIndividuals = None
52+
hasOtherRelevantIndividuals = None,
53+
vrns = None,
54+
payeRefs = None
5355
)
5456

5557
val afterGrsDataReceived: AgentApplicationLlp = afterStarted.copy(

app/uk/gov/hmrc/agentregistrationfrontend/testsupport/testdata/agentapplication/TdAgentApplicationScottishPartnership.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ trait TdAgentApplicationScottishPartnership { dependencies: (TdBase & TdSectionA
4545
refusalToDealWithCheckResult = None,
4646
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
4747
numberOfRequiredKeyIndividuals = None,
48-
hasOtherRelevantIndividuals = None
48+
hasOtherRelevantIndividuals = None,
49+
vrns = None,
50+
payeRefs = None
4951
)
5052

5153
val afterGrsDataReceived: AgentApplicationScottishPartnership = afterStarted.copy(

0 commit comments

Comments
 (0)