@defra-fish/gafl-webapp-service 1.61.0-rc.15 → 1.61.0-rc.17

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.61.0-rc.15",
3
+ "version": "1.61.0-rc.17",
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.61.0-rc.15",
40
- "@defra-fish/connectors-lib": "1.61.0-rc.15",
39
+ "@defra-fish/business-rules-lib": "1.61.0-rc.17",
40
+ "@defra-fish/connectors-lib": "1.61.0-rc.17",
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": "906584338318c1402682d486a40bb72ff1abb37d"
82
+ "gitHead": "e35e018372742acfe0cb41e31abd14d3b0c7f742"
83
83
  }
@@ -471,7 +471,8 @@
471
471
  "licence_start_title_other": "Dyddiad dechrau’r drwydded?",
472
472
  "licence_start_title_you": "Pryd yr hoffech i'ch trwydded ddechrau?",
473
473
  "licence_start_today_or_within": "Gall y drwydded ddechrau heddiw neu unrhyw ddiwrnod o fewn y ",
474
- "licence_summary_blue_badge_num": "Rhif Bathodyn Glas",
474
+ "licence_summary_blue_badge": "Bathodyn Glas",
475
+ "licence_summary_blue_badge_eligible": "Cymwys",
475
476
  "licence_summary_change": "Newid",
476
477
  "licence_summary_disability_concession": "Consesiwn anabledd",
477
478
  "licence_summary_dob": "Dyddiad geni",
@@ -471,7 +471,8 @@
471
471
  "licence_start_title_other": "When should the licence start?",
472
472
  "licence_start_title_you": "When would you like your licence to start?",
473
473
  "licence_start_today_or_within": "The licence can start today or any day within the next ",
474
- "licence_summary_blue_badge_num": "Blue Badge number",
474
+ "licence_summary_blue_badge": "Blue Badge",
475
+ "licence_summary_blue_badge_eligible": "Eligible",
475
476
  "licence_summary_change": "Change",
476
477
  "licence_summary_disability_concession": "Disability concession",
477
478
  "licence_summary_dob": "Date of birth",
@@ -31,15 +31,6 @@ describe('The disability concession page', () => {
31
31
  expect(response.headers.location).toHaveValidPathFor(DISABILITY_CONCESSION.uri)
32
32
  })
33
33
 
