diff --git a/.dockerignore b/.dockerignore index 9b15d0730..72424b12a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,3 +17,4 @@ pacts .project *.log *.txt +.env diff --git a/app/assets/sass/application.scss b/app/assets/sass/application.scss index e6b0f87f9..13ebfcb2d 100644 --- a/app/assets/sass/application.scss +++ b/app/assets/sass/application.scss @@ -57,5 +57,4 @@ $govuk-suppressed-warnings: ( @import "components/system-messages"; @import "components/spinner"; @import "components/service-settings"; -@import "components/hint-and-body-width"; @import "components/fieldset-legend-width"; diff --git a/app/assets/sass/components/hint-and-body-width.scss b/app/assets/sass/components/hint-and-body-width.scss deleted file mode 100644 index 1908573d5..000000000 --- a/app/assets/sass/components/hint-and-body-width.scss +++ /dev/null @@ -1,4 +0,0 @@ -.hint-and-body-width { - max-width: 630px; - word-wrap: break-word; -} diff --git a/app/assets/sass/components/service-settings.scss b/app/assets/sass/components/service-settings.scss index c9e510140..63333dac0 100644 --- a/app/assets/sass/components/service-settings.scss +++ b/app/assets/sass/components/service-settings.scss @@ -34,6 +34,10 @@ @include govuk-typography-weight-bold(); } +.service-settings-pane { + max-width: 630px; +} + .service-settings-inset-text--grey { background-color: govuk-colour("light-grey"); } @@ -45,6 +49,9 @@ } .task-list { + .govuk-task-list__name-and-hint { + width: 70% !important; + } a:visited, a:link { color: govuk-colour("blue"); } diff --git a/app/assets/sass/components/system-messages.scss b/app/assets/sass/components/system-messages.scss index afa257959..407e6a6d2 100644 --- a/app/assets/sass/components/system-messages.scss +++ b/app/assets/sass/components/system-messages.scss @@ -20,6 +20,8 @@ .system-message__text { flex: 1; + overflow-wrap: break-word; + overflow: hidden; } .system-message__icon--success { diff --git a/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.js b/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.js index daf3e785b..b9c7daa92 100644 --- a/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.js +++ b/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.js @@ -2,7 +2,8 @@ const { response } = require('@utils/response') const formatSimplifiedAccountPathsFor = require('@utils/simplified-account/format/format-simplified-account-paths-for') const paths = require('@root/paths') const { updateCustomParagraphByServiceIdAndAccountType } = require('@services/email.service') -const { validateOptionalField } = require('@utils/validation/server-side-form-validations') +const { body, validationResult } = require('express-validator') +const formatValidationErrors = require('@utils/simplified-account/format/format-validation-errors') const CUSTOM_PARAGRAPH_MAX_LENGTH = 5000 function get (req, res) { @@ -10,7 +11,7 @@ function get (req, res) { const service = req.service response(req, res, 'simplified-account/settings/email-notifications/custom-paragraph', { - customParagraphText: account.rawResponse.email_notifications.PAYMENT_CONFIRMED.template_body, + customParagraph: account.rawResponse.email_notifications.PAYMENT_CONFIRMED.template_body, serviceName: service.name, backLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.emailNotifications.templates, service.externalId, account.type), @@ -22,22 +23,31 @@ function get (req, res) { async function postEditCustomParagraph (req, res) { const serviceExternalId = req.service.externalId const accountType = req.account.type - const customParagraph = req.body['custom-paragraph'] + const validations = [ + body('customParagraph').trim().isLength({ max: CUSTOM_PARAGRAPH_MAX_LENGTH }).withMessage(`Custom paragraph name must be ${CUSTOM_PARAGRAPH_MAX_LENGTH} characters or fewer`) + ] - const validationResult = validateOptionalField(customParagraph, CUSTOM_PARAGRAPH_MAX_LENGTH, 'custom paragraph') - if (!validationResult.valid) { + await Promise.all(validations.map(validation => validation.run(req))) + const errors = validationResult(req) + + if (!errors.isEmpty()) { + const formattedErrors = formatValidationErrors(errors) return response(req, res, 'simplified-account/settings/email-notifications/custom-paragraph', { errors: { - customParagraph: validationResult.message + summary: formattedErrors.errorSummary, + formErrors: formattedErrors.formErrors }, - customParagraphText: customParagraph, + customParagraph: req.body.customParagraph, serviceName: req.service.name, backLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.emailNotifications.templates, + req.service.externalId, accountType), + removeCustomParagraphLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.emailNotifications.removeCustomParagraph, req.service.externalId, accountType) }) } - await updateCustomParagraphByServiceIdAndAccountType(serviceExternalId, accountType, customParagraph) + const newCustomParagraph = req.body.customParagraph.trim() + await updateCustomParagraphByServiceIdAndAccountType(serviceExternalId, accountType, newCustomParagraph) req.flash('messages', { state: 'success', icon: '✓', heading: 'Custom paragraph updated' }) res.redirect(formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.emailNotifications.templates, serviceExternalId, accountType)) @@ -48,6 +58,7 @@ async function postRemoveCustomParagraph (req, res) { const accountType = req.account.type await updateCustomParagraphByServiceIdAndAccountType(serviceExternalId, accountType, '') + req.flash('messages', { state: 'success', icon: '✓', heading: 'Custom paragraph removed' }) res.redirect(formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.emailNotifications.templates, serviceExternalId, accountType)) } diff --git a/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.test.js b/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.test.js index c79738037..8f6a65965 100644 --- a/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.test.js +++ b/app/controllers/simplified-account/settings/email-notifications/templates/custom-paragraph.controller.test.js @@ -79,7 +79,7 @@ describe('Controller: settings/email-notifications/templates/custom-paragraph', }) it('should pass context data to the response method', () => { - expect(responseStub.args[0][3]).to.have.property('customParagraphText').to.equal('Do this next') + expect(responseStub.args[0][3]).to.have.property('customParagraph').to.equal('Do this next') expect(responseStub.args[0][3]).to.have.property('serviceName').to.equal(SERVICE_NAME) expect(responseStub.args[0][3]).to.have.property('backLink').to.contain(paths.simplifiedAccount.settings.emailNotifications.index) }) @@ -87,7 +87,7 @@ describe('Controller: settings/email-notifications/templates/custom-paragraph', describe('postRemoveCustomParagraph', () => { before(() => { - const body = { 'custom-paragraph': 'a test custom paragraph' } + const body = { customParagraph: 'a test custom paragraph' } setupTest(body) customParagraphController.postRemoveCustomParagraph(req, res) }) @@ -105,7 +105,7 @@ describe('Controller: settings/email-notifications/templates/custom-paragraph', describe('postEditCustomParagraph', () => { before(() => { - const body = { 'custom-paragraph': 'a test custom paragraph' } + const body = { customParagraph: 'a test custom paragraph' } setupTest(body) customParagraphController.postEditCustomParagraph(req, res) }) @@ -125,7 +125,7 @@ describe('Controller: settings/email-notifications/templates/custom-paragraph', describe('with validation error', () => { const invalidText = 'hi'.repeat(5000) before(() => { - const body = { 'custom-paragraph': invalidText } + const body = { customParagraph: invalidText } setupTest(body) customParagraphController.postEditCustomParagraph(req, res) }) @@ -141,12 +141,23 @@ describe('Controller: settings/email-notifications/templates/custom-paragraph', }) it('should pass context data to the response method', () => { - expect(responseStub.args[0][3]).to.have.property('errors').to.deep.equal({ - customParagraph: 'Custom paragraph must be 5000 characters or fewer' - }) - expect(responseStub.args[0][3]).to.have.property('customParagraphText').to.equal(invalidText) + const errors = responseStub.args[0][3].errors + expect(errors.summary).to.deep.equal( + [ + { + text: 'Custom paragraph name must be 5000 characters or fewer', + href: '#custom-paragraph' + } + ]) + expect(errors.formErrors).to.deep.equal( + { + customParagraph: 'Custom paragraph name must be 5000 characters or fewer' + } + ) + expect(responseStub.args[0][3]).to.have.property('customParagraph').to.equal(invalidText) expect(responseStub.args[0][3]).to.have.property('serviceName').to.equal(SERVICE_NAME) expect(responseStub.args[0][3]).to.have.property('backLink').to.contain(paths.simplifiedAccount.settings.emailNotifications.index) + expect(responseStub.args[0][3]).to.have.property('removeCustomParagraphLink').to.contain(paths.simplifiedAccount.settings.emailNotifications.removeCustomParagraph) }) }) }) diff --git a/app/controllers/simplified-account/settings/service-name/service-name.controller.js b/app/controllers/simplified-account/settings/service-name/service-name.controller.js index 0774bc9e7..c31d782e4 100644 --- a/app/controllers/simplified-account/settings/service-name/service-name.controller.js +++ b/app/controllers/simplified-account/settings/service-name/service-name.controller.js @@ -36,11 +36,11 @@ function getEditServiceName (req, res) { async function postEditServiceName (req, res) { const editCy = req.body.cy === 'true' const validations = [ - body('serviceNameInput').trim().isLength({ max: SERVICE_NAME_MAX_LENGTH }).withMessage(`Service name must be ${SERVICE_NAME_MAX_LENGTH} characters or fewer`) + body('serviceName').trim().isLength({ max: SERVICE_NAME_MAX_LENGTH }).withMessage(`Service name must be ${SERVICE_NAME_MAX_LENGTH} characters or fewer`) ] // we don't check presence for welsh names if (!editCy) { - validations.push(body('serviceNameInput').trim().notEmpty().withMessage('Service name is required')) + validations.push(body('serviceName').trim().notEmpty().withMessage('Service name is required')) } await Promise.all(validations.map(validation => validation.run(req))) @@ -53,13 +53,14 @@ async function postEditServiceName (req, res) { formErrors: formattedErrors.formErrors }, editCy, - serviceName: req.body.serviceNameInput, + serviceName: req.body.serviceName, backLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.serviceName.index, req.service.externalId, req.account.type), - submitLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.serviceName.edit, req.service.externalId, req.account.type) + submitLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.serviceName.edit, req.service.externalId, req.account.type), + removeCyLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.serviceName.removeCy, req.service.externalId, req.account.type) }) } - const newServiceName = req.body.serviceNameInput.trim() + const newServiceName = req.body.serviceName.trim() editCy ? await updateServiceName(req.service.externalId, req.service.serviceName.en, newServiceName) : await updateServiceName(req.service.externalId, newServiceName, req.service.serviceName.cy) res.redirect(formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.serviceName.index, req.service.externalId, req.account.type)) } diff --git a/app/controllers/simplified-account/settings/service-name/service-name.controller.test.js b/app/controllers/simplified-account/settings/service-name/service-name.controller.test.js index 858b3e733..0ad1ba716 100644 --- a/app/controllers/simplified-account/settings/service-name/service-name.controller.test.js +++ b/app/controllers/simplified-account/settings/service-name/service-name.controller.test.js @@ -123,7 +123,7 @@ describe('Controller: settings/service-name', () => { before(() => { setupTest('postEditServiceName', {}, { body: { - serviceNameInput: 'New English Name', + serviceName: 'New English Name', cy: 'false' } }) @@ -143,7 +143,7 @@ describe('Controller: settings/service-name', () => { before(() => { setupTest('postEditServiceName', {}, { body: { - serviceNameInput: 'Enw Cymraeg newydd', + serviceName: 'Enw Cymraeg newydd', cy: 'true' } }) @@ -186,6 +186,7 @@ describe('Controller: settings/service-name', () => { expect(responseStub.calledOnce).to.be.true // eslint-disable-line const [, , template, context] = responseStub.args[0] expect(template).to.equal('simplified-account/settings/service-name/edit-service-name') + expect(context).to.have.property('removeCyLink').to.contain(paths.simplifiedAccount.settings.serviceName.removeCy) expect(context.errors).to.deep.equal({ summary: ['Error summary'], formErrors: { serviceNameInput: 'Error message' } diff --git a/app/simplified-account-routes.js b/app/simplified-account-routes.js index 8b477b27f..1228fe226 100644 --- a/app/simplified-account-routes.js +++ b/app/simplified-account-routes.js @@ -75,18 +75,20 @@ simplifiedAccount.get(paths.simplifiedAccount.settings.cardTypes.index, permissi // stripe details const stripeDetailsPath = paths.simplifiedAccount.settings.stripeDetails const stripeDetailsRouter = new Router({ mergeParams: true }) - .use(enforcePaymentProviderType(STRIPE), permission('stripe-account-details:update')) + .use(enforceLiveAccountOnly, enforcePaymentProviderType(STRIPE), permission('stripe-account-details:update')) stripeDetailsRouter.get(stripeDetailsPath.index, serviceSettingsController.stripeDetails.get) + stripeDetailsRouter.get(stripeDetailsPath.bankAccount, serviceSettingsController.stripeDetails.bankAccount.get) stripeDetailsRouter.post(stripeDetailsPath.bankAccount, serviceSettingsController.stripeDetails.bankAccount.post) -// -- new stuff + stripeDetailsRouter.get(stripeDetailsPath.companyNumber, serviceSettingsController.stripeDetails.companyNumber.get) stripeDetailsRouter.post(stripeDetailsPath.companyNumber, serviceSettingsController.stripeDetails.companyNumber.post) + stripeDetailsRouter.get(stripeDetailsPath.organisationDetails.index, serviceSettingsController.stripeDetails.organisationDetails.get) stripeDetailsRouter.post(stripeDetailsPath.organisationDetails.index, serviceSettingsController.stripeDetails.organisationDetails.post) stripeDetailsRouter.get(stripeDetailsPath.organisationDetails.update, serviceSettingsController.stripeDetails.organisationDetails.update.get) stripeDetailsRouter.post(stripeDetailsPath.organisationDetails.update, serviceSettingsController.stripeDetails.organisationDetails.update.post) -// -- responsible person + stripeDetailsRouter.get(stripeDetailsPath.responsiblePerson.index, serviceSettingsController.stripeDetails.responsiblePerson.get) stripeDetailsRouter.post(stripeDetailsPath.responsiblePerson.index, serviceSettingsController.stripeDetails.responsiblePerson.post) stripeDetailsRouter.get(stripeDetailsPath.responsiblePerson.homeAddress, serviceSettingsController.stripeDetails.responsiblePerson.homeAddress.get) @@ -95,13 +97,16 @@ stripeDetailsRouter.get(stripeDetailsPath.responsiblePerson.contactDetails, serv stripeDetailsRouter.post(stripeDetailsPath.responsiblePerson.contactDetails, serviceSettingsController.stripeDetails.responsiblePerson.contactDetails.post) stripeDetailsRouter.get(stripeDetailsPath.responsiblePerson.checkYourAnswers, serviceSettingsController.stripeDetails.responsiblePerson.checkYourAnswers.get) stripeDetailsRouter.post(stripeDetailsPath.responsiblePerson.checkYourAnswers, serviceSettingsController.stripeDetails.responsiblePerson.checkYourAnswers.post) -// -- + stripeDetailsRouter.get(stripeDetailsPath.vatNumber, serviceSettingsController.stripeDetails.vatNumber.get) stripeDetailsRouter.post(stripeDetailsPath.vatNumber, serviceSettingsController.stripeDetails.vatNumber.post) + stripeDetailsRouter.get(stripeDetailsPath.director, serviceSettingsController.stripeDetails.director.get) stripeDetailsRouter.post(stripeDetailsPath.director, serviceSettingsController.stripeDetails.director.post) + stripeDetailsRouter.get(stripeDetailsPath.governmentEntityDocument, serviceSettingsController.stripeDetails.governmentEntityDocument.get) stripeDetailsRouter.post(stripeDetailsPath.governmentEntityDocument, [upload.single(GOV_ENTITY_DOC_FORM_FIELD_NAME), ...serviceSettingsController.stripeDetails.governmentEntityDocument.post]) + simplifiedAccount.use(stripeDetailsRouter) module.exports = simplifiedAccount diff --git a/app/views/simplified-account/settings/email-notifications/collect-email-page.njk b/app/views/simplified-account/settings/email-notifications/collect-email-page.njk index c7d7960b5..c8696efbd 100644 --- a/app/views/simplified-account/settings/email-notifications/collect-email-page.njk +++ b/app/views/simplified-account/settings/email-notifications/collect-email-page.njk @@ -1,74 +1,61 @@ {% extends "../settings-layout.njk" %} {% block settingsPageTitle %} - Email notifications - {{currentService.name}} {{currentGatewayAccount.full_type}} + Email notifications - {{ currentService.name }} {{ currentGatewayAccount.full_type }} {% endblock %} {% block settingsContent %} +
+ - {{ govukBackLink({ - text: "Back", - href: backLink + {{ govukRadios({ + idPrefix: 'mode', + name: 'emailCollectionMode', + fieldset: { + legend: { + text: 'Ask users for their email address', + isPageHeading: true, + classes: 'govuk-fieldset__legend--l govuk-!-font-weight-bold' + } + }, + items: [ + { + value: emailCollectionModes.mandatory, + html: 'On – as a mandatory field', + label: { + classes: 'govuk-!-font-weight-bold' + }, + checked: emailCollectionMode === emailCollectionModes.mandatory, + hint: { + text: 'Users must enter an email address to complete a payment – they can receive notifications' + } + }, + { + value: emailCollectionModes.optional, + html: 'On – as an optional field', + label: { + classes: 'govuk-!-font-weight-bold' + }, + checked: emailCollectionMode === emailCollectionModes.optional, + hint: { + text: 'Users can choose to enter an email address – if they do, they can receive notifications' + } + }, + { + value: emailCollectionModes.no, + html: 'Off', + label: { + classes: 'govuk-!-font-weight-bold' + }, + checked: emailCollectionMode === emailCollectionModes.no, + hint: { + text: 'Users do not have the option to enter an email address – they will not receive notifications' + } + } + ] }) }} - - - - - {{ - govukRadios({ - idPrefix: 'mode', - name: 'emailCollectionMode', - fieldset: { - legend: { - text: 'Ask users for their email address', - isPageHeading: true, - classes: 'govuk-fieldset__legend--l govuk-!-font-weight-bold' - } - }, - items: [ - { - value: emailCollectionModes.mandatory, - html: 'On – as a mandatory field', - label: { - classes: 'govuk-!-font-weight-bold' - }, - checked: emailCollectionMode === emailCollectionModes.mandatory, - hint: { - text: 'Users must enter an email address to complete a payment – they can receive notifications', - classes: 'hint-and-body-width' - } - }, - { - value: emailCollectionModes.optional, - html: 'On – as an optional field', - label: { - classes: 'govuk-!-font-weight-bold' - }, - checked: emailCollectionMode === emailCollectionModes.optional, - hint: { - text: 'Users can choose to enter an email address – if they do, they can receive notifications', - classes: 'hint-and-body-width' - } - }, - { - value: emailCollectionModes.no, - html: 'Off', - label: { - classes: 'govuk-!-font-weight-bold' - }, - checked: emailCollectionMode === emailCollectionModes.no, - hint: { - text: 'Users do not have the option to enter an email address – they will not receive notifications', - classes: 'hint-and-body-width' - } - } - ] - }) - }} - {{ govukButton({ - text: 'Save changes' - }) }} -
- - + {{ govukButton({ + text: 'Save changes' + }) }} + {% endblock %} diff --git a/app/views/simplified-account/settings/email-notifications/custom-paragraph.njk b/app/views/simplified-account/settings/email-notifications/custom-paragraph.njk index 5cbc1993e..20d277f5b 100644 --- a/app/views/simplified-account/settings/email-notifications/custom-paragraph.njk +++ b/app/views/simplified-account/settings/email-notifications/custom-paragraph.njk @@ -5,38 +5,20 @@ {% endblock %} {% block settingsContent %} - - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: [ - { - text: errors.customParagraph, - href: "#" - } - ] - }) }} - {% endif %} -

Add a custom paragraph

- You can add a custom paragraph to give users more information about your service. For example, you can tell users: + You can add a custom paragraph to give users more information about your service. For example, you can tell users:

- If you include a link in your custom paragraph you must: + If you include a link in your custom paragraph you must:

- Do not include contact details in the custom paragraph. If you want to provide contact details, you must link to a page on a gov.uk domain. + Do not include contact details in the custom paragraph. If you want to provide contact details, you must link to a + page on a gov.uk domain.

- You should not: + You should not:

- - - {{ - govukTextarea({ - name: "custom-paragraph", - id: "custom-paragraph", - label: { - text: "Enter a custom paragraph", - classes: "govuk-label--m" - }, - classes: "qa-custom-p", - value: customParagraphText, - errorMessage: { text: errors.customParagraph } if errors.customParagraph else false - }) - }} + + + {{ govukTextarea({ + name: "customParagraph", + id: "custom-paragraph", + label: { + text: "Enter a custom paragraph", + classes: "govuk-label--m" + }, + errorMessage: { text: errors.formErrors['customParagraph'] } if errors.formErrors['customParagraph'] else false, + value: customParagraph + }) }}
- {% if customParagraphText %} + {% if customParagraph %}
@@ -91,7 +71,7 @@ form: "add-custom-paragraph" } }) }} - {% if customParagraphText %} + {% if customParagraph %} {{ govukButton({ text: "Remove custom paragraph", classes: "govuk-button--secondary", diff --git a/app/views/simplified-account/settings/email-notifications/edit-email-collection-mode.njk b/app/views/simplified-account/settings/email-notifications/edit-email-collection-mode.njk index 862350500..34632ebef 100644 --- a/app/views/simplified-account/settings/email-notifications/edit-email-collection-mode.njk +++ b/app/views/simplified-account/settings/email-notifications/edit-email-collection-mode.njk @@ -1,62 +1,52 @@ {% extends "../settings-layout.njk" %} {% block settingsPageTitle %} - Email notifications - {{currentService.name}} {{currentGatewayAccount.full_type}} + Email notifications - {{ currentService.name }} {{ currentGatewayAccount.full_type }} {% endblock %} {% block settingsContent %} +
+ - {{ govukBackLink({ - text: "Back", - href: backLink + {{ govukRadios({ + idPrefix: 'email-collection-mode', + name: 'emailCollectionMode', + fieldset: { + legend: { + text: 'Do you want to ask users for an email address on the card payment page?', + isPageHeading: true, + classes: 'govuk-fieldset__legend--l' + } + }, + items: [ + { + value: emailCollectionModes.mandatory, + text: 'Yes – as a mandatory field', + checked: emailCollectionMode === 'MANDATORY', + hint: { + text: 'Users must enter an email address to complete a payment – they can receive notifications' + } + }, + { + value: emailCollectionModes.optional, + text: 'Yes – as an optional field', + checked: emailCollectionMode === 'OPTIONAL', + hint: { + text: 'Users can choose to enter an email address – if they do, they can receive notifications' + } + }, + { + value: emailCollectionModes.no, + text: 'No', + checked: emailCollectionMode === 'OFF', + hint: { + text: 'Users do not have the option to enter an email address – they will not receive notifications' + } + } + ] }) }} - - - - - {{ - govukRadios({ - idPrefix: 'email-collection-mode', - name: 'emailCollectionMode', - fieldset: { - legend: { - text: 'Do you want to ask users for an email address on the card payment page?', - isPageHeading: true, - classes: 'govuk-fieldset__legend--l' - } - }, - items: [ - { - value: emailCollectionModes.mandatory, - text: 'Yes – as a mandatory field', - checked: emailCollectionMode === 'MANDATORY', - hint: { - text: 'Users must enter an email address to complete a payment – they can receive notifications' - } - }, - { - value: emailCollectionModes.optional, - text: 'Yes – as an optional field', - checked: emailCollectionMode === 'OPTIONAL', - hint: { - text: 'Users can choose to enter an email address – if they do, they can receive notifications' - } - }, - { - value: emailCollectionModes.no, - text: 'No', - checked: emailCollectionMode === 'OFF', - hint: { - text: 'Users do not have the option to enter an email address – they will not receive notifications' - } - } - ] - }) - }} - {{ govukButton({ - text: 'Save changes' - }) }} -
- - + {{ govukButton({ + text: 'Save changes' + }) }} + {% endblock %} diff --git a/app/views/simplified-account/settings/email-notifications/index.njk b/app/views/simplified-account/settings/email-notifications/index.njk index 3faf3272f..168312fbf 100644 --- a/app/views/simplified-account/settings/email-notifications/index.njk +++ b/app/views/simplified-account/settings/email-notifications/index.njk @@ -5,7 +5,6 @@ {% endblock %} {% block settingsContent %} - {% if not isAdminUser %} {{ govukInsetText({ text: "You don’t have permission to manage settings. Contact your service admin if you would like to manage 3D Secure, @@ -38,12 +37,12 @@ }, { key: { - text: "Send payment confirmation emails" - }, + text: "Send payment confirmation emails" + }, value: { - text: 'On' if (confirmationEmailEnabled and emailCollectionMode !== 'OFF') else + text: 'On' if (confirmationEmailEnabled and emailCollectionMode !== 'OFF') else ('Off' if (not confirmationEmailEnabled and emailCollectionMode !== 'OFF') else 'Off (not asking users for their email address)') - }, + }, actions: { items: [ { @@ -57,12 +56,12 @@ }, { key: { - text: "Send refund emails" - }, + text: "Send refund emails" + }, value: { - text: 'On' if (refundEmailEnabled and emailCollectionMode !== 'OFF') else + text: 'On' if (refundEmailEnabled and emailCollectionMode !== 'OFF') else ('Off' if (not refundEmailEnabled and emailCollectionMode !== 'OFF') else 'Off (not asking users for their email address)') - }, + }, actions: { items: [ { @@ -77,8 +76,10 @@ ]}) }} {% if isAdminUser %} -

View email templates and add a custom paragraph

+

View email templates + and add a custom paragraph

{% else %} -

View email templates

+

View email + templates

{% endif %} {% endblock %} diff --git a/app/views/simplified-account/settings/email-notifications/payment-confirmation-email-toggle.njk b/app/views/simplified-account/settings/email-notifications/payment-confirmation-email-toggle.njk index 5ed0a43cd..c5af732ca 100644 --- a/app/views/simplified-account/settings/email-notifications/payment-confirmation-email-toggle.njk +++ b/app/views/simplified-account/settings/email-notifications/payment-confirmation-email-toggle.njk @@ -5,15 +5,8 @@ {% endblock %} {% block settingsContent %} - - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} -
- {{ govukRadios({ idPrefix: 'toggle', name: 'paymentConfirmationEmailToggle', @@ -34,20 +27,19 @@ value: 'true', html: 'On', label: { - classes: 'govuk-!-font-weight-bold' - } if emailCollectionMode === 'OPTIONAL', + classes: 'govuk-!-font-weight-bold' + } if emailCollectionMode === 'OPTIONAL', checked: confirmationEnabled === true, hint: { - text: 'Entering an email address is currently optional so users might not get a payment confirmation', - classes: 'hint-and-body-width' - } if emailCollectionMode === 'OPTIONAL' + text: 'Entering an email address is currently optional so users might not get a payment confirmation' + } if emailCollectionMode === 'OPTIONAL' }, { value: 'false', html: 'Off', label: { - classes: 'govuk-!-font-weight-bold' - } if emailCollectionMode === 'OPTIONAL', + classes: 'govuk-!-font-weight-bold' + } if emailCollectionMode === 'OPTIONAL', checked: confirmationEnabled === false } ] @@ -55,6 +47,5 @@ {{ govukButton({ text: 'Save changes' }) }} -
{% endblock %} diff --git a/app/views/simplified-account/settings/email-notifications/refund-email-toggle.njk b/app/views/simplified-account/settings/email-notifications/refund-email-toggle.njk index 8f554e1c3..b059f5156 100644 --- a/app/views/simplified-account/settings/email-notifications/refund-email-toggle.njk +++ b/app/views/simplified-account/settings/email-notifications/refund-email-toggle.njk @@ -5,12 +5,6 @@ {% endblock %} {% block settingsContent %} - - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} -
@@ -34,20 +28,19 @@ value: 'true', html: 'On', label: { - classes: 'govuk-!-font-weight-bold' - } if emailCollectionMode === 'OPTIONAL', + classes: 'govuk-!-font-weight-bold' + } if emailCollectionMode === 'OPTIONAL', checked: refundEmailEnabled === true, hint: { - text: 'Entering an email address is currently optional so users might not get a refund confirmation', - classes: 'hint-and-body-width' - } if emailCollectionMode === 'OPTIONAL' + text: 'Entering an email address is currently optional so users might not get a refund confirmation' + } if emailCollectionMode === 'OPTIONAL' }, { value: 'false', html: 'Off', label: { - classes: 'govuk-!-font-weight-bold' - } if emailCollectionMode === 'OPTIONAL', + classes: 'govuk-!-font-weight-bold' + } if emailCollectionMode === 'OPTIONAL', checked: refundEmailEnabled === false } ] diff --git a/app/views/simplified-account/settings/email-notifications/templates.njk b/app/views/simplified-account/settings/email-notifications/templates.njk index 311cd6da9..e084d1e44 100644 --- a/app/views/simplified-account/settings/email-notifications/templates.njk +++ b/app/views/simplified-account/settings/email-notifications/templates.njk @@ -5,12 +5,6 @@ {% endblock %} {% block settingsContent %} - - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - {% if not isAdminUser %} {{ govukInsetText({ text: "You don’t have permission to manage settings. Contact your service admin if you would like to manage 3D Secure, @@ -21,7 +15,7 @@

Email templates

-

+

GOV.UK Pay can send notifications to users.

@@ -57,7 +51,8 @@ }) }}
-

Your payment of £[amount] to {{ serviceName }} was successful

+

Your payment of £[amount] to + {{ serviceName }} was successful

@@ -87,6 +83,7 @@ {{ govukButton({ href: customParagraphHref, + classes: 'govuk-!-margin-bottom-0', text: 'Edit custom paragraph' if customEmailText else 'Add a custom paragraph', attributes: { id: 'add-custom-paragraph-link' @@ -94,7 +91,8 @@ }) }} {% else %}

- Admin users can add a custom paragraph to give users extra information related to your service. For example, how long it will take to process the payment. + Admin users can add a custom paragraph to give users extra information related to your service. For example, + how long it will take to process the payment.

{% endif %}
@@ -132,14 +130,16 @@ }) }}
- +

Your refund may take up to 6 days to appear in your account.

-

This email address is not monitored. If you have any questions about your refund, contact the service you made the original payment to directly.

+

This email address is not monitored. If you have any questions about your refund, contact + the service you made the original payment to directly.

{% endset -%} @@ -149,8 +149,8 @@ label: 'Confirmation email', id: 'confirmation-html', panel: { - html: confirmationEmailHtml - } + html: confirmationEmailHtml + } }, { label: 'Refund email', diff --git a/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-address.njk b/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-address.njk index bdf55dcea..37474324b 100644 --- a/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-address.njk +++ b/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-address.njk @@ -13,7 +13,7 @@ hint: { text: "Cannot be a PO Box" }, - classes: "govuk-!-width-two-thirds", + classes: "govuk-!-width-three-quarters", id: "address-line1", name: "addressLine1", autocomplete: "section-address address-line1", @@ -25,7 +25,7 @@ label: { html: 'Building and street line 2 of 2' }, - classes: "govuk-!-width-two-thirds", + classes: "govuk-!-width-three-quarters", id: "address-line2", name: "addressLine2", autocomplete: "section-address address-line2", @@ -37,7 +37,7 @@ label: { text: "Town or city" }, - classes: "govuk-!-width-one-half", + classes: "govuk-!-width-two-thirds", id: "address-city", name: "addressCity", autocomplete: "section-address address-level2", @@ -47,7 +47,7 @@ {{ govukSelect({ id: "address-country", - classes: "govuk-!-width-one-half", + classes: "govuk-!-width-two-thirds", name: "addressCountry", errorMessage: { text: errors.formErrors['addressCountry'] } if errors.formErrors['addressCountry'] else false, label: { @@ -60,7 +60,7 @@ label: { text: "Postcode" }, - classes: "govuk-input--width-10", + classes: "govuk-!-width-one-quarter", id: "address-postcode", name: "addressPostcode", autocomplete: "section-address postal-code", diff --git a/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-name.njk b/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-name.njk index 415a43887..b9f5fa6fa 100644 --- a/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-name.njk +++ b/app/views/simplified-account/settings/organisation-details/_edit-organisation-details-name.njk @@ -1,5 +1,5 @@ {% set organisationNameHint %} -
+

Enter the main name of your organisation, not your local office or individual department.

Write the organisation name in full. Only use acronyms that are widely understood (for example, NHS).

@@ -16,6 +16,6 @@ hint: { html: organisationNameHint }, - classes: "govuk-!-width-two-thirds", + classes: "govuk-!-width-three-quarters", value: organisationDetails.organisationName }) }} diff --git a/app/views/simplified-account/settings/organisation-details/edit-organisation-details.njk b/app/views/simplified-account/settings/organisation-details/edit-organisation-details.njk index 4aa7b9825..72570cd47 100644 --- a/app/views/simplified-account/settings/organisation-details/edit-organisation-details.njk +++ b/app/views/simplified-account/settings/organisation-details/edit-organisation-details.njk @@ -5,23 +5,12 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) if backLink }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Organisation details

-

Payment card schemes require the details of the organisation taking payment to be shown on payment pages.

+

Payment card schemes require the details of the organisation taking + payment to be shown on payment pages.

- + {% include "./_edit-organisation-details-name.njk" %} @@ -68,7 +57,5 @@ id: "save-merchant-details" } }) }} - - {% endblock %} diff --git a/app/views/simplified-account/settings/organisation-details/index.njk b/app/views/simplified-account/settings/organisation-details/index.njk index f409e4228..3a3ec5bf7 100644 --- a/app/views/simplified-account/settings/organisation-details/index.njk +++ b/app/views/simplified-account/settings/organisation-details/index.njk @@ -7,7 +7,8 @@ {% block settingsContent %}

