From 6d4ad56d8a7875ff7d4731990120d375ddc30e76 Mon Sep 17 00:00:00 2001 From: Scott Dormand <61588381+ScottDormand96@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:03:39 +0000 Subject: [PATCH] Payment edge case 2025 (#2099) * Payment edge case 2025 https://eaflood.atlassian.net/browse/IWTF-4385 Edge case for completing purchase before price changes * change dates for when display message * update content --- .../gafl-webapp-service/src/locales/cy.json | 2 +- .../gafl-webapp-service/src/locales/en.json | 2 +- .../__tests__/pricing-summary.spec.js | 80 +++++++++---------- .../src/processors/pricing-summary.js | 4 +- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/packages/gafl-webapp-service/src/locales/cy.json b/packages/gafl-webapp-service/src/locales/cy.json index 2a87d1b4c..be3ac556a 100644 --- a/packages/gafl-webapp-service/src/locales/cy.json +++ b/packages/gafl-webapp-service/src/locales/cy.json @@ -482,7 +482,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", diff --git a/packages/gafl-webapp-service/src/locales/en.json b/packages/gafl-webapp-service/src/locales/en.json index ca26e7c88..cd3feedda 100644 --- a/packages/gafl-webapp-service/src/locales/en.json +++ b/packages/gafl-webapp-service/src/locales/en.json @@ -484,7 +484,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", diff --git a/packages/gafl-webapp-service/src/processors/__tests__/pricing-summary.spec.js b/packages/gafl-webapp-service/src/processors/__tests__/pricing-summary.spec.js index cdb224ece..303c39608 100644 --- a/packages/gafl-webapp-service/src/processors/__tests__/pricing-summary.spec.js +++ b/packages/gafl-webapp-service/src/processors/__tests__/pricing-summary.spec.js @@ -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 }) => { @@ -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 }) => { @@ -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) diff --git a/packages/gafl-webapp-service/src/processors/pricing-summary.js b/packages/gafl-webapp-service/src/processors/pricing-summary.js index 14805fb00..78155fe1c 100644 --- a/packages/gafl-webapp-service/src/processors/pricing-summary.js +++ b/packages/gafl-webapp-service/src/processors/pricing-summary.js @@ -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, '[]') }