34
- it('redirects back to itself on posting blue badge with an empty blue number', async () => {
35
- const response = await injectWithCookies('POST', DISABILITY_CONCESSION.uri, {
36
- 'disability-concession': disabilityConcessionTypes.blueBadge,
37
- 'blue-badge-number': ''
38
- })
39
- expect(response.statusCode).toBe(302)
40
- expect(response.headers.location).toHaveValidPathFor(DISABILITY_CONCESSION.uri)
41
- })
42
-
43
34
  it('on setting a correct ni number it redirects to the licence-to-start page', async () => {
44
35
  const response = await injectWithCookies('POST', DISABILITY_CONCESSION.uri, {
45
36
  'disability-concession': disabilityConcessionTypes.pipDla,
@@ -62,32 +53,28 @@ describe('The disability concession page', () => {
62
53
  })
63
54
  })
64
55
 
65
- it('on setting a correct blue badge number redirects to the licence-to-start page', async () => {
56
+ it('on selecting blue badge or meets criteria of bb, it causes a redirect to the licence-to-start page', async () => {
66
57
  const response = await injectWithCookies('POST', DISABILITY_CONCESSION.uri, {
67
- 'disability-concession': disabilityConcessionTypes.blueBadge,
68
- 'blue-badge-number': '1234'
58
+ 'disability-concession': disabilityConcessionTypes.blueBadge
69
59
  })
70
60
  expect(response.statusCode).toBe(302)
71
61
  expect(response.headers.location).toHaveValidPathFor(LICENCE_TO_START.uri)
72
62
  })
73
63
 
74
- it('on setting a correct blue badge number adds a disabled concession to the cache', async () => {
64
+ it('on selecting blue badge or meets criteria of bb, it adds a disabled concession to the cache', async () => {
75
65
  await injectWithCookies('POST', DISABILITY_CONCESSION.uri, {
76
- 'disability-concession': disabilityConcessionTypes.blueBadge,
77
- 'blue-badge-number': '1234'
66
+ 'disability-concession': disabilityConcessionTypes.blueBadge
78
67
  })
79
68
  const { payload } = await injectWithCookies('GET', TEST_TRANSACTION.uri)
80
69
  expect(concessionHelper.hasDisabled(JSON.parse(payload).permissions[0])).toBeTruthy()
81
70
  expect(JSON.parse(payload).permissions[0].concessions[0].proof).toEqual({
82
- type: CONCESSION_PROOF.blueBadge,
83
- referenceNumber: '1234'
71
+ type: CONCESSION_PROOF.blueBadge
84
72
  })
85
73
  })
86
74
 
87
75
  it('on setting a disability concession and changing to a 8 day licence and back, the concession is restored', async () => {
88
76
  await injectWithCookies('POST', DISABILITY_CONCESSION.uri, {
89
- 'disability-concession': disabilityConcessionTypes.blueBadge,
90
- 'blue-badge-number': '1234'
77
+ 'disability-concession': disabilityConcessionTypes.blueBadge
91
78
  })
92
79
  await injectWithCookies('POST', LICENCE_LENGTH.uri, { 'licence-length': '8D' })
93
80
  const { payload } = await injectWithCookies('GET', TEST_TRANSACTION.uri)
@@ -96,8 +83,7 @@ describe('The disability concession page', () => {
96
83
  const { payload: payload2 } = await injectWithCookies('GET', TEST_TRANSACTION.uri)
97
84
  expect(concessionHelper.hasDisabled(JSON.parse(payload2).permissions[0])).toBeTruthy()
98
85
  expect(JSON.parse(payload2).permissions[0].concessions[0].proof).toEqual({
99
- type: CONCESSION_PROOF.blueBadge,
100
- referenceNumber: '1234'
86
+ type: CONCESSION_PROOF.blueBadge
101
87
  })
102
88
  })
103
89
 
@@ -14,10 +14,6 @@
14
14
  'ni-number': {
15
15
  'string.empty': { ref: '#ni-number', text: mssgs.disability_concession_error_ni_empty },
16
16
  'string.pattern.base': { ref: '#ni-number', text: mssgs.disability_concession_error_ni_pattern }
17
- },
18
- 'blue-badge-number': {
19
- 'string.empty': { ref: '#blue-badge-number', text: mssgs.disability_concession_badge_error_msg },
20
- 'string.max': { ref: '#blue-badge-number', text: mssgs.disability_concession_badge_error_msg }
21
17
  }
22
18
  }
23
19
  %}
@@ -39,20 +35,6 @@
39
35
  }) }}
40
36
  {% endset -%}
41
37
 
42
- {% set blueBadge %}
43
- {{ govukInput({
44
- label: {
45
- html: mssgs.disability_concession_badge_error_msg
46
- },
47
- id: "blue-badge-number",
48
- name: "blue-badge-number",
49
- value: payload['blue-badge-number'],
50
- classes: "govuk-input--width-20",
51
- attributes: { maxlength: 25 },
52
- errorMessage: { text: mssgs.disability_concession_badge_error_msg } if error['blue-badge-number']
53
- }) }}
54
- {% endset -%}
55
-
56
38
  {% block pageContent %}
57
39
  {% if not data.hasJunior and not data.hasSenior %}
58
40
  <p class="govuk-hint">{{ mssgs.disability_concession_12_month }}<a href="https://www.gov.uk/government/publications/blue-badge-can-i-get-one/can-i-get-a-blue-badge" class="govuk-link" target="_blank">{{ mssgs.disability_concession_12_month_link }}</a></p>
@@ -71,13 +53,12 @@
71
53
  {
72
54
  text: mssgs['disability_concession_radio_badge_' ~ suffix],
73
55
  value: data.blueBadge,
74
- checked: payload['disability-concession'] === data.blueBadge,
75
- conditional: { html: blueBadge }
56
+ checked: payload['disability-concession'] === data.blueBadge
76
57
  },
77
58
  {
78
- text: mssgs['disability_concession_radio_no_' ~ suffix],
79
- value: data.no,
80
- checked: payload['disability-concession'] === data.no
59
+ text: mssgs['disability_concession_radio_no_' ~ suffix],
60
+ value: data.no,
61
+ checked: payload['disability-concession'] === data.no
81
62
  }
82
63
  ],
83
64
  errorMessage: { text: mssgs.disability_concession_error_choose_option } if error['disability-concession']
@@ -14,11 +14,6 @@ const validator = Joi.object({
14
14
  is: disabilityConcessionTypes.pipDla,
15
15
  then: validation.contact.createNationalInsuranceNumberValidator(Joi).required(),
16
16
  otherwise: Joi.string().empty('')
17
- }),
18
- 'blue-badge-number': Joi.alternatives().conditional('disability-concession', {
19
- is: disabilityConcessionTypes.blueBadge,
20
- then: Joi.string().max(25).required(),
21
- otherwise: Joi.string().empty('')
22
17
  })
23
18
  }).options({ abortEarly: false, allowUnknown: true })
24
19
 
