@govuk-pay/pay-js-commons 3.8.6 → 3.8.8

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.
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
16
  - name: Git checkout
17
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
17
+ uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
18
18
  - name: Detect secrets
19
19
  uses: alphagov/pay-ci/actions/detect-secrets@master
20
20
 
@@ -24,16 +24,16 @@ jobs:
24
24
 
25
25
  steps:
26
26
  - name: Checkout
27
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
27
+ uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
28
28
  - name: Parse Node version
29
- run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
29
+ run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
30
30
  id: parse-node-version
31
31
  - name: Setup
32
- uses: actions/setup-node@969bd2663942d722d85b6a8626225850c2f7be4b
32
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
33
33
  with:
34
34
  node-version: "${{ steps.parse-node-version.outputs.NVMRC }}"
35
35
  - name: Cache NPM packages
36
- uses: actions/cache@136d96b4aee02b1f0de3ba493b1d47135042d9c0
36
+ uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
37
37
  with:
38
38
  path: ~/.npm
39
39
  key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -10,12 +10,9 @@
10
10
  <option name="SPACES_WITHIN_IMPORTS" value="true" />
11
11
  </JSCodeStyleSettings>
12
12
  <JavaCodeStyleSettings>
13
- <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
14
- <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
13
+ <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
14
+ <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
15
15
  </JavaCodeStyleSettings>
16
- <ScalaCodeStyleSettings>
17
- <option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
18
- </ScalaCodeStyleSettings>
19
16
  <codeStyleSettings language="JavaScript">
20
17
  <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
21
18
  <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
package/.idea/misc.xml CHANGED
@@ -3,7 +3,4 @@
3
3
  <component name="ProjectRootManager">
4
4
  <output url="file://$PROJECT_DIR$/out" />
5
5
  </component>
6
- <component name="ProjectType">
7
- <option name="id" value="jpab" />
8
- </component>
9
6
  </project>
