From a0322d4ec2169e1562114f69a0e368097342895e Mon Sep 17 00:00:00 2001 From: laila aleissa <138867360+lailien3@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:22:44 +0000 Subject: [PATCH] Content amendments to payment summary (#2030) * Content amendments to payment summary https://eaflood.atlassian.net/browse/IWTF-4188 Changing the layout of the payment / licence summary to be more consistent across the service. * Fixed tests * Fixed govuk service tests * Update cy.json * updated welsh date fomat * Added welsh dates * junior / age_junior fixes * Created and implemented new label --- .../gafl-webapp-service/src/locales/cy.json | 8 ++- .../gafl-webapp-service/src/locales/en.json | 8 ++- .../__tests__/licence-type-display.spec.js | 52 +++++++++---------- .../src/processors/licence-type-display.js | 14 ++--- .../__test__/govuk-pay-service.spec.js | 16 +++--- 5 files changed, 55 insertions(+), 43 deletions(-) diff --git a/packages/gafl-webapp-service/src/locales/cy.json b/packages/gafl-webapp-service/src/locales/cy.json index caa1fb5b2..17f3cf5e8 100644 --- a/packages/gafl-webapp-service/src/locales/cy.json +++ b/packages/gafl-webapp-service/src/locales/cy.json @@ -121,7 +121,7 @@ "address_select_title_you": "Dewiswch eich cyfeiriad", "age_concession": "Consesiwn oed", "age_junior_concession": "Iau (13 i 16)", - "age_junior": "Iau, ", + "age_junior": "iau ", "age_senior_concession": "66 mlwydd oed a throsodd", "age_senior": "Uwch", "analytics_banner_acceptance_1": "Rydych wedi derbyn cwcis ychwanegol. Gallwch ", @@ -361,6 +361,9 @@ "important_info_contact_post": "Post", "important_info_contact_title_other": "Sut hoffech chi i ni gysylltu â deiliad y drwydded ynglŷn â diweddariadau sy’n effeithio ar eu trwydded?", "important_info_contact_title_you": "Sut hoffech chi i ni gysylltu â chi ynglŷn â diweddariadau sy’n effeithio ar eich trwydded?", + "licence_1_day": "Trwydded 1 diwrnod", + "licence_8_day": "Trwydded 8 diwrnod", + "licence_12_month": "Trwydded 12 mis", "licence_confirm_method_error_choose": "Dewiswch sut dylem anfon y drwydded", "licence_confirm_method_how_body_item": "Gwneud nodyn o rif y drwydded", "licence_confirm_method_how_body_text": "Dyma sut y byddwn yn anfon cadarnhad o’r drwydded bysgota", @@ -463,8 +466,11 @@ "licence_type_payment_edge_case": "Mae’n rhaid i chi gwblhau eich taliad cyn 11:30pm ar 31 Mawrth 2024 i dalu’r pris a ddangosir", "licence_type_radio_salmon_hint": "Mae'n cynnwys brithyllod a physgod bras (hyd at 3 gwialen)", "licence_type_radio_salmon": "Eogiaid a brithyllod y môr", + "licence_type_radio_salmon_payment_summary": "eogiaid a brithyllod y môr", "licence_type_radio_trout_three_rod": "Brithyllod a physgod bras (hyd at 3 gwialen)", + "licence_type_radio_trout_three_rod_payment_summary": "brithyllod a physgod bras (hyd at 3 gwialen)", "licence_type_radio_trout_two_rod": "Brithyllod a physgod bras (hyd at 2 wialen)", + "licence_type_radio_trout_two_rod_payment_summary": "brithyllod a physgod bras (hyd at 2 wialen)", "licence_type_rules": "rheolau pysgota â gwialen (yn agor ar dudalen newydd)", "licence_type_salmon_acr_note_1": "Yn ôl y gyfraith, mae'n rhaid i chi roi gwybod am ", "licence_type_salmon_acr_note_2": " ffurflen daliadau (yn agor ar dudalen newydd)", diff --git a/packages/gafl-webapp-service/src/locales/en.json b/packages/gafl-webapp-service/src/locales/en.json index e2e9f1b6e..f662cde0a 100644 --- a/packages/gafl-webapp-service/src/locales/en.json +++ b/packages/gafl-webapp-service/src/locales/en.json @@ -121,7 +121,7 @@ "address_select_title_you": "Choose your address", "age_concession": "Age concession", "age_junior_concession": "Junior (13 to 16)", - "age_junior": "Junior, ", + "age_junior": "junior ", "age_senior_concession": "Age 66 or over", "age_senior": "Senior", "analytics_banner_acceptance_1": "You have accepted additional cookies. You can ", @@ -361,6 +361,9 @@ "important_info_contact_post": "Post", "important_info_contact_title_other": "How should we contact the licence holder about updates affecting their licence?", "important_info_contact_title_you": "How should we contact you about updates affecting your licence?", + "licence_1_day": "1-day", + "licence_8_day": "8-day", + "licence_12_month": "12-month", "licence_confirm_method_error_choose": "Choose how we should send the licence", "licence_confirm_method_how_body_item": "I will make a note of the licence number", "licence_confirm_method_how_body_text": "This is where we will send confirmation of the fishing licence", @@ -463,8 +466,11 @@ "licence_type_payment_edge_case": "You must complete payment before 11:30pm on 31 March 2024 to get the price shown", "licence_type_radio_salmon_hint": "Includes trout and coarse (up to 3 rods)", "licence_type_radio_salmon": "Salmon and sea trout", + "licence_type_radio_salmon_payment_summary": "salmon and sea trout", "licence_type_radio_trout_three_rod": "Trout and coarse (up to 3 rods)", + "licence_type_radio_trout_three_rod_payment_summary": "trout and coarse (up to 3 rods)", "licence_type_radio_trout_two_rod": "Trout and coarse (up to 2 rods)", + "licence_type_radio_trout_two_rod_payment_summary": "trout and coarse (up to 2 rods)", "licence_type_rules": "rod fishing rules (opens in new tab)", "licence_type_salmon_acr_note_1": "Licence holders must by law ", "licence_type_salmon_acr_note_2": " report a catch return (opens in new tab)", diff --git a/packages/gafl-webapp-service/src/processors/__tests__/licence-type-display.spec.js b/packages/gafl-webapp-service/src/processors/__tests__/licence-type-display.spec.js index d6bec4207..83b180860 100644 --- a/packages/gafl-webapp-service/src/processors/__tests__/licence-type-display.spec.js +++ b/packages/gafl-webapp-service/src/processors/__tests__/licence-type-display.spec.js @@ -3,16 +3,16 @@ import { licenceTypeDisplay, licenceTypeAndLengthDisplay, isPhysical, recurringL const getCatalog = () => ({ over_66: ' (over_66)', - age_junior: 'Junior, ', - licence_type_radio_salmon: 'Salmon and sea trout', - licence_type_radio_trout_two_rod: 'Trout and coarse, up to 2 rods', - licence_type_radio_trout_three_rod: 'Trout and coarse, up to 3 rods', + age_junior: 'junior ', + licence_type_radio_salmon_payment_summary: 'salmon and sea trout', + licence_type_radio_trout_two_rod_payment_summary: 'trout and coarse (up to 2 rods)', + licence_type_radio_trout_three_rod_payment_summary: 'trout and coarse (up to 3 rods)', recurring_payment_set_up_bulletpoint_1_trout_2_rod: ' trout and coarse (2 rod)', recurring_payment_set_up_bulletpoint_1_trout_3_rod: ' trout and coarse (3 rod)', recurring_payment_set_up_bulletpoint_1_salmon: ' salmon and sea trout', - licence_type_12m: '12 months', - licence_type_8d: '8 days', - licence_type_1d: '1 day' + licence_1_day: '1-day', + licence_8_day: '8-day', + licence_12_month: '12-month' }) jest.mock('../concession-helper', () => ({ @@ -39,20 +39,20 @@ describe('licenceTypeDisplay', () => { const permission = getPermission() hasJunior.mockImplementationOnce(() => true) const result = licenceTypeDisplay(permission, getCatalog()) - expect(result).toEqual('Junior, Salmon and sea trout') + expect(result).toEqual('junior salmon and sea trout') }) it('returns senior if person is senior', () => { const permission = getPermission() hasSenior.mockImplementationOnce(() => true) const result = licenceTypeDisplay(permission, getCatalog()) - expect(result).toEqual('Salmon and sea trout (over_66)') + expect(result).toEqual('salmon and sea trout (over_66)') }) it.each([ - ['Salmon and sea trout', null, 'Salmon and sea trout'], - ['Trout and coarse', '2', 'Trout and coarse, up to 2 rods'], - ['Trout and coarse', '3', 'Trout and coarse, up to 3 rods'] + ['Salmon and sea trout', null, 'salmon and sea trout'], + ['Trout and coarse', '2', 'trout and coarse (up to 2 rods)'], + ['Trout and coarse', '3', 'trout and coarse (up to 3 rods)'] ])('returns correct licence type', (licenceType, numberOfRods, expected) => { const permission = getPermission({ licenceType, numberOfRods }) const result = licenceTypeDisplay(permission, getCatalog()) @@ -62,15 +62,15 @@ describe('licenceTypeDisplay', () => { describe('licenceTypeAndLengthDisplay', () => { it.each([ - ['12M', 'Salmon and sea trout', null, 'Salmon and sea trout, 12 months'], - ['12M', 'Trout and coarse', '2', 'Trout and coarse, up to 2 rods, 12 months'], - ['12M', 'Trout and coarse', '3', 'Trout and coarse, up to 3 rods, 12 months'], - ['8D', 'Salmon and sea trout', null, 'Salmon and sea trout, 8 days'], - ['8D', 'Trout and coarse', '2', 'Trout and coarse, up to 2 rods, 8 days'], - ['8D', 'Trout and coarse', '3', 'Trout and coarse, up to 3 rods, 8 days'], - ['1D', 'Salmon and sea trout', null, 'Salmon and sea trout, 1 day'], - ['1D', 'Trout and coarse', '2', 'Trout and coarse, up to 2 rods, 1 day'], - ['1D', 'Trout and coarse', '3', 'Trout and coarse, up to 3 rods, 1 day'] + ['12M', 'Salmon and sea trout', null, '12-month salmon and sea trout'], + ['12M', 'Trout and coarse', '2', '12-month trout and coarse (up to 2 rods)'], + ['12M', 'Trout and coarse', '3', '12-month trout and coarse (up to 3 rods)'], + ['8D', 'Salmon and sea trout', null, '8-day salmon and sea trout'], + ['8D', 'Trout and coarse', '2', '8-day trout and coarse (up to 2 rods)'], + ['8D', 'Trout and coarse', '3', '8-day trout and coarse (up to 3 rods)'], + ['1D', 'Salmon and sea trout', null, '1-day salmon and sea trout'], + ['1D', 'Trout and coarse', '2', '1-day trout and coarse (up to 2 rods)'], + ['1D', 'Trout and coarse', '3', '1-day trout and coarse (up to 3 rods)'] ])('returns correct licence length', (licenceLength, licenceType, numberOfRods, expected) => { const permission = getPermission({ licenceLength, licenceType, numberOfRods }) const result = licenceTypeAndLengthDisplay(permission, getCatalog()) @@ -81,32 +81,32 @@ describe('licenceTypeAndLengthDisplay', () => { const permission = getPermission() hasJunior.mockImplementationOnce(() => true) const result = licenceTypeAndLengthDisplay(permission, getCatalog()) - expect(result).toEqual('Junior, Salmon and sea trout, 12 months') + expect(result).toEqual('12-month junior salmon and sea trout') }) it('returns senior if licence length is senior', () => { const permission = getPermission() hasSenior.mockImplementationOnce(() => true) const result = licenceTypeAndLengthDisplay(permission, getCatalog()) - expect(result).toEqual('Salmon and sea trout (over_66), 12 months') + expect(result).toEqual('12-month salmon and sea trout (over_66)') }) it('returns correct licence length, 12 months', () => { const permission = getPermission({ licenceLength: Symbol('12M') }) const result = licenceTypeAndLengthDisplay(permission, getCatalog()) - expect(result).toEqual('Salmon and sea trout, 12 months') + expect(result).toEqual('12-month salmon and sea trout') }) it('returns correct licence length, 8 days', () => { const permission = getPermission({ licenceLength: Symbol('8D') }) const result = licenceTypeAndLengthDisplay(permission, getCatalog()) - expect(result).toEqual('Salmon and sea trout, 8 days') + expect(result).toEqual('8-day salmon and sea trout') }) it('returns correct licence length, 1 day', () => { const permission = getPermission({ licenceLength: Symbol('1D') }) const result = licenceTypeAndLengthDisplay(permission, getCatalog()) - expect(result).toEqual('Salmon and sea trout, 1 day') + expect(result).toEqual('1-day salmon and sea trout') }) }) diff --git a/packages/gafl-webapp-service/src/processors/licence-type-display.js b/packages/gafl-webapp-service/src/processors/licence-type-display.js index a0e03888b..ae288b96e 100644 --- a/packages/gafl-webapp-service/src/processors/licence-type-display.js +++ b/packages/gafl-webapp-service/src/processors/licence-type-display.js @@ -9,12 +9,12 @@ export const licenceTypeDisplay = (permission, mssgs) => { typesStrArr.push(mssgs.age_junior) } if (permission.licenceType === mappings.LICENCE_TYPE['salmon-and-sea-trout']) { - typesStrArr.push(mssgs.licence_type_radio_salmon) + typesStrArr.push(mssgs.licence_type_radio_salmon_payment_summary) } else if (permission.licenceType === mappings.LICENCE_TYPE['trout-and-coarse']) { if (permission.numberOfRods === '2') { - typesStrArr.push(mssgs.licence_type_radio_trout_two_rod) + typesStrArr.push(mssgs.licence_type_radio_trout_two_rod_payment_summary) } else { - typesStrArr.push(mssgs.licence_type_radio_trout_three_rod) + typesStrArr.push(mssgs.licence_type_radio_trout_three_rod_payment_summary) } } @@ -27,17 +27,17 @@ export const licenceTypeDisplay = (permission, mssgs) => { export const licenceTypeAndLengthDisplay = (permission, mssgs) => { const licenceTypeMessage = getLicenceTypeMessage(permission.licenceLength, mssgs) - return `${licenceTypeDisplay(permission, mssgs)}, ${licenceTypeMessage}` + return `${licenceTypeMessage} ${licenceTypeDisplay(permission, mssgs)}` } const getLicenceTypeMessage = (licenceLength, mssgs) => { const length = typeof licenceLength === 'symbol' ? licenceLength.description : licenceLength if (length === '12M') { - return mssgs.licence_type_12m + return mssgs.licence_12_month } else if (length === '8D') { - return mssgs.licence_type_8d + return mssgs.licence_8_day } else { - return mssgs.licence_type_1d + return mssgs.licence_1_day } } diff --git a/packages/gafl-webapp-service/src/services/payment/__test__/govuk-pay-service.spec.js b/packages/gafl-webapp-service/src/services/payment/__test__/govuk-pay-service.spec.js index e061689bc..de2697d82 100644 --- a/packages/gafl-webapp-service/src/services/payment/__test__/govuk-pay-service.spec.js +++ b/packages/gafl-webapp-service/src/services/payment/__test__/govuk-pay-service.spec.js @@ -15,7 +15,7 @@ describe('The govuk-pay-service', () => { i18n: { getCatalog: () => ({ over_66: 'Over 66', - licence_type_radio_trout_three_rod: 'Trout and coarse, up to 3 rods' + licence_type_radio_trout_three_rod_payment_summary: 'trout and coarse (up to 3 rods)' }) }, info: { host: '0.0.0.0:3000' }, @@ -35,7 +35,7 @@ describe('The govuk-pay-service', () => { i18n: { getCatalog: () => ({ over_66: 'Over 66', - licence_type_radio_trout_three_rod: 'Trout and coarse, up to 3 rods' + licence_type_radio_trout_three_rod_payment_summary: 'trout and coarse (up to 3 rods)' }) }, info: { host: '0.0.0.0:3000' }, @@ -55,8 +55,8 @@ describe('The govuk-pay-service', () => { i18n: { getCatalog: () => ({ over_66: ' (Over 66)', - licence_type_radio_salmon: 'Salmon and sea trout', - licence_type_12m: '12 months' + licence_type_radio_salmon_payment_summary: 'salmon and sea trout', + licence_12_month: '12-month' }) }, info: { host: '0.0.0.0:3000' }, @@ -68,7 +68,7 @@ describe('The govuk-pay-service', () => { ).toEqual({ amount: 5400, delayed_capture: false, - description: 'Salmon and sea trout (Over 66), 12 months', + description: '12-month salmon and sea trout (Over 66)', email: 'angling@email.com', reference: '44728b47-c809-4c31-8c92-bdf961be0c80', return_url: 'https://0.0.0.0:3000' + AGREED.uri, @@ -98,8 +98,8 @@ describe('The govuk-pay-service', () => { i18n: { getCatalog: () => ({ over_66: ' (Over 66)', - licence_type_radio_salmon: 'Salmon and sea trout', - licence_type_8d: '8 days' + licence_type_radio_salmon_payment_summary: 'salmon and sea trout', + licence_8_day: '8-day' }) }, info: { host: '0.0.0.0:3000' }, @@ -110,7 +110,7 @@ describe('The govuk-pay-service', () => { ).toEqual({ amount: 5400, delayed_capture: false, - description: 'Salmon and sea trout (Over 66), 8 days', + description: '8-day salmon and sea trout (Over 66)', email: 'angling@email.com', reference: '44728b47-c809-4c31-8c92-bdf961be0c80', return_url: 'https://0.0.0.0:3000' + AGREED.uri,