@defra-fish/gafl-webapp-service 1.58.0-rc.1 → 1.58.0-rc.11

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.1",
3
+ "version": "1.58.0-rc.11",
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.1",
40
- "@defra-fish/connectors-lib": "1.58.0-rc.1",
39
+ "@defra-fish/business-rules-lib": "1.58.0-rc.11",
40
+ "@defra-fish/connectors-lib": "1.58.0-rc.11",
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": "e00aea1ef5780d2c91cc88c39483fd73bfdbc1fb"
83
+ "gitHead": "07d834ede6126348ee4073360e20fbddac50041c"
84
84
  }
@@ -72,7 +72,7 @@
72
72
  "access_statement_visit": "Os ydych yn ymweld â'n swyddfeydd ac mae angen cymorth arnoch neu ddehonglydd Iaith Arwyddion Prydain, dylech gysylltu â ni cyn eich ymweliad. Mae dolenni sain yn rhai o'n swyddfeydd.",
73
73
  "account_disabled_body_1": "You were successfully signed in but your account is not enabled in Microsoft Dynamics.",
74
74
  "account_disabled_title": "Account not enabled",
75
- "address_entry_content_and_postcode": "and postcode",
75
+ "address_entry_content_and_postcode": "a chod post",
76
76
  "address_entry_content_name_num_hint": "Er enghraifft, 47, Fflat 2a neu Rose Cottage",
77
77
  "address_entry_content_name_num": "Rhif neu enw'r adeilad",
78
78
  "address_entry_content_postcode": "Cod post",
@@ -80,9 +80,9 @@
80
80
  "address_entry_content_street_2": "Cyfeiriad Llinell 2 (dewisol)",
81
81
  "address_entry_content_town": "Tref neu ddinas",
82
82
  "address_entry_content_country": "Gwlad",
83
- "address_entry_content_unable_to_find": "We could not find an address for premises",
84
- "address_entry_enter_full_add": "Enter the full address below",
85
- "address_entry_error_empty_country": "Select a country",
83
+ "address_entry_content_unable_to_find": "Nid oeddem yn gallu dod o hyd i gyfeiriad ar gyfer eiddo",
84
+ "address_entry_enter_full_add": "Rhowch y cyfeiriad llawn isod",
85
+ "address_entry_error_empty_country": "Dewiswch wlad",
86
86
  "address_entry_error_empty_num": "Nodwch rif neu enw adeilad",
87
87
  "address_entry_error_empty_postcode": "Nodwch god post",
88
88
  "address_entry_error_empty_town": "Nodwch dref neu ddinas",
@@ -270,7 +270,7 @@
270
270
  "disability_concession_radio_pip": "Taliad Annibyniaeth Personol (PIP)",
271
271
  "disability_concession_title_other": "A ydyw’n derbyn unrhyw un o’r canlynol?",
272
272
  "disability_concession_title_you": "Ydych chi’n derbyn unrhyw un o’r canlynol?",
273
- "dob_day": "Diwrnod",
273
+ "date_day": "Diwrnod",
274
274
  "dob_entry_hint": "Er enghraifft, 23 11 1979",
275
275
  "dob_error_date_real": "Mae’n rhaid i’r dyddiad geni fod yn ddyddiad dilys",
276
276
  "dob_error_missing_day_and_month": "Mae’n rhaid i’r dyddiad geni gynnwys diwrnod a mis",
@@ -283,12 +283,12 @@
283
283
  "dob_error_year_min": "Mae’r dyddiad geni yn rhy bell yn ôl",
284
284
  "dob_error_year_max": "Mae'n rhaid i’r dyddiad geni fod yn y gorffennol",
285
285
  "dob_error": "Rhowch dyddiad geni",
286
- "dob_month": "Mis",
286
+ "date_month": "Mis",
287
287
  "dob_privacy_link_prefix": "Os nad ydych yn darparu dyddiad geni cywir, gallai hynny achosi oedi wrth adnewyddu trwydded, neu olygu nad yw’r drwydded yn ddilys. Darllenwch am ",
288
288
  "dob_privacy_link": "sut yr ydym ni'n defnyddio data personol (yn agor ar dudalen newydd)",
289
289
  "dob_title_other": "Beth yw ei ddyddiad geni?",
290
290
  "dob_title_you": "Beth yw eich dyddiad geni?",
291
- "dob_year": "Blwyddyn",
291
+ "date_year": "Blwyddyn",
292
292
  "dp_email": "dataprotection@environment-agency.gov.uk",
293
293
  "email_address": "cyfeiriad e-bost",
294
294
  "email_alt": "E-bost",
@@ -383,7 +383,7 @@
383
383
  "licence_confirm_method_where_body_text": "Dyma ble byddwn yn anfon y drwydded ar ôl derbyn y taliad.",
384
384
  "licence_confirm_method_where_title_other": "I ble y dylen ni anfon y drwydded bysgota?",
385
385
  "licence_confirm_method_where_title_you": "I ble y dylen ni anfon eich trwydded bysgota?",
386
- "licence_date_picker": "Click to open date picker",
386
+ "licence_date_picker": "Cliciwch i agor y calendr",
387
387
  "licence_details_no_print_1": "Mae’n rhaid i ddeiliad y drwydded ddilyn yr ",
