@defra-fish/gafl-webapp-service 1.63.0-rc.1 → 1.63.0-rc.3

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.63.0-rc.1",
3
+ "version": "1.63.0-rc.3",
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.63.0-rc.1",
40
- "@defra-fish/connectors-lib": "1.63.0-rc.1",
39
+ "@defra-fish/business-rules-lib": "1.63.0-rc.3",
40
+ "@defra-fish/connectors-lib": "1.63.0-rc.3",
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": "93c7097feecf01ce2d207cafe43227f7aaa77376"
82
+ "gitHead": "326d589e6fa640bf0a4e895c7dd280699c1cde87"
83
83
  }
@@ -66,7 +66,7 @@ Array [
66
66
  "text": Symbol(contact-summary-row-address),
67
67
  },
68
68
  "value": Object {
69
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
69
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
70
70
  },
71
71
  },
72
72
  Object {
@@ -131,7 +131,7 @@ Array [
131
131
  "text": Symbol(contact-summary-row-address),
132
132
  },
133
133
  "value": Object {
134
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
134
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
135
135
  },
136
136
  },
137
137
  Object {
@@ -196,7 +196,7 @@ Array [
196
196
  "text": Symbol(contact-summary-row-address),
197
197
  },
198
198
  "value": Object {
199
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
199
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
200
200
  },
201
201
  },
202
202
  Object {
@@ -261,7 +261,7 @@ Array [
261
261
  "text": Symbol(contact-summary-row-address),
262
262
  },
263
263
  "value": Object {
264
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
264
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
265
265
  },
266
266
  },
267
267
  Object {
@@ -326,7 +326,7 @@ Array [
326
326
  "text": Symbol(contact-summary-row-address),
327
327
  },
328
328
  "value": Object {
329
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
329
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
330
330
  },
331
331
  },
332
332
  Object {
@@ -392,7 +392,7 @@ Array [
392
392
  "text": Symbol(contact-summary-row-address),
393
393
  },
394
394
  "value": Object {
395
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
395
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
396
396
  },
397
397
  },
398
398
  Object {
@@ -458,7 +458,7 @@ Array [
458
458
  "text": Symbol(contact-summary-row-address),
459
459
  },
460
460
  "value": Object {
461
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
461
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
462
462
  },
463
463
  },
464
464
  Object {
@@ -563,7 +563,7 @@ Array [
563
563
  "text": Symbol(contact-summary-row-address),
564
564
  },
565
565
  "value": Object {
566
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
566
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
567
567
  },
568
568
  },
569
569
  Object {
@@ -648,7 +648,7 @@ Array [
648
648
  "text": Symbol(contact-summary-row-address),
649
649
  },
650
650
  "value": Object {
651
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
651
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
652
652
  },
653
653
  },
654
654
  Object {
@@ -753,7 +753,7 @@ Array [
753
753
  "text": Symbol(contact-summary-row-address),
754
754
  },
755
755
  "value": Object {
756
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
756
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
757
757
  },
758
758
  },
759
759
  Object {
@@ -838,7 +838,7 @@ Array [
838
838
  "text": Symbol(contact-summary-row-address),
839
839
  },
840
840
  "value": Object {
841
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
841
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
842
842
  },
843
843
  },
844
844
  Object {
@@ -944,7 +944,7 @@ Array [
944
944
  "text": Symbol(contact-summary-row-address),
945
945
  },
946
946
  "value": Object {
947
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
947
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
948
948
  },
949
949
  },
950
950
  Object {
@@ -1030,7 +1030,7 @@ Array [
1030
1030
  "text": Symbol(contact-summary-row-address),
1031
1031
  },
1032
1032
  "value": Object {
1033
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1033
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1034
1034
  },
1035
1035
  },
1036
1036
  Object {
@@ -1136,7 +1136,7 @@ Array [
1136
1136
  "text": Symbol(contact-summary-row-address),
1137
1137
  },
1138
1138
  "value": Object {
1139
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1139
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1140
1140
  },
1141
1141
  },
1142
1142
  Object {
@@ -1222,7 +1222,7 @@ Array [
1222
1222
  "text": Symbol(contact-summary-row-address),
1223
1223
  },
1224
1224
  "value": Object {
1225
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1225
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1226
1226
  },
1227
1227
  },
1228
1228
  Object {
@@ -1327,7 +1327,7 @@ Array [
1327
1327
  "text": Symbol(contact-summary-row-address),
1328
1328
  },
1329
1329
  "value": Object {
1330
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1330
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1331
1331
  },
1332
1332
  },
1333
1333
  Object {
@@ -1432,7 +1432,7 @@ Array [
1432
1432
  "text": Symbol(contact-summary-row-address),
1433
1433
  },
1434
1434
  "value": Object {
1435
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1435
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1436
1436
  },
1437
1437
  },
