diff --git a/app/controllers/return-requirements.controller.js b/app/controllers/return-requirements.controller.js index 629808d8f7..3a36681762 100644 --- a/app/controllers/return-requirements.controller.js +++ b/app/controllers/return-requirements.controller.js @@ -140,6 +140,17 @@ async function saveNote (request, h) { return h.redirect(`/system/return-requirements/${id}/returns-check-your-answers`) } +async function returnsSettings (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + return h.view('return-requirements/settings.njk', { + activeNavBar: 'search', + ...session + }) +} + async function selectPurpose (request, h) { const { sessionId } = request.params @@ -170,6 +181,7 @@ module.exports = { reasonNewRequirements, requirementsApproved, returnsCheckYourAnswers, + returnsSettings, returnsHowDoYouWant, saveNoReturnsCheckYourAnswers, saveNoReturnsRequired, diff --git a/app/routes/return-requirement.routes.js b/app/routes/return-requirement.routes.js index 4a3540760d..e4b6539ac8 100644 --- a/app/routes/return-requirement.routes.js +++ b/app/routes/return-requirement.routes.js @@ -183,6 +183,18 @@ const routes = [ }, description: 'Save note' } + }, { + method: 'GET', + path: '/return-requirements/{sessionId}/settings', + handler: ReturnRequirementsController.returnsSettings, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Select how often collected readings or volumes are reported' + } }, { method: 'GET', path: '/return-requirements/{sessionId}/purpose', diff --git a/app/views/return-requirements/settings.njk b/app/views/return-requirements/settings.njk new file mode 100644 index 0000000000..9df5124cdb --- /dev/null +++ b/app/views/return-requirements/settings.njk @@ -0,0 +1,29 @@ +{% extends 'layout.njk' %} +{% from "govuk/components/back-link/macro.njk" import govukBackLink %} +{% from "govuk/components/button/macro.njk" import govukButton %} + +{% set title = "Select agreements and exceptions for the return requirement" %} +{% set rootLink = "/system/return-requirements/" + id %} + +{% block breadcrumbs %} + {# Back link #} + {{ + govukBackLink({ + text: 'Back', + href: rootLink + "/frequency" + }) + }} +{% endblock %} + +{% block content %} + {# Main heading #} +
+

{{ title }}

+
+ +
+
+ {{ govukButton({ text: "Continue" }) }} +
+
+{% endblock %} diff --git a/test/controllers/return-requirements.controller.test.js b/test/controllers/return-requirements.controller.test.js index 378574a64b..fe293fe354 100644 --- a/test/controllers/return-requirements.controller.test.js +++ b/test/controllers/return-requirements.controller.test.js @@ -192,6 +192,26 @@ describe('Return requirements controller', () => { }) }) + describe('GET /return-requirements/{sessionId}/settings', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/settings', + auth: { + strategy: 'session', + credentials: { scope: ['billing'] } + } + } + + describe('when the request succeeds', () => { + it('returns the page successfully', async () => { + const response = await server.inject(options) + + expect(response.statusCode).to.equal(200) + expect(response.payload).to.contain('Select agreements and exceptions for the return requirement') + }) + }) + }) + describe('GET /return-requirements/{sessionId}/purpose', () => { const options = { method: 'GET',