@@ -1,3 +0,0 @@
1
-
2
- A
3
- package-lock.json,f/a/fa288d1472d29beccb489a676f68739ad365fc47
@@ -0,0 +1,120 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body_1" width="250" height="320" viewBox="210 45 180 160">
4
+
5
+ <defs>
6
+ <clipPath id="1">
7
+
8
+ <path clip-rule="evenodd" d="M1497.6 857.42C 1531.12 857.42 1564.1799 859.299 1596.65 862.928L1596.65 862.928L1596.48 2088.8281L911.87 2088.8281C 778.06 1957.8882 694.33 1782.1382 694.33 1590.1082C 694.33 1185.4282 1053.96 857.3882 1497.6001 857.3882L1497.6001 857.3882L1497.6 857.42z" /> </clipPath>
9
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="373">
10
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
11
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
12
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
13
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
14
+ </radialGradient>
15
+ <mask id="767">
16
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 22.885 17.36)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
17
+ </mask>
18
+ <clipPath id="2">
19
+
20
+ <path clip-rule="evenodd" d="M1003.2 399.57C 1003.2 391.93 1007.98004 378.80902 1028.03 378.80902C 1039.48 378.80902 1048.0701 383.35202 1053.5701 391.69904C 1058.5801 399.80902 1058.81 406.48004 1059.28 423.19904C 1055.23 423.67203 1051.89 423.91003 1046.4 423.91003C 1037.34 423.91003 1003.2 423.91003 1003.2 399.57004L1003.2 399.57004L1003.2 399.57z" /> </clipPath>
21
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="1782">
22
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
23
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
24
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
25
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
26
+ </radialGradient>
27
+ <mask id="2177">
28
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 20.705 17.37)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
29
+ </mask>
30
+ <clipPath id="3">
31
+
32
+ <path clip-rule="evenodd" d="M668.84 429.16L733.984 429.16L702.254 513.641L668.84 429.16z" /> </clipPath>
33
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="2930">
34
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
35
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
36
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
37
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
38
+ </radialGradient>
39
+ <mask id="3325">
40
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 20.705 17.37)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
41
+ </mask>
42
+ <clipPath id="4">
43
+
44
+ <path clip-rule="evenodd" d="M1501.5 364.97L1478.59 364.97L1478.59 441.091C 1478.59 448.962 1477.63 456.122 1472.15 461.61002C 1466.41 467.10303 1458.54 469.72 1450.9 469.72C 1434.67 469.72 1419.64 458.032 1419.64 433.923L1419.64 433.923L1419.64 364.97L1397.22 364.97L1397.22 470.91998L1396.97 484.748L1419.4 484.748L1419.64 465.42798C 1422.27 470.447 1430.85 487.14597 1458.06 487.14597C 1468.8 487.14597 1501.5 483.08795 1501.5 446.34998L1501.5 446.34998L1501.5 364.97zM1306.12 360.923C 1266.51 360.923 1247.17 388.36002 1247.17 423.44202C 1247.17 453.02103 1261.02 487.86002 1308.03 487.86002C 1355.99 487.86002 1366.72 450.161 1366.72 425.10303C 1366.72 390.02103 1346.9199 360.92303 1306.12 360.92303zM1219.78 512.203L1192.8 512.203L1192.8 536.78503L1219.78 536.78503zM1217.62 364.97302L1195.19 364.97302L1195.19 484.75302L1217.62 484.75302zM1171.54 468.773L1144.81 468.773L1144.81 396.944C 1144.81 390.983 1144.81 380.964 1160.79 380.964C 1165.3301 380.964 1169.63 381.675 1171.54 382.151L1171.54 382.151L1171.54 364.733C 1167.4701 364.015 1161.03 363.30402 1152.92 363.30402C 1132.4 363.30402 1122.62 369.273 1122.62 388.84302L1122.62 388.84302L1122.62 468.773L1101.37 468.773L1101.37 485.233L1122.62 485.233L1122.62 510.292L1144.8099 517.464L1144.8099 485.233L1171.5399 485.233zM1060.8301 116.84302L1043.65 72.222015L1020.51 72.222015L1038.64 118.042015L988.774 237.34201L1014.07 237.34201L1051.53 142.854L1089.7101 237.34201L1114.05 237.34201zM1055.02 465.19302C 1050.49 471.16202 1040.72 473.06104 1034.26 473.06104C 1011.59 473.06104 1010.4 457.56104 1010.17 452.78302L1010.17 452.78302L987.727 452.78302C 988.442 458.99002 989.153 467.342 996.075 475.463C 1005.16003 485.471 1022.09 488.342 1034.74 488.342C 1052.17 488.342 1070.76 482.854 1077.22 470.682C 1081.0399 463.522 1081.27 457.79102 1081.27 452.303L1081.27 452.303L1080.3201 395.04102C 1080.3201 393.12302 1080.56 377.143 1082.2201 364.971L1082.2201 364.971L1061.9501 364.971C 1060.27 370.932 1059.8 376.66202 1059.8 382.86102C 1049.05 363.053 1032.8301 361.15002 1022.80005 361.15002C 995.3641 361.15002 980.57104 376.66202 980.57104 396.471C 980.57104 406.002 983.90704 421.28302 1001.57007 431.553C 1014.4601 438.713 1033.55 439.424 1043.0901 439.424C 1048.8201 439.424 1052.4001 439.19302 1059.31 438.713C 1059.31 453.49002 1059.31 459.94302 1055.02 465.19302zM974.141 221.36302L947.415 221.36302L947.415 149.53502C 947.415 143.56302 947.415 133.54301 963.40295 133.54301C 967.92993 133.54301 972.23096 134.26602 974.1409 134.73401L974.1409 134.73401L974.1409 117.324005C 970.0899 116.61301 963.64496 115.883 955.51996 115.883C 934.99994 115.883 925.21497 121.856 925.21497 141.414L925.21497 141.414L925.21497 221.363L903.98895 221.363L903.98895 237.824L925.21497 237.824L925.21497 262.875L947.415 270.043L947.415 237.824L974.141 237.824zM883.868 264.78503L856.915 264.78503L856.915 289.36304L883.868 289.36304zM881.73096 117.56503L859.29694 117.56503L859.29694 237.34503L881.73096 237.34503zM830.98096 364.97504L780.86395 484.75504L805.91797 484.75504L844.094 389.78604L881.321 484.75504L906.14496 484.75504L853.657 364.97504zM836.69995 216.35504C 835.50793 216.82304 834.06696 217.06204 832.4069 217.30405C 830.7349 217.54205 828.58594 217.54205 825.95795 217.54205C 799.46893 217.54205 793.26996 201.79205 793.26996 181.27306L793.26996 181.27306L793.26996 117.56206L770.6019 117.56206L770.6019 213.01506C 770.6019 221.12405 770.12494 229.47206 769.4069 237.34306L769.4069 237.34306L792.0789 237.34306L792.55493 214.20206C 796.84796 230.90106 811.1649 236.39406 821.1959 237.82306C 827.87195 238.78406 832.88293 238.53406 836.69995 238.30406zM741.16797 409.82504L661.22296 409.82504L642.61395 364.97403L618.03595 364.97403L690.579 537.26404L716.11 537.26404L785.79 364.97406L759.77795 364.97406zM679.579 113.505035C 639.961 113.505035 620.633 140.95404 620.633 176.02504C 620.633 205.60704 634.473 240.45404 681.489 240.45404C 729.44604 240.45404 740.188 202.74304 740.188 177.69604C 740.188 142.61404 720.383 113.50504 679.579 113.50504zM591.297 117.56403L568.387 117.56403L568.387 188.43503C 568.387 199.16502 568.387 222.31403 542.614 222.31403C 525.911 222.31403 517.555 212.06403 514.45404 206.32503C 510.63705 199.65303 510.63705 188.43503 510.63705 181.03603L510.63705 181.03603L510.63705 117.564026L487.96506 117.564026L487.96506 289.604L510.63705 289.604L510.63705 219.701C 518.04004 232.334 532.82904 239.502 549.5281 239.502C 562.18005 239.502 580.3171 234.971 587.2391 220.412C 589.6221 215.631 591.29706 209.90001 591.29706 192.494zM474.257 512.20404L447.289 512.20404L447.289 536.786L474.257 536.786zM472.10498 364.97406L449.679 364.97406L449.679 484.75406L472.10498 484.75406zM464.44098 221.36406L437.71097 221.36406L437.71097 149.53606C 437.71097 143.56406 437.71097 133.54405 453.70297 133.54405C 458.23398 133.54405 462.53098 134.26706 464.44098 134.73505L464.44098 134.73505L464.44098 117.32504C 460.382 116.614044 453.94098 115.88404 445.82797 115.88404C 425.304 115.88404 415.51898 121.85704 415.51898 141.41504L415.51898 141.41504L415.51898 221.36404L394.27698 221.36404L394.27698 237.82504L415.51898 237.82504L415.51898 262.87604L437.71097 270.04404L437.71097 237.82504L464.44098 237.82504zM351.80096 364.97406L301.69595 484.75406L326.75095 484.75406L364.92993 389.78506L402.15292 484.75406L426.97293 484.75406L374.47293 364.97406zM349.24295 117.56406L348.75797 138.07506C 344.46198 129.72406 336.35196 116.36406 310.58298 116.36406C 280.99298 116.36406 267.15298 133.31406 267.15298 156.93506L267.15298 156.93506L267.15298 237.34506L290.063 237.34506L290.063 160.27505C 290.063 148.58705 292.684 133.78606 315.594 133.78606C 326.805 133.78606 337.309 137.60706 343.751 147.15306C 348.758 154.30606 348.758 163.60706 348.758 169.58707L348.758 169.58707L348.758 237.34506L371.911 237.34506L371.911 139.98506C 371.911 137.60706 372.383 124.255066 372.622 117.564064zM256.89496 484.75406L279.32095 484.75406L279.32095 364.97406L256.89496 364.97406zM254.50797 536.78503L281.46896 536.78503L281.46896 512.203L254.50797 512.203zM225.40697 117.56503L206.79797 162.42804L126.85997 162.42804L108.242966 117.56504L83.66897 117.56504L156.20798 289.84503L181.73898 289.84503L251.41498 117.56503zM170.04398 539.645C 194.39098 539.645 228.75098 529.86304 231.85597 490.734L231.85597 490.734L206.32097 490.734C 205.36397 496.695 202.26196 520.555 169.09097 520.555C 127.574974 520.555 120.17297 478.086 120.17297 449.445C 120.17297 416.992 129.48097 381.914 168.85597 381.914C 179.35197 381.914 189.37598 384.543 196.77397 392.184C 202.97697 398.86298 204.41096 406.254 205.12598 410.305L205.12598 410.305L231.37198 410.305C 227.79797 376.426 196.53598 362.344 166.94998 362.344C 106.33298 362.344 94.63698 415.805 94.63698 449.203C 94.63698 485.473 108.71598 539.645 170.04398 539.645zM103.711975 784.66504L127.574974 784.66504L127.574974 678.005C 127.574974 659.63403 131.62598 651.993 135.21198 646.985C 145.94998 632.653 162.65297 630.044 174.58698 630.044C 221.11398 630.044 221.11398 666.556 221.11398 678.954L221.11398 678.954L221.11398 784.664L244.25798 784.664L244.25798 678.474C 244.25798 669.177 244.02399 649.857 230.17998 632.653C 213.23898 611.427 186.98898 608.806 174.58698 608.806C 158.34798 608.806 129.71597 613.33704 113.73097 636.247C 108.48097 643.88403 103.711975 653.903 103.711975 679.677zM283.83197 784.66504L307.45697 784.66504L307.45697 709.275L379.28098 784.66504L411.972 784.66504L334.89798 707.59503L420.32797 612.37604L386.91797 612.37604L307.45697 703.775L307.45697 612.37604L283.83197 612.37604zM509.49197 537.015L531.922 537.015L531.922 364.97504L509.492 364.97504zM951.282 484.75302L951.282 364.97302L928.868 364.97302L928.868 484.75302zM926.47296 536.784L953.438 536.784L953.438 512.202L926.47296 512.202zM1596.673 829.43396C 1487.923 794.863 1373.403 776.59393 1252.323 776.59393C 652.823 776.59393 166.823 1235.914 166.823 1802.394C 166.823 1920.654 188.034 2034.234 226.995 2088.834L226.995 2088.834L0.024993896 2088.834L0.024993896 -0.06591797L1596.725 -0.06591797z" /> </clipPath>
45
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="11981">
46
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
47
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
48
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
49
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
50
+ </radialGradient>
51
+ <mask id="12377">
52
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 20.705 17.37)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
53
+ </mask>
54
+ <clipPath id="5">
55
+
56
+ <path clip-rule="evenodd" d="M134.46 181.75L199.6 181.75L167.862 266.219L134.46 181.75z" /> </clipPath>
57
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="13129">
58
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
59
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
60
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
61
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
62
+ </radialGradient>
63
+ <mask id="13525">
64
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 20.705 17.37)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
65
+ </mask>
66
+ <clipPath id="6">
67
+
68
+ <path clip-rule="evenodd" d="M681.47 223.98C 667.146 223.98 644.001 214.91 644.001 177.449C 644.001 152.871 654.501 130.199 680.032 130.199C 696.974 130.199 716.30597 142.371 716.30597 178.41C 716.30597 208.238 702.47 223.98001 681.47 223.98001L681.47 223.98001L681.47 223.98z" /> </clipPath>
69
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="14466">
70
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
71
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
72
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
73
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
74
+ </radialGradient>
75
+ <mask id="14862">
76
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 20.705 17.37)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
77
+ </mask>
78
+ <clipPath id="7">
79
+
80
+ <path clip-rule="evenodd" d="M1308 471.39C 1293.67 471.39 1270.53 462.33102 1270.53 424.858C 1270.53 400.288 1281.03 377.62 1306.55 377.62C 1323.51 377.62 1342.8301 389.78 1342.8301 425.819C 1342.8301 455.64 1329.0001 471.39 1308.0001 471.39L1308.0001 471.39L1308 471.39z" /> </clipPath>
81
+ <radialGradient cx="0%" cy="0%" r="127.080574%" gradientUnits="objectBoundingBox" id="15798">
82
+ <stop offset="0%" stop-color="#1A2B69" stop-opacity="1"/>
83
+ <stop offset="32.047%" stop-color="#1A2B69" stop-opacity="1"/>
84
+ <stop offset="90.184%" stop-color="#1FB6DE" stop-opacity="1"/>
85
+ <stop offset="100%" stop-color="#1FB6DE" stop-opacity="1"/>
86
+ </radialGradient>
87
+ <mask id="16194">
88
+ <path transform="matrix(1572.6 2050.9 2050.9 -1572.6 20.705 17.37)" d="M1 0C 1 0.26511478 0.89457124 0.5196423 0.70710677 0.70710677C 0.5196423 0.89457124 0.26511478 1 6.123234E-17 1C -0.26511478 1 -0.5196423 0.89457124 -0.70710677 0.70710677C -0.89457124 0.5196423 -1 0.26511478 -1 1.2246469E-16C -1 -0.26511478 -0.89457124 -0.5196423 -0.70710677 -0.70710677C -0.5196423 -0.89457124 -0.26511478 -1 -1.6081226E-16 -1C 0.26511478 -1 0.5196423 -0.89457124 0.70710677 -0.70710677C 0.89457124 -0.5196423 1 -0.26511478 1 -2.4492937E-16z" fill="white"/>
89
+ </mask>
90
+ </defs>
91
+
92
+ <g transform="matrix(0.86169755 0 0 0.86169755 208.2766 -0)">
93
+ <g transform="matrix(1.3333 0 -0 -1.3333 0 278.52)">
94
+ <g transform="matrix(0.1 0 0 0.1 0 0)">
95
+ <path d="M1596.7 0L0 0L0 2088.9L1596.7 2088.9L1596.7 0" stroke="none" fill="#FFFFFF" fill-rule="nonzero" />
96
+ <g clip-path="url(#1)" >
97
+ <path d="M1497.6 857.42C 1531.12 857.42 1564.1799 859.299 1596.65 862.928L1596.65 862.928L1596.48 2088.8281L911.87 2088.8281C 778.06 1957.8882 694.33 1782.1382 694.33 1590.1082C 694.33 1185.4282 1053.96 857.3882 1497.6001 857.3882" stroke="none" mask="url(#767)" fill="url(#373)" />
98
+ </g>
99
+ <g clip-path="url(#2)" >
100
+ <path d="M1003.2 399.57C 1003.2 391.93 1007.98004 378.80902 1028.03 378.80902C 1039.48 378.80902 1048.0701 383.35202 1053.5701 391.69904C 1058.5801 399.80902 1058.81 406.48004 1059.28 423.19904C 1055.23 423.67203 1051.89 423.91003 1046.4 423.91003C 1037.34 423.91003 1003.2 423.91003 1003.2 399.57004" stroke="none" mask="url(#2177)" fill="url(#1782)" />
101
+ </g>
102
+ <g clip-path="url(#3)" >
103
+ <path d="M668.84 429.16L733.984 429.16L702.254 513.641L668.84 429.16z" stroke="none" mask="url(#3325)" fill="url(#2930)" />
104
+ </g>
105
+ <g clip-path="url(#4)" >
106
+ <path d="M1501.5 364.97L1478.59 364.97L1478.59 441.091C 1478.59 448.962 1477.63 456.122 1472.15 461.61002C 1466.41 467.10303 1458.54 469.72 1450.9 469.72C 1434.67 469.72 1419.64 458.032 1419.64 433.923L1419.64 433.923L1419.64 364.97L1397.22 364.97L1397.22 470.91998L1396.97 484.748L1419.4 484.748L1419.64 465.42798C 1422.27 470.447 1430.85 487.14597 1458.06 487.14597C 1468.8 487.14597 1501.5 483.08795 1501.5 446.34998L1501.5 446.34998L1501.5 364.97zM1306.12 360.923C 1266.51 360.923 1247.17 388.36002 1247.17 423.44202C 1247.17 453.02103 1261.02 487.86002 1308.03 487.86002C 1355.99 487.86002 1366.72 450.161 1366.72 425.10303C 1366.72 390.02103 1346.9199 360.92303 1306.12 360.92303zM1219.78 512.203L1192.8 512.203L1192.8 536.78503L1219.78 536.78503zM1217.62 364.97302L1195.19 364.97302L1195.19 484.75302L1217.62 484.75302zM1171.54 468.773L1144.81 468.773L1144.81 396.944C 1144.81 390.983 1144.81 380.964 1160.79 380.964C 1165.3301 380.964 1169.63 381.675 1171.54 382.151L1171.54 382.151L1171.54 364.733C 1167.4701 364.015 1161.03 363.30402 1152.92 363.30402C 1132.4 363.30402 1122.62 369.273 1122.62 388.84302L1122.62 388.84302L1122.62 468.773L1101.37 468.773L1101.37 485.233L1122.62 485.233L1122.62 510.292L1144.8099 517.464L1144.8099 485.233L1171.5399 485.233zM1060.8301 116.84302L1043.65 72.222015L1020.51 72.222015L1038.64 118.042015L988.774 237.34201L1014.07 237.34201L1051.53 142.854L1089.7101 237.34201L1114.05 237.34201zM1055.02 465.19302C 1050.49 471.16202 1040.72 473.06104 1034.26 473.06104C 1011.59 473.06104 1010.4 457.56104 1010.17 452.78302L1010.17 452.78302L987.727 452.78302C 988.442 458.99002 989.153 467.342 996.075 475.463C 1005.16003 485.471 1022.09 488.342 1034.74 488.342C 1052.17 488.342 1070.76 482.854 1077.22 470.682C 1081.0399 463.522 1081.27 457.79102 1081.27 452.303L1081.27 452.303L1080.3201 395.04102C 1080.3201 393.12302 1080.56 377.143 1082.2201 364.971L1082.2201 364.971L1061.9501 364.971C 1060.27 370.932 1059.8 376.66202 1059.8 382.86102C 1049.05 363.053 1032.8301 361.15002 1022.80005 361.15002C 995.3641 361.15002 980.57104 376.66202 980.57104 396.471C 980.57104 406.002 983.90704 421.28302 1001.57007 431.553C 1014.4601 438.713 1033.55 439.424 1043.0901 439.424C 1048.8201 439.424 1052.4001 439.19302 1059.31 438.713C 1059.31 453.49002 1059.31 459.94302 1055.02 465.19302zM974.141 221.36302L947.415 221.36302L947.415 149.53502C 947.415 143.56302 947.415 133.54301 963.40295 133.54301C 967.92993 133.54301 972.23096 134.26602 974.1409 134.73401L974.1409 134.73401L974.1409 117.324005C 970.0899 116.61301 963.64496 115.883 955.51996 115.883C 934.99994 115.883 925.21497 121.856 925.21497 141.414L925.21497 141.414L925.21497 221.363L903.98895 221.363L903.98895 237.824L925.21497 237.824L925.21497 262.875L947.415 270.043L947.415 237.824L974.141 237.824zM883.868 264.78503L856.915 264.78503L856.915 289.36304L883.868 289.36304zM881.73096 117.56503L859.29694 117.56503L859.29694 237.34503L881.73096 237.34503zM830.98096 364.97504L780.86395 484.75504L805.91797 484.75504L844.094 389.78604L881.321 484.75504L906.14496 484.75504L853.657 364.97504zM836.69995 216.35504C 835.50793 216.82304 834.06696 217.06204 832.4069 217.30405C 830.7349 217.54205 828.58594 217.54205 825.95795 217.54205C 799.46893 217.54205 793.26996 201.79205 793.26996 181.27306L793.26996 181.27306L793.26996 117.56206L770.6019 117.56206L770.6019 213.01506C 770.6019 221.12405 770.12494 229.47206 769.4069 237.34306L769.4069 237.34306L792.0789 237.34306L792.55493 214.20206C 796.84796 230.90106 811.1649 236.39406 821.1959 237.82306C 827.87195 238.78406 832.88293 238.53406 836.69995 238.30406zM741.16797 409.82504L661.22296 409.82504L642.61395 364.97403L618.03595 364.97403L690.579 537.26404L716.11 537.26404L785.79 364.97406L759.77795 364.97406zM679.579 113.505035C 639.961 113.505035 620.633 140.95404 620.633 176.02504C 620.633 205.60704 634.473 240.45404 681.489 240.45404C 729.44604 240.45404 740.188 202.74304 740.188 177.69604C 740.188 142.61404 720.383 113.50504 679.579 113.50504zM591.297 117.56403L568.387 117.56403L568.387 188.43503C 568.387 199.16502 568.387 222.31403 542.614 222.31403C 525.911 222.31403 517.555 212.06403 514.45404 206.32503C 510.63705 199.65303 510.63705 188.43503 510.63705 181.03603L510.63705 181.03603L510.63705 117.564026L487.96506 117.564026L487.96506 289.604L510.63705 289.604L510.63705 219.701C 518.04004 232.334 532.82904 239.502 549.5281 239.502C 562.18005 239.502 580.3171 234.971 587.2391 220.412C 589.6221 215.631 591.29706 209.90001 591.29706 192.494zM474.257 512.20404L447.289 512.20404L447.289 536.786L474.257 536.786zM472.10498 364.97406L449.679 364.97406L449.679 484.75406L472.10498 484.75406zM464.44098 221.36406L437.71097 221.36406L437.71097 149.53606C 437.71097 143.56406 437.71097 133.54405 453.70297 133.54405C 458.23398 133.54405 462.53098 134.26706 464.44098 134.73505L464.44098 134.73505L464.44098 117.32504C 460.382 116.614044 453.94098 115.88404 445.82797 115.88404C 425.304 115.88404 415.51898 121.85704 415.51898 141.41504L415.51898 141.41504L415.51898 221.36404L394.27698 221.36404L394.27698 237.82504L415.51898 237.82504L415.51898 262.87604L437.71097 270.04404L437.71097 237.82504L464.44098 237.82504zM351.80096 364.97406L301.69595 484.75406L326.75095 484.75406L364.92993 389.78506L402.15292 484.75406L426.97293 484.75406L374.47293 364.97406zM349.24295 117.56406L348.75797 138.07506C 344.46198 129.72406 336.35196 116.36406 310.58298 116.36406C 280.99298 116.36406 267.15298 133.31406 267.15298 156.93506L267.15298 156.93506L267.15298 237.34506L290.063 237.34506L290.063 160.27505C 290.063 148.58705 292.684 133.78606 315.594 133.78606C 326.805 133.78606 337.309 137.60706 343.751 147.15306C 348.758 154.30606 348.758 163.60706 348.758 169.58707L348.758 169.58707L348.758 237.34506L371.911 237.34506L371.911 139.98506C 371.911 137.60706 372.383 124.255066 372.622 117.564064zM256.89496 484.75406L279.32095 484.75406L279.32095 364.97406L256.89496 364.97406zM254.50797 536.78503L281.46896 536.78503L281.46896 512.203L254.50797 512.203zM225.40697 117.56503L206.79797 162.42804L126.85997 162.42804L108.242966 117.56504L83.66897 117.56504L156.20798 289.84503L181.73898 289.84503L251.41498 117.56503zM170.04398 539.645C 194.39098 539.645 228.75098 529.86304 231.85597 490.734L231.85597 490.734L206.32097 490.734C 205.36397 496.695 202.26196 520.555 169.09097 520.555C 127.574974 520.555 120.17297 478.086 120.17297 449.445C 120.17297 416.992 129.48097 381.914 168.85597 381.914C 179.35197 381.914 189.37598 384.543 196.77397 392.184C 202.97697 398.86298 204.41096 406.254 205.12598 410.305L205.12598 410.305L231.37198 410.305C 227.79797 376.426 196.53598 362.344 166.94998 362.344C 106.33298 362.344 94.63698 415.805 94.63698 449.203C 94.63698 485.473 108.71598 539.645 170.04398 539.645zM103.711975 784.66504L127.574974 784.66504L127.574974 678.005C 127.574974 659.63403 131.62598 651.993 135.21198 646.985C 145.94998 632.653 162.65297 630.044 174.58698 630.044C 221.11398 630.044 221.11398 666.556 221.11398 678.954L221.11398 678.954L221.11398 784.664L244.25798 784.664L244.25798 678.474C 244.25798 669.177 244.02399 649.857 230.17998 632.653C 213.23898 611.427 186.98898 608.806 174.58698 608.806C 158.34798 608.806 129.71597 613.33704 113.73097 636.247C 108.48097 643.88403 103.711975 653.903 103.711975 679.677zM283.83197 784.66504L307.45697 784.66504L307.45697 709.275L379.28098 784.66504L411.972 784.66504L334.89798 707.59503L420.32797 612.37604L386.91797 612.37604L307.45697 703.775L307.45697 612.37604L283.83197 612.37604zM509.49197 537.015L531.922 537.015L531.922 364.97504L509.492 364.97504zM951.282 484.75302L951.282 364.97302L928.868 364.97302L928.868 484.75302zM926.47296 536.784L953.438 536.784L953.438 512.202L926.47296 512.202zM1596.673 829.43396C 1487.923 794.863 1373.403 776.59393 1252.323 776.59393C 652.823 776.59393 166.823 1235.914 166.823 1802.394C 166.823 1920.654 188.034 2034.234 226.995 2088.834L226.995 2088.834L0.024993896 2088.834L0.024993896 -0.06591797L1596.725 -0.06591797L1596.625 829.3641" stroke="none" mask="url(#12377)" fill="url(#11981)" />
107
+ </g>
108
+ <g clip-path="url(#5)" >
109
+ <path d="M134.46 181.75L199.6 181.75L167.862 266.219L134.46 181.75z" stroke="none" mask="url(#13525)" fill="url(#13129)" />
110
+ </g>
111
+ <g clip-path="url(#6)" >
112
+ <path d="M681.47 223.98C 667.146 223.98 644.001 214.91 644.001 177.449C 644.001 152.871 654.501 130.199 680.032 130.199C 696.974 130.199 716.30597 142.371 716.30597 178.41C 716.30597 208.238 702.47 223.98001 681.47 223.98001" stroke="none" mask="url(#14862)" fill="url(#14466)" />
113
+ </g>
114
+ <g clip-path="url(#7)" >
115
+ <path d="M1308 471.39C 1293.67 471.39 1270.53 462.33102 1270.53 424.858C 1270.53 400.288 1281.03 377.62 1306.55 377.62C 1323.51 377.62 1342.8301 389.78 1342.8301 425.819C 1342.8301 455.64 1329.0001 471.39 1308.0001 471.39" stroke="none" mask="url(#16194)" fill="url(#15798)" />
116
+ </g>
117
+ </g>
118
+ </g>
119
+ </g>
120
+ </svg>
Binary file
package/jest.config.js CHANGED
@@ -1,3 +1,5 @@
1
1
  module.exports = {
2
- testURL: 'http://www.example.org'
2
+ testEnvironmentOptions : {
3
+ url: 'http://www.example.org'
4
+ }
3
5
  }
