From 0ac8fb501e6651e1d0b1e7d13f09d9682463bf0a Mon Sep 17 00:00:00 2001 From: Fazal Khan Date: Wed, 20 Dec 2023 14:38:32 +0000 Subject: [PATCH] feat:added stub page --- .../return-requirements.controller.js | 11 +++++++ app/routes/return-requirement.routes.js | 12 ++++++++ app/views/return-requirements/purpose.njk | 29 +++++++++++++++++++ .../return-requirements.controller.test.js | 20 +++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 app/views/return-requirements/purpose.njk diff --git a/app/controllers/return-requirements.controller.js b/app/controllers/return-requirements.controller.js index 83cd9531e8..ecc8fc1a92 100644 --- a/app/controllers/return-requirements.controller.js +++ b/app/controllers/return-requirements.controller.js @@ -140,6 +140,16 @@ async function saveNote (request, h) { return h.redirect(`/system/return-requirements/${id}/returns-check-your-answers`) } +async function selectPurpose (request, h) { + const { sessionId } = request.params + + const session = await SessionModel.query().findById(sessionId) + + const { id } = session + + return h.redirect(`/system/return-requirements/${id}/purpose`) +} + module.exports = { addANote, noReturnsCheckYourAnswers, @@ -151,6 +161,7 @@ module.exports = { saveNoReturnsCheckYourAnswers, saveNoReturnsRequired, saveNote, + selectPurpose, saveReasonNewRequirements, saveReturnsCheckYourAnswers, saveReturnsHowDoYouWant, diff --git a/app/routes/return-requirement.routes.js b/app/routes/return-requirement.routes.js index 2b4df020af..10f8e45ba6 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}/purpose', + handler: ReturnRequirementsController.selectPurpose, + options: { + auth: { + access: { + scope: ['billing'] + } + }, + description: 'Select prupose for returns requirement page' + } } ] diff --git a/app/views/return-requirements/purpose.njk b/app/views/return-requirements/purpose.njk new file mode 100644 index 0000000000..d8d2c3b4bc --- /dev/null +++ b/app/views/return-requirements/purpose.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 the purpose for the return requirement" %} +{% set rootLink = "/system/return-requirements/" + id %} + +{% block breadcrumbs %} + {# Back link #} + {{ + govukBackLink({ + text: 'Back', + href: rootLink + "/returns-how-do-you-want" + }) + }} +{% 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 8f32112467..003684f6fc 100644 --- a/test/controllers/return-requirements.controller.test.js +++ b/test/controllers/return-requirements.controller.test.js @@ -191,4 +191,24 @@ describe('Return requirements controller', () => { }) }) }) + + describe('GET /return-requirements/{sessionId}/purpose', () => { + const options = { + method: 'GET', + url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/purpose', + 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 the purpose for the return requirement') + }) + }) + }) })