Skip to content

Commit

Permalink
Aut-2843 add new contact form problem with bank or building society d…
Browse files Browse the repository at this point in the history
…etails
  • Loading branch information
di-fabs committed May 29, 2024
1 parent 4fb1eb9 commit ed0192f
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ export const CONTACT_US_THEMES = {
"proving_identity_problem_answering_security_questions",
PROVING_IDENTITY_PROBLEM_WITH_IDENTITY_DOCUMENT:
"proving_identity_problem_with_identity_document",
PROVING_IDENTITY_PROBLEM_WITH_BANK_BUILDING_SOCIETY_DETAILS:
"proving_identity_problem_with_bank_building_society_details",
PROVING_IDENTITY_NEED_TO_UPDATE_PERSONAL_INFORMATION:
"proving_identity_need_to_update_personal_information",
PROVING_IDENTITY_SOMETHING_ELSE: "proving_identity_something_else",
Expand Down
17 changes: 17 additions & 0 deletions src/components/contact-us/contact-us-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const themeToPageTitle = {
"pages.contactUsQuestions.provingIdentityProblemAnsweringSecurityQuestions.title",
[CONTACT_US_THEMES.PROVING_IDENTITY_PROBLEM_WITH_IDENTITY_DOCUMENT]:
"pages.contactUsQuestions.provingIdentityProblemWithIdentityDocument.title",
[CONTACT_US_THEMES.PROVING_IDENTITY_PROBLEM_WITH_BANK_BUILDING_SOCIETY_DETAILS]:
"pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.title",
[CONTACT_US_THEMES.PROVING_IDENTITY_NEED_TO_UPDATE_PERSONAL_INFORMATION]:
"pages.contactUsQuestions.provingIdentityNeedToUpdatePersonalInformation.title",
[CONTACT_US_THEMES.PROVING_IDENTITY_SOMETHING_ELSE]:
Expand Down Expand Up @@ -490,6 +492,7 @@ export function contactUsQuestionsFormPostToSmartAgent(
preferredLanguage: getPreferredLanguage(res.locals.language),
securityCodeSentMethod: req.body.securityCodeSentMethod,
identityDocumentUsed: req.body.identityDocumentUsed,
problemWith: req.body.problemWith,
});

logger.info(
Expand Down Expand Up @@ -804,6 +807,16 @@ export function getQuestionsFromFormTypeForMessageBody(
{ lng: "en" }
),
},
provingIdentityProblemWithBankBuildingSocietyDetails: {
issueDescription: req.t(
"pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section2.label",
{ lng: "en" }
),
serviceTryingToUse: req.t(
"pages.contactUsQuestions.serviceTryingToUse.header",
{ lng: "en" }
)
},
provingIdentityNeedToUpdatePersonalInformation: {
issueDescription: req.t(
"pages.contactUsQuestions.provingIdentityNeedToUpdatePersonalInformation.section1.label",
Expand Down Expand Up @@ -985,6 +998,10 @@ export function getQuestionFromThemes(
"pages.contactUsQuestions.provingIdentityProblemWithIdentityDocument.title",
{ lng: "en" }
),
provingIdentityProblemWithBankBuildingSocietyDetails: req.t(
"pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.title",
{ lng: "en" }
),
proving_identity_need_to_update_personal_information: req.t(
"pages.contactUsQuestions.provingIdentityNeedToUpdatePersonalInformation.title",
{ lng: "en" }
Expand Down
14 changes: 14 additions & 0 deletions src/components/contact-us/contact-us-questions-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ export function validateContactUsQuestionsRequest(): ValidationChainFunc {
{ value, lng: req.i18n.lng }
);
}),
body("problemWith")
.if(body("theme").equals("proving_identity"))
.if(
body("subtheme").equals(
"proving_identity_problem_with_bank_building_society_details"
)
)
.notEmpty()
.withMessage((value, { req }) => {
return req.t(
"pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section1.errorMessage",
{ value, lng: req.i18n.lng }
);
}),
body("issueDescription")
.optional()
.notEmpty()
Expand Down
18 changes: 18 additions & 0 deletions src/components/contact-us/contact-us-service-smart-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ export function prepareIdentityDocumentTitle(
return documentUsedDescription;
}

export function prepareProblemWithTitle(
problemWith: string
): string {
let problemWithDescription = "";
switch (problemWith) {
case "name":
problemWithDescription = "Entering your name";
break;
case "bankOrBuildingSocietyDetails":
problemWithDescription = "Entering your bank or building society account details";
break;
}

return problemWithDescription;
}

export function getIdentifierTag(theme: string): string {
if (theme === CONTACT_US_THEMES.ID_CHECK_APP) {
return "sign_in_app";
Expand Down Expand Up @@ -154,6 +170,8 @@ export function contactUsServiceSmartAgent(
contactForm.identityDocumentUsed
);

customAttributes["sa-tag-building-society"] = prepareProblemWithTitle(contactForm.problemWith);

customAttributes["sa-webformrefer"] = getRefererTag(contactForm);

customAttributes["sa-app-error-code"] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
value: "proving_identity_need_to_update_personal_information",
text: 'pages.contactUsFurtherInformation.provingIdentity.section1.radio3' | translate
},
{
value: "proving_identity_problem_with_bank_building_society_details",
text: 'pages.contactUsFurtherInformation.provingIdentity.section1.radio6' | translate
},
{
value: "proving_identity_technical_problem",
text: 'pages.contactUsFurtherInformation.provingIdentity.section1.radio4' | translate
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<h1 class="govuk-heading-l govuk-!-margin-top-0 govuk-!-margin-bottom-3">
{{ 'pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.header' | translate }}
</h1>

<form action="{{formSubmissionUrl}}" method="post" novalidate>

<input type="hidden" name="_csrf" value="{{csrfToken}}"/>
<input type="hidden" name="theme" value="{{theme}}"/>
<input type="hidden" name="subtheme" value="{{subtheme}}"/>
<input type="hidden" name="backurl" value="{{backurl}}"/>
<input type="hidden" name="fromURL" value="{{fromURL}}"/>
<input type="hidden" name="formType" value="provingIdentityProblemWithBankBuildingSocietyDetails"/>
<input type="hidden" name="referer" value="{{referer}}"/>
{% include 'contact-us/questions/_id-check-app-hidden-fields.njk' %}

{% set items = [
{
value: 'name',
checked: problemWith === 'name',
text: 'pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section1.radio1' | translate
},
{
value: 'bankOrBuildingSocietyDetails',
checked: problemWith === 'bankOrBuildingSocietyDetails',
text: 'pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section1.radio2' | translate
}
] %}

{{ govukRadios({
name: "problemWith",
fieldset: {
legend: {
text: 'pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section1.header' | translate,
isPageHeading: false,
classes: "govuk-fieldset__legend--s"
}
},
items: items,
errorMessage: {
text: errors['problemWith'].text
} if (errors['problemWith'])
}) }}

{{ govukCharacterCount({
label: {
text: 'pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section2.label' | translate,
classes: "govuk-label--s"
},
hint: {
text: 'pages.contactUsQuestions.provingIdentityProblemWithBankBuildingSocietyDetails.section2.hint' | translate
},
id: "issueDescription",
name: "issueDescription",
maxlength: contactUsFieldMaxLength,
value: issueDescription,
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['issueDescription'].text | translate | replace('[maximumCharacters]', contactUsFieldMaxLength.toLocaleString())
} if (errors['issueDescription'])
}) }}

{% 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
}) }}