388
388
  "licence_details_no_print_2": " Chwiliwch am is-ddeddfau pysgota â gwialen drwy deipio 'rod fishing byelaws' ar GOV.UK os ydych chi wedi argraffu'r dudalen hon.",
389
389
  "licence_details_no_print_link": "is-ddeddfau pysgota â gwialen (yn agor mewn tab newydd).",
@@ -530,7 +530,7 @@
530
530
  "new_prices_row_12_month": "12 mis",
531
531
  "new_prices_row_concession": "12 mis - pobl hŷn neu anabl",
532
532
  "new_prices_row_junior": "12 mis - ieuenctid (13 i 16)",
533
- "newsletter_error_choose": "Choose if you would like to receive our email newsletter",
533
+ "newsletter_error_choose": "Dewiswch os hoffech dderbyn ein cylchlythyr dros e-bost",
534
534
  "newsletter_error_set_email": "Nodwch gyfeiriad e-bost yn y fformat cywir, fel enw@enghraifft.com",
535
535
  "newsletter_subscribe": "Mynnwch yr wybodaeth ddiweddaraf am genweirio, pysgodfeydd a sut rydym yn gwario eich arian trwydded. Gallwch ddatdanysgrifio ar unrhyw adeg.",
536
536
  "newsletter_title": "A hoffech chi dderbyn ein cylchlythyr dros e-bost?",
@@ -546,7 +546,7 @@
546
546
  "order_complete_before_leave_page_bulletpoint_1": " - mae’n cymryd 30 eiliad",
547
547
  "order_complete_before_leave_page_bulletpoint_1_link": "ein cynorthwyo i wella’r gwasanaeth hwn (yn agor mewn tab newydd)",
548
548
  "order_complete_before_leave_page_bulletpoint_2": " i weld sut yr ydym yn gwario incwm o drwyddedau pysgota",
549
- "order_complete_before_leave_page_bulletpoint_2_link": "darllen yr adroddiad blynyddol pysgodfeydd (yn agor mewn tab newydd)",
549
+ "order_complete_before_leave_page_bulletpoint_2_link": "darllen yr adroddiad blynyddol pysgodfeydd ar gyfer Lloegr (yn agor mewn tab newydd)",
550
550
  "order_complete_before_leave_page_paragraph": "Efallai yr hoffech:",
551
551
  "order_complete_before_leave_page_title": "Cyn i chi adael y dudalen hon",
552
552
  "order_complete_future_payments_digital_paragraph_1": "Byddwch yn derbyn e-bost neu neges destun yn fuan yn cadarnhau eich cytundeb taliad cerdyn sy'n ailadrodd. Os ydych chi wedi newid eich meddwl, gallwch ",
@@ -595,12 +595,12 @@
595
595
  "our_address_5": "BS1 5AH",
596
596
  "over_66": " (66 mlwydd oed a throsodd)",
597
597
  "payment_cancelled_title": "Mae eich taliad wedi cael ei ganslo",
598
- "payment_failed_expired": "The payment was not completed within 90 minutes of being created",
598
+ "payment_failed_expired": "Ni chafodd y taliad ei gwblhau o fewn 90 munud o greu’r cais",
599
599
  "payment_failed_not_taken": "Nid oes unrhyw arian wedi cael ei dynnu o’ch cyfrif.",
600
- "payment_failed_rejected": "The payment was rejected by the payment provider. Please ensure that you entered your card details correctly and that you have sufficient funds in your account.",
601
- "payment_failed_title_1": "Your payment has expired",
602
- "payment_failed_title_2": "Your payment was rejected",
603
- "payment_failed_title_3": "Your payment has failed",
600
+ "payment_failed_rejected": "Mae’r taliad wedi cael ei wrthod gan ddarparwr y taliad. Sicrhewch eich bod wedi mewnbynnu manylion eich cerdyn yn gywir a bod digon o arian ar gael yn eich cyfrif",
601
+ "payment_failed_title_1": "Mae eich cais i dalu wedi dod i ben",
602
+ "payment_failed_title_2": "Mae eich taliad wedi cael ei wrthod",
603
+ "payment_failed_title_3": "Mae eich taliad wedi methu",
604
604
  "phone_number": "rhif ffôn",
605
605
  "pound": "£",
606
606
  "notification_heading": "Mae llythyr wedi’i argraffu wedi cymryd lle trwyddedau cerdyn wedi’u gorchuddio â phlastig ers 31 Mai 2024",
@@ -270,9 +270,8 @@
270
270
  "disability_concession_radio_pip": "Personal Independence Payment (PIP)",
271
271
  "disability_concession_title_other": "Do they receive any of the following?",
272
272
  "disability_concession_title_you": "Do you receive any of the following?",
273
- "dob_day": "day",
273
+ "date_day": "Day",
274
274
  "dob_entry_hint": "For example, 23 11 1979",
275
-
276
275
  "dob_error_date_real": "Date of birth must be a real date",
277
276
  "dob_error_missing_day_and_month": "Date of birth must include a day and month",
278
277
  "dob_error_missing_day_and_year": "Date of birth must include a day and year",
@@ -284,13 +283,12 @@
284
283
  "dob_error_year_min": "Date of birth is too long ago",
285
284
  "dob_error_year_max": "The date of birth must be in the past",
286
285
  "dob_error": "Enter a date of birth",
