diff --git a/src/app.constants.ts b/src/app.constants.ts index fe3d37dbc..c15f56398 100644 --- a/src/app.constants.ts +++ b/src/app.constants.ts @@ -181,6 +181,8 @@ export const CONTACT_US_THEMES = { PROVING_IDENTITY_NEED_TO_UPDATE_PERSONAL_INFORMATION: "proving_identity_need_to_update_personal_information", PROVING_IDENTITY_SOMETHING_ELSE: "proving_identity_something_else", + PROVING_IDENTITY_PROBLEM_WITH_NATIONAL_INSURANCE_NUMBER: + "proving_identity_problem_with_national_insurance_number", }; export const CONTACT_US_FIELD_MAX_LENGTH = 1200; diff --git a/src/components/contact-us/contact-us-controller.ts b/src/components/contact-us/contact-us-controller.ts index 4782e82e4..aebb298bc 100644 --- a/src/components/contact-us/contact-us-controller.ts +++ b/src/components/contact-us/contact-us-controller.ts @@ -71,6 +71,8 @@ const themeToPageTitle = { "pages.contactUsQuestions.provingIdentityNeedToUpdatePersonalInformation.title", [CONTACT_US_THEMES.PROVING_IDENTITY_SOMETHING_ELSE]: "pages.contactUsQuestions.provingIdentitySomethingElse.title", + [CONTACT_US_THEMES.PROVING_IDENTITY_PROBLEM_WITH_NATIONAL_INSURANCE_NUMBER]: + "pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.title", }; const somethingElseSubThemeToPageTitle = { @@ -469,6 +471,8 @@ export function contactUsQuestionsFormPostToSmartAgent( moreDetailDescription: req.body.moreDetailDescription, serviceTryingToUse: req.body.serviceTryingToUse, countryPhoneNumberFrom: req.body.countryPhoneNumberFrom, + problemWithNationalInsuranceNumber: + req.body.problemWithNationalInsuranceNumber, }, themes: { theme: req.body.theme, subtheme: req.body.subtheme }, subject: "GOV.UK One Login", @@ -824,6 +828,12 @@ export function getQuestionsFromFormTypeForMessageBody( { lng: "en" } ), }, + provingIdentityProblemWithNationalInsuranceNumber: { + serviceTryingToUse: req.t( + "pages.contactUsQuestions.serviceTryingToUse.header", + { lng: "en" } + ), + }, }; return formTypeToQuestions[formType]; @@ -993,6 +1003,10 @@ export function getQuestionFromThemes( "pages.contactUsQuestions.provingIdentitySomethingElse.title", { lng: "en" } ), + proving_identity_problem_with_national_insurance_number: req.t( + "pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.title", + { lng: "en" } + ), }; const themeQuestion = themesToQuestions[theme]; diff --git a/src/components/contact-us/contact-us-questions-validation.ts b/src/components/contact-us/contact-us-questions-validation.ts index 1e685e987..94b247e63 100644 --- a/src/components/contact-us/contact-us-questions-validation.ts +++ b/src/components/contact-us/contact-us-questions-validation.ts @@ -137,6 +137,34 @@ export function validateContactUsQuestionsRequest(): ValidationChainFunc { { value, lng: req.i18n.lng } ); }), + body("problemWithNationalInsuranceNumber") + .if(body("theme").equals("proving_identity")) + .if( + body("subtheme").equals( + "proving_identity_problem_with_national_insurance_number" + ) + ) + .notEmpty() + .withMessage((value, { req }) => { + return req.t( + "pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.section1.errorMessage", + { value, lng: req.i18n.lng } + ); + }), + body("problemWithNationalInsuranceNumber") + .if(body("theme").equals("proving_identity")) + .if( + body("subtheme").equals( + "proving_identity_problem_with_national_insurance_number" + ) + ) + .isLength({ max: CONTACT_US_FIELD_MAX_LENGTH }) + .withMessage((value, { req }) => { + return req.t( + "pages.contactUsQuestions.optionalDescriptionErrorMessage.entryTooLongMessage", + { value, lng: req.i18n.lng } + ); + }), body("contact") .notEmpty() .withMessage((value, { req }) => { diff --git a/src/components/contact-us/contact-us-service-smart-agent.ts b/src/components/contact-us/contact-us-service-smart-agent.ts index 2f662eb31..df614ea48 100644 --- a/src/components/contact-us/contact-us-service-smart-agent.ts +++ b/src/components/contact-us/contact-us-service-smart-agent.ts @@ -197,6 +197,11 @@ export function contactUsServiceSmartAgent( contactForm.descriptions.issueDescription; } + if (contactForm.descriptions.problemWithNationalInsuranceNumber) { + customAttributes["sa-tag-national-insurance-number"] = + contactForm.descriptions.problemWithNationalInsuranceNumber; + } + customAttributes["sa-tag-what-gov-service"] = contactForm.descriptions.serviceTryingToUse; diff --git a/src/components/contact-us/questions/_proving-identity-problem-with-national-insurance-number.njk b/src/components/contact-us/questions/_proving-identity-problem-with-national-insurance-number.njk new file mode 100644 index 000000000..0d3baa6bc --- /dev/null +++ b/src/components/contact-us/questions/_proving-identity-problem-with-national-insurance-number.njk @@ -0,0 +1,59 @@ +

+ {{ 'pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.header' | translate }} +

+ +
+ + + + + + + + + {% include 'contact-us/questions/_id-check-app-hidden-fields.njk' %} + +

{{ 'pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.paragraph1' | translate }}

+

{{ 'pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.paragraph2' | translate }}

+

{{ 'pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.paragraph3' | translate }}

+

{{ 'pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.paragraph4' | translate | safe}}

+ + {{ govukCharacterCount({ + label: { + text: 'pages.contactUsQuestions.provingIdentityProblemWithNationalInsuranceNumber.section1.header' | translate, + classes: "govuk-label--s" + }, + id: "problemWithNationalInsuranceNumber", + name: "problemWithNationalInsuranceNumber", + maxlength: contactUsFieldMaxLength, + value: problemWithNationalInsuranceNumber, + charactersAtLimitText: 'pages.contactUsQuestions.characterCountComponent.charactersAtLimitText' | translate, + charactersUnderLimitText: { + other: 'pages.contactUsQuestions.characterCountComponent.charactersUnderLimitText.other' | translate, + one: 'pages.contactUsQuestions.characterCountComponent.charactersUnderLimitText.one' | translate + }, + charactersOverLimitText: { + other: 'pages.contactUsQuestions.characterCountComponent.charactersOverLimitText.other' | translate, + one: 'pages.contactUsQuestions.characterCountComponent.charactersOverLimitText.one' | translate + }, + errorMessage: { + text: errors['problemWithNationalInsuranceNumber'].text | translate | replace('[maximumCharacters]', contactUsFieldMaxLength.toLocaleString()) + } if (errors['problemWithNationalInsuranceNumber']) + }) }} + + {% include 'contact-us/questions/_service-trying-to-use.njk' %} + + {{ govukWarningText({ + text:'pages.contactUsQuestions.personalInformation.paragraph1' | translate, + iconFallbackText: "Warning" + }) }} + + {% include 'contact-us/questions/_reply_by_email.njk' %} + + {{ govukButton({ + "text": "general.sendMessage" | translate, + "type": "Submit", + "preventDoubleClick": true + }) }} + +
diff --git a/src/components/contact-us/questions/index.njk b/src/components/contact-us/questions/index.njk index 7fabd55c5..a0aa5e2c2 100644 --- a/src/components/contact-us/questions/index.njk +++ b/src/components/contact-us/questions/index.njk @@ -135,4 +135,8 @@ {% include 'contact-us/questions/_proving-identity-something-else.njk' %} {% endif %} + {% if (theme == 'proving_identity') and (subtheme == 'proving_identity_problem_with_national_insurance_number') %} + {% include 'contact-us/questions/_proving-identity-problem-with-national-insurance-number.njk' %} + {% endif %} + {% endblock %} diff --git a/src/components/contact-us/tests/contact-us-controller-integration.test.ts b/src/components/contact-us/tests/contact-us-controller-integration.test.ts index 795d3abbb..c92f46c84 100644 --- a/src/components/contact-us/tests/contact-us-controller-integration.test.ts +++ b/src/components/contact-us/tests/contact-us-controller-integration.test.ts @@ -362,6 +362,24 @@ describe("Integration:: contact us - public user", () => { }); }); + describe("when a user had a problem with their national insurance number", () => { + it("should return validation error when user has not described which problem they had", (done) => { + const data = { + _csrf: token, + theme: "proving_identity", + subtheme: "proving_identity_problem_with_national_insurance_number", + contact: "false", + }; + expectValidationErrorOnPost( + "/contact-us-questions", + data, + "#problemWithNationalInsuranceNumber-error", + "What problem were you having with your National Insurance number?", + done + ); + }); + }); + describe("when a user had a problem with their phone number when creating an account", () => { const phoneNumberIssueData = ( issueDescription: string, diff --git a/src/components/contact-us/types.ts b/src/components/contact-us/types.ts index 914b5f61e..01c1dbc4f 100644 --- a/src/components/contact-us/types.ts +++ b/src/components/contact-us/types.ts @@ -45,6 +45,7 @@ export interface Descriptions { moreDetailDescription?: string; serviceTryingToUse?: string; countryPhoneNumberFrom?: string; + problemWithNationalInsuranceNumber?: string; } export interface Themes { @@ -77,6 +78,7 @@ export interface SmartAgentCustomAttributes { "sa-tag-subtheme"?: string; "sa-app-error-code"?: string; "sa-security-mobile-country"?: string; + "sa-tag-national-insurance-number"?: string; } export interface SmartAgentTicket { diff --git a/src/locales/cy/translation.json b/src/locales/cy/translation.json index 6c08b8495..18b5667c9 100644 --- a/src/locales/cy/translation.json +++ b/src/locales/cy/translation.json @@ -2171,8 +2171,21 @@ "section2": { "errorMessage": "Rhowch beth ddigwyddodd" } + }, + "provingIdentityProblemWithNationalInsuranceNumber": { + "title": "Problem gyda’ch rhif Yswiriant Gwladol", + "header": "Problem gyda’ch rhif Yswiriant Gwladol", + "paragraph1": "Mae eich rhif Yswiriant Gwladol yn cael ei wneud i fyny o 2 lythyren, 6 rhif a llythyren terfynol.", + "paragraph2": "Er enghraifft, QQ123456B.", + "paragraph3": "Gallwch ddod o hyd i’ch rhif Yswiriant Gwladol ar eich slip cyflog, P60 neu lythyr budd-dal.", + "paragraph4": "Gallwch ddarllen mwy am gael neu ddod o hyd i’ch rhif Yswiriant Gwladol yn www.gov.uk/rhif-yswiriant-gwladol-coll", + "section1": { + "header": "Pa broblem oeddech chi’n ei chael gyda’ch rhif Yswiriant Gwladol?", + "errorMessage": "Pa broblem oeddech chi’n ei chael gyda’ch rhif Yswiriant Gwladol?" + } } }, + "contactUsSubmitSuccess": { "title": "Mae eich neges wedi ei anfon", "header": "Mae eich neges wedi ei anfon", diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 7a8f54bd6..604e29df9 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -2171,8 +2171,21 @@ "section2": { "errorMessage": "Enter what happened" } + }, + "provingIdentityProblemWithNationalInsuranceNumber": { + "title": "A problem with your National Insurance number", + "header": "A problem with your National Insurance number", + "paragraph1": "Your National Insurance number is made up of 2 letters, 6 numbers and a final letter.", + "paragraph2": "For example, QQ123456B.", + "paragraph3": "You can find your National Insurance number on your payslip, P60 or benefit letter.", + "paragraph4": "You can read more about getting or finding your National Insurance number at www.gov.uk/find-national-insurance-number", + "section1": { + "header": "What problem were you having with your National Insurance number?", + "errorMessage": "What problem were you having with your National Insurance number?" + } } }, + "contactUsSubmitSuccess": { "title": "Your message has been submitted", "header": "Your message has been submitted",