Organisation details

-

Payment card schemes require the details of the organisation taking payment to be shown on payment pages.

+

Payment card schemes require the details of the organisation taking + payment to be shown on payment pages.

{{ govukSummaryList({ classes: "govuk-!-margin-bottom-9", @@ -27,35 +28,35 @@ rows: [ { key: { - text: "Name" - }, + text: "Name" + }, value: { - text: organisationDetails.organisationName - } + text: organisationDetails.organisationName + } }, { key: { - text: "Address" - }, + text: "Address" + }, value: { - html: organisationDetails.address - } + html: organisationDetails.address + } }, { key: { - text: "Telephone number" - }, + text: "Telephone number" + }, value: { - text: organisationDetails.telephoneNumber - } + text: organisationDetails.telephoneNumber + } }, { key: { - text: "Website address" - }, + text: "Website address" + }, value: { - text: organisationDetails.url - } + text: organisationDetails.url + } } ] }) }} diff --git a/app/views/simplified-account/settings/service-name/edit-service-name.njk b/app/views/simplified-account/settings/service-name/edit-service-name.njk index 56086293b..501b95ceb 100644 --- a/app/views/simplified-account/settings/service-name/edit-service-name.njk +++ b/app/views/simplified-account/settings/service-name/edit-service-name.njk @@ -9,22 +9,10 @@ {% endset %} {% block settingsPageTitle %} - Edit {% if editCy %}Welsh{% else %}English{% endif%} service name + Edit {% if editCy %}Welsh{% else %}English{% endif %} service name {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -
@@ -33,11 +21,11 @@ label: { html: inputLabel }, - errorMessage: { text: errors.formErrors['serviceNameInput'] } if errors.formErrors['serviceNameInput'] else false, - id: "service-name-input", - name: "serviceNameInput", + errorMessage: { text: errors.formErrors['serviceName'] } if errors.formErrors['serviceName'] else false, + id: "service-name", + name: "serviceName", value: serviceName, - classes: "govuk-!-width-one-half", + classes: "govuk-!-width-two-thirds", type: "text", spellcheck: true, hint: { @@ -48,7 +36,7 @@ } }) }} -

