@defra-fish/gafl-webapp-service 1.58.0-rc.0 → 1.58.0-rc.2
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/gafl-webapp-service",
|
|
3
|
-
"version": "1.58.0-rc.
|
|
3
|
+
"version": "1.58.0-rc.2",
|
|
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.58.0-rc.
|
|
40
|
-
"@defra-fish/connectors-lib": "1.58.0-rc.
|
|
39
|
+
"@defra-fish/business-rules-lib": "1.58.0-rc.2",
|
|
40
|
+
"@defra-fish/connectors-lib": "1.58.0-rc.2",
|
|
41
41
|
"@defra/hapi-gapi": "^2.0.0",
|
|
42
42
|
"@hapi/boom": "^9.1.2",
|
|
43
43
|
"@hapi/catbox-redis": "^6.0.2",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"./gafl-jest-matchers.js"
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "06d1e00b91644b9bfaf04b34c26fd45cba8ba198"
|
|
84
84
|
}
|
|
@@ -5,7 +5,6 @@ import { COMPLETION_STATUS, FEEDBACK_URI_DEFAULT } from '../../../../constants.j
|
|
|
5
5
|
import { displayStartTime } from '../../../../processors/date-and-time-display.js'
|
|
6
6
|
import { LICENCE_TYPE } from '../../../../processors/mapping-constants.js'
|
|
7
7
|
import { displayPrice } from '../../../../processors/price-display.js'
|
|
8
|
-
import { validForRecurringPayment } from '../../../../processors/recurring-pay-helper.js'
|
|
9
8
|
|
|
10
9
|
jest.mock('../../../../processors/recurring-pay-helper.js')
|
|
11
10
|
jest.mock('../../../../processors/date-and-time-display.js')
|
|
@@ -50,14 +49,16 @@ const getSamplePermission = ({
|
|
|
50
49
|
licenceType = LICENCE_TYPE['trout-and-coarse'],
|
|
51
50
|
isLicenceForYou = true,
|
|
52
51
|
licenceLength = '12M',
|
|
53
|
-
licensee = getSampleLicensee()
|
|
52
|
+
licensee = getSampleLicensee(),
|
|
53
|
+
isRecurringPayment = false
|
|
54
54
|
} = {}) => ({
|
|
55
55
|
startDate: '2019-12-14T00:00:00Z',
|
|
56
56
|
licensee,
|
|
57
57
|
isLicenceForYou,
|
|
58
58
|
licenceType,
|
|
59
59
|
referenceNumber,
|
|
60
|
-
licenceLength
|
|
60
|
+
licenceLength,
|
|
61
|
+
isRecurringPayment
|
|
61
62
|
})
|
|
62
63
|
|
|
63
64
|
const getSampleCompletionStatus = ({ agreed = true, posted = true, finalised = true, setUpPayment = true } = {}) => ({
|
|
@@ -203,27 +204,23 @@ describe('The order completion handler', () => {
|
|
|
203
204
|
expect(displayStartTime).toHaveBeenCalledWith(request, permission)
|
|
204
205
|
})
|
|
205
206
|
|
|
206
|
-
it('validForRecurringPayment is called with a permission', async () => {
|
|
207
|
-
const permission = getSamplePermission()
|
|
208
|
-
|
|
209
|
-
await getData(getSampleRequest({ permission }))
|
|
210
|
-
|
|
211
|
-
expect(validForRecurringPayment).toHaveBeenCalledWith(permission)
|
|
212
|
-
})
|
|
213
|
-
|
|
214
207
|
it.each`
|
|
215
|
-
|
|
216
|
-
${true}
|
|
217
|
-
${true}
|
|
218
|
-
${false}
|
|
219
|
-
${false}
|
|
208
|
+
show | recurring | expected
|
|
209
|
+
${true} | ${true} | ${true}
|
|
210
|
+
${true} | ${false} | ${false}
|
|
211
|
+
${false} | ${false} | ${false}
|
|
212
|
+
${false} | ${true} | ${false}
|
|
220
213
|
`(
|
|
221
|
-
'recurringPayment returns $expected when
|
|
222
|
-
async ({
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
const
|
|
214
|
+
'recurringPayment returns $expected when SHOW_RECURRING_PAYMENTS is $show and the permission recurring payment is $recurring',
|
|
215
|
+
async ({ show, recurring, expected }) => {
|
|
216
|
+
process.env.SHOW_RECURRING_PAYMENTS = show
|
|
217
|
+
const permission = getSamplePermission({ isRecurringPayment: recurring })
|
|
218
|
+
const request = getSampleRequest({ permission })
|
|
219
|
+
const { recurringPayment } = await getData(request)
|
|
220
|
+
|
|
226
221
|
expect(recurringPayment).toBe(expected)
|
|
222
|
+
|
|
223
|
+
delete process.env.SHOW_RECURRING_PAYMENTS
|
|
227
224
|
}
|
|
228
225
|
)
|
|
229
226
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import pageRoute from '../../../routes/page-route.js'
|
|
2
|
-
import { validForRecurringPayment } from '../../../processors/recurring-pay-helper.js'
|
|
3
2
|
import Boom from '@hapi/boom'
|
|
4
3
|
import { COMPLETION_STATUS, FEEDBACK_URI_DEFAULT } from '../../../constants.js'
|
|
5
4
|
import { ORDER_COMPLETE, NEW_TRANSACTION, LICENCE_DETAILS } from '../../../uri.js'
|
|
@@ -42,7 +41,7 @@ export const getData = async request => {
|
|
|
42
41
|
digitalConfirmation: digital && permission.licensee.postalFulfilment,
|
|
43
42
|
digitalLicence: digital && !permission.licensee.postalFulfilment,
|
|
44
43
|
postalLicence: permission.licensee.postalFulfilment,
|
|
45
|
-
recurringPayment: isRecurringPayment(
|
|
44
|
+
recurringPayment: isRecurringPayment(permission),
|
|
46
45
|
uri: {
|
|
47
46
|
feedback: process.env.FEEDBACK_URI || FEEDBACK_URI_DEFAULT,
|
|
48
47
|
licenceDetails: addLanguageCodeToUri(request, LICENCE_DETAILS.uri),
|
|
@@ -59,7 +58,7 @@ const postalFulfilment = permission => {
|
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
const isRecurringPayment =
|
|
61
|
+
const isRecurringPayment = permission => process.env.SHOW_RECURRING_PAYMENTS?.toLowerCase() === 'true' && permission.isRecurringPayment
|
|
63
62
|
|
|
64
63
|
const digitalConfirmation = permission =>
|
|
65
64
|
permission.licensee.preferredMethodOfConfirmation === HOW_CONTACTED.email ||
|