1438
1438
  Object {
@@ -1537,7 +1537,7 @@ Array [
1537
1537
  "text": Symbol(contact-summary-row-address),
1538
1538
  },
1539
1539
  "value": Object {
1540
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1540
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1541
1541
  },
1542
1542
  },
1543
1543
  Object {
@@ -1642,7 +1642,7 @@ Array [
1642
1642
  "text": Symbol(contact-summary-row-address),
1643
1643
  },
1644
1644
  "value": Object {
1645
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1645
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1646
1646
  },
1647
1647
  },
1648
1648
  Object {
@@ -1748,7 +1748,7 @@ Array [
1748
1748
  "text": Symbol(contact-summary-row-address),
1749
1749
  },
1750
1750
  "value": Object {
1751
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1751
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1752
1752
  },
1753
1753
  },
1754
1754
  Object {
@@ -1854,7 +1854,7 @@ Array [
1854
1854
  "text": Symbol(contact-summary-row-address),
1855
1855
  },
1856
1856
  "value": Object {
1857
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1857
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1858
1858
  },
1859
1859
  },
1860
1860
  Object {
@@ -1960,7 +1960,7 @@ Array [
1960
1960
  "text": Symbol(contact-summary-row-address),
1961
1961
  },
1962
1962
  "value": Object {
1963
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
1963
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
1964
1964
  },
1965
1965
  },
1966
1966
  Object {
@@ -2046,7 +2046,7 @@ Array [
2046
2046
  "text": Symbol(contact-summary-row-address),
2047
2047
  },
2048
2048
  "value": Object {
2049
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2049
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2050
2050
  },
2051
2051
  },
2052
2052
  Object {
@@ -2152,7 +2152,7 @@ Array [
2152
2152
  "text": Symbol(contact-summary-row-address),
2153
2153
  },
2154
2154
  "value": Object {
2155
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2155
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2156
2156
  },
2157
2157
  },
2158
2158
  Object {
@@ -2238,7 +2238,7 @@ Array [
2238
2238
  "text": Symbol(contact-summary-row-address),
2239
2239
  },
2240
2240
  "value": Object {
2241
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2241
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2242
2242
  },
2243
2243
  },
2244
2244
  Object {
@@ -2345,7 +2345,7 @@ Array [
2345
2345
  "text": Symbol(contact-summary-row-address),
2346
2346
  },
2347
2347
  "value": Object {
2348
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2348
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2349
2349
  },
2350
2350
  },
2351
2351
  Object {
@@ -2432,7 +2432,7 @@ Array [
2432
2432
  "text": Symbol(contact-summary-row-address),
2433
2433
  },
2434
2434
  "value": Object {
2435
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2435
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2436
2436
  },
2437
2437
  },
2438
2438
  Object {
@@ -2539,7 +2539,7 @@ Array [
2539
2539
  "text": Symbol(contact-summary-row-address),
2540
2540
  },
2541
2541
  "value": Object {
2542
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2542
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2543
2543
  },
2544
2544
  },
2545
2545
  Object {
@@ -2626,7 +2626,7 @@ Array [
2626
2626
  "text": Symbol(contact-summary-row-address),
2627
2627
  },
2628
2628
  "value": Object {
2629
- "text": "14 Howecroft Court, Eastmead Lane, Bristol, BS9 1HJ, GB",
2629
+ "text": "14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB",
2630
2630
  },
2631
2631
  },