</form>
4 changes: 4 additions & 0 deletions src/components/contact-us/questions/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
{% include 'contact-us/questions/_proving-identity-problem-with-identity-document.njk' %}
{% endif %}

{% if (theme == 'proving_identity') and (subtheme == 'proving_identity_problem_with_bank_building_society_details') %}
{% include 'contact-us/questions/_proving-identity-problem-with-bank-building-society-details.njk' %}
{% endif %}

{% if (theme == 'proving_identity') and (subtheme == 'proving_identity_need_to_update_personal_information') %}
{% include 'contact-us/questions/_proving-identity-need-to-update-personal-information.njk' %}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,24 @@ describe("Integration:: contact us - public user", () => {
});
});

describe("when a user had a problem with their bank or building society details", () => {
it("should return validation error when user has not selected which problem they had", (done) => {
const data = {
_csrf: token,
theme: "proving_identity",
subtheme: "proving_identity_problem_with_bank_building_society_details",
contact: "false",
};
expectValidationErrorOnPost(
"/contact-us-questions",
data,
"#problemWith-error",
"Select which problem you were having with your bank or building society details",
done
);
});
});

describe("when a user had a problem taking a photo of your identity document using the GOV.UK ID Check app", () => {
it("should return validation error when user has not selected which identity document they were using", (done) => {
const data = {
Expand Down
2 changes: 2 additions & 0 deletions src/components/contact-us/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ContactForm {
preferredLanguage?: string;
securityCodeSentMethod?: string;
identityDocumentUsed?: string;
problemWith?: string;
fromURL?: string;
}

Expand Down Expand Up @@ -77,6 +78,7 @@ export interface SmartAgentCustomAttributes {
"sa-tag-subtheme"?: string;
"sa-app-error-code"?: string;
"sa-security-mobile-country"?: string;
"sa-tag-building-society"?: string;
}

export interface SmartAgentTicket {
Expand Down
14 changes: 14 additions & 0 deletions src/locales/cy/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,20 @@
"hint": "Er enghraifft, os ydych am ychwanegu mwy o fanylion"
}
},
"provingIdentityProblemWithBankBuildingSocietyDetails": {
"title": "Problem gyda’ch manylion banc neu gymdeithas adeiladu",
"header": "Problem gyda’ch manylion banc neu gymdeithas adeiladu",
"section1": {
"header": "Pa broblem oeddech chi’n ei chael gyda’ch manylion banc neu gymdeithas adeiladu?",
"radio1": "Rhoi eich enw",
"radio2": "Rhoi eich manylion banc neu gymdeithas adeiladu",
"errorMessage": "Dewiswch pa broblem oeddech chi’n ei chael gyda’ch manylion banc neu gymdeithas adeiladu"
},
"section2": {
"label": "Unrhyw beth arall rydych angen dweud wrthym?",
"hint": "Er enghraifft, os ydych am ychwanegu mwy o fanylion"
}
},
"provingIdentityNeedToUpdatePersonalInformation": {
"title": "Mae angen i chi ddiweddaru eich gwybodaeth bersonol",
"header": "Mae angen i chi ddiweddaru eich gwybodaeth bersonol",
Expand Down
14 changes: 14 additions & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,20 @@
"hint": "For example, if you want to add more detail"
}
},
"provingIdentityProblemWithBankBuildingSocietyDetails": {
"title": "A problem with your bank or building society details",
"header": "A problem with your bank or building society details",
"section1": {
"header": "What problem were you having with your bank or building society details?",
"radio1": "Entering your name",
"radio2": "Entering your bank or building society account details",
"errorMessage": "Select which problem you were having with your bank or building society details"
},
"section2": {
"label": "Anything else you need to tell us?",
"hint": "For example, if you want to add more detail"
}
},
"provingIdentityNeedToUpdatePersonalInformation": {
"title": "You need to update your personal information",
"header": "You need to update your personal information",
Expand Down

0 comments on commit ed0192f

Please sign in to comment.