Skip to content

Commit

Permalink
Content amendments to payment summary (#2030)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lailien3 authored Oct 28, 2024
1 parent c042b1d commit a0322d4
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 43 deletions.
8 changes: 7 additions & 1 deletion packages/gafl-webapp-service/src/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)",
Expand Down
8 changes: 7 additions & 1 deletion packages/gafl-webapp-service/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => ({
Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -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')
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand All @@ -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' },
Expand All @@ -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' },
Expand All @@ -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: '[email protected]',
reference: '44728b47-c809-4c31-8c92-bdf961be0c80',
return_url: 'https://0.0.0.0:3000' + AGREED.uri,
Expand Down Expand Up @@ -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' },
Expand All @@ -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: '[email protected]',
reference: '44728b47-c809-4c31-8c92-bdf961be0c80',
return_url: 'https://0.0.0.0:3000' + AGREED.uri,
Expand Down

0 comments on commit a0322d4

Please sign in to comment.