+

{% if editCy %} diff --git a/app/views/simplified-account/settings/service-name/index.njk b/app/views/simplified-account/settings/service-name/index.njk index cbdfa6e89..bd63c7a68 100644 --- a/app/views/simplified-account/settings/service-name/index.njk +++ b/app/views/simplified-account/settings/service-name/index.njk @@ -4,8 +4,6 @@ Add Welsh service name {% endset %} - - {% block settingsPageTitle %} Service name {% endblock %} diff --git a/app/views/simplified-account/settings/settings-layout.njk b/app/views/simplified-account/settings/settings-layout.njk index 0c4c24456..924529b23 100644 --- a/app/views/simplified-account/settings/settings-layout.njk +++ b/app/views/simplified-account/settings/settings-layout.njk @@ -12,10 +12,23 @@ {% block mainContent %}

- {% if messages is defined and messages is iterable and messages|length > 0 %} - {{ systemMessages({ messages: messages }) }} - {% endif %} - - {% block settingsContent %}{% endblock %} +
+ {% if backLink %} + {{ govukBackLink({ + text: "Back", + href: backLink + }) }} + {% endif %} + {% if messages is defined and messages is iterable and messages|length > 0 %} + {{ systemMessages({ messages: messages }) }} + {% endif %} + {% if errors %} + {{ govukErrorSummary({ + titleText: "There is a problem", + errorList: errors.summary + }) }} + {% endif %} + {% block settingsContent %}{% endblock %} +
{% endblock %} diff --git a/app/views/simplified-account/settings/stripe-details/bank-account/index.njk b/app/views/simplified-account/settings/stripe-details/bank-account/index.njk index 1275e6763..d5093d020 100644 --- a/app/views/simplified-account/settings/stripe-details/bank-account/index.njk +++ b/app/views/simplified-account/settings/stripe-details/bank-account/index.njk @@ -5,18 +5,6 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} - {% call govukFieldset({ @@ -77,7 +65,7 @@ document.getElementById('bank-account-form').addEventListener('submit', function () { submitButton.setAttribute('disabled', 'true') submitButton.setAttribute('aria-disabled', 'true') - submitButton.textContent = "Saving..." + submitButton.textContent = 'Saving...' }) // progressively enhance the account number input to only accept digits diff --git a/app/views/simplified-account/settings/stripe-details/company-number/index.njk b/app/views/simplified-account/settings/stripe-details/company-number/index.njk index 3cc2a721d..ba02fa208 100644 --- a/app/views/simplified-account/settings/stripe-details/company-number/index.njk +++ b/app/views/simplified-account/settings/stripe-details/company-number/index.njk @@ -5,18 +5,6 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Company registration number

@@ -41,7 +29,7 @@ label: { text: "Enter your Company registration number" }, - classes: "govuk-!-width-one-quarter", + classes: "govuk-input--width-10", id: "company-number", name: "companyNumber", value: companyNumber, diff --git a/app/views/simplified-account/settings/stripe-details/director/index.njk b/app/views/simplified-account/settings/stripe-details/director/index.njk index dadf2c530..85dc4e8ee 100644 --- a/app/views/simplified-account/settings/stripe-details/director/index.njk +++ b/app/views/simplified-account/settings/stripe-details/director/index.njk @@ -5,18 +5,6 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Service director

We need the details of the director of the service or someone at director level in your @@ -48,7 +36,7 @@ autocomplete: "given-name", spellcheck: false, errorMessage: { text: errors.formErrors['firstName'] } if errors.formErrors['firstName'] else false, - classes: "govuk-input--width-20" + classes: "govuk-!-width-two-thirds" }) }} {{ govukInput({ @@ -62,7 +50,7 @@ autocomplete: "family-name", spellcheck: false, errorMessage: { text: errors.formErrors['lastName'] } if errors.formErrors['lastName'] else false, - classes: "govuk-input--width-20" + classes: "govuk-!-width-two-thirds" }) }} {% endcall %} @@ -121,7 +109,7 @@ autocomplete: "work email", spellcheck: false, errorMessage: { text: errors.formErrors['workEmail'] } if errors.formErrors['workEmail'] else false, - classes: "govuk-!-width-two-thirds" + classes: "govuk-!-width-full" }) }} {{ govukButton({ diff --git a/app/views/simplified-account/settings/stripe-details/government-entity-document/index.njk b/app/views/simplified-account/settings/stripe-details/government-entity-document/index.njk index c23a661b6..7ba83bcab 100644 --- a/app/views/simplified-account/settings/stripe-details/government-entity-document/index.njk +++ b/app/views/simplified-account/settings/stripe-details/government-entity-document/index.njk @@ -6,18 +6,6 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Upload a government entity document

For Stripe to verify that your organisation is a ‘government entity’, you need to upload one @@ -54,6 +42,7 @@ {{ govukButton({ text: "Submit and continue", id: "government-entity-document-submit" }) }}

+ {% endblock %} diff --git a/app/views/simplified-account/settings/stripe-details/responsible-person/contact-details.njk b/app/views/simplified-account/settings/stripe-details/responsible-person/contact-details.njk index 2df56e082..cd6943098 100644 --- a/app/views/simplified-account/settings/stripe-details/responsible-person/contact-details.njk +++ b/app/views/simplified-account/settings/stripe-details/responsible-person/contact-details.njk @@ -5,18 +5,6 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Responsible person contact details

@@ -36,7 +24,7 @@ type: "tel", autocomplete: "section-contact work tel", errorMessage: { text: errors.formErrors['workTelephoneNumber'] } if errors.formErrors['workTelephoneNumber'] else false, - classes: "govuk-!-width-two-thirds" + classes: "govuk-!-full-width" }) }} {{ govukInput({ @@ -51,7 +39,7 @@ autocomplete: "section-contact work email", spellcheck: false, errorMessage: { text: errors.formErrors['workEmail'] } if errors.formErrors['workEmail'] else false, - classes: "govuk-!-width-two-thirds" + classes: "govuk-!-full-width" }) }} {{ govukButton({ text: "Save and continue" }) }} diff --git a/app/views/simplified-account/settings/stripe-details/responsible-person/home-address.njk b/app/views/simplified-account/settings/stripe-details/responsible-person/home-address.njk index aeb4cdd5e..23a2181c7 100644 --- a/app/views/simplified-account/settings/stripe-details/responsible-person/home-address.njk +++ b/app/views/simplified-account/settings/stripe-details/responsible-person/home-address.njk @@ -5,28 +5,13 @@ {% endblock %} {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Responsible person home address

- - {% call govukFieldset({}) %} - -

Do not use a work address. Stripe needs the responsible person’s home address to check their +

Do not use a work address. Stripe needs the responsible person’s home address to check + their identity

- {{ govukInput({ label: { html: 'Address line 1' @@ -37,7 +22,7 @@ type: "text", autocomplete: "section-address address-line1", errorMessage: { text: errors.formErrors['homeAddressLine1'] } if errors.formErrors['homeAddressLine1'] else false, - classes: "govuk-!-width-two-thirds" + classes: "govuk-!-width-three-quarters" }) }} {{ govukInput({ label: { @@ -52,7 +37,7 @@ attributes: { "aria-label": "Enter address line 2" }, - classes: "govuk-!-width-two-thirds" + classes: "govuk-!-width-three-quarters" }) }} {{ govukInput({ label: { @@ -64,7 +49,7 @@ type: "text", autocomplete: "section-address address-level2", errorMessage: { text: errors.formErrors['homeAddressCity'] } if errors.formErrors['homeAddressCity'] else false, - classes: "govuk-input--width-20" + classes: "govuk-!-width-one-half" }) }} {{ govukInput({ label: { @@ -75,14 +60,10 @@ value: address.homeAddressPostcode, type: "text", autocomplete: "section-address postal-code", - classes: "govuk-input--width-10", + classes: "govuk-!-width-one-third", errorMessage: { text: errors.formErrors['homeAddressPostcode'] } if errors.formErrors['homeAddressPostcode'] else false }) }} - {% endcall %} - - {{ govukButton({ text: "Save and continue" }) }} -
{% endblock %} diff --git a/app/views/simplified-account/settings/stripe-details/responsible-person/index.njk b/app/views/simplified-account/settings/stripe-details/responsible-person/index.njk index ea89fc999..751f587b2 100644 --- a/app/views/simplified-account/settings/stripe-details/responsible-person/index.njk +++ b/app/views/simplified-account/settings/stripe-details/responsible-person/index.njk @@ -7,18 +7,6 @@ {% block settingsContent %} - {{ govukBackLink({ - text: "Back", - href: backLink - }) }} - - {% if errors %} - {{ govukErrorSummary({ - titleText: "There is a problem", - errorList: errors.summary - }) }} - {% endif %} -

Responsible person

We need details of a responsible @@ -54,7 +42,7 @@ autocomplete: "section-person given-name", spellcheck: false, errorMessage: { text: errors.formErrors['firstName'] } if errors.formErrors['firstName'] else false, - classes: "govuk-input--width-20" + classes: "govuk-!-width-three-quarters" }) }} {{ govukInput({ @@ -68,7 +56,7 @@ autocomplete: "section-person family-name", spellcheck: false, errorMessage: { text: errors.formErrors['lastName'] } if errors.formErrors['lastName'] else false, - classes: "govuk-input--width-20" + classes: "govuk-!-width-three-quarters" }) }} {% endcall %} @@ -121,7 +109,7 @@