@defra-fish/gafl-webapp-service 1.65.0-rc.3 → 1.65.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/handlers/__tests__/cancel-recurring-payment-authentication-handler.spec.js +18 -10
- package/src/handlers/cancel-recurring-payment-authentication-handler.js +17 -3
- package/src/locales/cy.json +15 -2
- package/src/locales/en.json +15 -2
- package/src/pages/recurring-payments/cancel/agreement-not-found/cancel-rp-agreement-not-found.njk +1 -1
- package/src/pages/recurring-payments/cancel/already-cancelled/__tests__/route.spec.js +115 -0
- package/src/pages/recurring-payments/cancel/already-cancelled/already-cancelled.njk +28 -0
- package/src/pages/recurring-payments/cancel/already-cancelled/route.js +25 -0
- package/src/pages/recurring-payments/cancel/licence-not-found/__tests__/route.spec.js +21 -0
- package/src/pages/recurring-payments/cancel/licence-not-found/licence-not-found.njk +27 -0
- package/src/pages/recurring-payments/cancel/licence-not-found/route.js +4 -0
- package/src/routes/__tests__/__snapshots__/telesales-routes.spec.js.snap +32 -0
- package/src/routes/journey-definition.js +15 -1
- package/src/routes/telesales-routes.js +11 -1
- package/src/uri.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/gafl-webapp-service",
|
|
3
|
-
"version": "1.65.0-rc.
|
|
3
|
+
"version": "1.65.0-rc.5",
|
|
4
4
|
"description": "The websales frontend for the GAFL service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"prepare": "gulp --gulpfile build/gulpfile.cjs"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@defra-fish/business-rules-lib": "1.65.0-rc.
|
|
40
|
-
"@defra-fish/connectors-lib": "1.65.0-rc.
|
|
39
|
+
"@defra-fish/business-rules-lib": "1.65.0-rc.5",
|
|
40
|
+
"@defra-fish/connectors-lib": "1.65.0-rc.5",
|
|
41
41
|
"@defra/hapi-gapi": "2.0.0",
|
|
42
42
|
"@hapi/boom": "9.1.2",
|
|
43
43
|
"@hapi/catbox-redis": "6.0.2",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"./gafl-jest-matchers.js"
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "e1f68ba5a71995c3eecaafc1dedc08dbd6129a82"
|
|
83
83
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import handler from '../cancel-recurring-payment-authentication-handler'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CANCEL_RP_IDENTIFY,
|
|
4
|
+
CANCEL_RP_DETAILS,
|
|
5
|
+
CANCEL_RP_AGREEMENT_NOT_FOUND,
|
|
6
|
+
CANCEL_RP_ALREADY_CANCELLED,
|
|
7
|
+
CANCEL_RP_LICENCE_NOT_FOUND
|
|
8
|
+
} from '../../uri.js'
|
|
3
9
|
import { salesApi } from '@defra-fish/connectors-lib'
|
|
4
10
|
|
|
5
11
|
jest.mock('../../processors/uri-helper.js')
|
|
@@ -19,7 +25,9 @@ jest.mock('@defra-fish/business-rules-lib', () => ({
|
|
|
19
25
|
jest.mock('../../uri.js', () => ({
|
|
20
26
|
CANCEL_RP_IDENTIFY: { page: 'cancel-rp-identify page', uri: Symbol('cancel-rp-identify-uri') },
|
|
21
27
|
CANCEL_RP_DETAILS: { uri: Symbol('cancel-rp-details-uri') },
|
|
22
|
-
CANCEL_RP_AGREEMENT_NOT_FOUND: { uri: Symbol('cancel-rp-agreement-not-found-uri') }
|
|
28
|
+
CANCEL_RP_AGREEMENT_NOT_FOUND: { uri: Symbol('cancel-rp-agreement-not-found-uri') },
|
|
29
|
+
CANCEL_RP_ALREADY_CANCELLED: { uri: Symbol('cancel-rp-already-cancelled-uri ') },
|
|
30
|
+
CANCEL_RP_LICENCE_NOT_FOUND: { uri: Symbol('cancel-rp-licence-not-found-uri') }
|
|
23
31
|
}))
|
|
24
32
|
jest.mock('../../processors/recurring-payments-write-cache.js')
|
|
25
33
|
|
|
@@ -99,9 +107,9 @@ describe('Cancel RP Authentication Handler', () => {
|
|
|
99
107
|
})
|
|
100
108
|
|
|
101
109
|
describe('Unsuccessful authentication - no match', () => {
|
|
102
|
-
it('redirects to the
|
|
110
|
+
it('redirects to the CANCEL_RP_LICENCE_NOT_FOUND.uri', async () => {
|
|
103
111
|
const { h } = await invokeHandlerWithMocks({ salesApiResponse: null })
|
|
104
|
-
expect(h.redirectWithLanguageCode).toHaveBeenCalledWith(
|
|
112
|
+
expect(h.redirectWithLanguageCode).toHaveBeenCalledWith(CANCEL_RP_LICENCE_NOT_FOUND.uri)
|
|
105
113
|
})
|
|
106
114
|
|
|
107
115
|
it('returns value of redirect', async () => {
|
|
@@ -121,7 +129,7 @@ describe('Cancel RP Authentication Handler', () => {
|
|
|
121
129
|
CANCEL_RP_IDENTIFY.page,
|
|
122
130
|
expect.objectContaining({
|
|
123
131
|
payload: expect.any(Object),
|
|
124
|
-
|
|
132
|
+
errorRedirect: true
|
|
125
133
|
})
|
|
126
134
|
)
|
|
127
135
|
})
|
|
@@ -165,12 +173,12 @@ describe('Cancel RP Authentication Handler', () => {
|
|
|
165
173
|
})
|
|
166
174
|
})
|
|
167
175
|
|
|
168
|
-
describe('Unsuccessful authentication - RCP cancelled', () => {
|
|
169
|
-
it('redirects to the
|
|
176
|
+
describe('Unsuccessful authentication - RCP already cancelled', () => {
|
|
177
|
+
it('redirects to the CANCEL_RP_ALREADY_CANCELLED.uri', async () => {
|
|
170
178
|
const { h } = await invokeHandlerWithMocks({
|
|
171
179
|
salesApiResponse: { permission: { id: 'perm-id' }, recurringPayment: { id: 'rcp-id', status: 1, cancelledDate: '2024-01-01' } }
|
|
172
180
|
})
|
|
173
|
-
expect(h.redirectWithLanguageCode).toHaveBeenCalledWith(
|
|
181
|
+
expect(h.redirectWithLanguageCode).toHaveBeenCalledWith(CANCEL_RP_ALREADY_CANCELLED.uri)
|
|
174
182
|
})
|
|
175
183
|
|
|
176
184
|
it('returns value of redirect', async () => {
|
|
@@ -184,7 +192,7 @@ describe('Cancel RP Authentication Handler', () => {
|
|
|
184
192
|
expect(result).toBe(redirectResult)
|
|
185
193
|
})
|
|
186
194
|
|
|
187
|
-
it('sets page cache
|
|
195
|
+
it('sets page cache for RCP already cancelled', async () => {
|
|
188
196
|
const { request } = await invokeHandlerWithMocks({
|
|
189
197
|
salesApiResponse: { permission: { id: 'perm-id' }, recurringPayment: { id: 'rcp-id', status: 1, cancelledDate: '2024-01-01' } }
|
|
190
198
|
})
|
|
@@ -192,7 +200,7 @@ describe('Cancel RP Authentication Handler', () => {
|
|
|
192
200
|
CANCEL_RP_IDENTIFY.page,
|
|
193
201
|
expect.objectContaining({
|
|
194
202
|
payload: expect.any(Object),
|
|
195
|
-
|
|
203
|
+
errorRedirect: true
|
|
196
204
|
})
|
|
197
205
|
)
|
|
198
206
|
})
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CANCEL_RP_IDENTIFY,
|
|
3
|
+
CANCEL_RP_DETAILS,
|
|
4
|
+
CANCEL_RP_AGREEMENT_NOT_FOUND,
|
|
5
|
+
CANCEL_RP_ALREADY_CANCELLED,
|
|
6
|
+
CANCEL_RP_LICENCE_NOT_FOUND
|
|
7
|
+
} from '../../src/uri.js'
|
|
2
8
|
import { salesApi } from '@defra-fish/connectors-lib'
|
|
3
9
|
import { validation } from '@defra-fish/business-rules-lib'
|
|
4
10
|
import { setupCancelRecurringPaymentCacheFromAuthResult } from '../processors/recurring-payments-write-cache.js'
|
|
11
|
+
import { cacheDateFormat } from '../../src/processors/date-and-time-display.js'
|
|
12
|
+
import moment from 'moment-timezone'
|
|
5
13
|
import Joi from 'joi'
|
|
6
14
|
|
|
7
15
|
const applyAuthFailure = async (request, h, { pageData, redirectUri, statusData }) => {
|
|
@@ -30,12 +38,18 @@ const cancelRecurringPaymentAuthenticationHandler = async (request, h) => {
|
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
if (!authenticationResult) {
|
|
33
|
-
context.pageData.
|
|
41
|
+
context.pageData.errorRedirect = true
|
|
42
|
+
context.redirectUri = CANCEL_RP_LICENCE_NOT_FOUND.uri
|
|
34
43
|
} else if (!authenticationResult.recurringPayment) {
|
|
35
44
|
context.pageData.errorRedirect = true
|
|
36
45
|
context.redirectUri = CANCEL_RP_AGREEMENT_NOT_FOUND.uri
|
|
37
46
|
} else if (authenticationResult.recurringPayment.cancelledDate) {
|
|
38
|
-
context.pageData.
|
|
47
|
+
context.pageData.errorRedirect = true
|
|
48
|
+
context.redirectUri = CANCEL_RP_ALREADY_CANCELLED.uri
|
|
49
|
+
context.pageData.payload = {
|
|
50
|
+
...context.pageData.payload,
|
|
51
|
+
endDate: moment(authenticationResult.recurringPayment.endDate).format(cacheDateFormat)
|
|
52
|
+
}
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
if (context.pageData.error || context.pageData.errorRedirect) {
|
package/src/locales/cy.json
CHANGED
|
@@ -440,6 +440,10 @@
|
|
|
440
440
|
"licence_not_found_body_ea_link": "enquiries@environment-agency.gov.uk",
|
|
441
441
|
"licence_not_found_body_3": " neu ffonio 03708 506 506 (8am - 6pm o ddydd Llun i ddydd Gwener, ac eithrio gwyliau cyhoeddus). ",
|
|
442
442
|
"licence_not_found_body_call_charges_link": "Gallwch weld costau’r galwadau yma (yn agor mewn tab newydd)",
|
|
443
|
+
"licence_not_found_rp_body_1": "If you keep seeing this page you can cancel your recurring card payment by:",
|
|
444
|
+
"licence_not_found_rp_bullet_point_1": "emailing ",
|
|
445
|
+
"licence_not_found_rp_bullet_point_1_2": " up to 15 days before your payment date",
|
|
446
|
+
"licence_not_found_rp_bullet_point_2": "calling 03708 506 506 (8am to 6pm, Monday to Friday, except public holidays) up to the day before your payment date.",
|
|
443
447
|
"licence_start_days": " diwrnod nesaf",
|
|
444
448
|
"licence_start_enter_todays_date": "Rhowch ddyddiad heddiw os ydych chi am i’r drwydded 1 diwrnod neu 8 diwrnod ddechrau yn hwyrach heddiw.",
|
|
445
449
|
"licence_start_error_date_real": "Mae’n rhaid i ddyddiad dechrau’r drwydded fod yn ddyddiad dilys",
|
|
@@ -786,9 +790,18 @@
|
|
|
786
790
|
"role_required_body_1": "You were successfully signed in but you do not have the correct role assigned to access the telesales application.",
|
|
787
791
|
"role_required_body_2": "Please contact your Microsoft Dynamics administrator to request access.",
|
|
788
792
|
"role_required_title": "Role required",
|
|
793
|
+
"rp_licence_already_cancelled_heading": "Your recurring card payment agreement is already cancelled",
|
|
794
|
+
"rp_licence_already_cancelled_body_1": "Licence ending ",
|
|
795
|
+
"rp_licence_already_cancelled_body_1_1": " expires on ",
|
|
796
|
+
"rp_licence_already_cancelled_body_1_2": " and will not renew automatically. To continue fishing after this date you need to ",
|
|
797
|
+
"rp_licence_already_cancelled_body_link": "get a new licence (opens in new tab)",
|
|
798
|
+
"rp_licence_already_cancelled_body_2_1": "If you need help email ",
|
|
799
|
+
"rp_licence_already_cancelled_body_2_2": " or call 03708 506 506 (8am to 6pm, Monday to Friday, except public holidays).",
|
|
800
|
+
"rp_licence_already_cancelled_body_3_1": "Go back",
|
|
801
|
+
"rp_licence_already_cancelled_body_3_2": " to cancel the recurring card payment for a different licence.",
|
|
802
|
+
"rp_licence_already_cancelled_body_ea_link": "enquiries@environment-agency.gov.uk",
|
|
803
|
+
"rp_cancel_already_cancelled_title": "Already cancelled - Cancel your recurring card payment ",
|
|
789
804
|
"rp_cancel_complete_title": "Cancel your recurring card payment agreement - complete",
|
|
790
|
-
"rp_cancel_confirm_title": "Cancel your recurring card payment agreement - confirm",
|
|
791
|
-
"rp_cancel_details_title": "Cancel your recurring card payment agreement - details",
|
|
792
805
|
"rp_cancel_identify_title": "Cancel your recurring card payment agreement - identify",
|
|
793
806
|
"rp_cancel_no_agreement_found_title": "Agreement not found - Cancel your recurring card payment",
|
|
794
807
|
"rp_cancel_no_agreement_found_heading": "There is no recurring card payment linked to this licence",
|
package/src/locales/en.json
CHANGED
|
@@ -439,6 +439,10 @@
|
|
|
439
439
|
"licence_not_found_body_ea_link": "enquiries@environment-agency.gov.uk",
|
|
440
440
|
"licence_not_found_body_3": " or calling 03708 506 506 (8am to 6pm, Monday to Friday, except public holidays). ",
|
|
441
441
|
"licence_not_found_body_call_charges_link": "View call charges (opens in new tab)",
|
|
442
|
+
"licence_not_found_rp_body_1": "If you keep seeing this page you can cancel your recurring card payment by:",
|
|
443
|
+
"licence_not_found_rp_bullet_point_1": "emailing ",
|
|
444
|
+
"licence_not_found_rp_bullet_point_1_2": " up to 15 days before your payment date",
|
|
445
|
+
"licence_not_found_rp_bullet_point_2": "calling 03708 506 506 (8am to 6pm, Monday to Friday, except public holidays) up to the day before your payment date.",
|
|
442
446
|
"licence_num": "Licence number",
|
|
443
447
|
"licence_start_days": " days",
|
|
444
448
|
"licence_start_enter_todays_date": "Enter today’s date if you want the 1-day or 8-day licence to start later today.",
|
|
@@ -786,9 +790,18 @@
|
|
|
786
790
|
"role_required_body_1": "You were successfully signed in but you do not have the correct role assigned to access the telesales application.",
|
|
787
791
|
"role_required_body_2": "Please contact your Microsoft Dynamics administrator to request access.",
|
|
788
792
|
"role_required_title": "Role required",
|
|
793
|
+
"rp_licence_already_cancelled_heading": "Your recurring card payment agreement is already cancelled",
|
|
794
|
+
"rp_licence_already_cancelled_body_1": "Licence ending ",
|
|
795
|
+
"rp_licence_already_cancelled_body_1_1": " expires on ",
|
|
796
|
+
"rp_licence_already_cancelled_body_1_2": " and will not renew automatically. To continue fishing after this date you need to ",
|
|
797
|
+
"rp_licence_already_cancelled_body_link": "get a new licence (opens in new tab)",
|
|
798
|
+
"rp_licence_already_cancelled_body_2_1": "If you need help email ",
|
|
799
|
+
"rp_licence_already_cancelled_body_2_2": " or call 03708 506 506 (8am to 6pm, Monday to Friday, except public holidays).",
|
|
800
|
+
"rp_licence_already_cancelled_body_3_1": "Go back",
|
|
801
|
+
"rp_licence_already_cancelled_body_3_2": " to cancel the recurring card payment for a different licence.",
|
|
802
|
+
"rp_licence_already_cancelled_body_ea_link": "enquiries@environment-agency.gov.uk",
|
|
803
|
+
"rp_cancel_already_cancelled_title": "Already cancelled - Cancel your recurring card payment ",
|
|
789
804
|
"rp_cancel_complete_title": "Cancel your recurring card payment agreement - complete",
|
|
790
|
-
"rp_cancel_confirm_title": "Cancel your recurring card payment agreement - confirm",
|
|
791
|
-
"rp_cancel_details_title": "Cancel your recurring card payment agreement - details",
|
|
792
805
|
"rp_cancel_identify_title": "Cancel your recurring card payment agreement - identify",
|
|
793
806
|
"rp_cancel_no_agreement_found_title": "Agreement not found - Cancel your recurring card payment",
|
|
794
807
|
"rp_cancel_no_agreement_found_heading": "There is no recurring card payment linked to this licence",
|
package/src/pages/recurring-payments/cancel/agreement-not-found/cancel-rp-agreement-not-found.njk
CHANGED
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
<p class="govuk-body">{{ mssgs.rp_cancel_no_agreement_found_need_help_1 }}<a class="govuk-link" href="mailto:{{ data.links.contactUs }}">{{ mssgs.rp_cancel_no_agreement_found_need_help_email }}</a>{{ mssgs.rp_cancel_no_agreement_found_need_help_2 }}<a class="govuk-link" href="{{ data.links.callCharges }}" target="_blank">{{ mssgs.rp_cancel_no_agreement_found_call_charges_link }}</a></p>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
|
-
{% endblock %}
|
|
15
|
+
{% endblock %}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import pageRoute from '../../../../../routes/page-route.js'
|
|
2
|
+
import { CANCEL_RP_ALREADY_CANCELLED } from '../../../../../uri.js'
|
|
3
|
+
|
|
4
|
+
require('../route.js')
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line no-unused-vars
|
|
7
|
+
const getData = pageRoute.mock.calls[0][4]
|
|
8
|
+
|
|
9
|
+
jest.mock('../../../../../routes/page-route.js', () => jest.fn())
|
|
10
|
+
jest.mock('../../../../../uri.js', () => ({
|
|
11
|
+
...jest.requireActual('../../../../../uri.js'),
|
|
12
|
+
CANCEL_RP_ALREADY_CANCELLED: {
|
|
13
|
+
page: Symbol('cancel-rp-already-cancelled page'),
|
|
14
|
+
uri: Symbol('cancel-rp-already-cancelled uri')
|
|
15
|
+
}
|
|
16
|
+
}))
|
|
17
|
+
jest.mock('../../../../../processors/uri-helper.js')
|
|
18
|
+
|
|
19
|
+
const getSampleRequest = referenceNumber => ({
|
|
20
|
+
cache: jest.fn(() => ({
|
|
21
|
+
helpers: {
|
|
22
|
+
page: {
|
|
23
|
+
getCurrentPermission: jest.fn(() => ({ payload: { referenceNumber, endDate: '2025:10:03:03:33:33' } }))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}))
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('pageRoute receives expected arguments', () => {
|
|
30
|
+
it('passes CANCEL_RP_ALREADY_CANCELLED.page as the view name', () => {
|
|
31
|
+
jest.isolateModules(() => {
|
|
32
|
+
require('../route.js')
|
|
33
|
+
expect(pageRoute).toHaveBeenCalledWith(
|
|
34
|
+
CANCEL_RP_ALREADY_CANCELLED.page,
|
|
35
|
+
expect.anything(),
|
|
36
|
+
expect.anything(),
|
|
37
|
+
expect.anything(),
|
|
38
|
+
expect.anything()
|
|
39
|
+
)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('passes CANCEL_RP_ALREADY_CANCELLED.uri as the path', () => {
|
|
44
|
+
jest.isolateModules(() => {
|
|
45
|
+
require('../route.js')
|
|
46
|
+
expect(pageRoute).toHaveBeenCalledWith(
|
|
47
|
+
expect.anything(),
|
|
48
|
+
CANCEL_RP_ALREADY_CANCELLED.uri,
|
|
49
|
+
expect.anything(),
|
|
50
|
+
expect.anything(),
|
|
51
|
+
expect.anything()
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('passes a function as the validator', () => {
|
|
57
|
+
jest.isolateModules(() => {
|
|
58
|
+
require('../route.js')
|
|
59
|
+
expect(pageRoute).toHaveBeenCalledWith(
|
|
60
|
+
expect.anything(),
|
|
61
|
+
expect.anything(),
|
|
62
|
+
expect.any(Function),
|
|
63
|
+
expect.anything(),
|
|
64
|
+
expect.anything()
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('passes a function to generate redirect location on completion', () => {
|
|
70
|
+
jest.isolateModules(() => {
|
|
71
|
+
require('../route.js')
|
|
72
|
+
expect(pageRoute).toHaveBeenCalledWith(
|
|
73
|
+
expect.anything(),
|
|
74
|
+
expect.anything(),
|
|
75
|
+
expect.anything(),
|
|
76
|
+
expect.any(Function),
|
|
77
|
+
expect.anything()
|
|
78
|
+
)
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('passes getData to pageRoute', () => {
|
|
83
|
+
jest.isolateModules(() => {
|
|
84
|
+
require('../route.js')
|
|
85
|
+
expect(pageRoute).toHaveBeenCalledWith(
|
|
86
|
+
expect.anything(),
|
|
87
|
+
expect.anything(),
|
|
88
|
+
expect.anything(),
|
|
89
|
+
expect.anything(),
|
|
90
|
+
expect.any(Function)
|
|
91
|
+
)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
describe('getData', () => {
|
|
97
|
+
it('returns reference number from payload', async () => {
|
|
98
|
+
const referenceNumber = 'RP0310'
|
|
99
|
+
expect(await getData(getSampleRequest(referenceNumber))).toEqual(
|
|
100
|
+
expect.objectContaining({
|
|
101
|
+
referenceNumber
|
|
102
|
+
})
|
|
103
|
+
)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('transforms end date to display format', async () => {
|
|
107
|
+
const endDate = '2025-10-03T03:33:33.000Z'
|
|
108
|
+
const request = getSampleRequest()
|
|
109
|
+
request.cache().helpers.page.getCurrentPermission.mockResolvedValueOnce({
|
|
110
|
+
payload: { referenceNumber: 'RP0310', endDate }
|
|
111
|
+
})
|
|
112
|
+
const data = await getData(request)
|
|
113
|
+
expect(data.endDate).toEqual('3 October 2025')
|
|
114
|
+
})
|
|
115
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{% extends "layout.njk" %}
|
|
2
|
+
{% from "page-title.njk" import pageTitle %}
|
|
3
|
+
|
|
4
|
+
{% set title = mssgs.rp_cancel_already_cancelled_title %}
|
|
5
|
+
{% block pageTitle %}{{ pageTitle(title, mssgs) }}{% endblock %}
|
|
6
|
+
|
|
7
|
+
{% block content %}
|
|
8
|
+
<div class="govuk-grid-row">
|
|
9
|
+
<div class="govuk-grid-column-two-thirds">
|
|
10
|
+
<h1 class="govuk-heading-l">{{ mssgs.rp_licence_already_cancelled_heading }}</h1>
|
|
11
|
+
<p class="govuk-body">
|
|
12
|
+
{{ mssgs.rp_licence_already_cancelled_body_1 }}{{ data.referenceNumber }}{{ mssgs.rp_licence_already_cancelled_body_1_1 }}{{ data.endDate }}{{ mssgs.rp_licence_already_cancelled_body_1_2 }}
|
|
13
|
+
<a href="/" class="govuk-link" target="_blank" rel="noopener"> {{ mssgs.rp_licence_already_cancelled_body_link }}</a>{{ mssgs.full_stop }}
|
|
14
|
+
</p>
|
|
15
|
+
<p class="govuk-body">
|
|
16
|
+
{{ mssgs.rp_licence_already_cancelled_body_2_1 }}
|
|
17
|
+
<a href="mailto:enquiries@environment-agency.gov.uk"> {{ mssgs.rp_licence_already_cancelled_body_ea_link }}</a>
|
|
18
|
+
{{ mssgs.rp_licence_already_cancelled_body_2_2 }}
|
|
19
|
+
<a href="https://www.gov.uk/call-charges" target="_blank" rel="noopener"> {{ mssgs.licence_not_found_body_call_charges_link }}</a>{{ mssgs.full_stop }}
|
|
20
|
+
</p>
|
|
21
|
+
<p class="govuk-body">
|
|
22
|
+
<a class="govuk-link" href="/buy/cancel-recurring-payment/identify"> {{ mssgs.rp_licence_already_cancelled_body_3_1 }}
|
|
23
|
+
</a>{{ mssgs.rp_licence_already_cancelled_body_3_2 }}
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
{% endblock %}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pageRoute from '../../../../routes/page-route.js'
|
|
2
|
+
import { SERVICE_LOCAL_TIME } from '@defra-fish/business-rules-lib'
|
|
3
|
+
import { CANCEL_RP_ALREADY_CANCELLED, CANCEL_RP_IDENTIFY } from '../../../../uri.js'
|
|
4
|
+
import { cacheDateFormat, dateDisplayFormat } from '../../../../processors/date-and-time-display.js'
|
|
5
|
+
import moment from 'moment-timezone'
|
|
6
|
+
|
|
7
|
+
const getData = async request => {
|
|
8
|
+
const {
|
|
9
|
+
payload: { referenceNumber, endDate }
|
|
10
|
+
} = await request.cache().helpers.page.getCurrentPermission(CANCEL_RP_IDENTIFY.page)
|
|
11
|
+
const endDateString = moment(endDate, cacheDateFormat).tz(SERVICE_LOCAL_TIME).format(dateDisplayFormat)
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
referenceNumber,
|
|
15
|
+
endDate: endDateString
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default pageRoute(
|
|
20
|
+
CANCEL_RP_ALREADY_CANCELLED.page,
|
|
21
|
+
CANCEL_RP_ALREADY_CANCELLED.uri,
|
|
22
|
+
() => {},
|
|
23
|
+
() => {},
|
|
24
|
+
getData
|
|
25
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import pageRoute from '../../../../../routes/page-route.js'
|
|
2
|
+
import { CANCEL_RP_LICENCE_NOT_FOUND } from '../../../../../uri.js'
|
|
3
|
+
import '../route.js'
|
|
4
|
+
|
|
5
|
+
jest.mock('../../../../../routes/page-route.js', () => jest.fn())
|
|
6
|
+
jest.mock('../../../../../uri.js', () => ({
|
|
7
|
+
CANCEL_RP_LICENCE_NOT_FOUND: {
|
|
8
|
+
page: Symbol('licence-not-found page'),
|
|
9
|
+
uri: Symbol('licence-not-found uri')
|
|
10
|
+
}
|
|
11
|
+
}))
|
|
12
|
+
|
|
13
|
+
describe('CANCEL_RP_LICENCE_NOT_FOUND route', () => {
|
|
14
|
+
it('passes CANCEL_RP_LICENCE_NOT_FOUND.page as the first argument to pageRoute', () => {
|
|
15
|
+
expect(pageRoute).toHaveBeenCalledWith(CANCEL_RP_LICENCE_NOT_FOUND.page, expect.anything())
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('passes CANCEL_RP_LICENCE_NOT_FOUND.uri as the second argument to pageRoute', () => {
|
|
19
|
+
expect(pageRoute).toHaveBeenCalledWith(expect.anything(), CANCEL_RP_LICENCE_NOT_FOUND.uri)
|
|
20
|
+
})
|
|
21
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{% extends "layout.njk" %}
|
|
2
|
+
{% extends "standard-form.njk" %}
|
|
3
|
+
|
|
4
|
+
{% set title = mssgs.licence_not_found_title %}
|
|
5
|
+
|
|
6
|
+
{% block content %}
|
|
7
|
+
<div class="govuk-grid-row">
|
|
8
|
+
<div class="govuk-grid-column-two-thirds">
|
|
9
|
+
<h1 class="govuk-heading-l">{{ mssgs.licence_not_found_title }}</h1>
|
|
10
|
+
<p class="govuk-body">
|
|
11
|
+
{{ mssgs.licence_not_found_body_1 }}
|
|
12
|
+
<a class="govuk-link" href="/buy/renew/identify">{{ mssgs.licence_not_found_body_previous_page }}</a>{{ mssgs.full_stop }}
|
|
13
|
+
</p>
|
|
14
|
+
<p class="govuk-body">
|
|
15
|
+
{{ mssgs.licence_not_found_rp_body_1}}
|
|
16
|
+
</p>
|
|
17
|
+
<ul class="govuk-list govuk-list--bullet">
|
|
18
|
+
<li> {{ mssgs.licence_not_found_rp_bullet_point_1 }} <a href="mailto:enquiries@environment-agency.gov.uk"> {{ mssgs.licence_not_found_body_ea_link }}
|
|
19
|
+
</a> {{ mssgs.licence_not_found_rp_bullet_point_1_2 }} </li>
|
|
20
|
+
|
|
21
|
+
<li> {{ mssgs.licence_not_found_rp_bullet_point_2 }} <a href="https://www.gov.uk/call-charges" target="_blank" rel="noopener"> {{ mssgs.licence_not_found_body_call_charges_link }}
|
|
22
|
+
</a>{{ mssgs.full_stop }} </li>
|
|
23
|
+
</ul>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
{% endblock %}
|
|
@@ -116,6 +116,38 @@ Object {
|
|
|
116
116
|
},
|
|
117
117
|
"path": "/buy/cancel-recurring-payment/agreement-not-found",
|
|
118
118
|
},
|
|
119
|
+
Object {
|
|
120
|
+
"handler": [Function],
|
|
121
|
+
"method": "GET",
|
|
122
|
+
"path": "/buy/cancel-recurring-payment/already-cancelled",
|
|
123
|
+
},
|
|
124
|
+
Object {
|
|
125
|
+
"handler": [Function],
|
|
126
|
+
"method": "POST",
|
|
127
|
+
"options": Object {
|
|
128
|
+
"validate": Object {
|
|
129
|
+
"failAction": [Function],
|
|
130
|
+
"payload": [Function],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
"path": "/buy/cancel-recurring-payment/already-cancelled",
|
|
134
|
+
},
|
|
135
|
+
Object {
|
|
136
|
+
"handler": [Function],
|
|
137
|
+
"method": "GET",
|
|
138
|
+
"path": "/buy/cancel-recurring-payment/licence-not-found",
|
|
139
|
+
},
|
|
140
|
+
Object {
|
|
141
|
+
"handler": [Function],
|
|
142
|
+
"method": "POST",
|
|
143
|
+
"options": Object {
|
|
144
|
+
"validate": Object {
|
|
145
|
+
"failAction": [Function],
|
|
146
|
+
"payload": undefined,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
"path": "/buy/cancel-recurring-payment/licence-not-found",
|
|
150
|
+
},
|
|
119
151
|
],
|
|
120
152
|
}
|
|
121
153
|
`;
|
|
@@ -34,7 +34,9 @@ import {
|
|
|
34
34
|
CANCEL_RP_DETAILS,
|
|
35
35
|
CANCEL_RP_CONFIRM,
|
|
36
36
|
CANCEL_RP_COMPLETE,
|
|
37
|
-
CANCEL_RP_AGREEMENT_NOT_FOUND
|
|
37
|
+
CANCEL_RP_AGREEMENT_NOT_FOUND,
|
|
38
|
+
CANCEL_RP_ALREADY_CANCELLED,
|
|
39
|
+
CANCEL_RP_LICENCE_NOT_FOUND
|
|
38
40
|
} from '../uri.js'
|
|
39
41
|
|
|
40
42
|
import { CommonResults, CONTACT_SUMMARY_SEEN, ShowDigitalLicencePages } from '../constants.js'
|
|
@@ -463,5 +465,17 @@ export default [
|
|
|
463
465
|
{
|
|
464
466
|
current: CANCEL_RP_AGREEMENT_NOT_FOUND,
|
|
465
467
|
backLink: CANCEL_RP_IDENTIFY.uri
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
current: CANCEL_RP_LICENCE_NOT_FOUND,
|
|
471
|
+
backLink: CANCEL_RP_IDENTIFY.uri
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
current: CANCEL_RP_ALREADY_CANCELLED,
|
|
475
|
+
backLink: CANCEL_RP_IDENTIFY.uri
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
current: CANCEL_RP_LICENCE_NOT_FOUND,
|
|
479
|
+
backLink: CANCEL_RP_IDENTIFY.uri
|
|
466
480
|
}
|
|
467
481
|
]
|
|
@@ -5,6 +5,8 @@ import cancelRPDetails from '../pages/recurring-payments/cancel/details/route.js
|
|
|
5
5
|
import cancelRPConfirm from '../pages/recurring-payments/cancel/confirm/route.js'
|
|
6
6
|
import cancelRPComplete from '../pages/recurring-payments/cancel/complete/route.js'
|
|
7
7
|
import cancelRPAgreementNotFound from '../pages/recurring-payments/cancel/agreement-not-found/route.js'
|
|
8
|
+
import cancelRPLicenceNotFound from '../pages/recurring-payments/cancel/licence-not-found/route.js'
|
|
9
|
+
import cancelRPAlreadyCancelled from '../pages/recurring-payments/cancel/already-cancelled/route.js'
|
|
8
10
|
|
|
9
11
|
const telesalesRoutes = [
|
|
10
12
|
{
|
|
@@ -33,6 +35,14 @@ const telesalesRoutes = [
|
|
|
33
35
|
]
|
|
34
36
|
|
|
35
37
|
if (process.env.SHOW_CANCELLATION_JOURNEY === 'true') {
|
|
36
|
-
telesalesRoutes.push(
|
|
38
|
+
telesalesRoutes.push(
|
|
39
|
+
...cancelRPIdentify,
|
|
40
|
+
...cancelRPDetails,
|
|
41
|
+
...cancelRPConfirm,
|
|
42
|
+
...cancelRPComplete,
|
|
43
|
+
...cancelRPAgreementNotFound,
|
|
44
|
+
...cancelRPAlreadyCancelled,
|
|
45
|
+
...cancelRPLicenceNotFound
|
|
46
|
+
)
|
|
37
47
|
}
|
|
38
48
|
export default telesalesRoutes
|
package/src/uri.js
CHANGED
|
@@ -62,6 +62,9 @@ export const ERROR_TESTING = { uri: '/buy/throw-error' }
|
|
|
62
62
|
export const CHOOSE_PAYMENT = { uri: '/buy/choose-payment', page: 'choose-payment' }
|
|
63
63
|
export const SET_UP_PAYMENT = { uri: '/buy/set-up-recurring-card-payment', page: 'set-up-payment' }
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Recurring payments cancellation pages
|
|
67
|
+
*/
|
|
65
68
|
export const CANCEL_RP_IDENTIFY = { uri: '/buy/cancel-recurring-payment/identify', page: 'cancel-rp-identify' }
|
|
66
69
|
export const CANCEL_RP_AUTHENTICATE = { uri: '/buy/cancel-recurring-payment/authenticate' }
|
|
67
70
|
export const CANCEL_RP_DETAILS = { uri: '/buy/cancel-recurring-payment/details', page: 'cancel-rp-details' }
|
|
@@ -71,6 +74,8 @@ export const CANCEL_RP_AGREEMENT_NOT_FOUND = {
|
|
|
71
74
|
uri: '/buy/cancel-recurring-payment/agreement-not-found',
|
|
72
75
|
page: 'cancel-rp-agreement-not-found'
|
|
73
76
|
}
|
|
77
|
+
export const CANCEL_RP_LICENCE_NOT_FOUND = { uri: '/buy/cancel-recurring-payment/licence-not-found', page: 'licence-not-found' }
|
|
78
|
+
export const CANCEL_RP_ALREADY_CANCELLED = { uri: '/buy/cancel-recurring-payment/already-cancelled', page: 'already-cancelled' }
|
|
74
79
|
|
|
75
80
|
/**
|
|
76
81
|
* These are informational static pages
|