Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payment edge case 2025 #2099

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gafl-webapp-service/src/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
"licence_type_byelaws": "is-ddeddfau pysgota lleol (yn agor ar dudalen newydd)",
"licence_type_error_choose": "Dewiswch un o’r mathau o drwyddedau pysgota",
"licence_type_na": "Nid oes cyfnodau byrrach ar gael ar gyfer y math hwn o drwydded.",
"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_payment_edge_case": "Mae’n rhaid i chi gwblhau eich taliad cyn 11:30pm ar 31 Mawrth 2025 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",
Expand Down
2 changes: 1 addition & 1 deletion packages/gafl-webapp-service/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
"licence_type_byelaws": "local fishing byelaws (opens in new tab)",
"licence_type_error_choose": "Choose one of the fishing licence types",
"licence_type_na": "Shorter lengths are not available for this licence type",
"licence_type_payment_edge_case": "You must complete payment before 11:30pm on 31 March 2024 to get the price shown",
"licence_type_payment_edge_case": "You must complete payment before 11:30pm on 31 March 2025 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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,18 +564,18 @@ describe('The pricing summary calculator', () => {
describe('shouldDisplayPriceChangePaymentWarningMessage', () => {
it.each`
permission | currentDateTime | length | expected | licence | dateTime
${getAdultPermission()} | ${moment.utc('2024-03-25T23:59Z')} | ${'12M'} | ${undefined} | ${'12 month adult licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2024-04-02T00:01Z')} | ${'12M'} | ${undefined} | ${'12 month adult licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'12M'} | ${'payment-edge-case'} | ${'12 month adult licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'12M'} | ${undefined} | ${'12 month junior licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2024-03-25T23:59Z')} | ${'8D'} | ${undefined} | ${'8 day adult licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2024-04-02T00:01Z')} | ${'8D'} | ${undefined} | ${'8 day adult licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'8D'} | ${'payment-edge-case'} | ${'8 day adult licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'8D'} | ${undefined} | ${'8 day junior licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2024-03-25T23:59Z')} | ${'1D'} | ${undefined} | ${'1 day adult licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2024-04-02T00:01Z')} | ${'1D'} | ${undefined} | ${'1 day adult licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'1D'} | ${'payment-edge-case'} | ${'1 day adult licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'1D'} | ${undefined} | ${'1 day junior licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2025-03-25T23:59Z')} | ${'12M'} | ${undefined} | ${'12 month adult licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2025-04-02T00:01Z')} | ${'12M'} | ${undefined} | ${'12 month adult licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'12M'} | ${'payment-edge-case'} | ${'12 month adult licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'12M'} | ${undefined} | ${'12 month junior licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2025-03-25T23:59Z')} | ${'8D'} | ${undefined} | ${'8 day adult licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2025-04-02T00:01Z')} | ${'8D'} | ${undefined} | ${'8 day adult licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'8D'} | ${'payment-edge-case'} | ${'8 day adult licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'8D'} | ${undefined} | ${'8 day junior licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2025-03-25T23:59Z')} | ${'1D'} | ${undefined} | ${'1 day adult licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2025-04-02T00:01Z')} | ${'1D'} | ${undefined} | ${'1 day adult licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'1D'} | ${'payment-edge-case'} | ${'1 day adult licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'1D'} | ${undefined} | ${'1 day junior licence'} | ${'within range'}
`(
'returns $expected for payment_msg for $licence when current date and time is $dateTime for displaying price change payment warning message',
async ({ permission, currentDateTime, expected }) => {
Expand All @@ -588,18 +588,18 @@ describe('The pricing summary calculator', () => {

it.each`
permission | currentDateTime | type | expected | licence | dateTime
${getAdultPermission()} | ${moment.utc('2024-03-25T23:59Z')} | ${'salmon-and-sea-trout'} | ${undefined} | ${'adult salmon licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2024-04-02T00:01Z')} | ${'salmon-and-sea-trout'} | ${undefined} | ${'adult salmon licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'salmon-and-sea-trout'} | ${'payment-edge-case'} | ${'adult salmon licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'salmon-and-sea-trout'} | ${undefined} | ${'junior salmon licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2024-03-25T23:59Z')} | ${'trout-and-coarse-2-rod'} | ${undefined} | ${'adult 2 rod licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2024-04-02T00:01Z')} | ${'trout-and-coarse-2-rod'} | ${undefined} | ${'adult 2 rod licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'trout-and-coarse-2-rod'} | ${'payment-edge-case'} | ${'adult 2 rod licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'trout-and-coarse-2-rod'} | ${undefined} | ${'junior 2 rod licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2024-03-25T23:59Z')} | ${'trout-and-coarse-3-rod'} | ${undefined} | ${'adult 3 rod licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2024-04-02T00:01Z')} | ${'trout-and-coarse-3-rod'} | ${undefined} | ${'adult 3 rod licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'trout-and-coarse-3-rod'} | ${'payment-edge-case'} | ${'adult 3 rod licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2024-04-01T00:01Z')} | ${'trout-and-coarse-3-rod'} | ${undefined} | ${'junior 3 rod licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2025-03-25T23:59Z')} | ${'salmon-and-sea-trout'} | ${undefined} | ${'adult salmon licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2025-04-02T00:01Z')} | ${'salmon-and-sea-trout'} | ${undefined} | ${'adult salmon licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'salmon-and-sea-trout'} | ${'payment-edge-case'} | ${'adult salmon licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'salmon-and-sea-trout'} | ${undefined} | ${'junior salmon licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2025-03-25T23:59Z')} | ${'trout-and-coarse-2-rod'} | ${undefined} | ${'adult 2 rod licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2025-04-02T00:01Z')} | ${'trout-and-coarse-2-rod'} | ${undefined} | ${'adult 2 rod licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'trout-and-coarse-2-rod'} | ${'payment-edge-case'} | ${'adult 2 rod licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'trout-and-coarse-2-rod'} | ${undefined} | ${'junior 2 rod licence'} | ${'within range'}
${getAdultPermission()} | ${moment.utc('2025-03-25T23:59Z')} | ${'trout-and-coarse-3-rod'} | ${undefined} | ${'adult 3 rod licence'} | ${'before start date'}
${getAdultPermission()} | ${moment.utc('2025-04-02T00:01Z')} | ${'trout-and-coarse-3-rod'} | ${undefined} | ${'adult 3 rod licence'} | ${'after end date'}
${getAdultPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'trout-and-coarse-3-rod'} | ${'payment-edge-case'} | ${'adult 3 rod licence'} | ${'within range'}
${getJuniorPermission()} | ${moment.utc('2025-04-01T00:01Z')} | ${'trout-and-coarse-3-rod'} | ${undefined} | ${'junior 3 rod licence'} | ${'within range'}
`(
'returns $expected for payment_msg for $licence when current date and time is $dateTime for displaying price change payment warning message',
async ({ permission, currentDateTime, type, expected }) => {
Expand All @@ -612,22 +612,22 @@ describe('The pricing summary calculator', () => {

it.each`
date | concessions | expected | dateTime | licence
${new Date('2024-03-25T23:59Z')} | ${[]} | ${false} | ${'before start date'} | ${'an adult licence'}
${new Date('2024-04-04T01:00Z')} | ${[]} | ${false} | ${'after start date'} | ${'an adult licence'}
${new Date('2024-03-30T23:58Z')} | ${[]} | ${false} | ${'same date but before time'} | ${'an adult licence'}
${new Date('2024-04-01T00:04Z')} | ${[]} | ${false} | ${'same date but after time'} | ${'an adult licence'}
${new Date('2024-03-30T23:59Z')} | ${[]} | ${true} | ${'start of range'} | ${'an adult licence'}
${new Date('2024-04-01T00:00Z')} | ${[]} | ${true} | ${'within range'} | ${'an adult licence'}
${new Date('2024-04-01T00:01Z')} | ${[]} | ${true} | ${'end of range'} | ${'an adult licence'}
${new Date('2024-03-30T23:59Z')} | ${['Junior']} | ${false} | ${'start of range'} | ${'a junior licence'}
${new Date('2024-04-01T00:00Z')} | ${['Junior']} | ${false} | ${'within range'} | ${'a junior licence'}
${new Date('2024-04-01T00:01Z')} | ${['Junior']} | ${false} | ${'end of range'} | ${'a junior licence'}
${new Date('2024-03-30T23:59Z')} | ${['Senior']} | ${true} | ${'start of range'} | ${'a senior licence'}
${new Date('2024-04-01T00:00Z')} | ${['Senior']} | ${true} | ${'within range'} | ${'a senior licence'}
${new Date('2024-04-01T00:01Z')} | ${['Senior']} | ${true} | ${'end of range'} | ${'a senior licence'}
${new Date('2024-03-30T23:59Z')} | ${['Disabled']} | ${true} | ${'start of range'} | ${'a disabled licence'}
${new Date('2024-04-01T00:00Z')} | ${['Disabled']} | ${true} | ${'within range'} | ${'a disabled licence'}
${new Date('2024-04-01T00:01Z')} | ${['Disabled']} | ${true} | ${'end of range'} | ${'a disabled licence'}
${new Date('2025-03-25T23:59Z')} | ${[]} | ${false} | ${'before start date'} | ${'an adult licence'}
${new Date('2025-04-04T01:00Z')} | ${[]} | ${false} | ${'after start date'} | ${'an adult licence'}
${new Date('2025-03-30T23:58Z')} | ${[]} | ${false} | ${'same date but before time'} | ${'an adult licence'}
${new Date('2025-04-01T00:04Z')} | ${[]} | ${false} | ${'same date but after time'} | ${'an adult licence'}
${new Date('2025-03-30T23:59Z')} | ${[]} | ${true} | ${'start of range'} | ${'an adult licence'}
${new Date('2025-04-01T00:00Z')} | ${[]} | ${true} | ${'within range'} | ${'an adult licence'}
${new Date('2025-04-01T00:01Z')} | ${[]} | ${true} | ${'end of range'} | ${'an adult licence'}
${new Date('2025-03-30T23:59Z')} | ${['Junior']} | ${false} | ${'start of range'} | ${'a junior licence'}
${new Date('2025-04-01T00:00Z')} | ${['Junior']} | ${false} | ${'within range'} | ${'a junior licence'}
${new Date('2025-04-01T00:01Z')} | ${['Junior']} | ${false} | ${'end of range'} | ${'a junior licence'}
${new Date('2025-03-30T23:59Z')} | ${['Senior']} | ${true} | ${'start of range'} | ${'a senior licence'}
${new Date('2025-04-01T00:00Z')} | ${['Senior']} | ${true} | ${'within range'} | ${'a senior licence'}
${new Date('2025-04-01T00:01Z')} | ${['Senior']} | ${true} | ${'end of range'} | ${'a senior licence'}
${new Date('2025-03-30T23:59Z')} | ${['Disabled']} | ${true} | ${'start of range'} | ${'a disabled licence'}
${new Date('2025-04-01T00:00Z')} | ${['Disabled']} | ${true} | ${'within range'} | ${'a disabled licence'}
${new Date('2025-04-01T00:01Z')} | ${['Disabled']} | ${true} | ${'end of range'} | ${'a disabled licence'}
`('returns $expected when we have $licence and current date and time is $dateTime', ({ date, concessions, expected }) => {
moment.now = () => moment(date)
const result = shouldDisplayPriceChangePaymentWarningMessage(concessions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export const shouldDisplayPriceChangePaymentWarningMessage = concessions => {
if (concessions.includes('Junior')) {
return false
}
const startRange = moment('2024-03-30T23:59:00Z')
const endRange = moment('2024-04-01T00:01:00Z')
const startRange = moment('2025-03-30T23:59:00Z')
const endRange = moment('2025-04-01T00:01:00Z')

return now.isBetween(startRange, endRange, null, '[]')
}
Expand Down
Loading