287
-
288
- "dob_month": "month",
286
+ "date_month": "Month",
289
287
  "dob_privacy_link_prefix": "If you do not provide a correct date of birth, this may cause delays when a licence is renewed or mean that a licence is not valid. Read about ",
290
288
  "dob_privacy_link": "how we use personal information (opens in new tab)",
291
289
  "dob_title_other": "What is the person’s date of birth?",
292
290
  "dob_title_you": "What is your date of birth?",
293
- "dob_year": "year",
291
+ "date_year": "Year",
294
292
  "dp_email": "dataprotection@environment-agency.gov.uk",
295
293
  "email_address": "email address",
296
294
  "email_alt": "Email",
@@ -551,7 +549,7 @@
551
549
  "order_complete_before_leave_page_bulletpoint_1": " - takes 30 seconds",
552
550
  "order_complete_before_leave_page_bulletpoint_1_link": "help us improve this service (opens in new tab)",
553
551
  "order_complete_before_leave_page_bulletpoint_2": " to see how we spend income from fishing licences",
554
- "order_complete_before_leave_page_bulletpoint_2_link": "read the latest fisheries annual report (opens in new tab)",
552
+ "order_complete_before_leave_page_bulletpoint_2_link": "read the latest fisheries annual report for England (opens in new tab)",
555
553
  "order_complete_before_leave_page_paragraph": "You may like to:",
556
554
  "order_complete_before_leave_page_title": "Before you leave this page",
557
555
  "order_complete_future_payments_digital_paragraph_1": "You will shortly get an email or text message confirming your recurring card payment agreement. If you have changed your mind, you can ",
@@ -602,7 +600,7 @@
602
600
  "payment_cancelled_title": "Your payment has been cancelled",
603
601
  "payment_failed_expired": "The payment was not completed within 90 minutes of being created",
604
602
  "payment_failed_not_taken": "No money has been taken from your account.",
605
- "payment_failed_rejected": "The payment was rejected by the payment provider. Please ensure that you entered your card details correctly and that you have sufficient funds in your account.",
603
+ "payment_failed_rejected": "The payment was rejected by the payment provider. Please ensure that you entered your card details correctly and that you have sufficient funds in your account",
606
604
  "payment_failed_title_1": "Your payment has expired",
607
605
  "payment_failed_title_2": "Your payment was rejected",
608
606
  "payment_failed_title_3": "Your payment has failed",
@@ -45,21 +45,21 @@
45
45
 
