@defra-fish/gafl-webapp-service 1.58.0-rc.11 → 1.58.0-rc.12
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.12",
|
|
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.12",
|
|
40
|
+
"@defra-fish/connectors-lib": "1.58.0-rc.12",
|
|
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": "ab9cb3b6afa14e6ba82df8a96ef13102c9c604d1"
|
|
84
84
|
}
|
|
@@ -105,7 +105,8 @@ const getSampleRequest = ({
|
|
|
105
105
|
statusSet = () => {},
|
|
106
106
|
statusSetCurrentPermission = () => {},
|
|
107
107
|
transactionCost = 1,
|
|
108
|
-
messages = getMessages()
|
|
108
|
+
messages = getMessages(),
|
|
109
|
+
agreementId
|
|
109
110
|
} = {}) => ({
|
|
110
111
|
cache: () => ({
|
|
111
112
|
helpers: {
|
|
@@ -116,7 +117,8 @@ const getSampleRequest = ({
|
|
|
116
117
|
},
|
|
117
118
|
transaction: {
|
|
118
119
|
get: async () => ({
|
|
119
|
-
cost: transactionCost
|
|
120
|
+
cost: transactionCost,
|
|
121
|
+
agreementId
|
|
120
122
|
}),
|
|
121
123
|
getCurrentPermission: () => permission
|
|
122
124
|
}
|
|
@@ -205,17 +207,16 @@ describe('The order completion handler', () => {
|
|
|
205
207
|
})
|
|
206
208
|
|
|
207
209
|
it.each`
|
|
208
|
-
show |
|
|
209
|
-
${true} | ${
|
|
210
|
-
${true} | ${
|
|
211
|
-
${false} | ${
|
|
212
|
-
${false} | ${
|
|
210
|
+
show | agreementId | expected
|
|
211
|
+
${true} | ${'foo123'} | ${true}
|
|
212
|
+
${true} | ${undefined} | ${false}
|
|
213
|
+
${false} | ${'foo123'} | ${false}
|
|
214
|
+
${false} | ${undefined} | ${false}
|
|
213
215
|
`(
|
|
214
|
-
'recurringPayment returns $expected when SHOW_RECURRING_PAYMENTS is $show and the
|
|
215
|
-
async ({ show,
|
|
216
|
+
'recurringPayment returns $expected when SHOW_RECURRING_PAYMENTS is $show and the transaction agreementId is $agreementId',
|
|
217
|
+
async ({ show, agreementId, expected }) => {
|
|
216
218
|
process.env.SHOW_RECURRING_PAYMENTS = show
|
|
217
|
-
const
|
|
218
|
-
const request = getSampleRequest({ permission })
|
|
219
|
+
const request = getSampleRequest({ agreementId })
|
|
219
220
|
const { recurringPayment } = await getData(request)
|
|
220
221
|
|
|
221
222
|
expect(recurringPayment).toBe(expected)
|
|
@@ -41,7 +41,7 @@ export const getData = async request => {
|
|
|
41
41
|
digitalConfirmation: digital && permission.licensee.postalFulfilment,
|
|
42
42
|
digitalLicence: digital && !permission.licensee.postalFulfilment,
|
|
43
43
|
postalLicence: permission.licensee.postalFulfilment,
|
|
44
|
-
recurringPayment: isRecurringPayment(
|
|
44
|
+
recurringPayment: isRecurringPayment(transaction),
|
|
45
45
|
uri: {
|
|
46
46
|
feedback: process.env.FEEDBACK_URI || FEEDBACK_URI_DEFAULT,
|
|
47
47
|
licenceDetails: addLanguageCodeToUri(request, LICENCE_DETAILS.uri),
|
|
@@ -58,7 +58,7 @@ const postalFulfilment = permission => {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const isRecurringPayment =
|
|
61
|
+
const isRecurringPayment = transaction => process.env.SHOW_RECURRING_PAYMENTS?.toLowerCase() === 'true' && !!transaction.agreementId
|
|
62
62
|
|
|
63
63
|
const digitalConfirmation = permission =>
|
|
64
64
|
permission.licensee.preferredMethodOfConfirmation === HOW_CONTACTED.email ||
|