@defra-fish/gafl-webapp-service 1.62.0-rc.4 → 1.62.0-rc.6

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.62.0-rc.4",
3
+ "version": "1.62.0-rc.6",
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.62.0-rc.4",
40
- "@defra-fish/connectors-lib": "1.62.0-rc.4",
39
+ "@defra-fish/business-rules-lib": "1.62.0-rc.6",
40
+ "@defra-fish/connectors-lib": "1.62.0-rc.6",
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": "ffb61b6f55dc319cc1afbe57f8787deeb27f1dee"
82
+ "gitHead": "99bf15ee471b05eb6f99d1051ddf955c1cbed9bf"
83
83
  }
@@ -1,5 +1,5 @@
1
1
  {% extends "template.njk" %}
2
- {% set assetPath = "/public" %}
2
+ {% set assetPath = "/public/assets/rebrand" %}
3
3
 
4
4
  {% if not journeyBeginning %}
5
5
  <meta name="robots" content="noindex">
@@ -182,7 +182,7 @@
182
182
  <footer class="govuk-footer">
183
183
  <div class="govuk-width-container">
184
184
  <div class="govuk-footer__meta">
185
- <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
185
+ <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
186
186
  {% if (title === mssgs.address_lookup_title_you) or (title === mssgs.address_lookup_title_other) %}
187
187
  <p class="govuk-body-s">{{ mssgs.address_lookup_crown_copyright }}<a class="govuk-link" href="http://www.ordnancesurvey.co.uk" rel="noreferrer noopener" target="_blank">{{ mssgs.address_lookup_crown_copyright_new_tab }}</a> {{ mssgs.address_lookup_crown_copyright_ref }}
188
188
  <br>{{ mssgs.address_lookup_crown_copyright_terms }} <a class="govuk-link" href="{{ data.uri.osTerms }}">{{ mssgs.address_lookup_crown_copyright_terms_link }}</a></p>
@@ -426,23 +426,20 @@ describe('The govuk-pay-service', () => {
426
426
  [false, false],
427
427
  [false, undefined]
428
428
  ])('should call the govUkPayApi with recurring as %s if the argument is %s', async (expected, value) => {
429
- const mockResponse = { ok: true, status: 200, json: () => {} }
430
- govUkPayApi.fetchPaymentStatus.mockResolvedValue(mockResponse)
429
+ govUkPayApi.fetchPaymentStatus.mockResolvedValue(getMockFetchPaymentStatus())
431
430
  await getPaymentStatus(paymentId, value)
432
431
  expect(govUkPayApi.fetchPaymentStatus).toHaveBeenCalledWith(paymentId, expected)
433
432
  })
434
433
 
435
434
  it('should send provided paymentId to Gov.UK Pay', async () => {
436
- const mockResponse = { ok: true, status: 200, json: () => {} }
437
- govUkPayApi.fetchPaymentStatus.mockResolvedValue(mockResponse)
435
+ govUkPayApi.fetchPaymentStatus.mockResolvedValue(getMockFetchPaymentStatus())
438
436
  await getPaymentStatus(paymentId)
439
437
  expect(govUkPayApi.fetchPaymentStatus).toHaveBeenCalledWith(paymentId, false)
440
438
  })
441
439
 
442
440
  it('should return response body when payment status check is successful', async () => {
443
- const resBody = Symbol('body')
444
- const mockResponse = { ok: true, status: 200, json: jest.fn().mockResolvedValue(resBody) }
445
- govUkPayApi.fetchPaymentStatus.mockResolvedValue(mockResponse)
441
+ const resBody = { card_details: { foo: Symbol('foo') }, bar: Symbol('bar'), baz: Symbol('baz') }
442
+ govUkPayApi.fetchPaymentStatus.mockResolvedValue(getMockFetchPaymentStatus(resBody))
446
443
 
447
444
  const result = await getPaymentStatus(paymentId)
448
445
 
@@ -450,13 +447,13 @@ describe('The govuk-pay-service', () => {
450
447
  })
451
448
 
452
449
  it('should log debug message when response.ok is true', async () => {
453
- const resBody = Symbol('body')
454
- const mockResponse = { ok: true, status: 200, json: jest.fn().mockResolvedValue(resBody) }
455
- govUkPayApi.fetchPaymentStatus.mockResolvedValue(mockResponse)
450
+ const expectedLoggedOutput = { bar: Symbol('bar'), baz: Symbol('baz') }
451
+ const resBody = { card_details: { foo: Symbol('foo') }, ...expectedLoggedOutput }
452
+ govUkPayApi.fetchPaymentStatus.mockResolvedValue(getMockFetchPaymentStatus(resBody))
456
453
 
457
454
  await getPaymentStatus(paymentId)
458
455
 
459
- expect(debug).toHaveBeenCalledWith('Payment status response: %o', resBody)
456
+ expect(debug).toHaveBeenCalledWith('Payment status response: %o', expectedLoggedOutput)
460
457
  })
461
458
 
462
459
  it('should log error message when response.ok is false', async () => {
@@ -530,3 +527,9 @@ describe('The govuk-pay-service', () => {
530
527
  })
531
528
  })
532
529
  })
530
+
531
+ const getMockFetchPaymentStatus = (resBody = { card_details: 'foo' }) => ({
532
+ ok: true,
533
+ status: 200,
534
+ json: jest.fn().mockResolvedValue(resBody)
535
+ })
@@ -93,7 +93,9 @@ export const getPaymentStatus = async (paymentId, recurring = false) => {
93
93
 
94
94
  if (response.ok) {
95
95
  const resBody = await response.json()
96
- debug('Payment status response: %o', resBody)
96
+ // eslint-disable-next-line camelcase
97
+ const { card_details, ...loggableBody } = resBody
98
+ debug('Payment status response: %o', loggableBody)
97
99
  return resBody
98
100
  } else {
99
101
  const mes = {