Skip to content

Commit 9ccefb5

Browse files
authored
APB-10767 Create FF links for limited company, limited partnership and Scottish limited partnership (#199)
* APB-10767 Add limited company fast forward links * APB-10767 Add limited partnership fast forward links * APB-10767 Add scottish limited partnership fast forward links * APB-10767 Remove unnecessary log-in link from ff page * APB-10767 Remove alreadyDeveloped flag and update deps
1 parent 09290d4 commit 9ccefb5

File tree

10 files changed

+624
-40
lines changed

10 files changed

+624
-40
lines changed

app/uk/gov/hmrc/agentregistrationfrontend/testonly/controllers/applicant/FastForwardController.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ extends FrontendController(mcc, applicantActions):
8383
authorisedOrCreateAndLoginAgent.async: (req: RequestWithAuth) =>
8484
given RequestWithAuth = req
8585
fastForwardTo(c).map(_ => Redirect(AppRoutes.apply.TaskListController.show))
86+
case c: CompletedSectionLimitedCompany =>
87+
authorisedOrCreateAndLoginAgent.async: (req: RequestWithAuth) =>
88+
given RequestWithAuth = req
89+
fastForwardTo(c).map(_ => Redirect(AppRoutes.apply.TaskListController.show))
90+
case c: CompletedSectionLimitedPartnership =>
91+
authorisedOrCreateAndLoginAgent.async: (req: RequestWithAuth) =>
92+
given RequestWithAuth = req
93+
fastForwardTo(c).map(_ => Redirect(AppRoutes.apply.TaskListController.show))
94+
case c: CompletedSectionScottishLimitedPartnership =>
95+
authorisedOrCreateAndLoginAgent.async: (req: RequestWithAuth) =>
96+
given RequestWithAuth = req
97+
fastForwardTo(c).map(_ => Redirect(AppRoutes.apply.TaskListController.show))
8698

8799
private def loginAndRetry(using request: Request[AnyContent]): Future[Result | RequestWithAuth] = stubUserService.createAndLoginAgent.map: stubsHc =>
88100
val bearerToken: String = stubsHc.authorization
@@ -125,8 +137,10 @@ extends FrontendController(mcc, applicantActions):
125137
case BusinessType.Partnership.LimitedLiabilityPartnership => TestOnlyData.grs.llp.journeyData
126138
case BusinessType.Partnership.GeneralPartnership => TestOnlyData.grs.generalPartnership.journeyData
127139
case BusinessType.Partnership.ScottishPartnership => TestOnlyData.grs.scottishPartnership.journeyData
140+
case BusinessType.Partnership.ScottishLimitedPartnership => TestOnlyData.grs.scottishLtdPartnership.journeyData
141+
case BusinessType.Partnership.LimitedPartnership => TestOnlyData.grs.ltdPartnership.journeyData
128142
case BusinessType.SoleTrader => TestOnlyData.grs.soleTrader.journeyData
129-
case _ => throw new IllegalArgumentException(s"Add $bt journey data here")
143+
case BusinessType.LimitedCompany => TestOnlyData.grs.ltd.journeyData
130144

131145
private def updateIdentifiers(agentApplication: AgentApplication)(using
132146
r: RequestWithAuth,

app/uk/gov/hmrc/agentregistrationfrontend/testonly/model/CompletedSection.scala

Lines changed: 150 additions & 25 deletions
Large diffs are not rendered by default.

app/uk/gov/hmrc/agentregistrationfrontend/testonly/views/FastForwardPage.scala.html

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,12 @@
3939
<h1 class="govuk-heading-xl">Fast Forward to completed sections of applicant journey</h1>
4040
<p class="govuk-body">
4141
Use these links to fast forward through the journey to a specific section.
42-
These links require you to log in using the correct credentials.
43-
</p>
44-
<p class="govuk-body">
45-
<a class="govuk-link" href="@{appConfig.signInUri(uri"${appConfig.thisFrontendBaseUrl + AppRoutes.testOnly.applicant.FastForwardController.show.url}", AffinityGroup.Agent)}">Log In</a>
4642
</p>
4743

4844
<p class="govuk-body">
4945
<h2 class="govuk-caption-xl">Limited Liability Partnership</h2>
5046
<ul class="govuk-list govuk-list--bullet">
51-
@CompletedSection.CompletedSectionLlp.values.filter(_.alreadyDeveloped).sortBy(_.displayOrder).map { completedSection =>
47+
@CompletedSection.CompletedSectionLlp.values.sortBy(_.displayOrder).map { completedSection =>
5248
<li>
5349
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
5450
</li>
@@ -59,7 +55,7 @@ <h2 class="govuk-caption-xl">Limited Liability Partnership</h2>
5955
<p class="govuk-body">
6056
<h2 class="govuk-caption-xl">General Partnership</h2>
6157
<ul class="govuk-list govuk-list--bullet">
62-
@CompletedSection.CompletedSectionGeneralPartnership.values.filter(_.alreadyDeveloped).sortBy(_.displayOrder).map { completedSection =>
58+
@CompletedSection.CompletedSectionGeneralPartnership.values.sortBy(_.displayOrder).map { completedSection =>
6359
<li>
6460
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
6561
</li>
@@ -70,7 +66,7 @@ <h2 class="govuk-caption-xl">General Partnership</h2>
7066
<p class="govuk-body">
7167
<h2 class="govuk-caption-xl">Scottish Partnership</h2>
7268
<ul class="govuk-list govuk-list--bullet">
73-
@CompletedSection.CompletedSectionScottishPartnership.values.filter(_.alreadyDeveloped).sortBy(_.displayOrder).map { completedSection =>
69+
@CompletedSection.CompletedSectionScottishPartnership.values.sortBy(_.displayOrder).map { completedSection =>
7470
<li>
7571
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
7672
</li>
@@ -81,7 +77,40 @@ <h2 class="govuk-caption-xl">Scottish Partnership</h2>
8177
<p class="govuk-body">
8278
<h2 class="govuk-caption-xl">Sole trader</h2>
8379
<ul class="govuk-list govuk-list--bullet">
84-
@CompletedSection.CompletedSectionSoleTrader.values.filter(_.alreadyDeveloped).sortBy(_.displayOrder).map { completedSection =>
80+
@CompletedSection.CompletedSectionSoleTrader.values.sortBy(_.displayOrder).map { completedSection =>
81+
<li>
82+
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
83+
</li>
84+
}
85+
</ul>
86+
</p>
87+
88+
<p class="govuk-body">
89+
<h2 class="govuk-caption-xl">Limited Company</h2>
90+
<ul class="govuk-list govuk-list--bullet">
91+
@CompletedSection.CompletedSectionLimitedCompany.values.sortBy(_.displayOrder).map { completedSection =>
92+
<li>
93+
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
94+
</li>
95+
}
96+
</ul>
97+
</p>
98+
99+
<p class="govuk-body">
100+
<h2 class="govuk-caption-xl">Limited Partnership</h2>
101+
<ul class="govuk-list govuk-list--bullet">
102+
@CompletedSection.CompletedSectionLimitedPartnership.values.sortBy(_.displayOrder).map { completedSection =>
103+
<li>
104+
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
105+
</li>
106+
}
107+
</ul>
108+
</p>
109+
110+
<p class="govuk-body">
111+
<h2 class="govuk-caption-xl">Scottish Limited Partnership</h2>
112+
<ul class="govuk-list govuk-list--bullet">
113+
@CompletedSection.CompletedSectionScottishLimitedPartnership.values.sortBy(_.displayOrder).map { completedSection =>
85114
<li>
86115
<a class="govuk-link" href="@{AppRoutes.testOnly.applicant.FastForwardController.fastForward(completedSection)}">@completedSection.sectionName</a>
87116
</li>

app/uk/gov/hmrc/agentregistrationfrontend/testsupport/testdata/TdAll.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ extends TdBase,
2424
TdAgentApplicationLlp,
2525
TdAgentApplicationGeneralPartnership,
2626
TdAgentApplicationScottishPartnership,
27+
TdAgentApplicationSoleTrader,
28+
TdAgentApplicationLimitedCompany,
29+
TdAgentApplicationLimitedPartnership,
30+
TdAgentApplicationScottishLimitedPartnership,
2731
agentapplication.sections.TdSectionContactDetails,
2832
agentapplication.sections.TdSectionAgentDetails,
2933
agentapplication.sections.TdUpload,
3034
agentapplication.sections.TdSectionAmls,
31-
TdAgentApplicationSoleTrader,
3235
providedetails.individual.TdIndividualProvidedDetails

app/uk/gov/hmrc/agentregistrationfrontend/testsupport/testdata/TdGrs.scala

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
package uk.gov.hmrc.agentregistrationfrontend.testsupport.testdata
1818

1919
import uk.gov.hmrc.agentregistration.shared.businessdetails.BusinessDetailsGeneralPartnership
20+
import uk.gov.hmrc.agentregistration.shared.businessdetails.BusinessDetailsLimitedCompany
2021
import uk.gov.hmrc.agentregistration.shared.businessdetails.BusinessDetailsLlp
22+
import uk.gov.hmrc.agentregistration.shared.businessdetails.BusinessDetailsPartnership
2123
import uk.gov.hmrc.agentregistration.shared.businessdetails.BusinessDetailsScottishPartnership
2224
import uk.gov.hmrc.agentregistration.shared.businessdetails.BusinessDetailsSoleTrader
2325
import uk.gov.hmrc.agentregistration.shared.businessdetails.FullName
@@ -87,6 +89,7 @@ trait TdGrs {
8789
)
8890

8991
object ltd:
92+
9093
val journeyData: JourneyData = JourneyData(
9194
fullName = None,
9295
dateOfBirth = None,
@@ -103,7 +106,61 @@ trait TdGrs {
103106
)
104107
)
105108

106-
// val businessDetails: BusinessDetailsLlp = to be defined
109+
val businessDetails: BusinessDetailsLimitedCompany = BusinessDetailsLimitedCompany(
110+
safeId = journeyData.registration.registeredBusinessPartnerId.getOrThrowExpectedDataMissing("registration.registeredBusinessPartnerId"),
111+
ctUtr = journeyData.ctutr.getOrThrowExpectedDataMissing("ctutr"),
112+
companyProfile = journeyData.companyProfile.getOrThrowExpectedDataMissing("companyProfile")
113+
)
114+
115+
object ltdPartnership:
116+
117+
val journeyData: JourneyData = JourneyData(
118+
fullName = None,
119+
dateOfBirth = None,
120+
nino = None,
121+
trn = None,
122+
sautr = Some(dependencies.saUtr),
123+
companyProfile = Some(dependencies.companyProfile),
124+
ctutr = None,
125+
postcode = Some(dependencies.postcode),
126+
identifiersMatch = true,
127+
registration = Registration(
128+
registrationStatus = RegistrationStatus.GrsRegistered,
129+
registeredBusinessPartnerId = Some(dependencies.safeId)
130+
)
131+
)
132+
133+
val businessDetails: BusinessDetailsPartnership = BusinessDetailsPartnership(
134+
safeId = journeyData.registration.registeredBusinessPartnerId.getOrThrowExpectedDataMissing("registration.registeredBusinessPartnerId"),
135+
saUtr = journeyData.sautr.getOrThrowExpectedDataMissing("saUtr"),
136+
postcode = journeyData.postcode.getOrThrowExpectedDataMissing("postcode"),
137+
companyProfile = journeyData.companyProfile.getOrThrowExpectedDataMissing("companyProfile")
138+
)
139+
140+
object scottishLtdPartnership:
141+
142+
val journeyData: JourneyData = JourneyData(
143+
fullName = None,
144+
dateOfBirth = None,
145+
nino = None,
146+
trn = None,
147+
sautr = Some(dependencies.saUtr),
148+
companyProfile = Some(dependencies.companyProfile),
149+
ctutr = None,
150+
postcode = Some(dependencies.postcode),
151+
identifiersMatch = true,
152+
registration = Registration(
153+
registrationStatus = RegistrationStatus.GrsRegistered,
154+
registeredBusinessPartnerId = Some(dependencies.safeId)
155+
)
156+
)
157+
158+
val businessDetails: BusinessDetailsPartnership = BusinessDetailsPartnership(
159+
safeId = journeyData.registration.registeredBusinessPartnerId.getOrThrowExpectedDataMissing("registration.registeredBusinessPartnerId"),
160+
saUtr = journeyData.sautr.getOrThrowExpectedDataMissing("saUtr"),
161+
postcode = journeyData.postcode.getOrThrowExpectedDataMissing("postcode"),
162+
companyProfile = journeyData.companyProfile.getOrThrowExpectedDataMissing("companyProfile")
163+
)
107164

108165
object generalPartnership:
109166

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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.agentregistrationfrontend.testsupport.testdata.agentapplication
18+
19+
import uk.gov.hmrc.agentregistration.shared.ApplicationState.GrsDataReceived
20+
import uk.gov.hmrc.agentregistration.shared.*
21+
import uk.gov.hmrc.agentregistration.shared.lists.FiveOrLess
22+
import uk.gov.hmrc.agentregistrationfrontend.testsupport.testdata.TdBase
23+
import uk.gov.hmrc.agentregistrationfrontend.testsupport.testdata.TdGrs
24+
import uk.gov.hmrc.agentregistrationfrontend.testsupport.testdata.agentapplication.sections.TdSectionAgentDetails
25+
import uk.gov.hmrc.agentregistrationfrontend.testsupport.testdata.agentapplication.sections.TdSectionAmls
26+
import uk.gov.hmrc.agentregistrationfrontend.testsupport.testdata.agentapplication.sections.TdSectionContactDetails
27+
28+
trait TdAgentApplicationLimitedCompany { dependencies: (TdBase & TdSectionAmls & TdSectionContactDetails & TdGrs & TdSectionAgentDetails) =>
29+
30+
object agentApplicationLimitedCompany:
31+
32+
val afterStarted: AgentApplicationLimitedCompany = AgentApplicationLimitedCompany(
33+
_id = dependencies.agentApplicationId,
34+
internalUserId = dependencies.internalUserId,
35+
linkId = dependencies.linkId,
36+
groupId = dependencies.groupId,
37+
createdAt = dependencies.nowAsInstant,
38+
applicationState = ApplicationState.Started,
39+
userRole = Some(UserRole.Authorised),
40+
businessDetails = None,
41+
applicantContactDetails = None,
42+
amlsDetails = None,
43+
agentDetails = None,
44+
refusalToDealWithCheckResult = None,
45+
companyStatusCheckResult = None,
46+
hmrcStandardForAgentsAgreed = StateOfAgreement.NotSet,
47+
numberOfRequiredKeyIndividuals = None,
48+
hasOtherRelevantIndividuals = None
49+
)
50+
51+
val afterGrsDataReceived: AgentApplicationLimitedCompany = afterStarted.copy(
52+
businessDetails = Some(
53+
dependencies.grs.ltd.businessDetails
54+
),
55+
applicationState = GrsDataReceived
56+
)
57+
58+
val afterRefusalToDealWithCheckPass: AgentApplicationLimitedCompany = afterGrsDataReceived.copy(
59+
refusalToDealWithCheckResult = Some(CheckResult.Pass)
60+
)
61+
62+
val afterRefusalToDealWithCheckFail: AgentApplicationLimitedCompany = afterGrsDataReceived.copy(
63+
refusalToDealWithCheckResult = Some(CheckResult.Fail)
64+
)
65+
66+
val afterCompaniesHouseStatusCheckPass: AgentApplicationLimitedCompany = afterRefusalToDealWithCheckPass.copy(
67+
companyStatusCheckResult = Some(CheckResult.Pass)
68+
)
69+
70+
val afterCompaniesHouseStatusCheckFail: AgentApplicationLimitedCompany = afterRefusalToDealWithCheckPass.copy(
71+
companyStatusCheckResult = Some(CheckResult.Fail)
72+
)
73+
74+
val afterContactDetailsComplete: AgentApplicationLimitedCompany = afterCompaniesHouseStatusCheckPass.copy(
75+
applicantContactDetails = Some(dependencies.applicantContactDetails),
76+
agentDetails = None
77+
)
78+
79+
val afterAgentDetailsComplete: AgentApplicationLimitedCompany = afterContactDetailsComplete.copy(
80+
agentDetails = Some(dependencies.completeAgentDetails)
81+
)
82+
83+
val afterAmlsComplete: AgentApplicationLimitedCompany = afterAgentDetailsComplete.copy(
84+
amlsDetails = Some(dependencies.completeAmlsDetails)
85+
)
86+
87+
val afterHmrcStandardForAgentsAgreed: AgentApplicationLimitedCompany = afterAmlsComplete.copy(
88+
hmrcStandardForAgentsAgreed = StateOfAgreement.Agreed
89+
)
90+
91+
val afterHowManyKeyIndividuals: AgentApplicationLimitedCompany = afterHmrcStandardForAgentsAgreed.copy(
92+
numberOfRequiredKeyIndividuals = Some(
93+
FiveOrLess(
94+
numberOfKeyIndividuals = 3
95+
)
96+
)
97+
)
98+
99+
val afterDeclarationSubmitted: AgentApplicationLimitedCompany = afterHmrcStandardForAgentsAgreed.copy(
100+
applicationState = ApplicationState.Submitted
101+
)
102+
103+
val baseForSectionAmls: AgentApplicationLimitedCompany = afterGrsDataReceived
104+
protected val AgentApplicationLimitedCompanyWithSectionAmls = new AgentApplicationWithSectionAmls(baseForSectionAmls = baseForSectionAmls)
105+
export AgentApplicationLimitedCompanyWithSectionAmls.sectionAmls
106+
107+
val baseForSectionContactDetails: AgentApplicationLimitedCompany = afterGrsDataReceived
108+
protected val tdAgentApplicationLimitedCompanyWithSectionContactDetails =
109+
new TdAgentApplicationWithSectionContactDetails(baseForSectionContactDetails = baseForSectionContactDetails)
110+
111+
export tdAgentApplicationLimitedCompanyWithSectionContactDetails.sectionContactDetails
112+
113+
protected val tdAgentApplicationLimitedCompanyWithSectionAgentDetails =
114+
new TdAgentApplicationWithSectionAgentDetails(baseForSectionAgentDetails = afterContactDetailsComplete)
115+
116+
export tdAgentApplicationLimitedCompanyWithSectionAgentDetails.sectionAgentDetails
117+
118+
}

0 commit comments

Comments
 (0)