2632
2632
  Object {
@@ -124,6 +124,18 @@ const getRequestMock = ({
124
124
  })
125
125
 
126
126
  describe('contact-summary > route', () => {
127
+ it('omits undefined address fields from the output string', () => {
128
+ const permission = getMockPermission({
129
+ locality: undefined
130
+ })
131
+
132
+ const request = getRequestMock({ permission })
133
+ const rowGenerator = new route.RowGenerator(request, permission)
134
+ const row = rowGenerator.generateAddressRow('GB')
135
+
136
+ expect(row.value.text).toBe('14 howecroft court, eastmead lane, bristol, BS9 1HJ, GB')
137
+ })
138
+
127
139
  it('should set status.fromSummary to seen', async () => {
128
140
  const mockPermission = jest.fn()
129
141
  const mockRequest = getRequestMock({ setStatusPermission: mockPermission })
@@ -15,7 +15,9 @@
15
15
  isPageHeading: true
16
16
  }
17
17
  }) %}
18
- {{ govukSummaryList({ rows: data.summaryTable }) }}
18
+ <div class="address_list">
19
+ {{ govukSummaryList({ rows: data.summaryTable }) }}
20
+ </div>
19
21
  {% endcall %}
20
22
  {% endset -%}
21
23
 
@@ -112,7 +112,15 @@ export class RowGenerator {
112
112
 
113
113
  generateAddressRow (countryName) {
114
114
  const { licensee } = this.permission
115
- const text = [licensee.premises, licensee.street, licensee.locality, licensee.town, licensee.postcode, countryName?.toUpperCase()]
115
+
116
+ const text = [
117
+ licensee.premises?.toLowerCase(),
118
+ licensee.street?.toLowerCase(),
119
+ licensee.locality?.toLowerCase(),
120
+ licensee.town?.toLowerCase(),
121
+ licensee.postcode?.toUpperCase(),
122
+ countryName?.toUpperCase()
123
+ ]
116
124
  .filter(Boolean)
117
125
  .join(', ')
118
126
 
@@ -214,15 +214,17 @@ describe('The govuk-pay-service', () => {
214
214
  })
215
215
 
216
216
  it('should log debug message when response.ok is true', async () => {
217
+ const expectedLoggedOutput = { success: true, paymentId: 'abc123', bar: Symbol('bar'), baz: Symbol('baz') }
218
+ const resBody = { card_details: { foo: Symbol('foo') }, card_brand: Symbol('foobarbaz'), ...expectedLoggedOutput }
217
219
  const mockResponse = {
218
220
  ok: true,
219
- json: jest.fn().mockResolvedValue({ success: true, paymentId: 'abc123' })
221
+ json: jest.fn().mockResolvedValue(resBody)
220
222
  }
221
223
  govUkPayApi.createPayment.mockResolvedValue(mockResponse)
222
224
 
223
225
  await sendPayment(preparedPayment)
224
226
 
225
- expect(debug).toHaveBeenCalledWith('Successful payment creation response: %o', { success: true, paymentId: 'abc123' })
227
+ expect(debug).toHaveBeenCalledWith('Successful payment creation response: %o', expectedLoggedOutput)
226
228
  })
227
229
 
228
230
  it('should log error message when response.ok is false', async () => {
@@ -334,15 +336,17 @@ describe('The govuk-pay-service', () => {
334
336
  })
335
337
 
336
338
  it('should log debug message when response.ok is true', async () => {
339
+ const expectedLoggedOutput = { success: true, paymentId: 'abc123', bar: Symbol('bar'), baz: Symbol('baz') }
340
+ const resBody = { card_details: { foo: Symbol('foo') }, card_brand: Symbol('foobarbaz'), ...expectedLoggedOutput }
337
341
  const mockResponse = {
338
342
  ok: true,
339
- json: jest.fn().mockResolvedValue({ success: true, paymentId: 'abc123' })
343
+ json: jest.fn().mockResolvedValue(resBody)
340
344
  }
341
345
  govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
342
346
 
343
347
  await sendRecurringPayment(preparedPayment)
344
348
 
345
- expect(debug).toHaveBeenCalledWith('Successful agreement creation response: %o', { success: true, paymentId: 'abc123' })
349
+ expect(debug).toHaveBeenCalledWith('Successful agreement creation response: %o', expectedLoggedOutput)
346
350
  })
347
351
 
348
352
  it('should log error message when response.ok is false', async () => {
@@ -60,7 +60,7 @@ export const sendPayment = async (preparedPayment, recurring = false) => {
60
60
 
61
61
  if (response.ok) {
62
62
  const resBody = await response.json()
63
- debug('Successful payment creation response: %o', resBody)
63
+ debug('Successful payment creation response: %o', loggableBody(resBody))
64
64
  return resBody
65
65
  } else {
66
66
  const errMsg = await getTransactionErrorMessage(preparedPayment.id, preparedPayment, response)
@@ -93,9 +93,7 @@ export const getPaymentStatus = async (paymentId, recurring = false) => {
93
93
 
94
94
  if (response.ok) {
95
95
  const resBody = await response.json()
96
- // eslint-disable-next-line camelcase
97
- const { card_brand, card_details, ...loggableBody } = resBody
98
- debug('Payment status response: %o', loggableBody)
96
+ debug('Payment status response: %o', loggableBody(resBody))
99
97
  return resBody
100
98
  } else {
101
99
  const mes = {
@@ -123,12 +121,18 @@ const createRecurringPaymentAgreement = async preparedPayment => {
123
121
  }
124
122
  }
125
123
 
124
+ const loggableBody = resBody => {
125
+ // eslint-disable-next-line camelcase
126
+ const { card_brand, card_details, ...filteredBody } = resBody
127
+ return filteredBody
128
+ }
129
+
126
130
  export const sendRecurringPayment = async preparedPayment => {
127
131
  const response = await createRecurringPaymentAgreement(preparedPayment)
128
132
 
129
133
  if (response.ok) {
130
134
  const resBody = await response.json()
131
- debug('Successful agreement creation response: %o', resBody)
135
+ debug('Successful agreement creation response: %o', loggableBody(resBody))
132
136
  return resBody
133
137
  } else {
134
138
  const errMsg = await getTransactionErrorMessage(preparedPayment.reference, preparedPayment, response)