Skip to content

Commit b3baee8

Browse files
authored
[WG][APB-10887] Application status tracker page 1 - just submitted (#210)
* [WG][APB-10887] Application status tracker page 1 - just submitted * [WG][APB-10887] Application status tracker page 1 - just submitted, PR comments --------- Co-authored-by: wojciech.gradzki <gitwojciech@users.noreply.github.com>
1 parent 3a6cc3e commit b3baee8

File tree

6 files changed

+210
-1
lines changed

6 files changed

+210
-1
lines changed

app/uk/gov/hmrc/agentregistrationfrontend/controllers/applicant/AgentApplicationController.scala

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import uk.gov.hmrc.agentregistrationfrontend.services.applicant.AgentRegistratio
2727
import uk.gov.hmrc.agentregistrationfrontend.util.DisplayDate.displayDateForLang
2828
import uk.gov.hmrc.agentregistrationfrontend.views.html.SimplePage
2929
import uk.gov.hmrc.agentregistrationfrontend.views.html.applicant.ConfirmationPage
30+
import uk.gov.hmrc.agentregistrationfrontend.views.html.applicant.InProgressPage
3031
import uk.gov.hmrc.agentregistrationfrontend.views.html.applicant.ViewApplicationPage
3132

3233
import java.time.Instant
@@ -43,6 +44,7 @@ class AgentApplicationController @Inject() (
4344
mcc: MessagesControllerComponents,
4445
simplePage: SimplePage,
4546
confirmationPage: ConfirmationPage,
47+
inProgressPage: InProgressPage,
4648
viewApplicationPage: ViewApplicationPage,
4749
appConfig: AppConfig,
4850
agentRegistrationRiskingService: AgentRegistrationRiskingService
@@ -92,13 +94,42 @@ extends FrontendController(mcc, actions):
9294
case _ => Redirect(AppRoutes.apply.AgentApplicationController.viewApplicationProgress)
9395

9496
def viewApplicationProgress: Action[AnyContent] = actions
97+
.getApplicationSubmitted
98+
.getBusinessPartnerRecord
99+
.async:
100+
implicit request =>
101+
val agentApplication: AgentApplication = request.get
102+
agentRegistrationRiskingService
103+
.getApplicationStatus(agentApplication.agentApplicationId)
104+
.map:
105+
case ApplicationForRiskingStatus.SubmittedForRisking => // show the confirmation screen
106+
val decisionLeadTime: FiniteDuration = appConfig.applicationDecisionLeadTime
107+
val submittedAt: Instant = agentApplication.getSubmittedAt
108+
val localDateOfDecision: LocalDate =
109+
submittedAt
110+
.plus(decisionLeadTime.toMillis, ChronoUnit.MILLIS)
111+
.atZone(ZoneId.systemDefault())
112+
.toLocalDate
113+
val localDateSubmitted: LocalDate =
114+
submittedAt
115+
.atZone(ZoneId.systemDefault())
116+
.toLocalDate
117+
Ok(inProgressPage(
118+
entityName = request.businessPartnerRecordResponse.getEntityName,
119+
agentApplication = agentApplication,
120+
dateOfDecision = displayDateForLang(Some(localDateOfDecision)),
121+
dateSubmitted = displayDateForLang(Some(localDateSubmitted))
122+
))
123+
case _ => Redirect(AppRoutes.apply.AgentApplicationController.viewApplicationApproved)
124+
125+
def viewApplicationApproved: Action[AnyContent] = actions
95126
.getApplicationSubmitted:
96127
implicit request =>
97128
val agentApplication: AgentApplication = request.get
98129
Ok(simplePage(
99130
h1 = s"Application reference: ${agentApplication.agentApplicationId.value}",
100131
bodyText = Some(
101-
"Placeholder for the Application Progress page..."
132+
"Placeholder for the Application Approved page..."
102133
)
103134
))
104135

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
@import uk.gov.hmrc.agentregistration.shared.AgentApplication
18+
@import uk.gov.hmrc.agentregistrationfrontend.views.html.Layout
19+
20+
@this(
21+
layout: Layout
22+
)
23+
24+
@(
25+
entityName: String,
26+
agentApplication: AgentApplication,
27+
dateOfDecision: String,
28+
dateSubmitted: String
29+
)(implicit
30+
request: RequestHeader,
31+
messages: Messages
32+
)
33+
34+
@key = @{"applicationProgress"}
35+
36+
@caption = @{messages(s"$key.caption")}
37+
@title = @{messages(s"$key.title", agentApplication.agentApplicationId.value)}
38+
39+
@layout(
40+
pageTitle = title
41+
) {
42+
<h2 class="govuk-caption-l">@caption</h2>
43+
<h1 class="govuk-heading-l">@title</h1>
44+
45+
<p class="govuk-body">@Html(messages(s"$key.p1", entityName))</p>
46+
<p class="govuk-body">@messages(s"$key.p2")</p>
47+
48+
<ol class="hmrc-timeline">
49+
<li class="hmrc-timeline__event">
50+
<h2 class="hmrc-timeline__event-title">@messages(s"$key.decision.h2")</h2>
51+
<div class="hmrc-timeline__event-content">
52+
<p class="govuk-body">@messages(s"$key.decision.p1")</p>
53+
<p class="govuk-body">@messages(s"$key.decision.p2")</p>
54+
<p class="govuk-body">@Html(messages(s"$key.decision.p3", dateOfDecision))</p>
55+
<p class="govuk-body">@messages(s"$key.decision.p4")</p>
56+
</div>
57+
</li>
58+
<li class="hmrc-timeline__event">
59+
<h2 class="hmrc-timeline__event-title">@messages(s"$key.submitted.h2")</h2>
60+
<time class="hmrc-timeline__event-meta">@dateSubmitted</time>
61+
</li>
62+
</ol>
63+
64+
<p class="govuk-body govuk-!-display-none-print">
65+
<a class="govuk-link" href="@{AppRoutes.apply.AgentApplicationController.viewSubmittedApplication.url}" target="_blank">
66+
@messages(s"$key.viewLink")
67+
</a>
68+
</p>
69+
}

conf/app.routes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ GET /timed-out uk.gov.hm
1212
GET /application-submitted uk.gov.hmrc.agentregistrationfrontend.controllers.applicant.AgentApplicationController.applicationSubmitted
1313
GET /view-application uk.gov.hmrc.agentregistrationfrontend.controllers.applicant.AgentApplicationController.viewSubmittedApplication
1414
GET /view-application-progress uk.gov.hmrc.agentregistrationfrontend.controllers.applicant.AgentApplicationController.viewApplicationProgress
15+
GET /view-application-approved uk.gov.hmrc.agentregistrationfrontend.controllers.applicant.AgentApplicationController.viewApplicationApproved
1516

1617
# Agent apply routes
1718
GET /apply uk.gov.hmrc.agentregistrationfrontend.controllers.applicant.AgentApplicationController.startRegistration

conf/messages

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,21 @@ confirmation.progress.p1 = You can click the link on the GOV.UK page “Apply fo
457457
confirmation.viewLink = View or print your application
458458
confirmation.signOutLink = Finish and sign out
459459

460+
# Apply / InProgress / SubmittedForRisking status
461+
applicationProgress.caption = Check the progress of an application
462+
applicationProgress.title = Application reference: {0}
463+
applicationProgress.p1 = This is application is for an agent services account for <strong>{0}</strong>.
464+
applicationProgress.p2 = Some of the information on this page uses real-time data and might change.
465+
applicationProgress.decision.h2 = When to expect a decision
466+
applicationProgress.decision.p1 = It’s currently taking up to 8 weeks to process applications for an agent services account.
467+
applicationProgress.decision.p2 = If we need further information to help us make a decision, we will contact you.
468+
applicationProgress.decision.p3 = We expect to reach a decision by <strong>{0}</strong> and will not be able to give you an update before this date.
469+
applicationProgress.decision.p4 = We’ll send you an email as soon as we’ve reached a decision.
470+
applicationProgress.submitted.h2 = Date submitted
471+
applicationProgress.viewLink = View or print your application (opens in a new tab)
472+
473+
474+
460475
# Apply / entitycheckfailed/ CompanyStatusBlock
461476
companyStatusBlock.title = We cannot create an account for this company
462477
companyStatusBlock.p1 = We cannot register this company for an agent services account. This is because of the company''s status on the Companies House register.

test/uk/gov/hmrc/agentregistrationfrontend/controllers/applicant/AgentApplicationControllerSpec.scala

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ extends ControllerSpec:
2929
private val path: String = "/agent-registration/apply"
3030
private val submittedPath: String = "/agent-registration/application-submitted"
3131
private val viewApplicationPath: String = "/agent-registration/view-application"
32+
private val viewApplicationProgressPath: String = "/agent-registration/view-application-progress"
3233

3334
object agentApplication:
3435
val submitted: AgentApplicationLlp =
@@ -49,6 +50,10 @@ extends ControllerSpec:
4950
method = "GET",
5051
url = "/agent-registration/view-application"
5152
)
53+
AppRoutes.apply.AgentApplicationController.viewApplicationProgress shouldBe Call(
54+
method = "GET",
55+
url = "/agent-registration/view-application-progress"
56+
)
5257

5358
s"GET $path should redirect to agent type page" in:
5459
val response: WSResponse = get(path)
@@ -77,6 +82,27 @@ extends ControllerSpec:
7782
ApplyStubHelper.verifyConnectorsForAuthAction()
7883
AgentRegistrationRiskingStubs.verifyGetApplicationStatus(agentApplication.submitted.agentApplicationId)
7984

85+
s"GET $viewApplicationProgressPath should render the in-progress page when status is SubmittedForRisking" in:
86+
ApplyStubHelper.stubsToSupplyBprToPage(agentApplication.submitted)
87+
AgentRegistrationRiskingStubs.stubGetApplicationStatus(agentApplication.submitted._id, ApplicationForRiskingStatus.SubmittedForRisking)
88+
val response: WSResponse = get(viewApplicationProgressPath)
89+
90+
response.status shouldBe Status.OK
91+
response.parseBodyAsJsoupDocument.title() shouldBe s"Application reference: ${agentApplication.submitted.agentApplicationId.value} - Apply for an agent services account - GOV.UK"
92+
ApplyStubHelper.verifyConnectorsToSupplyBprToPage()
93+
AgentRegistrationRiskingStubs.verifyGetApplicationStatus(agentApplication.submitted.agentApplicationId)
94+
95+
s"GET $viewApplicationProgressPath should redirect when status is anything other than SubmittedForRisking" in:
96+
ApplyStubHelper.stubsToSupplyBprToPage(agentApplication.submitted)
97+
AgentRegistrationRiskingStubs.stubGetApplicationStatus(agentApplication.submitted._id, ApplicationForRiskingStatus.Approved)
98+
val response: WSResponse = get(viewApplicationProgressPath)
99+
100+
response.status shouldBe Status.SEE_OTHER
101+
response.body[String] shouldBe ""
102+
response.header("Location").value shouldBe AppRoutes.apply.AgentApplicationController.viewApplicationApproved.url
103+
ApplyStubHelper.verifyConnectorsToSupplyBprToPage()
104+
AgentRegistrationRiskingStubs.verifyGetApplicationStatus(agentApplication.submitted.agentApplicationId)
105+
80106
s"GET $viewApplicationPath should return OK" in:
81107
ApplyStubHelper.stubsToSupplyBprToPage(agentApplication.submitted)
82108
val response: WSResponse = get(viewApplicationPath)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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.agentregistrationfrontend.views.applicant
18+
19+
import org.jsoup.Jsoup
20+
import org.jsoup.nodes.Document
21+
import uk.gov.hmrc.agentregistration.shared.AgentApplicationLlp
22+
import uk.gov.hmrc.agentregistrationfrontend.testsupport.ViewSpec
23+
import uk.gov.hmrc.agentregistrationfrontend.views.html.applicant.InProgressPage
24+
25+
class InProgressPageSpec
26+
extends ViewSpec:
27+
28+
val viewTemplate: InProgressPage = app.injector.instanceOf[InProgressPage]
29+
val agentApplication: AgentApplicationLlp =
30+
tdAll
31+
.agentApplicationLlp
32+
.afterDeclarationSubmitted
33+
34+
val doc: Document = Jsoup.parse(
35+
viewTemplate(
36+
entityName = "Test Company Name",
37+
agentApplication = agentApplication,
38+
dateOfDecision = "21 April 2026",
39+
dateSubmitted = "10 March 2026"
40+
).body
41+
)
42+
43+
"InProgressPage" should:
44+
45+
"have expected content" in:
46+
doc.mainContent shouldContainContent
47+
s"""
48+
|Check the progress of an application
49+
|Application reference: ${agentApplication.agentApplicationId.value}
50+
|This is application is for an agent services account for Test Company Name.
51+
|Some of the information on this page uses real-time data and might change.
52+
|When to expect a decision
53+
|It’s currently taking up to 8 weeks to process applications for an agent services account.
54+
|If we need further information to help us make a decision, we will contact you.
55+
|We expect to reach a decision by 21 April 2026 and will not be able to give you an update before this date.
56+
|We’ll send you an email as soon as we’ve reached a decision.
57+
|Date submitted
58+
|10 March 2026
59+
|View or print your application (opens in a new tab)
60+
|"""
61+
.stripMargin
62+
63+
"have the correct title" in:
64+
doc.title() shouldBe s"Application reference: ${agentApplication.agentApplicationId.value} - Apply for an agent services account - GOV.UK"
65+
66+
"have the correct h1" in:
67+
doc.h1 shouldBe s"Application reference: ${agentApplication.agentApplicationId.value}"

0 commit comments

Comments
 (0)