46
46
  {% set dateInputItems = [
47
47
  {
48
- label: mssgs.dob_day,
48
+ label: mssgs.date_day,
49
49
  name: 'day',
50
50
  classes: "govuk-input--width-2 govuk-input--error" if data.isDayError else "govuk-input--width-2",
51
51
  value: payload['date-of-birth-day'],
52
52
  attributes: { maxlength : 2 }
53
53
  },
54
54
  {
55
- label: mssgs.dob_month,
55
+ label: mssgs.date_month,
56
56
  name: 'month',
57
57
  classes: "govuk-input--width-2 govuk-input--error" if data.isMonthError else "govuk-input--width-2",
58
58
  value: payload['date-of-birth-month'],
59
59
  attributes: { maxlength : 2 }
60
60
  },
61
61
  {
62
- label: mssgs.dob_year,
62
+ label: mssgs.date_year,
63
63
  name: 'year',
64
64
  classes: "govuk-input--width-4 govuk-input--error" if data.isYearError else "govuk-input--width-4",
65
65
  value: payload['date-of-birth-year'],
@@ -81,7 +81,9 @@
81
81
  </div>
82
82
  <div id="text-ro" class="govuk-body-m initially-hidden">
83
83
  {{ mssgs.important_info_contact_input_mobile_note }}</br>
84
- <span class="govuk-body-m govuk-!-font-weight-bold">{{ data.licensee.mobilePhone }}
84
+ <meta name="format-detection" content="telephone=no">
85
+ <span class="govuk-body-m govuk-!-font-weight-bold">{{ data.licensee.mobilePhone }}
86
+ </meta>
85
87
  </span>
86
88
  </div>
87
89
  {% endset -%}
@@ -21,9 +21,19 @@
21
21
  {{ title }}
22
22
  </h1>
23
23
 
24
- <p class="govuk-body contact-scroll" id="contact-information" aria-labelledby="contact-information">
25
- {{ contactInfo }}
26
- </p>
24
+
25
+ {% if data.licensee.preferredMethodOfConfirmation == 'Email' %}
26
+ <p class="govuk-body contact-scroll" id="contact-information" aria-labelledby="contact-information">
27
+ {{ contactInfo }}
28
+ </p>
29
+ {% else %}
30
+ <meta name="format-detection" content="telephone=no">
31
+ <p class="govuk-body contact-scroll" id="contact-information" aria-labelledby="contact-information">
32
+ {{ contactInfo }}
33
+ </p>
34
+ </meta>
35
+ {% endif %}
36
+
27
37
 
28
38
  <p class="govuk-body govuk-!-margin-bottom-6">
29
39
  <a class="govuk-link" href="{{ data.uri.change }}">
@@ -48,21 +48,21 @@
48
48
  {% set dateInputItems = [
49
49
  {
50
50
  name: "day",
51
- label: mssgs.dob_day,
51
+ label: mssgs.date_day,
52
52
  classes: "govuk-input--width-2 govuk-input--error" if data.isDayError else "govuk-input--width-2",
53
53
  value: payload['licence-start-date-day'],
54
54
  attributes: { maxlength : 2 }
55
55
  },
56
56
  {
57
57
  name: "month",
58
- label: mssgs.dob_month,
58
+ label: mssgs.date_month,
59
59
  classes: "govuk-input--width-2 govuk-input--error" if data.isMonthError else "govuk-input--width-2",
60
60
  value: payload['licence-start-date-month'],
61
61
  attributes: { maxlength : 2 }
62
62
  },
63
63
  {
64
64
  name: "year",
65
- label: mssgs.dob_year,
65
+ label: mssgs.date_year,
66
66
  classes: "govuk-input--width-4 govuk-input--error" if data.isYearError else "govuk-input--width-4",
67
67
  value: payload['licence-start-date-year'],
68
68
  attributes: { maxlength : 4 }
@@ -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
- agreement | valid | expected
216
- ${true} | ${true} | ${true}
217
- ${true} | ${false} | ${false}
218
- ${false} | ${false} | ${false}
219
- ${false} | ${true} | ${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 status for setup of recurring payment agreement is $agreement and valid for recurring payment is $valid',
222
- async ({ agreement, valid, expected }) => {
223
- validForRecurringPayment.mockReturnValueOnce(valid)
224
- const completionStatus = getSampleCompletionStatus({ setUpPayment: agreement })
225
- const { recurringPayment } = await getData(getSampleRequest({ completionStatus }))
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
 
@@ -50,7 +50,7 @@
50
50
  <p class="govuk-body">{{ mssgs.order_complete_before_leave_page_paragraph }}</p>
51
51
  <ul class="govuk-list govuk-list--bullet">
52
52
  <li><a class="govuk-link" rel="noreferrer noopener" target="_blank" href="{{ data.uri.feedback }}">{{ mssgs.order_complete_before_leave_page_bulletpoint_1_link }}</a>{{ mssgs.order_complete_before_leave_page_bulletpoint_1 }}</li>
53
- <li><a class="govuk-link" rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/government/publications/fisheries-annual-report-2021-to-2022/fisheries-annual-report-2021-to-2022">{{ mssgs.order_complete_before_leave_page_bulletpoint_2_link }}</a>{{ mssgs.order_complete_before_leave_page_bulletpoint_2 }}</li>
53
+ <li><a class="govuk-link" rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/government/collections/fisheries-annual-reports">{{ mssgs.order_complete_before_leave_page_bulletpoint_2_link }}</a>{{ mssgs.order_complete_before_leave_page_bulletpoint_2 }}</li>
54
54
  </ul>
55
55
  </div>
56
56
  </div>
@@ -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(status, permission),
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 = (status, permission) => validForRecurringPayment(permission) && status.permissions[0]['set-up-payment']
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 ||
@@ -61,21 +61,21 @@
61
61
 
62
62
  {% set dateInputItems = [
63
63
  {
64
- label: mssgs.dob_day,
64
+ label: mssgs.date_day,
65
65
  name: "day",
66
66
  classes: "govuk-input--width-2 govuk-input--error" if data.isDayError else "govuk-input--width-2",
67
67
  value: payload['date-of-birth-day'],
68
68
  attributes: { maxlength : 2 }
69
69
  },
70
70
  {
71
- label: mssgs.dob_month,
71
+ label: mssgs.date_month,
72
72
  name: "month",
73
73
  classes: "govuk-input--width-2 govuk-input--error" if data.isMonthError else "govuk-input--width-2",
74
74
  value: payload['date-of-birth-month'],
75
75
  attributes: { maxlength : 2 }
76
76
  },
77
77
  {
78
- label: mssgs.dob_year,
78
+ label: mssgs.date_year,
79
79
  name: "year",
80
80
  classes: "govuk-input--width-4 govuk-input--error" if data.isYearError else "govuk-input--width-4",
81
81
  value: payload['date-of-birth-year'],
@@ -16,19 +16,19 @@
16
16
 
17
17
  {% set dateInputItems = [
18
18
  {
19
- label: mssgs.dob_day,
19
+ label: mssgs.date_day,
20
20
  name: 'day',
21
21
  classes: "govuk-input--width-2",
22
22
  value: payload['licence-start-date-day']
23
23
  },
24
24
  {
25
- label: mssgs.dob_month,
25
+ label: mssgs.date_month,
26
26
  name: 'month',
27
27
  classes: "govuk-input--width-2",
28
28
  value: payload['licence-start-date-month']
29
29
  },
30
30
  {
31
- label: mssgs.dob_year,
31
+ label: mssgs.date_year,
32
32
  name: 'year',
33
33
  classes: "govuk-input--width-4",
34
34
  value: payload['licence-start-date-year']
@@ -1,5 +1,52 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`contact-summary > route generateContactRow should generate a contact row with meta tag when includeMeta is true 1`] = `
4
+ Object {
5
+ "actions": Object {
6
+ "items": Array [
7
+ Object {
8
+ "attributes": Object {
9
+ "id": "change-licence-confirmation-option",
10
+ },
11
+ "href": Symbol(decoratedUri),
12
+ "text": "contact-summary-change",
13
+ "visuallyHiddenText": Symbol(contact-summary-hidden-licence-confirmation),
14
+ },
15
+ ],
16
+ },
17
+ "key": Object {
18
+ "text": Symbol(contact-summary-row-contact),
19
+ },
20
+ "value": Object {
21
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
22
+ "text": "Text message-contact-summary-text-sngl07123432817",
23
+ },
24
+ }
25
+ `;
26
+
27
+ exports[`contact-summary > route generateContactRow should generate a contact row without meta tag when includeMeta is false 1`] = `
28
+ Object {
29
+ "actions": Object {
30
+ "items": Array [
31
+ Object {
32
+ "attributes": Object {
33
+ "id": "change-licence-confirmation-option",
34
+ },
35
+ "href": Symbol(decoratedUri),
36
+ "text": "contact-summary-change",
37
+ "visuallyHiddenText": Symbol(contact-summary-hidden-licence-confirmation),
38
+ },
39
+ ],
40
+ },
41
+ "key": Object {
42
+ "text": Symbol(contact-summary-row-contact),
43
+ },
44
+ "value": Object {
45
+ "text": "contact-summary-emailtest@example.com",
46
+ },
47
+ }
48
+ `;
49
+
3
50
  exports[`contact-summary > route getLicenseeDetailsSummaryRows when purchasing a 1 or 8 day should display the Licence as Email Me and Newsletter as Please not contact moi 1`] = `
4
51
  Array [
5
52
  Object {
@@ -299,6 +346,7 @@ Array [
299
346
  "text": Symbol(contact-summary-row-licence-details),
300
347
  },
301
348
  "value": Object {
349
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
302
350
  "text": "contact-summary-license-non-physical",
303
351
  },
304
352
  },
@@ -364,6 +412,7 @@ Array [
364
412
  "text": Symbol(contact-summary-row-licence-details),
365
413
  },
366
414
  "value": Object {
415
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
367
416
  "text": "contact-summary-license-non-physical",
368
417
  },
369
418
  },
@@ -849,7 +898,8 @@ Array [
849
898
  "text": Symbol(contact-summary-row-contact),
850
899
  },
851
900
  "value": Object {
852
- "text": "contact-summary-text-plrl01234567890",
901
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
902
+ "text": "Text messages-contact-summary-text-plrl01234567890",
853
903
  },
854
904
  },
855
905
  Object {
@@ -934,7 +984,8 @@ Array [
934
984
  "text": Symbol(contact-summary-row-contact),
935
985
  },
936
986
  "value": Object {
937
- "text": "contact-summary-text-plrl01234567890",
987
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
988
+ "text": "Text messages-contact-summary-text-plrl01234567890",
938
989
  },
939
990
  },
940
991
  Object {
@@ -1039,7 +1090,8 @@ Array [
1039
1090
  "text": Symbol(contact-summary-row-contact),
1040
1091
  },
1041
1092
  "value": Object {
1042
- "text": "contact-summary-text-plrl01234567890",
1093
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
1094
+ "text": "Text messages-contact-summary-text-plrl01234567890",
1043
1095
  },
1044
1096
  },
1045
1097
  Object {
@@ -1124,7 +1176,8 @@ Array [
1124
1176
  "text": Symbol(contact-summary-row-contact),
1125
1177
  },
1126
1178
  "value": Object {
1127
- "text": "contact-summary-text-plrl01234567890",
1179
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
1180
+ "text": "Text messages-contact-summary-text-plrl01234567890",
1128
1181
  },
1129
1182
  },
1130
1183
  Object {
@@ -1649,7 +1702,8 @@ Array [
1649
1702
  "text": Symbol(contact-summary-row-contact),
1650
1703
  },
1651
1704
  "value": Object {
1652
- "text": "contact-summary-text-plrl01234567890",
1705
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
1706
+ "text": "Text messages-contact-summary-text-plrl01234567890",
1653
1707
  },
1654
1708
  },
1655
1709
  Object {
@@ -1754,7 +1808,8 @@ Array [
1754
1808
  "text": Symbol(contact-summary-row-contact),
1755
1809
  },
1756
1810
  "value": Object {
1757
- "text": "contact-summary-text-plrl01234567890",
1811
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
1812
+ "text": "Text messages-contact-summary-text-plrl01234567890",
1758
1813
  },
1759
1814
  },
1760
1815
  Object {
@@ -1839,7 +1894,8 @@ Array [
1839
1894
  "text": Symbol(contact-summary-row-licence-conf),
1840
1895
  },
1841
1896
  "value": Object {
1842
- "text": "contact-summary-text-sngl01234567890",
1897
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
1898
+ "text": "Text message-contact-summary-text-sngl01234567890",
1843
1899
  },
1844
1900
  },
1845
1901
  Object {
@@ -1924,7 +1980,8 @@ Array [
1924
1980
  "text": Symbol(contact-summary-row-licence),
1925
1981
  },
1926
1982
  "value": Object {
1927
- "text": "contact-summary-text-sngl01234567890",
1983
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
1984
+ "text": "Text message-contact-summary-text-sngl01234567890",
1928
1985
  },
1929
1986
  },
1930
1987
  Object {
@@ -2029,7 +2086,8 @@ Array [
2029
2086
  "text": Symbol(contact-summary-row-licence-conf),
2030
2087
  },
2031
2088
  "value": Object {
2032
- "text": "contact-summary-text-sngl01234567890",
2089
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2090
+ "text": "Text message-contact-summary-text-sngl01234567890",
2033
2091
  },
2034
2092
  },
2035
2093
  Object {
@@ -2114,7 +2172,8 @@ Array [
2114
2172
  "text": Symbol(contact-summary-row-licence),
2115
2173
  },
2116
2174
  "value": Object {
2117
- "text": "contact-summary-text-sngl01234567890",
2175
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2176
+ "text": "Text message-contact-summary-text-sngl01234567890",
2118
2177
  },
2119
2178
  },
2120
2179
  Object {
@@ -2219,7 +2278,8 @@ Array [
2219
2278
  "text": Symbol(contact-summary-row-licence-conf),
2220
2279
  },
2221
2280
  "value": Object {
2222
- "text": "contact-summary-text-sngl01234567890",
2281
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2282
+ "text": "Text message-contact-summary-text-sngl01234567890",
2223
2283
  },
2224
2284
  },
2225
2285
  Object {
@@ -2239,7 +2299,8 @@ Array [
2239
2299
  "text": Symbol(contact-summary-row-contact),
2240
2300
  },
2241
2301
  "value": Object {
2242
- "text": "contact-summary-text-plrl01234567890",
2302
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2303
+ "text": "Text messages-contact-summary-text-plrl01234567890",
2243
2304
  },
2244
2305
  },
2245
2306
  Object {
@@ -2304,7 +2365,8 @@ Array [
2304
2365
  "text": Symbol(contact-summary-row-licence),
2305
2366
  },
2306
2367
  "value": Object {
2307
- "text": "contact-summary-text-sngl01234567890",
2368
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2369
+ "text": "Text message-contact-summary-text-sngl01234567890",
2308
2370
  },
2309
2371
  },
2310
2372
  Object {
@@ -2324,7 +2386,8 @@ Array [
2324
2386
  "text": Symbol(contact-summary-row-contact),
2325
2387
  },
2326
2388
  "value": Object {
2327
- "text": "contact-summary-text-plrl01234567890",
2389
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2390
+ "text": "Text messages-contact-summary-text-plrl01234567890",
2328
2391
  },
2329
2392
  },
2330
2393
  Object {
@@ -2409,7 +2472,8 @@ Array [
2409
2472
  "text": Symbol(contact-summary-row-licence-conf),
2410
2473
  },
2411
2474
  "value": Object {
2412
- "text": "contact-summary-text-sngl01234567890",
2475
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2476
+ "text": "Text message-contact-summary-text-sngl01234567890",
2413
2477
  },
2414
2478
  },
2415
2479
  Object {
@@ -2429,7 +2493,8 @@ Array [
2429
2493
  "text": Symbol(contact-summary-row-contact),
2430
2494
  },
2431
2495
  "value": Object {
2432
- "text": "contact-summary-text-plrl01234567890",
2496
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2497
+ "text": "Text messages-contact-summary-text-plrl01234567890",
2433
2498
  },
2434
2499
  },
2435
2500
  Object {
@@ -2494,7 +2559,8 @@ Array [
2494
2559
  "text": Symbol(contact-summary-row-licence),
2495
2560
  },
2496
2561
  "value": Object {
2497
- "text": "contact-summary-text-sngl01234567890",
2562
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2563
+ "text": "Text message-contact-summary-text-sngl01234567890",
2498
2564
  },
2499
2565
  },
2500
2566
  Object {
@@ -2514,7 +2580,8 @@ Array [
2514
2580
  "text": Symbol(contact-summary-row-contact),
2515
2581
  },
2516
2582
  "value": Object {
2517
- "text": "contact-summary-text-plrl01234567890",
2583
+ "meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
2584
+ "text": "Text messages-contact-summary-text-plrl01234567890",
2518
2585
  },
2519
2586
  },
2520
2587
  Object {
@@ -38,9 +38,8 @@ jest.mock('../../../../processors/licence-type-display.js', () => ({
38
38
  isPhysical: jest.fn(() => true)
39
39
  }))
40
40
 
41
- const mockRoute = Symbol('mock-route')
42
- const route = require('../route.js').default
43
- jest.mock('../../../../routes/page-route.js', () => jest.fn(() => mockRoute))
41
+ const route = require('../route.js')
42
+ jest.mock('../../../../routes/page-route.js')
44
43
  const getData = pageRoute.mock.calls[1][4]
45
44
 
46
45
  const getMockCatalog = overrides => ({
@@ -62,8 +61,8 @@ const getMockCatalog = overrides => ({
62
61
  contact_summary_row_contact: Symbol('contact-summary-row-contact'),
63
62
  contact_summary_row_licence_details: Symbol('contact-summary-row-licence-details'),
64
63
  contact_summary_row_newsletter: Symbol('contact-summary-row-newsletter'),
65
- contact_summary_text_sngl: 'contact-summary-text-sngl',
66
- contact_summary_text_plrl: 'contact-summary-text-plrl',
64
+ contact_summary_text_sngl: 'Text message-contact-summary-text-sngl',
65
+ contact_summary_text_plrl: 'Text messages-contact-summary-text-plrl',
67
66
  contact_summary_title: Symbol('contact-summary-title'),
68
67
  no: 'negative, Ghost Rider',
69
68
  yes: 'aye',
@@ -125,10 +124,6 @@ const getRequestMock = ({
125
124
  })
126
125
 
127
126
  describe('contact-summary > route', () => {
128
- it('should return result of pageRoute call', () => {
129
- expect(route).toEqual(mockRoute)
130
- })
131
-
132
127
  it('should set status.fromSummary to seen', async () => {
133
128
  const mockPermission = jest.fn()
134
129
  const mockRequest = getRequestMock({ setStatusPermission: mockPermission })
@@ -169,7 +164,6 @@ describe('contact-summary > route', () => {
169
164
  const mssgCatalog = getMockCatalog({
170
165
  [mssgKey]: mssg
171
166
  })
172
- console.log('mssgcat: ', mssgCatalog.yes)
173
167
  const samplePermission = getMockPermission({
174
168
  preferredMethodOfNewsletter
175
169
  })
@@ -336,4 +330,59 @@ describe('contact-summary > route', () => {
336
330
  await expect(() => getData(mockRequest)).rejects.toThrowRedirectTo(LICENCE_CONFIRMATION_METHOD.uri)
337
331
  })
338
332
  })
333
+
334
+ describe('generateContactRow', () => {
335
+ it('should generate a contact row with meta tag when includeMeta is true', () => {
336
+ const permission = {
337
+ licensee: {
338
+ preferredMethodOfReminder: 'Text Me',
339
+ preferredMethodOfConfirmation: 'Text Me',
340
+ mobilePhone: '07123432817'
341
+ }
342
+ }
343
+ const rowGenerator = new route.RowGenerator(getRequestMock(), permission)
344
+ const decoratedUri = Symbol('decoratedUri')
345
+ addLanguageCodeToUri.mockReturnValue(decoratedUri)
346
+ const row = rowGenerator.generateContactRow({
347
+ label: 'contact_summary_row_contact',
348
+ href: LICENCE_CONFIRMATION_METHOD.uri,
349
+ visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
350
+ id: 'change-licence-confirmation-option',
351
+ contactTextSpec: {
352
+ EMAIL: 'contact_summary_email',
353
+ TEXT: 'contact_summary_text_sngl',
354
+ DEFAULT: 'contact_summary_default'
355
+ },
356
+ includeMeta: true
357
+ })
358
+
359
+ expect(row).toMatchSnapshot()
360
+ })
361
+
362
+ it('should generate a contact row without meta tag when includeMeta is false', async () => {
363
+ const permission = {
364
+ licensee: {
365
+ preferredMethodOfReminder: 'Email Me',
366
+ preferredMethodOfConfirmation: 'Email Me',
367
+ email: 'test@example.com'
368
+ }
369
+ }
370
+ const rowGenerator = new route.RowGenerator(getRequestMock(), permission)
371
+ const decoratedUri = Symbol('decoratedUri')
372
+ addLanguageCodeToUri.mockReturnValue(decoratedUri)
373
+ const row = rowGenerator.generateContactRow({
374
+ label: 'contact_summary_row_contact',
375
+ href: LICENCE_CONFIRMATION_METHOD.uri,
376
+ visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
377
+ id: 'change-licence-confirmation-option',
378
+ contactTextSpec: {
379
+ EMAIL: 'contact_summary_email',
380
+ TEXT: 'contact_summary_text_sngl',
381
+ DEFAULT: 'contact_summary_default'
382
+ }
383
+ })
384
+
385
+ expect(row).toMatchSnapshot()
386
+ })
387
+ })
339
388
  })
@@ -39,7 +39,9 @@ const CONTACT_TEXT_PHYSICAL = {
39
39
 
40
40
  const CHANGE_CONTACT = 'change-contact'
41
41
 
42
- class RowGenerator {
42
+ const META_TAG_TELEPHONE_NO = '<meta name="format-detection" content="telephone=no">'
43
+
44
+ export class RowGenerator {
43
45
  constructor (request, permission) {
44
46
  this.request = request
45
47
  this.permission = permission
@@ -68,9 +70,9 @@ class RowGenerator {
68
70
  }
69
71
  }
70
72
 
71
- _generateRow (label, text, rawHref, visuallyHiddenText, id) {
73
+ _generateRow ({ label, text, rawHref, visuallyHiddenText, id, includeMeta = false }) {
72
74
  const href = addLanguageCodeToUri(this.request, rawHref)
73
- return {
75
+ const row = {
74
76
  key: {
75
77
  text: label
76
78
  },
@@ -90,10 +92,22 @@ class RowGenerator {
90
92
  }
91
93
  })
92
94
  }
95
+
96
+ if (includeMeta) {
97
+ row.value.meta = META_TAG_TELEPHONE_NO
98
+ }
99
+
100
+ return row
93
101
  }
94
102
 
95
103
  generateStandardRow (label, text, rawHref, visuallyHiddenText, id) {
96
- return this._generateRow(this.labels[label], this.labels[text], rawHref, this.labels[visuallyHiddenText], id)
104
+ return this._generateRow({
105
+ label: this.labels[label],
106
+ text: this.labels[text],
107
+ rawHref,
108
+ visuallyHiddenText: this.labels[visuallyHiddenText],
109
+ id
110
+ })
97
111
  }
98
112
 
99
113
  generateAddressRow (countryName) {
@@ -102,21 +116,28 @@ class RowGenerator {
102
116
  .filter(Boolean)
103
117
  .join(', ')
104
118
 
105
- return this._generateRow(
106
- this.labels.contact_summary_row_address,
119
+ return this._generateRow({
120
+ label: this.labels.contact_summary_row_address,
107
121
  text,
108
- ADDRESS_LOOKUP.uri,
109
- this.labels.contact_summary_hidden_address,
110
- 'change-address'
111
- )
122
+ rawHref: ADDRESS_LOOKUP.uri,
123
+ visuallyHiddenText: this.labels.contact_summary_hidden_address,
124
+ id: 'change-address'
125
+ })
112
126
  }
113
127
 
114
- generateContactRow (label, href, visuallyHiddenText, id, contactTextSpec = CONTACT_TEXT_DEFAULT) {
128
+ generateContactRow ({ label, href, visuallyHiddenText, id, contactTextSpec = CONTACT_TEXT_DEFAULT, includeMeta = false }) {
115
129
  const contactText =
116
130
  label === 'contact_summary_row_contact'
117
131
  ? this._getPreferredMethodOfReminderText(contactTextSpec)
118
132
  : this._getPreferredMethodOfConfirmation(contactTextSpec)
119
- return this._generateRow(this.labels[label], contactText, href, this.labels[visuallyHiddenText], id)
133
+ return this._generateRow({
134
+ label: this.labels[label],
135
+ text: contactText,
136
+ rawHref: href,
137
+ visuallyHiddenText: this.labels[visuallyHiddenText],
138
+ id,
139
+ includeMeta
140
+ })
120
141
  }
121
142
  }
122
143
 
@@ -145,6 +166,8 @@ const getLicenseeDetailsSummaryRows = (permission, countryName, request) => {
145
166
  const rowGenerator = new RowGenerator(request, permission)
146
167
 
147
168
  const licenseeSummaryArray = [rowGenerator.generateAddressRow(countryName)]
169
+ const confirmationText = permission.licensee.preferredMethodOfConfirmation === HOW_CONTACTED.text
170
+ const reminderText = permission.licensee.preferredMethodOfReminder === HOW_CONTACTED.text
148
171
  if (isPhysical(permission)) {
149
172
  if (permission.licensee.postalFulfilment) {
150
173
  licenseeSummaryArray.push(
@@ -155,42 +178,46 @@ const getLicenseeDetailsSummaryRows = (permission, countryName, request) => {
155
178
  'contact_summary_hidden_licence_fulfilment',
156
179
  'change-licence-fulfilment-option'
157
180
  ),
158
- rowGenerator.generateContactRow(
159
- 'contact_summary_row_licence_conf',
160
- LICENCE_CONFIRMATION_METHOD.uri,
161
- 'contact_summary_hidden_licence_confirmation',
162
- 'change-licence-confirmation-option'
163
- )
181
+ rowGenerator.generateContactRow({
182
+ label: 'contact_summary_row_licence_conf',
183
+ href: LICENCE_CONFIRMATION_METHOD.uri,
184
+ visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
185
+ id: 'change-licence-confirmation-option',
186
+ includeMeta: confirmationText
187
+ })
164
188
  )
165
189
  } else {
166
190
  licenseeSummaryArray.push(
167
- rowGenerator.generateContactRow(
168
- 'contact_summary_row_licence',
169
- LICENCE_FULFILMENT.uri,
170
- 'contact_summary_hidden_licence_confirmation',
171
- 'change-licence-confirmation-option'
172
- )
191
+ rowGenerator.generateContactRow({
192
+ label: 'contact_summary_row_licence',
193
+ href: LICENCE_FULFILMENT.uri,
194
+ visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
195
+ id: 'change-licence-confirmation-option',
196
+ includeMeta: confirmationText
197
+ })
173
198
  )
174
199
  }
175
200
 
176
201
  licenseeSummaryArray.push(
177
- rowGenerator.generateContactRow(
178
- 'contact_summary_row_contact',
179
- CONTACT.uri,
180
- 'contact_summary_hidden_contact',
181
- CHANGE_CONTACT,
182
- CONTACT_TEXT_PHYSICAL
183
- )
202
+ rowGenerator.generateContactRow({
203
+ label: 'contact_summary_row_contact',
204
+ href: CONTACT.uri,
205
+ visuallyHiddenText: 'contact_summary_hidden_contact',
206
+ id: CHANGE_CONTACT,
207
+ contactTextSpec: CONTACT_TEXT_PHYSICAL,
208
+ includeMeta: reminderText
209
+ })
184
210
  )
185
211
  } else {
186
212
  licenseeSummaryArray.push(
187
- rowGenerator.generateContactRow(
188
- 'contact_summary_row_licence_details',
189
- CONTACT.uri,
190
- 'contact_summary_hidden_contact',
191
- CHANGE_CONTACT,
192
- CONTACT_TEXT_NON_PHYSICAL
193
- )
213
+ rowGenerator.generateContactRow({
214
+ label: 'contact_summary_row_licence_details',
215
+ href: CONTACT.uri,
216
+ visuallyHiddenText: 'contact_summary_hidden_contact',
217
+ id: CHANGE_CONTACT,
218
+ contactTextSpec: CONTACT_TEXT_NON_PHYSICAL,
219
+ includeMeta: reminderText
220
+ })
194
221
  )
195
222
  }
196
223