@@ -1,31 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var fs = require('fs');
4
-
5
4
  var Cookies = require('js-cookie');
6
-
7
5
  var path = require('path');
8
-
9
6
  var template = fs.readFileSync(path.join(__dirname, 'banner.html'), 'utf-8');
10
7
  var GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME = 'govuk_pay_cookie_policy';
11
8
  var ANALYTICS_CONSENT_BANNER_ID = 'pay-cookie-banner';
12
-
13
9
  function hasAnalyticsConsent() {
14
10
  var cookie = Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME);
15
11
  var parsed = cookie && JSON.parse(cookie);
16
12
  return Boolean(parsed) && parsed.analytics === true;
17
13
  }
18
-
19
14
  function getCookieDomain() {
20
15
  var PROD_HOSTNAME = 'payments.service.gov.uk';
21
-
22
16
  if (window.location.hostname.includes(PROD_HOSTNAME)) {
23
17
  return PROD_HOSTNAME;
24
18
  }
25
-
26
19
  return undefined;
27
20
  }
28
-
29
21
  function setAnalyticsCookie() {
30
22
  var userConsentedToAnalytics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
31
23
  var cookieValue = JSON.stringify({
@@ -38,19 +30,15 @@ function setAnalyticsCookie() {
38
30
  };
39
31
  Cookies.set(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME, cookieValue, cookieAttributes);
40
32
  }
41
-
42
33
  function hideBannerIfExists(event) {
43
34
  var banner = document.querySelector("#".concat(ANALYTICS_CONSENT_BANNER_ID));
44
-
45
35
  if (banner) {
46
36
  banner.style.display = 'none';
47
37
  }
48
-
49
38
  if (event.target) {
50
39
  event.preventDefault();
51
40
  }
52
41
  }
53
-
54
42
  function showConfirmationMessage(analyticsConsent) {
55
43
  var messagePrefix = analyticsConsent ? 'You’ve accepted analytics cookies.' : 'You told us not to use analytics cookies.';
56
44
  var $cookieBannerMainContent = document.querySelector('.pay-cookie-banner__wrapper');
@@ -60,17 +48,14 @@ function showConfirmationMessage(analyticsConsent) {
60
48
  var $cookieBannerConfirmationWrapper = document.querySelector('.pay-cookie-banner__confirmation');
61
49
  $cookieBannerConfirmationWrapper.style.display = 'block';
62
50
  }
63
-
64
51
  function acceptAnalyticsCookies() {
65
52
  setAnalyticsCookie(true);
66
53
  showConfirmationMessage(true);
67
54
  }
68
-
69
55
  function rejectAnalyticsCookies() {
70
56
  setAnalyticsCookie(false);
71
57
  showConfirmationMessage(false);
72
58
  }
73
-
74
59
  function createBannerHTMLElement() {
75
60
  var consentProvidedCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
76
61
  var banner = document.createElement('div');
@@ -78,39 +63,31 @@ function createBannerHTMLElement() {
78
63
  banner.innerHTML = template.trim();
79
64
  var acceptButton = banner.querySelector('button[data-accept-cookies=true]');
80
65
  var rejectButton = banner.querySelector('button[data-accept-cookies=false]');
81
-
82
66
  if (acceptButton && rejectButton) {
83
67
  acceptButton.addEventListener('click', acceptAnalyticsCookies);
84
68
  acceptButton.addEventListener('click', consentProvidedCallback);
85
69
  rejectButton.addEventListener('click', rejectAnalyticsCookies);
86
70
  }
87
-
88
71
  var hideCookieBannerLink = banner.querySelector('button[data-hide-cookie-banner]');
89
-
90
72
  if (hideCookieBannerLink) {
91
73
  hideCookieBannerLink.addEventListener('click', hideBannerIfExists);
92
74
  }
93
-
94
75
  return banner;
95
76
  }
77
+
96
78
  /**
97
79
  * ConsentProvidedCallback: function - generic callback that will be called
98
80
  * if and only if the user provides consent
99
81
  */
100
-
101
-
102
82
  function showBannerIfConsentNotSet() {
103
83
  var consentProvidedCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
104
84
  var consentCookieNotSet = !Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME);
105
85
  var banner = document.querySelector("#".concat(ANALYTICS_CONSENT_BANNER_ID));
106
-
107
86
  if (consentCookieNotSet && !banner) {
108
87
  var _banner = createBannerHTMLElement(consentProvidedCallback);
109
-
110
88
  document.body.prepend(_banner);
111
89
  }
112
90
  }
113
-
114
91
  module.exports = {
115
92
  hasAnalyticsConsent: hasAnalyticsConsent,
116
93
  showBannerIfConsentNotSet: showBannerIfConsentNotSet
@@ -870,29 +870,22 @@ process.umask = function() { return 0; };
870
870
  "use strict";
871
871
 
872
872
  var Cookies = require('js-cookie');
873
-
874
873
  var path = require('path');
875
-
876
874
  var template = "<style>\n\t/* component should only be shown if JS is available, by the cookieMessage JS, so hide by default */\n\t.pay-cookie-banner {\n\t\tdisplay: block;\n\t}\n\n\t.pay-cookie-banner__wrapper {\n\t\tpadding-top: 15px;\n \tpadding-bottom: 15px;\n\t}\n\n\t.pay-cookie-banner__buttons {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t}\n\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__buttons {\n\t\t\tflex-wrap: nowrap;\n\t\t}\n\t}\n\n\n\t.pay-cookie-banner__button,\n\t.pay-cookie-banner__link {\n\t\tvertical-align: baseline;\n\t}\n\n\t.pay-cookie-banner__button {\n\t\tdisplay: inline-block;\n\t\tflex: 1 0;\n\t\tpadding-left: 60px;\n\t\tpadding-right: 60px;\n\t\tmargin-bottom: 10px;\n\t\tmargin-right: 20px;\n\t}\n\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__button {\n\t\t\tflex: 0 0 150px;\n\t\t\tpadding-left: 10px;\n\t\t\tpadding-right: 10px;\n\t\t\tmargin-bottom: 5px;\n\t\t}\n\t}\n\t\n\t.pay-cookie-banner__link {\n\t\tfont-family: \"GDS Transport\", Arial, sans-serif;\n\t\tfont-weight: 400;\n\t\tfont-size: 16px;\n\t\tfont-size: 1rem;\n\t\tline-height: 1.25;\n\t\tline-height: 1;\n\t\tdisplay: block;\n\t\twidth: 100%;\n\t padding: 9px 0px 6px;\n\t}\n\t\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__link {\n\t\t\tdisplay: inline;\n\t\t\twidth: auto;\n\t\t\tmargin-left: 30px;\n\t\t}\n\t}\n\n\n\t.pay-cookie-banner__confirmation {\n\t\tdisplay: none;\n\t\tposition: relative;\n\t\tpadding: 20px 0;\n\n\t\t\n\t}\n\n\t/* This element is focused using JavaScript so that it's being read out by screen readers\n\tor this reason we don't want to show the default outline or emphasise it visually using `govuk-focused-text`*/\n\t.pay-cookie-banner__confirmation:focus {\n\t outline: none;\n\t}\n\n\n\t.pay-cookie-banner__confirmation-message,\n\t.pay-cookie-banner__hide-button {\n\t\tdisplay: block;\n\t}\n\n\n\t@media (min-width: 48.0625em){\n\t\t.pay-cookie-banner__confirmation-message, \n\t\t.pay-cookie-banner__hide-button {\n\t\t display: inline-block;\n\t\t}\n\t}\n\n\t.pay-cookie-banner__confirmation-message {\n\t\tmargin-right: 20px;\n\t}\n\n\t@media (min-width: 48.0625em){\n\t\t.pay-cookie-banner__confirmation-message {\n\t\t\tmax-width: 90%;\n\t\t}\n\t}\n\n\t.pay-cookie-banner__hide-button {\n\t\tfont-family: \"GDS Transport\", Arial, sans-serif;\n\t\tfont-weight: 400;\n\t\tfont-size: 16px;\n\t\tfont-size: 1rem;\n\t\tline-height: 1.25;\n\t\tcolor: #1d70b8;\n\t\toutline: 0;\n\t\tborder: 0;\n\t\tbackground: none;\n\t\ttext-decoration: underline;\n\t\tpadding: 0;\n\t\tmargin-top: 10px;\n\t\tright: 15px;\n\t\tcursor: pointer;\n\t}\n\n\t@media (min-width: 40.0625em){\n\t\t.pay-cookie-banner__hide-button {\n\t\t\tfont-size: 19px;\n\t\t\tfont-size: 1.1875rem;\n\t\t\tline-height: 1.3157894737;\n\t\t}\n\t}\n</style>\n<div id=\"pay-cookie-banner\" class=\"pay-cookie-banner govuk-width-container\" data-module=\"pay-cookie-banner\" role=\"region\" aria-label=\"cookie banner\">\n\t<div class=\"pay-cookie-banner__wrapper\">\n\t\t<h2 class=\"pay-cookie-banner__heading govuk-heading-m\" id=\"pay-cookie-banner__heading\">\n\t\t\tCan we store analytics cookies on your device?\n\t\t</h2>\n\t\t<p class=\"govuk-body\">\n\t\t\tAnalytics cookies help us understand how our website is being used.\n\t\t</p>\n\t\t<div class=\"pay-cookie-banner__buttons\">\n\t\t\t<button class=\"govuk-button pay-cookie-banner__button pay-cookie-banner__button--accept\" type=\"submit\" data-accept-cookies=\"true\" aria-describedby=\"pay-cookie-banner__heading\">\n\t\t\t\tYes<span class=\"govuk-visually-hidden\">, GOV.UK Pay can store analytics cookies on your device</span>\n\t\t\t</button>\n\t\t\t<button class=\"govuk-button pay-cookie-banner__button pay-cookie-banner__button--reject\" type=\"submit\" data-accept-cookies=\"false\" aria-describedby=\"pay-cookie-banner__heading\">\n\t\t\t\tNo<span class=\"govuk-visually-hidden\">, GOV.UK Pay cannot store analytics cookies on your device</span>\n\t\t\t</button>\n\t\t\t<a class=\"govuk-link pay-cookie-banner__link\" href=\"https://www.payments.service.gov.uk/cookies\">How GOV.UK Pay uses cookies</a>\n\t\t</div>\n\t</div>\n\n\t<div class=\"pay-cookie-banner__confirmation\" tabindex=\"-1\">\n\t\t<p class=\"pay-cookie-banner__confirmation-message govuk-body\">\n\t\t\tYou can <a class=\"govuk-link\" href=\"https://www.payments.service.gov.uk/cookies/\">change your cookie settings</a> at any time.\n\t\t</p>\n\t\t<button class=\"pay-cookie-banner__hide-button govuk-link\" data-hide-cookie-banner=\"true\" role=\"link\">Hide</button>\n\t</div>\n</div>\n";
877
875
  var GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME = 'govuk_pay_cookie_policy';
878
876
  var ANALYTICS_CONSENT_BANNER_ID = 'pay-cookie-banner';
879
-
880
877
  function hasAnalyticsConsent() {
881
878
  var cookie = Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME);
882
879
  var parsed = cookie && JSON.parse(cookie);
883
880
  return Boolean(parsed) && parsed.analytics === true;
884
881
  }
885
-
886
882
  function getCookieDomain() {
887
883
  var PROD_HOSTNAME = 'payments.service.gov.uk';
888
-
889
884
  if (window.location.hostname.includes(PROD_HOSTNAME)) {
890
885
  return PROD_HOSTNAME;
891
886
  }
892
-
893
887
  return undefined;
894
888
  }
895
-
896
889
  function setAnalyticsCookie() {
897
890
  var userConsentedToAnalytics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
898
891
  var cookieValue = JSON.stringify({
@@ -905,19 +898,15 @@ function setAnalyticsCookie() {
905
898
  };
906
899
  Cookies.set(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME, cookieValue, cookieAttributes);
907
900
  }
908
-
909
901
  function hideBannerIfExists(event) {
910
902
  var banner = document.querySelector("#".concat(ANALYTICS_CONSENT_BANNER_ID));
911
-
912
903
  if (banner) {
913
904
  banner.style.display = 'none';
914
905
  }
915
-
916
906
  if (event.target) {
917
907
  event.preventDefault();
918
908
  }
919
909
  }
920
-
921
910
  function showConfirmationMessage(analyticsConsent) {
922
911
  var messagePrefix = analyticsConsent ? 'You’ve accepted analytics cookies.' : 'You told us not to use analytics cookies.';
923
912
  var $cookieBannerMainContent = document.querySelector('.pay-cookie-banner__wrapper');
@@ -927,17 +916,14 @@ function showConfirmationMessage(analyticsConsent) {
927
916
  var $cookieBannerConfirmationWrapper = document.querySelector('.pay-cookie-banner__confirmation');
928
917
  $cookieBannerConfirmationWrapper.style.display = 'block';
929
918
  }
930
-
931
919
  function acceptAnalyticsCookies() {
932
920
  setAnalyticsCookie(true);
933
921
  showConfirmationMessage(true);
934
922
  }
935
-
936
923
  function rejectAnalyticsCookies() {
937
924
  setAnalyticsCookie(false);
938
925
  showConfirmationMessage(false);
939
926
  }
940
-
941
927
  function createBannerHTMLElement() {
942
928
  var consentProvidedCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
943
929
  var banner = document.createElement('div');
@@ -945,39 +931,31 @@ function createBannerHTMLElement() {
945
931
  banner.innerHTML = template.trim();
946
932
  var acceptButton = banner.querySelector('button[data-accept-cookies=true]');
947
933
  var rejectButton = banner.querySelector('button[data-accept-cookies=false]');
948
-
949
934
  if (acceptButton && rejectButton) {
950
935
  acceptButton.addEventListener('click', acceptAnalyticsCookies);
951
936
  acceptButton.addEventListener('click', consentProvidedCallback);
952
937
  rejectButton.addEventListener('click', rejectAnalyticsCookies);
953
938
  }
954
-
955
939
  var hideCookieBannerLink = banner.querySelector('button[data-hide-cookie-banner]');
956
-
957
940
  if (hideCookieBannerLink) {
958
941
  hideCookieBannerLink.addEventListener('click', hideBannerIfExists);
959
942
  }
960
-
961
943
  return banner;
962
944
  }
945
+
963
946
  /**
964
947
  * ConsentProvidedCallback: function - generic callback that will be called
965
948
  * if and only if the user provides consent
966
949
  */
967
-
968
-
969
950
  function showBannerIfConsentNotSet() {
970
951
  var consentProvidedCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
971
952
  var consentCookieNotSet = !Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME);
972
953
  var banner = document.querySelector("#".concat(ANALYTICS_CONSENT_BANNER_ID));
973
-
974
954
  if (consentCookieNotSet && !banner) {
975
955
  var _banner = createBannerHTMLElement(consentProvidedCallback);
976
-
977
956
  document.body.prepend(_banner);
978
957
  }
979
958
  }
980
-
981
959
  module.exports = {
982
960
  hasAnalyticsConsent: hasAnalyticsConsent,
983
961
  showBannerIfConsentNotSet: showBannerIfConsentNotSet
@@ -987,7 +965,6 @@ module.exports = {
987
965
  "use strict";
988
966
 
989
967
  var cookies = require('./cookies/validate');
990
-
991
968
  window.GovUkPay = {
992
969
  cookies: cookies
993
970
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var cookies = require('./cookies/validate');
4
-
5
4
  window.GovUkPay = {
6
5
  cookies: cookies
7
6
  };
@@ -1,10 +1,10 @@
1
- 'use strict'; // NPM Dependencies
2
-
3
- var every = require('lodash/every'); // Local Dependencies
1
+ 'use strict';
4
2
 
3
+ // NPM Dependencies
4
+ var every = require('lodash/every');
5
5
 
6
+ // Local Dependencies
6
7
  var checks = require('../../utils/field-validation-checks');
7
-
8
8
  exports.enableFieldValidation = function () {
9
9
  var allForms = Array.prototype.slice.call(document.getElementsByTagName('form'));
10
10
  allForms.filter(function (form) {
@@ -13,7 +13,6 @@ exports.enableFieldValidation = function () {
13
13
  return form.addEventListener('submit', initValidation, false);
14
14
  });
15
15
  };
16
-
17
16
  function initValidation(e) {
18
17
  var form = e.target;
19
18
  e.preventDefault();
@@ -21,14 +20,12 @@ function initValidation(e) {
21
20
  var validatedFields = findFields(form).map(function (field) {
22
21
  return validateField(form, field);
23
22
  });
24
-
25
23
  if (every(validatedFields)) {
26
24
  form.submit();
27
25
  } else {
28
26
  populateErrorSummary(form);
29
27
  }
30
28
  }
31
-
32
29
  function clearPreviousErrors() {
33
30
  var previousErrorsMessages = Array.prototype.slice.call(document.querySelectorAll('.error-message, .error-summary'));
34
31
  var previousErrorsFields = Array.prototype.slice.call(document.querySelectorAll('.form-group.error'));
@@ -39,14 +36,12 @@ function clearPreviousErrors() {
39
36
  return errorField.classList.remove('error');
40
37
  });
41
38
  }
42
-
43
39
  function findFields(form) {
44
40
  var formFields = Array.prototype.slice.call(form.querySelectorAll('input, textarea, select'));
45
41
  return formFields.filter(function (field) {
46
42
  return field.hasAttribute('data-validate');
47
43
  });
48
44
  }
49
-
50
45
  function validateField(form, field) {
51
46
  var result;
52
47
  var validationTypes = field.getAttribute('data-validate').split(' ');
@@ -55,60 +50,47 @@ function validateField(form, field) {
55
50
  case 'required':
56
51
  result = checks.isEmpty(field.value);
57
52
  break;
58
-
59
53
  case 'currency':
60
54
  result = checks.isCurrency(field.value);
61
55
  break;
62
-
63
56
  case 'email':
64
57
  result = checks.isValidEmail(field.value);
65
58
  break;
66
-
67
59
  case 'phone':
68
60
  result = checks.isPhoneNumber(field.value);
69
61
  break;
70
-
71
62
  case 'https':
72
63
  result = checks.isHttps(field.value);
73
64
  break;
74
-
75
65
  case 'belowMaxAmount':
76
66
  result = checks.isAboveMaxAmount(field.value);
77
67
  break;
78
-
79
68
  case 'passwordLessThanTenChars':
80
69
  result = checks.isPasswordLessThanTenChars(field.value);
81
70
  break;
82
-
83
71
  case 'isFieldGreaterThanMaxLengthChars':
84
72
  result = checks.isFieldGreaterThanMaxLengthChars(field.value, field.getAttribute('data-validate-max-length'));
85
73
  break;
86
-
87
74
  case 'isNaxsiSafe':
88
75
  result = checks.isNaxsiSafe(field.value);
89
76
  break;
90
-
91
77
  default:
92
78
  result = false;
93
79
  break;
94
80
  }
95
-
96
81
  if (result) {
97
82
  applyErrorMessaging(form, field, result);
98
83
  }
99
84
  });
100
85
  return !field.closest('.form-group').classList.contains('error');
101
86
  }
102
-
103
87
  function applyErrorMessaging(form, field, result) {
104
88
  var formGroup = field.closest('.form-group');
105
-
106
89
  if (!formGroup.classList.contains('error')) {
107
90
  formGroup.classList.add('error');
108
91
  document.querySelector('label[for="' + field.id + '"]').insertAdjacentHTML('beforeend', '<span class="error-message">' + result + '</span>');
109
92
  }
110
93
  }
111
-
112
94
  function populateErrorSummary(form) {
113
95
  var erroringFields = Array.prototype.slice.call(form.querySelectorAll('.form-group.error label'));
114
96
  var errorMessages = erroringFields.map(function (field) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
+
2
3
  /*
3
4
  Metadata Column constants match up those defined:
4
5
  https://github.com/alphagov/pay-java-commons/blob/master/model/src/main/java/uk/gov/pay/commons/model/charge/ExternalMetadata.java
5
6
  */
6
-
7
7
  module.exports = {
8
8
  externalMetadata: {
9
9
  MAX_KEY_VALUE_PAIRS: 10,
package/lib/index.js CHANGED
@@ -1,23 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  var browsered = require('./browsered');
4
-
5
4
  var utils = require('./utils');
6
-
7
5
  var nunjucksFilters = require('./nunjucks-filters');
8
-
9
6
  var logging = require('./logging');
7
+ var constants = require('./constants');
10
8
 
11
- var constants = require('./constants'); // Add to window.GOVUKPAY if in browser context
12
-
13
-
9
+ // Add to window.GOVUKPAY if in browser context
14
10
  if (typeof window !== 'undefined') {
15
11
  window.GOVUKPAY = window.GOVUKPAY || {};
16
12
  window.GOVUKPAY = {
17
13
  browsered: browsered
18
14
  };
19
15
  }
20
-
21
16
  module.exports = {
22
17
  browsered: browsered,
23
18
  utils: utils,
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _require = require('winston'),
4
- format = _require.format;
5
-
4
+ format = _require.format;
6
5
  var govUkPayLoggingFormat = format(function (info, opts) {
7
6
  info['@timestamp'] = new Date().toISOString();
8
7
  info['@version'] = 1;
@@ -1,12 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var keys = require('./keys');
4
-
5
4
  var _require = require('./format'),
6
- govUkPayLoggingFormat = _require.govUkPayLoggingFormat;
7
-
5
+ govUkPayLoggingFormat = _require.govUkPayLoggingFormat;
8
6
  var requestLogFormat = require('./request-log-format');
9
-
10
7
  module.exports = {
11
8
  govUkPayLoggingFormat: govUkPayLoggingFormat,
12
9
  keys: keys,
@@ -1,75 +1,108 @@
1
- 'use strict'; // This file needs to be kept in sync with its Java consociate
1
+ 'use strict';
2
+
3
+ // This file needs to be kept in sync with its Java consociate
2
4
  // https://github.com/alphagov/pay-java-commons/blob/master/logging/src/main/java/uk/gov/pay/logging/LoggingKeys.java
5
+
3
6
  // "card", "Direct Debit"
7
+ exports.PAYMENT_TYPE = 'payment_type';
4
8
 
5
- exports.PAYMENT_TYPE = 'payment_type'; // "payment", "mandate", "refund"
9
+ // "payment", "mandate", "refund"
10
+ exports.RESOURCE_TYPE = 'resource_type';
6
11
 
7
- exports.RESOURCE_TYPE = 'resource_type'; // "sandbox", "Worldpay", "Smartpay", "ePDQ", "Stripe", "GoCardless"
12
+ // "sandbox", "Worldpay", "Smartpay", "ePDQ", "Stripe", "GoCardless"
13
+ exports.PROVIDER = 'provider';
8
14
 
9
- exports.PROVIDER = 'provider'; // The digital wallet used for a payment
15
+ // The digital wallet used for a payment
10
16
  // Value must be a value of the WalletType enum
11
17
  // https://github.com/alphagov/pay-connector/blob/master/src/main/java/uk/gov/pay/connector/wallets/WalletType.java
18
+ exports.WALLET = 'wallet';
12
19
 
13
- exports.WALLET = 'wallet'; // The type of a gateway account
20
+ // The type of a gateway account
14
21
  // Value must be a value of the GatewayAccountEntity.Type enum
15
22
  // https://github.com/alphagov/pay-connector/blob/master/src/main/java/uk/gov/pay/connector/gatewayaccount/model/GatewayAccountEntity.java
23
+ exports.GATEWAY_ACCOUNT_TYPE = 'gateway_account_type';
16
24
 
17
- exports.GATEWAY_ACCOUNT_TYPE = 'gateway_account_type'; // The type of operation being performed with a gateway for a card payment
25
+ // The type of operation being performed with a gateway for a card payment
18
26
  // Value must be a value of the OperationType enum
19
27
  // https://github.com/alphagov/pay-connector/blob/master/src/main/java/uk/gov/pay/connector/paymentprocessor/model/OperationType.java
28
+ exports.GATEWAY_CARD_OPERATION = 'gateway_card_operation';
20
29
 
21
- exports.GATEWAY_CARD_OPERATION = 'gateway_card_operation'; // The amount of a payment in pence
30
+ // The amount of a payment in pence
31
+ exports.AMOUNT = 'amount';
22
32
 
23
- exports.AMOUNT = 'amount'; // Mandate external id
33
+ // Mandate external id
34
+ exports.MANDATE_EXTERNAL_ID = 'mandate_external_id';
24
35
 
25
- exports.MANDATE_EXTERNAL_ID = 'mandate_external_id'; // The PSP's identifier for a payment
36
+ // The PSP's identifier for a payment
37
+ exports.PROVIDER_PAYMENT_ID = 'provider_payment_id';
26
38
 
27
- exports.PROVIDER_PAYMENT_ID = 'provider_payment_id'; // The ID a provider gives to an event (e.g. one in a notification)
39
+ // The ID a provider gives to an event (e.g. one in a notification)
40
+ exports.PROVIDER_EVENT_ID = 'provider_event_id';
28
41
 
29
- exports.PROVIDER_EVENT_ID = 'provider_event_id'; // The reference a partner service assigns to a payment, mandate etc.
42
+ // The reference a partner service assigns to a payment, mandate etc.
43
+ exports.SERVICE_PAYMENT_REFERENCE = 'service_reference';
30
44
 
31
- exports.SERVICE_PAYMENT_REFERENCE = 'service_reference'; // The ID GOV.UK Pay gives to a gateway account
45
+ // The ID GOV.UK Pay gives to a gateway account
46
+ exports.GATEWAY_ACCOUNT_ID = 'gateway_account_id';
32
47
 
33
- exports.GATEWAY_ACCOUNT_ID = 'gateway_account_id'; // The ID of an event emitted to ledger
48
+ // The ID of an event emitted to ledger
49
+ exports.LEDGER_EVENT_ID = 'ledger_event_id';
34
50
 
35
- exports.LEDGER_EVENT_ID = 'ledger_event_id'; // The type of an event emitted to ledger
51
+ // The type of an event emitted to ledger
52
+ exports.LEDGER_EVENT_TYPE = 'ledger_event_type';
36
53
 
37
- exports.LEDGER_EVENT_TYPE = 'ledger_event_type'; // The type of an internal event recorded by Direct Debit
54
+ // The type of an internal event recorded by Direct Debit
38
55
  // Value must be a value from the GovUkPayEventType enum
39
56
  // https://github.com/alphagov/pay-direct-debit-connector/blob/master/src/main/java/uk/gov/pay/directdebit/events/model/GovUkPayEventType.java
57
+ exports.DIRECT_DEBIT_INTERNAL_EVENT_TYPE = 'direct_debit_internal_event_type';
40
58
 
41
- exports.DIRECT_DEBIT_INTERNAL_EVENT_TYPE = 'direct_debit_internal_event_type'; // The current (or new if transitioning) internal state of a payment, mandate etc.
42
-
43
- exports.CURRENT_INTERNAL_STATE = 'current_internal_state'; // The previous internal state of a payment, mandate etc. when transitioning
59
+ // The current (or new if transitioning) internal state of a payment, mandate etc.
60
+ exports.CURRENT_INTERNAL_STATE = 'current_internal_state';
44
61
 
45
- exports.PREVIOUS_INTERNAL_STATUS = 'previous_internal_status'; // The last event (status) that Worldpay recorded for a payment, refund etc.
62
+ // The previous internal state of a payment, mandate etc. when transitioning
63
+ exports.PREVIOUS_INTERNAL_STATUS = 'previous_internal_status';
46
64
 
47
- exports.WORLDPAY_LAST_EVENT = 'worldpay_last_event'; // The result code (status) that Smartpay recorded for a payment, refund etc.
65
+ // The last event (status) that Worldpay recorded for a payment, refund etc.
66
+ exports.WORLDPAY_LAST_EVENT = 'worldpay_last_event';
48
67
 
49
- exports.SMARTPAY_RESULT_CODE = 'smartpay_result_code'; // The status code that ePDQ recorded for a payment, refund etc.
68
+ // The result code (status) that Smartpay recorded for a payment, refund etc.
69
+ exports.SMARTPAY_RESULT_CODE = 'smartpay_result_code';
50
70
 
51
- exports.EPDQ_STATUS = 'epdq_status'; // The status that Stripe recorded for a payment, refund etc.
71
+ // The status code that ePDQ recorded for a payment, refund etc.
72
+ exports.EPDQ_STATUS = 'epdq_status';
52
73
 
53
- exports.STRIPE_STATUS = 'stripe_status'; // The action that GoCardless recorded for a payment, mandate etc.
74
+ // The status that Stripe recorded for a payment, refund etc.
75
+ exports.STRIPE_STATUS = 'stripe_status';
54
76
 
55
- exports.GOCARDLESS_PAYMENT_ACTION = 'gocardless_action'; // The HTTP status we sent to a client
77
+ // The action that GoCardless recorded for a payment, mandate etc.
78
+ exports.GOCARDLESS_PAYMENT_ACTION = 'gocardless_action';
56
79
 
57
- exports.HTTP_STATUS = 'http_status'; // The HTTP status code we received from a remote server (e.g. a payment provider)
80
+ // The HTTP status we sent to a client
81
+ exports.HTTP_STATUS = 'http_status';
58
82
 
59
- exports.REMOTE_HTTP_STATUS = 'remote_http_status'; // AWS error code
83
+ // The HTTP status code we received from a remote server (e.g. a payment provider)
84
+ exports.REMOTE_HTTP_STATUS = 'remote_http_status';
60
85
 
61
- exports.AWS_ERROR_CODE = 'aws_error_code'; // The correlation id for the request
86
+ // AWS error code
87
+ exports.AWS_ERROR_CODE = 'aws_error_code';
62
88
 
63
- exports.CORRELATION_ID = 'x_request_id'; // Payment External Id
89
+ // The correlation id for the request
90
+ exports.CORRELATION_ID = 'x_request_id';
64
91
 
65
- exports.PAYMENT_EXTERNAL_ID = 'payment_external_id'; // Refund External Id
92
+ // Payment External Id
93
+ exports.PAYMENT_EXTERNAL_ID = 'payment_external_id';
66
94
 
67
- exports.REFUND_EXTERNAL_ID = 'refund_external_id'; // Secure Token
95
+ // Refund External Id
96
+ exports.REFUND_EXTERNAL_ID = 'refund_external_id';
68
97
 
69
- exports.SECURE_TOKEN = 'secure_token'; // User external id
98
+ // Secure Token
99
+ exports.SECURE_TOKEN = 'secure_token';
70
100
 
71
- exports.USER_EXTERNAL_ID = 'user_external_id'; // A service's external id
101
+ // User external id
102
+ exports.USER_EXTERNAL_ID = 'user_external_id';
72
103
 
73
- exports.SERVICE_EXTERNAL_ID = 'service_external_id'; // product external id
104
+ // A service's external id
105
+ exports.SERVICE_EXTERNAL_ID = 'service_external_id';
74
106
 
107
+ // product external id
75
108
  exports.PRODUCT_EXTERNAL_ID = 'product_external_id';
@@ -2,7 +2,6 @@
2
2
 
3
3
  module.exports = function () {
4
4
  var correlationIdHeader = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'x-request-id';
5
-
6
5
  var format = function format(tokens, req, res) {
7
6
  return JSON.stringify({
8
7
  /* eslint-disable camelcase */
@@ -18,7 +17,6 @@ module.exports = function () {
18
17
  response_time: "".concat(tokens['response-time'](req, res), " ms"),
19
18
  x_request_id: tokens.req(req, res, correlationIdHeader)
20
19
  /* eslint-enable camelcase */
21
-
22
20
  });
23
21
  };
24
22
 
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _require = require('../utils/countries'),
4
- translateAlpha2 = _require.translateAlpha2;
5
-
4
+ translateAlpha2 = _require.translateAlpha2;
6
5
  module.exports = function (iso) {
7
6
  return translateAlpha2(iso);
8
7
  };
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var moment = require('moment-timezone');
4
-
5
4
  module.exports = function (isoTimeString, format) {
6
5
  var formatString = 'D MMMM YYYY h:mm:ssa z';
7
-
8
6
  if (format === 'date') {
9
7
  formatString = 'DD/MM/YYYY';
10
8
  } else if (format === 'datelong') {
@@ -12,6 +10,5 @@ module.exports = function (isoTimeString, format) {
12
10
  } else if (format === 'time') {
13
11
  formatString = 'HH:mm:ss';
14
12
  }
15
-
16
13
  return moment(isoTimeString).tz('Europe/London').format(formatString);
17
14
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  // Removes indefinite articles (a/an)
4
4
  // Removes definite articles (the)
5
+
5
6
  module.exports = function (string) {
6
7
  return string.replace(/\ba\s|\ban\s|\bthe\s/gi, '');
7
8
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var slugify = require('slugify');
4
-
5
4
  module.exports = function (string) {
6
5
  slugify.extend({
7
6
  ŵ: 'w',
@@ -1,18 +1,17 @@
1
- 'use strict'; // NPM Dependencies
2
-
3
- var lodash = require('lodash'); // Local Dependencies
1
+ 'use strict';
4
2
 
3
+ // NPM Dependencies
4
+ var lodash = require('lodash');
5
5
 
6
+ // Local Dependencies
6
7
  var countries = require('../data/countries.json');
8
+ var extensions = require('../data/country-record-extension.json');
7
9
 
8
- var extensions = require('../data/country-record-extension.json'); // Merge the additional data into the register data
9
-
10
-
10
+ // Merge the additional data into the register data
11
11
  countries.forEach(function (country) {
12
12
  var extension = extensions.find(function (item) {
13
13
  return item.country === country;
14
14
  });
15
-
16
15
  if (extension) {
17
16
  country.entry.aliases = extension.aliases;
18
17
  country.entry.weighting = extension.weighting;
@@ -21,8 +20,9 @@ countries.forEach(function (country) {
21
20
  countries = lodash.compact(countries);
22
21
  countries = lodash.sortBy(countries, function (country) {
23
22
  return country.entry.name.toLowerCase();
24
- }); // Exports
23
+ });
25
24
 
25
+ // Exports
26
26
  exports.retrieveCountries = function (selectedCountry) {
27
27
  var countriesList = lodash.clone(countries);
28
28
  countriesList.forEach(function (country) {
@@ -30,7 +30,6 @@ exports.retrieveCountries = function (selectedCountry) {
30
30
  });
31
31
  return countriesList;
32
32
  };
33
-
34
33
  exports.govukFrontendFormatted = function (selectedCountry) {
35
34
  var countriesList = lodash.clone(countries);
36
35
  countriesList.forEach(function (country) {
@@ -40,7 +39,6 @@ exports.govukFrontendFormatted = function (selectedCountry) {
40
39
  });
41
40
  return countriesList;
42
41
  };
43
-
44
42
  exports.translateAlpha2 = function (alpha2Code) {
45
43
  return countries.find(function (country) {
46
44
  return country.entry.country === alpha2Code;
@@ -1,44 +1,36 @@
1
- 'use strict'; // Local contants
1
+ 'use strict';
2
2
 
3
+ // Local contants
3
4
  var AMOUNT_FORMAT = /^(\d+)(?:\.(\d{1,2}))?$/;
4
-
5
5
  var penceToPounds = function penceToPounds(amount) {
6
6
  return (amount / 100).toFixed(2);
7
7
  };
8
-
9
8
  var poundsToPence = function poundsToPence(amount) {
10
9
  return (amount * 100).toFixed(0);
11
10
  };
12
-
13
11
  var penceToPoundsWithCurrency = function penceToPoundsWithCurrency(amount) {
14
12
  return new Intl.NumberFormat('en-gb', {
15
13
  style: 'currency',
16
14
  currency: 'GBP'
17
15
  }).format(penceToPounds(amount));
18
16
  };
19
-
20
17
  var sanitisePoundsAndPenceInput = function sanitisePoundsAndPenceInput(amount) {
21
18
  if (amount) {
22
19
  var cleanedCurrencyString = amount.replace(/[^0-9.-]+/g, '');
23
20
  var result = AMOUNT_FORMAT.exec(cleanedCurrencyString);
24
-
25
21
  if (result) {
26
22
  var pounds = result[1];
27
23
  var pence = result[2];
28
-
29
24
  if (pence === undefined) {
30
25
  pence = '00';
31
26
  } else if (pence.length === 1) {
32
27
  pence += '0';
33
28
  }
34
-
35
29
  return parseInt(pounds + pence, 10);
36
30
  }
37
-
38
31
  return null;
39
32
  }
40
33
  };
41
-
42
34
  module.exports = {
43
35
  penceToPounds: penceToPounds,
44
36
  poundsToPence: poundsToPence,
@@ -1,11 +1,12 @@
1
- 'use strict'; // NPM dependencies
1
+ 'use strict';
2
2
 
3
- var parseInt = require('lodash/parseInt'); // Local dependencies
4
-
5
-
6
- var emailValidator = require('./is-valid-email'); // Constants
3
+ // NPM dependencies
4
+ var parseInt = require('lodash/parseInt');
7
5
 
6
+ // Local dependencies
7
+ var emailValidator = require('./is-valid-email');
8
8
 
9
+ // Constants
9
10
  var NUMBERS_ONLY = /^\d+$/;
10
11
  var MAX_AMOUNT = 100000;
11
12
  var validationErrors = {
@@ -19,70 +20,53 @@ var validationErrors = {
19
20
  isGreaterThanMaxLengthChars: 'The text is too long',
20
21
  invalidCharacters: 'You cannot use any of the following characters < > ; : ` ( ) " \' = | , ~ [ ]'
21
22
  };
22
-
23
23
  exports.isEmpty = function (value) {
24
24
  if (value === '') {
25
25
  return validationErrors.required;
26
26
  }
27
-
28
27
  return false;
29
28
  };
30
-
31
29
  exports.isCurrency = function (value) {
32
30
  if (!/^(\d+)(?:\.(\d{1,2}))?$/.test(value)) {
33
31
  return validationErrors.currency;
34
32
  }
35
-
36
33
  return false;
37
34
  };
38
-
39
35
  exports.isValidEmail = function (value) {
40
36
  if (!emailValidator(value)) {
41
37
  return validationErrors.validEmail;
42
38
  }
43
-
44
39
  return false;
45
40
  };
46
-
47
41
  exports.isPhoneNumber = function (value) {
48
42
  var trimmedTelephoneNumber = value.replace(/\s/g, '');
49
-
50
43
  if (trimmedTelephoneNumber.length < 11 || !NUMBERS_ONLY.test(trimmedTelephoneNumber)) {
51
44
  return validationErrors.phoneNumber;
52
45
  }
53
-
54
46
  return false;
55
47
  };
56
-
57
48
  exports.isHttps = function (value) {
58
49
  if (value.substr(0, 8) !== 'https://') {
59
50
  return validationErrors.isHttps;
60
51
  }
61
-
62
52
  return false;
63
53
  };
64
-
65
54
  exports.isAboveMaxAmount = function (value) {
66
55
  if (!exports.isCurrency(value) && parseFloat(value) > MAX_AMOUNT) {
67
56
  return validationErrors.isAboveMaxAmount;
68
57
  }
69
-
70
58
  return false;
71
59
  };
72
-
73
60
  exports.isFieldGreaterThanMaxLengthChars = function (value, maxLength) {
74
61
  var parsedMaxLength = parseInt(maxLength);
75
62
  return parsedMaxLength && value.length > parsedMaxLength ? validationErrors.isGreaterThanMaxLengthChars : false;
76
63
  };
77
-
78
64
  exports.isPasswordLessThanTenChars = function (value) {
79
65
  return !value || value.length < 10 ? validationErrors.isPasswordLessThanTenChars : false;
80
66
  };
81
-
82
67
  exports.isNaxsiSafe = function (value) {
83
68
  if (/[<>;:`()"'=|,~[\]]+/g.test(value)) {
84
69
  return validationErrors.invalidCharacters;
85
70
  }
86
-
87
71
  return false;
88
72
  };
@@ -1,12 +1,11 @@
1
- 'use strict'; // NPM dependencies
1
+ 'use strict';
2
2
 
3
+ // NPM dependencies
3
4
  var rfc822Validator = require('rfc822-validate');
4
-
5
5
  module.exports = function (email) {
6
6
  if (rfc822Validator(email)) {
7
7
  var domain = email.split('@')[1];
8
8
  return !(domain && domain.indexOf('.') === -1);
9
9
  }
10
-
11
10
  return false;
12
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/pay-js-commons",
3
- "version": "3.8.6",
3
+ "version": "3.8.8",
4
4
  "description": "Reusable js scripts for GOV.UK Pay Node.js projects",
5
5
  "engines": {
6
6
  "node": "^16.14.0"
@@ -111,10 +111,10 @@
111
111
  "chai": "^4.2.0",
112
112
  "eslint-plugin-import": "^2.18.0",
113
113
  "eslint-plugin-promise": "^6.0.0",
114
- "jest": "^27.0.1",
115
- "jest-environment-jsdom": "^27.0.1",
114
+ "jest": "^29.4.3",
115
+ "jest-environment-jsdom": "^29.4.3",
116
116
  "js-cookie": "^3.0.0",
117
- "jsdom": "^20.0.1",
117
+ "jsdom": "^21.1.1",
118
118
  "jsdom-global": "^3.0.2",
119
119
  "karma": "^6.0.0",
120
120
  "karma-browserify": "^8.0.0",
@@ -135,9 +135,9 @@
135
135
  },
136
136
  "dependencies": {
137
137
  "lodash": "4.17.21",
138
- "moment-timezone": "0.5.40",
138
+ "moment-timezone": "0.5.42",
139
139
  "rfc822-validate": "1.0.0",
140
- "slugify": "1.6.5",
140
+ "slugify": "1.6.6",
141
141
  "winston": "3.8.2"
142
142
  }
143
143
  }
@@ -0,0 +1,62 @@
1
+ $govuk-font-family: -apple-system,BlinkMacSystemFont,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif; // Override font as so not to use New Transport
2
+ @import "application";
3
+
4
+ // CUSTOM BRANDING
5
+ // Use the variables below to control the style
6
+ // Make sure banner colours meet minimum colour contrast levels
7
+
8
+ $custom-banner-colour: #0c1975;
9
+ $custom-banner-border-colour: #ffffff;
10
+ $custom-text-colour: #ffffff;
11
+ $logo-image-height: 3.5em;
12
+
13
+ .custom-branding {
14
+ @if $logo-image-height != null {
15
+ .custom-branding-image {
16
+ max-height: $logo-image-height;
17
+
18
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
19
+ width: 100%;
20
+ }
21
+ }
22
+ }
23
+
24
+ .govuk-header {
25
+ background-color: $custom-banner-colour;
26
+ }
27
+
28
+ .govuk-header__link{
29
+ &:link,
30
+ &:visited {
31
+ color: $custom-text-colour;
32
+ }
33
+ }
34
+
35
+ .govuk-header__link--homepage{
36
+ &:hover {
37
+ margin-bottom: 0;
38
+ border-bottom: inherit;
39
+ }
40
+ }
41
+
42
+ .govuk-header__link--service-name {
43
+ color: $custom-text-colour;
44
+ }
45
+
46
+ .govuk-header__container {
47
+ border-bottom-color: $custom-banner-border-colour;
48
+ }
49
+
50
+ @include govuk-media-query($from: tablet) {
51
+ .govuk-header__content {
52
+ width: 66%;
53
+ vertical-align: bottom;
54
+ margin-bottom: 7px;
55
+ }
56
+ }
57
+
58
+ .govuk-button {
59
+ padding: 7px 15px 6px;
60
+ padding: .368421053em .842105263em .315789474em;
61
+ }
62
+ }
@@ -0,0 +1,55 @@
1
+ $govuk-font-family: -apple-system,BlinkMacSystemFont,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif; // Override font as so not to use New Transport
2
+ @import "application";
3
+
4
+ // CUSTOM BRANDING
5
+ // Use the variables below to control the style
6
+ // Make sure banner colours meet minimum colour contrast levels
7
+
8
+ $custom-banner-colour: #102B66;
9
+ $custom-banner-border-colour: #FBBC1B;
10
+ $custom-text-colour: #ffffff;
11
+ $logo-image-height: 2em;
12
+
13
+ .custom-branding {
14
+ @if $logo-image-height != null {
15
+ .custom-branding-image {
16
+ max-height: $logo-image-height;
17
+
18
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
19
+ width: 100%;
20
+ }
21
+ }
22
+ }
23
+
24
+ .govuk-header {
25
+ background-color: $custom-banner-colour;
26
+ }
27
+
28
+ .govuk-header__link{
29
+ &:link,
30
+ &:visited {
31
+ color: $custom-text-colour;
32
+ }
33
+ }
34
+
35
+ .govuk-header__link--service-name {
36
+ color: $custom-text-colour;
37
+ }
38
+
39
+ .govuk-header__container {
40
+ border-bottom-color: $custom-banner-border-colour;
41
+ }
42
+
43
+ @include govuk-media-query($from: tablet) {
44
+ .govuk-header__content {
45
+ width: 66%;
46
+ vertical-align: bottom;
47
+ margin-bottom: 7px;
48
+ }
49
+ }
50
+
51
+ .govuk-button {
52
+ padding: 7px 15px 6px;
53
+ padding: .368421053em .842105263em .315789474em;
54
+ }
55
+ }
package/.idea/aws.xml DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="accountSettings">
4
- <option name="activeRegion" value="eu-west-1" />
5
- <option name="recentlyUsedRegions">
6
- <list>
7
- <option value="eu-west-1" />
8
- </list>
9
- </option>
10
- </component>
11
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JpaBuddyIdeaProjectConfig">
4
- <option name="renamerInitialized" value="true" />
5
- </component>
6
- </project>