@@ -19,7 +19,7 @@ export default async request => {
19
19
  concessionHelper.addDisabled(permission, CONCESSION_PROOF.NI, payload['ni-number'])
20
20
  Object.assign(permission, { licenceLength: '12M', licenceStartTime: '0' })
21
21
  } else if (payload['disability-concession'] === disabilityConcessionTypes.blueBadge) {
22
- concessionHelper.addDisabled(permission, CONCESSION_PROOF.blueBadge, payload['blue-badge-number'])
22
+ concessionHelper.addDisabled(permission, CONCESSION_PROOF.blueBadge)
23
23
  Object.assign(permission, { licenceLength: '12M', licenceStartTime: '0' })
24
24
  } else {
25
25
  concessionHelper.removeDisabled(permission)
@@ -599,7 +599,7 @@ Array [
599
599
  "text": "licence_summary_disability_concession",
600
600
  },
601
601
  "value": Object {
602
- "html": "<span>licence_summary_none</span>",
602
+ "html": "licence_summary_none",
603
603
  },
604
604
  },
605
605
  Object {
@@ -930,15 +930,15 @@ Array [
930
930
  },
931
931
  "href": "/buy/disability-concession",
932
932
  "text": "contact_summary_change",
933
- "visuallyHiddenText": "licence_summary_blue_badge_num",
933
+ "visuallyHiddenText": "licence_summary_blue_badge",
934
934
  },
935
935
  ],
936
936
  },
937
937
  "key": Object {
938
- "text": "licence_summary_blue_badge_num",
938
+ "text": "licence_summary_blue_badge",
939
939
  },
940
940
  "value": Object {
941
- "html": "AB1 CDE 0 1234F5678",
941
+ "html": "licence_summary_blue_badge_eligible",
942
942
  },
943
943
  },
944
944
  Object {
@@ -1172,7 +1172,7 @@ Array [
1172
1172
  "text": "licence_summary_disability_concession",
1173
1173
  },
1174
1174
  "value": Object {
1175
- "html": "<span>licence_summary_none</span>",
1175
+ "html": "licence_summary_none",
1176
1176
  },
1177
1177
  },
1178
1178
  Object {
@@ -84,7 +84,8 @@ const getMockRequest = ({
84
84
  licence_type_12m: 'licence_type_12m',
85
85
  licence_type_8d: 'licence_type_8d',
86
86
  licence_type_1d: 'licence_type_1d',
87
- licence_summary_blue_badge_num: 'licence_summary_blue_badge_num',
87
+ licence_summary_blue_badge: 'licence_summary_blue_badge',
88
+ licence_summary_blue_badge_eligible: 'licence_summary_blue_badge_eligible',
88
89
  licence_summary_ni_num: 'licence_summary_ni_num',
89
90
  licence_summary_disability_concession: 'licence_summary_disability_concession',
90
91
  free: 'gratis',
@@ -163,8 +164,7 @@ const getMockBlueBadgePermission = () => ({
163
164
  {
164
165
  type: mappingConstants.CONCESSION.DISABLED,
165
166
  proof: {
166
- type: mappingConstants.CONCESSION_PROOF.blueBadge,
167
- referenceNumber: 'AB1 CDE 0 1234F5678'
167
+ type: mappingConstants.CONCESSION_PROOF.blueBadge
168
168
  }
169
169
  }
170
170
  ]
@@ -70,7 +70,7 @@ class RowGenerator {
70
70
 
71
71
  _getConcessionText () {
72
72
  if (this.disabled?.proof?.type === CONCESSION_PROOF.blueBadge) {
73
- return this.labels.licence_summary_blue_badge_num
73
+ return this.labels.licence_summary_blue_badge
74
74
  } else if (this.disabled?.proof?.type === CONCESSION_PROOF.NI) {
75
75
  return this.labels.licence_summary_ni_num
76
76
  }
@@ -93,7 +93,16 @@ class RowGenerator {
93
93
  }
94
94
 
95
95
  generateConcessionRow () {
96
- const label = this.disabled ? this.disabled.proof.referenceNumber : `<span>${this.labels.licence_summary_none}</span>`
96
+ const label = (() => {
97
+ if (this.disabled?.proof?.type === CONCESSION_PROOF.blueBadge) {
98
+ return this.labels.licence_summary_blue_badge_eligible
99
+ }
100
+ if (this.disabled?.proof?.type === CONCESSION_PROOF.NI) {
101
+ return this.disabled.proof.referenceNumber
102
+ }
103
+ return this.labels.licence_summary_none
104
+ })()
105
+
97
106
  const concessionText = this._getConcessionText()
98
107
  return this._generateRow(concessionText, label, DISABILITY_CONCESSION.uri, concessionText, 'change-benefit-check')
99
108
  }