@govuk-pay/pay-js-commons 3.8.7 → 3.8.9
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/.github/workflows/run-tests.yml +3 -3
- package/.idea/sonarlint/issuestore/index.pb +0 -20
- package/images/custom/gwent-police.png +0 -0
- package/images/custom/wealden-white.svg +1 -0
- package/lib/analytics/cookies/validate.js +1 -24
- package/lib/analytics/dist/cookies.js +1 -24
- package/lib/analytics/index.js +0 -1
- package/lib/browsered/field-validation/field-validation.js +4 -22
- package/lib/constants/index.js +1 -1
- package/lib/index.js +2 -7
- package/lib/logging/format.js +1 -2
- package/lib/logging/index.js +1 -4
- package/lib/logging/keys.js +66 -33
- package/lib/logging/request-log-format.js +0 -2
- package/lib/nunjucks-filters/country-iso-to-name.js +1 -2
- package/lib/nunjucks-filters/datetime.js +0 -3
- package/lib/nunjucks-filters/remove-indefinite-articles.js +1 -0
- package/lib/nunjucks-filters/slugify.js +0 -1
- package/lib/utils/countries.js +8 -10
- package/lib/utils/currency-formatter.js +2 -10
- package/lib/utils/field-validation-checks.js +6 -22
- package/lib/utils/is-valid-email.js +2 -3
- package/package.json +4 -4
- package/sass/custom/gwent-police.scss +55 -0
- package/sass/custom/wealden.scss +62 -0
- package/.idea/sonarlint/issuestore/2/c/2c2e25e54af134656f786492369f2d309af6fc5d +0 -0
- package/.idea/sonarlint/issuestore/2/d/2d83766dd283a47d86fda16cefdc1d9ff0e10ebf +0 -0
- package/.idea/sonarlint/issuestore/4/6/4618075fb32da882b46f5fa15732392152d50ecb +0 -0
- package/.idea/sonarlint/issuestore/7/2/72f6352a42775f83fdc03e7894ace532dbb6f517 +0 -0
- package/.idea/sonarlint/issuestore/b/3/b32d76c4339f54eb551e11b44e4442dba06ab61e +0 -0
- package/.idea/sonarlint/issuestore/c/5/c5befeaa8e93d7c83f1cc31a8d2813217dcdb78a +0 -0
- package/.idea/sonarlint/issuestore/c/8/c8effc650c46f8b8849324e542704a2a4590fda1 +0 -0
- package/.idea/sonarlint/issuestore/f/a/fa288d1472d29beccb489a676f68739ad365fc47 +0 -0
- package/.idea/sonarlint/issuestore/f/c/fce3b30bccc478e9ebb36570f32eb3de1e4205cf +0 -0
- /package/.idea/sonarlint/{issuestore/0/a/0ab90bbd755fb821ff9a7a389d27ecf24fde7721 → securityhotspotstore/index.pb} +0 -0
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
runs-on: ubuntu-latest
|
|
15
15
|
steps:
|
|
16
16
|
- name: Git checkout
|
|
17
|
-
uses: actions/checkout@
|
|
17
|
+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
18
18
|
- name: Detect secrets
|
|
19
19
|
uses: alphagov/pay-ci/actions/detect-secrets@master
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
|
|
25
25
|
steps:
|
|
26
26
|
- name: Checkout
|
|
27
|
-
uses: actions/checkout@
|
|
27
|
+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
28
28
|
- name: Parse Node version
|
|
29
29
|
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
|
|
30
30
|
id: parse-node-version
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
with:
|
|
34
34
|
node-version: "${{ steps.parse-node-version.outputs.NVMRC }}"
|
|
35
35
|
- name: Cache NPM packages
|
|
36
|
-
uses: actions/cache@
|
|
36
|
+
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
|
37
37
|
with:
|
|
38
38
|
path: ~/.npm
|
|
39
39
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
A
|
|
3
|
-
package-lock.json,f/a/fa288d1472d29beccb489a676f68739ad365fc47
|
|
4
2
|
F
|
|
5
3
|
src/browsered/index.js,8/1/8136864071632c6a6005186e654fffb6c71ab55c
|
|
6
4
|
`
|
|
@@ -30,11 +28,7 @@ h
|
|
|
30
28
|
q
|
|
31
29
|
Asass/custom/guys-and-st-thomas-nhs-foundation-trust-nhs-care.scss,6/6/66d847400b1fd796f14ab3b04c1c578a7266cde3
|
|
32
30
|
D
|
|
33
|
-
sass/custom/hiw.scss,c/8/c8effc650c46f8b8849324e542704a2a4590fda1
|
|
34
|
-
D
|
|
35
31
|
sass/custom/kcc.scss,b/9/b9ccc38dcaeab6f307ef082a1949fb667086e1d4
|
|
36
|
-
I
|
|
37
|
-
sass/custom/kingston.scss,4/6/4618075fb32da882b46f5fa15732392152d50ecb
|
|
38
32
|
E
|
|
39
33
|
sass/custom/lbbd.scss,1/b/1b953f6fcfc364492f8d5a0320de136123cf5e7b
|
|
40
34
|
S
|
|
@@ -49,8 +43,6 @@ E
|
|
|
49
43
|
sass/custom/mhra.scss,7/f/7f9487bbbd0beaa9bb22a2869949b73f98bcb381
|
|
50
44
|
K
|
|
51
45
|
sass/custom/mhra-black.scss,3/f/3f1338f565197b8d3fae4ce389ffcf4781c0940a
|
|
52
|
-
\
|
|
53
|
-
,sass/custom/ministry-of-defence-dbs-fps.scss,7/2/72f6352a42775f83fdc03e7894ace532dbb6f517
|
|
54
46
|
T
|
|
55
47
|
$sass/custom/national-museums-ni.scss,6/f/6facc008124fe02a29743441c6504e92d6552fa4
|
|
56
48
|
Z
|
|
@@ -67,20 +59,12 @@ f
|
|
|
67
59
|
6sass/custom/nottingham-university-hospitals-trust.scss,b/8/b8c547eabe39aba372c866c1536d31bb75113eae
|
|
68
60
|
i
|
|
69
61
|
9sass/custom/planning-and-building-services-edinburgh.scss,a/c/ac144cdcf526351c17f77f4845a5e6d0c46c5420
|
|
70
|
-
K
|
|
71
|
-
sass/custom/portsmouth.scss,2/d/2d83766dd283a47d86fda16cefdc1d9ff0e10ebf
|
|
72
62
|
Y
|
|
73
63
|
)sass/custom/social-security-scotland.scss,7/4/74f3a79eac0dbec82b9a27402e12d0073e08a5f8
|
|
74
64
|
]
|
|
75
65
|
-sass/custom/scottish-government-planning.scss,f/7/f7a87ae0426cafc2323c6c7ea540fb129c638c87
|
|
76
|
-
Y
|
|
77
|
-
)sass/custom/someret-west-and-taunton.scss,b/3/b32d76c4339f54eb551e11b44e4442dba06ab61e
|
|
78
66
|
S
|
|
79
67
|
#sass/custom/south-wales-police.scss,1/d/1d086eb8ad446fac3834cef1541ba21ae3251bcc
|
|
80
|
-
G
|
|
81
|
-
sass/custom/sutton.scss,c/5/c5befeaa8e93d7c83f1cc31a8d2813217dcdb78a
|
|
82
|
-
X
|
|
83
|
-
(sass/custom/canterbury-city-council.scss,2/c/2c2e25e54af134656f786492369f2d309af6fc5d
|
|
84
68
|
T
|
|
85
69
|
$images/custom/leeds-city-council.svg,b/3/b3f38ade028e88019dd06ebcf5ca13096ca42238
|
|
86
70
|
7
|
|
@@ -93,12 +77,8 @@ V
|
|
|
93
77
|
&sass/custom/cadw-welsh-government.scss,e/a/ea864c9949202498771817849e38d80c7cba1e2b
|
|
94
78
|
P
|
|
95
79
|
sass/custom/croydon-council.scss,1/0/1059ffd486aaf829fa5d1e15979d3afff31267be
|
|
96
|
-
G
|
|
97
|
-
sass/custom/custom.scss,f/c/fce3b30bccc478e9ebb36570f32eb3de1e4205cf
|
|
98
80
|
_
|
|
99
81
|
/sass/custom/edinburgh-council-pest-control.scss,d/6/d6ca95ce28b96fac596da957816f6d5c412d710e
|
|
100
|
-
I
|
|
101
|
-
sass/custom/ea-defra.scss,0/a/0ab90bbd755fb821ff9a7a389d27ecf24fde7721
|
|
102
82
|
L
|
|
103
83
|
images/custom/kcc-mobile.svg,7/a/7af2f4f8529d55f0d321898d1d1432bc82062bfb
|
|
104
84
|
E
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 203.67 133"><defs><style>.cls-1{fill:#ffffff;}.cls-2{fill:none;}</style></defs><title>WDC logo line work solid K uc</title><path class="cls-1" d="M23.87,68.2a8.87,8.87,0,0,0,3.51,0c1.79,7.13,3.27,11.91,6.08,20.8h.07c1.27-3.87,5.83-17.19,6.71-20.8a3.92,3.92,0,0,0,2.32,0C43.62,72,48,85.35,49.27,89h.07C50.4,85.88,55,71.26,55.64,68.2a4.39,4.39,0,0,0,2.46,0c-1.37,3.3-7.17,20.52-8.4,24.25a4.12,4.12,0,0,0-2.39,0c-2-6.57-4.15-13.18-6.47-20.14h-.07c-1.13,3.23-4.67,13.56-6.85,20.14a4.37,4.37,0,0,0-2.46,0C30.3,88.62,25.24,71.93,23.87,68.2Z"/><path class="cls-1" d="M66.53,75.3c4.92,0,7.28,3.27,7.28,7.17,0,.46,0,.91-.07,1.37-2.53,0-5-.11-7.52-.11-1.55,0-3.06.07-4.6.11a9.82,9.82,0,0,0,0,1c0,3.65,2.18,6.5,6.08,6.5a7.65,7.65,0,0,0,5.27-2.5l.18.11-.21,1.72A10.07,10.07,0,0,1,67,92.8c-5.06,0-8.54-3.58-8.54-8.26C58.49,78.85,61.37,75.3,66.53,75.3ZM61.68,82.5c1.44,0,3.09.1,4.57.1s3.2-.07,4.67-.1c0-2.5-.67-6.08-4.32-6.08C63.16,76.42,61.86,80,61.68,82.5Z"/><path class="cls-1" d="M77.85,77.34a8.77,8.77,0,0,1,5.66-2c3.37,0,5.69,2.07,5.69,5.2,0,2.63-.14,5.24-.14,8.19,0,1.16,0,2.6,1.37,2.6a1.46,1.46,0,0,0,.74-.14v.77a6,6,0,0,1-2.25.49,2.3,2.3,0,0,1-2.43-2.18C84.81,91.92,83.37,92.8,81,92.8a4.46,4.46,0,0,1-4.67-4.32c0-2.81,1.9-4.32,5-4.81,5.1-.81,5.27-1.09,5.27-2.46,0-2.35-1.05-4.43-3.86-4.43a5,5,0,0,0-4.43,2.39h-.39Zm8.68,6.25c-2.42.81-7.34.56-7.34,4.39a3.07,3.07,0,0,0,3.06,3.34,5.08,5.08,0,0,0,4.15-2.46Z"/><path class="cls-1" d="M96,76c0-3.23-.07-7.77-.28-10.12a7.2,7.2,0,0,0,3.16,0c-.21,2.35-.28,6.89-.28,10.12v6.36c0,3.23.07,7.77.28,10.12a7.16,7.16,0,0,0-3.16,0c.21-2.36.28-6.89.28-10.12Z"/><path class="cls-1" d="M116.79,89h-.07a6.46,6.46,0,0,1-5.94,3.79c-3.55,0-7.13-2.6-7.13-8.64s3.9-8.86,7.55-8.86a5.49,5.49,0,0,1,5.41,3.51h.07c0-4.43,0-9.95-.14-13a13.31,13.31,0,0,0,1.58.18,14.23,14.23,0,0,0,1.58-.18c-.31,3-.42,12.16-.42,18.17,0,3.2.07,5.62.11,8.44a11,11,0,0,0-1.37-.18,9.68,9.68,0,0,0-1.33.18Zm-5.2,2.5c3.65,0,5.24-4,5.24-7.8,0-4.43-1.79-6.92-5.13-6.92s-5,3.34-5,7.59C106.74,90,109.31,91.5,111.59,91.5Z"/><path class="cls-1" d="M131,75.3c4.92,0,7.28,3.27,7.28,7.17,0,.46,0,.91-.07,1.37-2.53,0-5-.11-7.52-.11-1.55,0-3.06.07-4.6.11a9.54,9.54,0,0,0,0,1c0,3.65,2.18,6.5,6.08,6.5a7.64,7.64,0,0,0,5.27-2.5l.18.11-.21,1.72a10.07,10.07,0,0,1-5.87,2.14c-5.06,0-8.54-3.58-8.54-8.26C122.94,78.85,125.82,75.3,131,75.3Zm-4.85,7.21c1.44,0,3.09.1,4.57.1s3.2-.07,4.68-.1c0-2.5-.67-6.08-4.32-6.08C127.62,76.42,126.31,80,126.14,82.5Z"/><path class="cls-1" d="M149.58,77.13c-3.27,0-4.75,2.11-4.75,5.76v3c0,2.11.07,4.57.28,6.57a7.17,7.17,0,0,0-3.16,0c.21-2,.28-4.46.28-6.57V82.22c0-2.11-.07-4.57-.28-6.57a6.42,6.42,0,0,0,3,0c-.07.95-.11,1.86-.11,2.81h.07a6.35,6.35,0,0,1,5.62-3.16c2.6,0,5.62,1.27,5.62,6.11,0,2-.14,4.11-.14,6.5,0,1.55,0,3,.07,4.53a7.25,7.25,0,0,0-1.48-.18,6.67,6.67,0,0,0-1.44.18c.07-2.57.25-5.13.25-7.84V82.47C153.41,79,151.9,77.13,149.58,77.13Z"/><path class="cls-1" d="M84.74,99.09a3.89,3.89,0,0,1,2.86,1.07,5.46,5.46,0,0,1,0,6.19,3.88,3.88,0,0,1-2.86,1.07H81.86V99.09Zm-.4,7.65a5.42,5.42,0,0,0,1.54-.19,2.48,2.48,0,0,0,1.07-.61,2.53,2.53,0,0,0,.62-1.08,6.54,6.54,0,0,0,0-3.19,2.51,2.51,0,0,0-.62-1.08,2.44,2.44,0,0,0-1.07-.61,5.42,5.42,0,0,0-1.54-.19H82.65v7Z"/><path class="cls-1" d="M90.45,99.09v1.18h-.73V99.09Zm0,2.31v6h-.73v-6Z"/><path class="cls-1" d="M95.32,102.57a1.18,1.18,0,0,0-.35-.41,1.42,1.42,0,0,0-.49-.24,2.34,2.34,0,0,0-.59-.08,2.42,2.42,0,0,0-.5.05,1.52,1.52,0,0,0-.46.18,1,1,0,0,0-.34.32.89.89,0,0,0-.13.49.69.69,0,0,0,.12.41,1.08,1.08,0,0,0,.31.29,2,2,0,0,0,.41.19l.41.12,1,.22a2.91,2.91,0,0,1,.62.17,2,2,0,0,1,.55.32,1.55,1.55,0,0,1,.39.49,1.49,1.49,0,0,1,.15.69,1.51,1.51,0,0,1-.22.83,1.81,1.81,0,0,1-.57.56,2.43,2.43,0,0,1-.78.31,4,4,0,0,1-.85.09,2.75,2.75,0,0,1-1.72-.5,2.12,2.12,0,0,1-.75-1.61h.73a1.44,1.44,0,0,0,.54,1.13A2,2,0,0,0,94,107a2.76,2.76,0,0,0,.55-.06,1.82,1.82,0,0,0,.53-.2,1.25,1.25,0,0,0,.4-.36.86.86,0,0,0,.16-.53.85.85,0,0,0-.11-.45,1,1,0,0,0-.3-.3,1.8,1.8,0,0,0-.43-.2l-.48-.14-.94-.21a5.72,5.72,0,0,1-.66-.22,2.06,2.06,0,0,1-.53-.3,1.25,1.25,0,0,1-.36-.44,1.47,1.47,0,0,1-.13-.64,1.43,1.43,0,0,1,.2-.78,1.58,1.58,0,0,1,.53-.53,2.45,2.45,0,0,1,.73-.29,3.5,3.5,0,0,1,.8-.09,2.92,2.92,0,0,1,.84.12,1.93,1.93,0,0,1,.69.36,1.75,1.75,0,0,1,.47.61,2.19,2.19,0,0,1,.2.85h-.73A1.38,1.38,0,0,0,95.32,102.57Z"/><path class="cls-1" d="M99.85,101.4V102H98.63v4.06a1.33,1.33,0,0,0,.1.56c.06.13.23.21.5.23a6.22,6.22,0,0,0,.63,0v.62H99.2a1.46,1.46,0,0,1-1-.29,1.44,1.44,0,0,1-.28-1.05V102h-1v-.62h1v-1.8h.73v1.8Z"/><path class="cls-1" d="M101.59,101.4v1.41h0a2.2,2.2,0,0,1,2.27-1.49v.73a2.2,2.2,0,0,0-.91.13,2,2,0,0,0-1.17,1.14,2.31,2.31,0,0,0-.16.88v3.21h-.73v-6Z"/><path class="cls-1" d="M105.33,99.09v1.18h-.73V99.09Zm0,2.31v6h-.73v-6Z"/><path class="cls-1" d="M110.42,102.23a1.59,1.59,0,0,0-1.14-.39,1.84,1.84,0,0,0-.92.22,2,2,0,0,0-.66.58,2.66,2.66,0,0,0-.4.82,3.35,3.35,0,0,0,0,1.88,2.66,2.66,0,0,0,.4.82,2,2,0,0,0,.66.58,1.84,1.84,0,0,0,.92.22,1.62,1.62,0,0,0,.64-.13,1.73,1.73,0,0,0,.54-.36,1.91,1.91,0,0,0,.38-.54,2,2,0,0,0,.19-.69h.73A2.78,2.78,0,0,1,111,107a2.36,2.36,0,0,1-1.68.61,2.83,2.83,0,0,1-1.22-.25,2.62,2.62,0,0,1-.89-.68,3,3,0,0,1-.55-1,4.15,4.15,0,0,1,0-2.46,3,3,0,0,1,.55-1,2.63,2.63,0,0,1,.89-.69,2.75,2.75,0,0,1,1.22-.26,2.61,2.61,0,0,1,1.64.51,2.19,2.19,0,0,1,.8,1.55H111A2,2,0,0,0,110.42,102.23Z"/><path class="cls-1" d="M115.18,101.4V102H114v4.06a1.31,1.31,0,0,0,.1.56c.07.13.23.21.5.23a6.13,6.13,0,0,0,.63,0v.62h-.65a1.46,1.46,0,0,1-1-.29,1.43,1.43,0,0,1-.28-1.05V102h-1v-.62h1v-1.8H114v1.8Z"/><path class="cls-1" d="M125.36,100.75a2.38,2.38,0,0,0-.58-.63,2.66,2.66,0,0,0-.76-.39,2.85,2.85,0,0,0-.87-.13,3,3,0,0,0-1.42.31,2.79,2.79,0,0,0-1,.83,3.63,3.63,0,0,0-.56,1.17,5,5,0,0,0,0,2.68,3.6,3.6,0,0,0,.56,1.18,2.81,2.81,0,0,0,1,.83,3,3,0,0,0,1.42.31,2.54,2.54,0,0,0,1-.21,2.46,2.46,0,0,0,.8-.57,3,3,0,0,0,.55-.84,3.58,3.58,0,0,0,.27-1h.79a4.54,4.54,0,0,1-.36,1.39,3.44,3.44,0,0,1-.72,1,3.1,3.1,0,0,1-1,.66,3.65,3.65,0,0,1-1.33.23,3.94,3.94,0,0,1-1.72-.36,3.54,3.54,0,0,1-1.23-1,4,4,0,0,1-.73-1.37,5.66,5.66,0,0,1,0-3.29,4.08,4.08,0,0,1,.73-1.38,3.54,3.54,0,0,1,1.23-1,4.16,4.16,0,0,1,2.88-.18,3.35,3.35,0,0,1,1,.52,3,3,0,0,1,.77.84,2.86,2.86,0,0,1,.39,1.15h-.79A2.67,2.67,0,0,0,125.36,100.75Z"/><path class="cls-1" d="M131.44,101.48a2.63,2.63,0,0,1,.89.69,3,3,0,0,1,.55,1,4.17,4.17,0,0,1,0,2.46,3,3,0,0,1-.55,1,2.61,2.61,0,0,1-.89.68,3.09,3.09,0,0,1-2.43,0,2.6,2.6,0,0,1-.89-.68,3,3,0,0,1-.55-1,4.13,4.13,0,0,1,0-2.46,3,3,0,0,1,.55-1,2.62,2.62,0,0,1,.89-.69,3,3,0,0,1,2.43,0Zm-2.14.58a2,2,0,0,0-.66.58,2.64,2.64,0,0,0-.4.82,3.33,3.33,0,0,0,0,1.88,2.64,2.64,0,0,0,.4.82,2,2,0,0,0,.66.58,2,2,0,0,0,1.84,0,2,2,0,0,0,.66-.58,2.67,2.67,0,0,0,.4-.82,3.33,3.33,0,0,0,0-1.87,2.68,2.68,0,0,0-.4-.82,2,2,0,0,0-.66-.58,2,2,0,0,0-1.84,0Z"/><path class="cls-1" d="M138.36,107.41v-1.09h0a2.07,2.07,0,0,1-.84.93,2.42,2.42,0,0,1-1.23.32,2.71,2.71,0,0,1-1-.16,1.62,1.62,0,0,1-.65-.45,1.83,1.83,0,0,1-.37-.71,3.56,3.56,0,0,1-.12-1V101.4h.73v3.92a2,2,0,0,0,.38,1.24,1.9,1.9,0,0,0,2,.21,1.74,1.74,0,0,0,.56-.54,2.45,2.45,0,0,0,.32-.78,3.68,3.68,0,0,0,.11-.89V101.4H139v6Z"/><path class="cls-1" d="M141.14,101.4v1h0a1.75,1.75,0,0,1,.75-.88,2.2,2.2,0,0,1,1.18-.33,3,3,0,0,1,1.05.16,1.65,1.65,0,0,1,.68.46,1.72,1.72,0,0,1,.36.73,4.09,4.09,0,0,1,.1,1v3.87h-.73v-3.75a3.43,3.43,0,0,0-.07-.71,1.53,1.53,0,0,0-.25-.58,1.19,1.19,0,0,0-.47-.38,1.73,1.73,0,0,0-.74-.14,1.86,1.86,0,0,0-.79.16,1.74,1.74,0,0,0-.58.43,2,2,0,0,0-.37.65,2.59,2.59,0,0,0-.14.82v3.51h-.73v-6Z"/><path class="cls-1" d="M150.36,102.23a1.6,1.6,0,0,0-1.14-.39,1.84,1.84,0,0,0-.92.22,2,2,0,0,0-.66.58,2.58,2.58,0,0,0-.39.82,3.28,3.28,0,0,0,0,1.88,2.58,2.58,0,0,0,.39.82,2.06,2.06,0,0,0,.66.58,1.84,1.84,0,0,0,.92.22,1.62,1.62,0,0,0,.64-.13,1.74,1.74,0,0,0,.54-.36,1.91,1.91,0,0,0,.38-.54,1.94,1.94,0,0,0,.19-.69h.73a2.77,2.77,0,0,1-.8,1.71,2.36,2.36,0,0,1-1.68.61,2.83,2.83,0,0,1-1.22-.25,2.6,2.6,0,0,1-.89-.68,3,3,0,0,1-.55-1,4.17,4.17,0,0,1,0-2.46,3,3,0,0,1,.55-1,2.62,2.62,0,0,1,.89-.69,2.74,2.74,0,0,1,1.22-.26,2.61,2.61,0,0,1,1.64.51,2.2,2.2,0,0,1,.8,1.55h-.73A2,2,0,0,0,150.36,102.23Z"/><path class="cls-1" d="M153.47,99.09v1.18h-.73V99.09Zm0,2.31v6h-.73v-6Z"/><path class="cls-1" d="M155.63,99.09v8.32h-.73V99.09Z"/><path class="cls-1" d="M113,42.29c.31-.41.78.25,1.11.16s.29-.62.84-.22c.21.15.23.39.47.42a.57.57,0,0,0,.42-.23c.06-.21-.47-1,.28-.75.4.13.59.91,1,1s.71-.49,1.13-.66a.94.94,0,0,1,.37-.08q.23.09.18-.14c.19-.16.19-.33.46-.46s.36,0,.58-.27a3.21,3.21,0,0,0,.4-.75c-.33-.15-.32,0-.5-.37a1.37,1.37,0,0,1-.2-1.16c0-.17,0-.35,0-.52s.17-.32.25-.54a1.39,1.39,0,0,0,0-.91c-.13-.41-.55-.53-.62-1a.84.84,0,0,1,.19-.65c.21-.21.21-.09.46-.19s.07,0,.22-.15c.52-.4.2-.56.1-1.06-.06-.28,0-.34-.17-.54s-.42-.17-.56-.35-.12-.47-.19-.72a6,6,0,0,0-.2-.74c-.31-.3-.95.56-1.12-.26a2.33,2.33,0,0,1,0-1.38c.25-.62.23-.52-.45-.63s-.92-.61-1.17-1.21c-.08-.2-.22-.14-.2-.4s.12-.2.17-.34.2,0,0-.22c-.38-.37-1.06.09-1.43-.29-.16-.16-.13-.49-.14-.7,0-.41.07-.11-.13-.36a4.08,4.08,0,0,0-.47-.46s-.35,0-.44-.09-.11-.23-.19-.26-.27.06-.36,0-.23-.15-.35-.18-.48,0-.65-.05-.17-.59-.35-.81-.27,0-.5.15c-.51.42-1-.28-1.43-.43a.8.8,0,0,0-.75,0c-.26.16-.35.49-.71.52s-.43-.28-.6-.27.12,0-.18.14c-.14.09-.09.28-.3.33s-.37-.31-.46-.29-.15.44-.17.47a.93.93,0,0,1-.45.43c-.46.21-.85-.08-1.28,0-.22.05-.21.21-.51.22s-.27-.15-.45-.08c-.38.15-.32.66-.41,1-.15.52-.18,1.1-.71,1.33a2.61,2.61,0,0,0-1,.51c-.24.21-.74.41-.91.66s0,.6,0,.94a1.22,1.22,0,0,1-.55.92c-.12.1-.4.21-.48.31s-.05.31-.13.44c-.35.65-1.7.21-1.72,1.22,0,.3.31.62.3.93,0,.11-.15.21-.15.3s0,.28,0,.4a1.23,1.23,0,0,1-.38.9s-.27.07-.31.13a2.93,2.93,0,0,0-.19.4c-.09.15-.19.18-.26.34-.16.4,0,.53.23.78a.8.8,0,0,1,.3.89,1.46,1.46,0,0,1-.23.66c-.07.16-.13,0-.15.2s.1.14.1.22c0,.36-.13.61-.14,1s-.18.58-.11.93a7.29,7.29,0,0,0,.24.8c.23.68.63,1-.06,1.6-.1.07.48.48.56.49a3.66,3.66,0,0,0,1.21-.23,5.49,5.49,0,0,0,.75-.25,2.27,2.27,0,0,1,.32-.18c.25-.06.31.06.53.06s.21-.08.35-.09a2.33,2.33,0,0,1,.63.12c.48.08.59-.17,1-.37a2.1,2.1,0,0,1,1.52-.16c.19.09.31.31.5.41s.55.09.78.31.18.47.39.53.56-.23.76-.35.91-.72,1.34-.64.36,1,.35,1.4c0,1,.38,2-.18,2.92a5.66,5.66,0,0,1,1.65.08c-.48-.28-.55-1.24-.57-1.74,0-.75,0-1.5,0-2.24,0-.32,0-.62.42-.59.2,0,.33.2.5.2s.54-.25.73-.3a2.66,2.66,0,0,1,2.08.13S113,42.33,113,42.29Z"/><path class="cls-1" d="M138.75,44.19l.13-.1c0-.16-.3-.38-.36-.47a1.79,1.79,0,0,1-.2-.39c0-.4.46-.63.53-1a1.59,1.59,0,0,0-.23-.88c-.1-.28-.06-.89-.28-1.1s-.43-.12-.58-.49-.08-.66-.2-1a1.4,1.4,0,0,0-.72-.88.81.81,0,0,1-.46-1c.05-.29.27-.52.16-.83s-.7-.42-1-.63-.36-.58-.55-1q0-.09,0-.18a.61.61,0,0,1-.36-.23c-.1-.13-.07-.38-.19-.51-.31-.33-.92-.22-1.33-.27a5.7,5.7,0,0,1-1.26-.39c-.41-.15-.48-.24-.88-.2s-.64-.19-.76-.17-.54.52-.92.5a1.19,1.19,0,0,0-1.2.45c-.23.23-.33.32-.66.3-.13,0-.17-.19-.37-.12s-.15.75-.23,1c-.13.41-.52.35-.68.62s0,.62-.08.8a3.4,3.4,0,0,1-.25.6c-.12.15-.28.08-.42.17s-.2.3-.35.39-.46.12-.67.24c-.5.29-.18.35-.25.85,0,.27-.28.39-.35.61a1.37,1.37,0,0,0,.1.77,1.7,1.7,0,0,1,.07.86c0,.17-.05.15,0,.32s.17.26.18.43a.87.87,0,0,1-.05.33,3,3,0,0,0-.18.38,2.38,2.38,0,0,1-.68.72c-.29.13-.43.11-.21.64,0,.08,0,.2,0,.3a1.21,1.21,0,0,0,.17.29c.08.09.21.15.28.24.31.43.13.64.7.6s.43-.07.76.22a2.47,2.47,0,0,0,.87.51,11.33,11.33,0,0,0,1.28.19c.55.1,1.21,0,1.77.05a3.31,3.31,0,0,1,1.31.51c.1,0,.47-.1.47-.1.25.11.25.3.27.53s0,.66,0,1a2.29,2.29,0,0,1-.21,1.79,3.14,3.14,0,0,0,1.4.05c-.52-.43-.42-1.51-.36-2.1,0-.42,0-1,.31-1.33.51-.48,1.22-.13,1.81-.24a5.82,5.82,0,0,1,1-.24c.24,0,.48.07.73.08a1.5,1.5,0,0,0,.93-.31.27.27,0,0,0,.21,0,3.32,3.32,0,0,1,.27-.27,2.2,2.2,0,0,1,.55-.33.16.16,0,0,0,.24,0,2,2,0,0,0,.29-.32,2.69,2.69,0,0,1,.71-.3S138.65,44.23,138.75,44.19Z"/><path class="cls-2" d="M129.45,46.52a.5.5,0,0,1-.18,0,.35.35,0,0,1-.24-.11l-.43,0-.53,0a4.43,4.43,0,0,0-.67,0H127a.59.59,0,0,1-.49-.13h-.2a2,2,0,0,1-.9-.11l-.17-.11a2.29,2.29,0,0,1-.91-.61,4.41,4.41,0,0,1-.45.06c-.65.08-.88-.51-1-.82a1.22,1.22,0,0,1-.43-.49.53.53,0,0,1-.2-.15,121.41,121.41,0,0,0-12.41.33s0,.05,0,.08a1.74,1.74,0,0,0,0,.18,1.9,1.9,0,0,1,0,.5v.11c0,.1.06.55.06.55l.17.59a118.47,118.47,0,0,1,20.09.65v-.17A.64.64,0,0,1,129.45,46.52Z"/><path class="cls-2" d="M124.6,36.7a1,1,0,0,1,.64-.48,1.1,1.1,0,0,1,.26-.51,1.93,1.93,0,0,1,0-.35.83.83,0,0,1,.13-.47q-2.54.16-5,.41v.21l-.67.22,0,0,0,.1.21.14.14.18.2.39.12.67c1.13-.08,2.28-.15,3.44-.2A2.07,2.07,0,0,1,124.6,36.7Z"/><path class="cls-1" d="M132.38,47.27c0,.13,0,.23-.06.34l0,.18a1.51,1.51,0,0,1,0,.38c0,.09,0,.22.06.36s0,.24.07.36l.07.19.37.24.43.14c.45.24.72.38.65.66l-.07.24h-.27l-.42,0-.52-.05a1.22,1.22,0,0,1-.41-.08l-.25,0h-.09a3.4,3.4,0,0,1-.73,0l-.19,0a2.66,2.66,0,0,1-.57-.09h0a1.52,1.52,0,0,1-.49.05,1.83,1.83,0,0,0-.53.06A.31.31,0,0,1,129,50c-.08-.24.18-.4.18-.4l.53-.2a.35.35,0,0,1,.23-.14.59.59,0,0,0,.16-.05h0l.13-.2.1-.37v-.48l-.11-.64V47a118.47,118.47,0,0,0-20.09-.65v0l.37.28.5.2c.53.32.73.48.66.73l-.06.22h-.26l-.49-.05-.52-.06a1.11,1.11,0,0,1-.42-.09,5.49,5.49,0,0,0-.55-.15l-.42,0a2.6,2.6,0,0,1-.48.06,2,2,0,0,0-.43,0l-.08,0a1.18,1.18,0,0,1-.55.09,1.77,1.77,0,0,0-.55.08.28.28,0,0,1-.37-.17.31.31,0,0,1,.14-.39l.71-.33.29-.2,0-.09C88.95,48,73.13,54,64.7,63.08,78.66,56,99,53,120.51,55.91c16.8,2.27,31.33,7.77,41.62,15A43.81,43.81,0,0,1,178.62,67l1.3,0C169.73,57.48,152.74,50,132.43,47.28Z"/><path class="cls-1" d="M137,37.21a.37.37,0,0,1,.27.23l.09,0a.92.92,0,0,1,.27.15,1.45,1.45,0,0,1,.32.49,1.7,1.7,0,0,0,.08.17,2.39,2.39,0,0,1,.27,1.15l.07.16a.93.93,0,0,1,.61.49,1.1,1.1,0,0,1,.13.73V41a.8.8,0,0,0,.11.14.63.63,0,0,1,.2.69s0,.05,0,.15a.75.75,0,0,1,0,.57,1,1,0,0,1-.26.38,1,1,0,0,1-.1.22.81.81,0,0,1,.09.34.81.81,0,0,1,.36.71.57.57,0,0,1-.28.44h0c-.06.12-.22.18-.74.33a1.88,1.88,0,0,1-.5.44C148.54,47,157.79,50,164.92,53.77a44,44,0,0,1,14.39-3.71l1.14-.08c-9.41-6.77-24.74-11.7-42.79-12.87l-.65,0,0,.08A.2.2,0,0,0,137,37.21Z"/><path class="cls-1" d="M122.31,44a.39.39,0,0,1-.07-.08.55.55,0,0,1,0-.45.75.75,0,0,1,.12-1l.1-.3a.76.76,0,0,0,.21.14l.07,0s.06-.09.09-.14a1.68,1.68,0,0,1,.16-.22c.07-.08.18-.08.22-.14s0-.22,0-.29l0-.33s.1,0,.11,0,0,0,0-.06a1,1,0,0,1-.15-.27.37.37,0,0,1,.05-.31.38.38,0,0,1,0-.29.45.45,0,0,1,.11-.2l0-.07a3.8,3.8,0,0,1-.19-.93.85.85,0,0,1,.28-.59.82.82,0,0,0,.14-.18l0-.17a.88.88,0,0,1,0-.56,1.49,1.49,0,0,1,.2-.33,2.86,2.86,0,0,1,.29-.2c-1.15.05-2.3.11-3.44.2l0,.28v0a1.46,1.46,0,0,1-.34.75s0,.06,0,.09a1.27,1.27,0,0,1-.1.71l0,.09a2.31,2.31,0,0,1,.21.4l0,.11.1,0h0a.68.68,0,0,1,.44.39.81.81,0,0,1-.14.67l-.09.17c-.16.36-.45,1-1.19,1,0,0,0,.06,0,.1a.56.56,0,0,1-.27.56.42.42,0,0,1-.32,0,.38.38,0,0,0-.49.14,1.15,1.15,0,0,1-.61.42.53.53,0,0,1-.15.15c-.42.27-.95-.18-1.21-.44a.67.67,0,0,1-.46.33,1.19,1.19,0,0,0-.21.08c-.55.27-.81-.05-1.08-.39l0,0c-.26.29-.51.31-1,.1l-.25-.11c-.29.19-.47.18-.91,0a2.79,2.79,0,0,0-1.89.21c-.25.17-.41.27-.59.23l0,.23c0,.06,0,.48,0,.8A121.41,121.41,0,0,1,122.31,44Z"/><path class="cls-1" d="M107.74,43.29v0l-1,.59a1.45,1.45,0,0,1-1,.32,1.25,1.25,0,0,1-.55-.42l-.2-.33-.68-.22-.45-.38h-.15l-.69.13a4.4,4.4,0,0,0-.58.37.72.72,0,0,1-.69.14,1.87,1.87,0,0,1-.56-.16.84.84,0,0,1-.48.14.89.89,0,0,1-.41-.12l-.24.13-.89.3a13.91,13.91,0,0,1-1.42.24.78.78,0,0,1-.45-.21l-.12-.08c-.34-.09-.44-.51-.46-.59a.71.71,0,0,1,.14-.72l.06-.07v-.19s.09,0,.12,0,0,0,0-.05a1.12,1.12,0,0,1-.24-.25s0-.06,0-.09C89,44.39,82.66,48,78.57,52.21c7.72-3.86,17.86-6.55,29.18-7.67l0-.2Z"/><path class="cls-1" d="M119.72,31.68l.08.18.13.39v.24l.12.09.38.21.35.32v.45l0,.2.14.26.16.54-.33.54-.15.12v.08q2.48-.25,5-.41l.07-.08a1.16,1.16,0,0,1,.32-.2l.08,0c.08,0,.09-.06.09-.07a.82.82,0,0,0,0-.29,1,1,0,0,1,.17-.76l.06-.09a.6.6,0,0,1,.64-.34,1.26,1.26,0,0,1,.48.08l.11-.13a1.6,1.6,0,0,1,.53-.47,2.52,2.52,0,0,1,1-.12l.18,0,.13,0s0,0,0-.08a1.17,1.17,0,0,1,.14-.2.59.59,0,0,1,.78-.18.31.31,0,0,1,.14-.06c.1,0,.2.14.2.14a.81.81,0,0,1,.35-.08.94.94,0,0,1,.61.21.94.94,0,0,0,.18.1h.1a.76.76,0,0,1,.29.05,1.39,1.39,0,0,1,.22.13.79.79,0,0,0,.19.11,3,3,0,0,0,.69.09,2,2,0,0,1,1.39.4,1.32,1.32,0,0,1,.23.41.93.93,0,0,0,.06.13l.07.11a.46.46,0,0,1,.28.16.75.75,0,0,1,.1.56.85.85,0,0,0,0,.1.68.68,0,0,0,0,.08c11.72.14,22,1.83,29.74,4.59A46.89,46.89,0,0,1,178,35.66l1-.13c-8.59-4.32-22.37-6.93-38.44-6.67a131,131,0,0,0-21.09,2l.2.26Z"/><path class="cls-1" d="M96.46,40.15a1.07,1.07,0,0,1,.16-.47,1.06,1.06,0,0,1,.07-.91l0-.34,0-.43a33.86,33.86,0,0,0-8.09,5.43,66.89,66.89,0,0,1,7.85-3.16s0,0,0,0Z"/></svg>
|
|
@@ -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
|
};
|
package/lib/analytics/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
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) {
|
package/lib/constants/index.js
CHANGED
|
@@ -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
|
-
|
|
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,
|
package/lib/logging/format.js
CHANGED
package/lib/logging/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var keys = require('./keys');
|
|
4
|
-
|
|
5
4
|
var _require = require('./format'),
|
|
6
|
-
|
|
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,
|
package/lib/logging/keys.js
CHANGED
|
@@ -1,75 +1,108 @@
|
|
|
1
|
-
'use strict';
|
|
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
|
-
|
|
9
|
+
// "payment", "mandate", "refund"
|
|
10
|
+
exports.RESOURCE_TYPE = 'resource_type';
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
// "sandbox", "Worldpay", "Smartpay", "ePDQ", "Stripe", "GoCardless"
|
|
13
|
+
exports.PROVIDER = 'provider';
|
|
8
14
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
30
|
+
// The amount of a payment in pence
|
|
31
|
+
exports.AMOUNT = 'amount';
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
// Mandate external id
|
|
34
|
+
exports.MANDATE_EXTERNAL_ID = 'mandate_external_id';
|
|
24
35
|
|
|
25
|
-
|
|
36
|
+
// The PSP's identifier for a payment
|
|
37
|
+
exports.PROVIDER_PAYMENT_ID = 'provider_payment_id';
|
|
26
38
|
|
|
27
|
-
|
|
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
|
-
|
|
42
|
+
// The reference a partner service assigns to a payment, mandate etc.
|
|
43
|
+
exports.SERVICE_PAYMENT_REFERENCE = 'service_reference';
|
|
30
44
|
|
|
31
|
-
|
|
45
|
+
// The ID GOV.UK Pay gives to a gateway account
|
|
46
|
+
exports.GATEWAY_ACCOUNT_ID = 'gateway_account_id';
|
|
32
47
|
|
|
33
|
-
|
|
48
|
+
// The ID of an event emitted to ledger
|
|
49
|
+
exports.LEDGER_EVENT_ID = 'ledger_event_id';
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
// The type of an event emitted to ledger
|
|
52
|
+
exports.LEDGER_EVENT_TYPE = 'ledger_event_type';
|
|
36
53
|
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
62
|
+
// The previous internal state of a payment, mandate etc. when transitioning
|
|
63
|
+
exports.PREVIOUS_INTERNAL_STATUS = 'previous_internal_status';
|
|
46
64
|
|
|
47
|
-
|
|
65
|
+
// The last event (status) that Worldpay recorded for a payment, refund etc.
|
|
66
|
+
exports.WORLDPAY_LAST_EVENT = 'worldpay_last_event';
|
|
48
67
|
|
|
49
|
-
|
|
68
|
+
// The result code (status) that Smartpay recorded for a payment, refund etc.
|
|
69
|
+
exports.SMARTPAY_RESULT_CODE = 'smartpay_result_code';
|
|
50
70
|
|
|
51
|
-
|
|
71
|
+
// The status code that ePDQ recorded for a payment, refund etc.
|
|
72
|
+
exports.EPDQ_STATUS = 'epdq_status';
|
|
52
73
|
|
|
53
|
-
|
|
74
|
+
// The status that Stripe recorded for a payment, refund etc.
|
|
75
|
+
exports.STRIPE_STATUS = 'stripe_status';
|
|
54
76
|
|
|
55
|
-
|
|
77
|
+
// The action that GoCardless recorded for a payment, mandate etc.
|
|
78
|
+
exports.GOCARDLESS_PAYMENT_ACTION = 'gocardless_action';
|
|
56
79
|
|
|
57
|
-
|
|
80
|
+
// The HTTP status we sent to a client
|
|
81
|
+
exports.HTTP_STATUS = 'http_status';
|
|
58
82
|
|
|
59
|
-
|
|
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
|
-
|
|
86
|
+
// AWS error code
|
|
87
|
+
exports.AWS_ERROR_CODE = 'aws_error_code';
|
|
62
88
|
|
|
63
|
-
|
|
89
|
+
// The correlation id for the request
|
|
90
|
+
exports.CORRELATION_ID = 'x_request_id';
|
|
64
91
|
|
|
65
|
-
|
|
92
|
+
// Payment External Id
|
|
93
|
+
exports.PAYMENT_EXTERNAL_ID = 'payment_external_id';
|
|
66
94
|
|
|
67
|
-
|
|
95
|
+
// Refund External Id
|
|
96
|
+
exports.REFUND_EXTERNAL_ID = 'refund_external_id';
|
|
68
97
|
|
|
69
|
-
|
|
98
|
+
// Secure Token
|
|
99
|
+
exports.SECURE_TOKEN = 'secure_token';
|
|
70
100
|
|
|
71
|
-
|
|
101
|
+
// User external id
|
|
102
|
+
exports.USER_EXTERNAL_ID = 'user_external_id';
|
|
72
103
|
|
|
73
|
-
|
|
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,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
|
};
|
package/lib/utils/countries.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
'use strict';
|
|
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
|
-
|
|
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
|
-
});
|
|
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';
|
|
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';
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
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';
|
|
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.
|
|
3
|
+
"version": "3.8.9",
|
|
4
4
|
"description": "Reusable js scripts for GOV.UK Pay Node.js projects",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^16.14.0"
|
|
@@ -128,16 +128,16 @@
|
|
|
128
128
|
"standard": "^17.0.0",
|
|
129
129
|
"uglify-js": "^3.6.0",
|
|
130
130
|
"watchify": "^4.0.0",
|
|
131
|
-
"xo": "^0.
|
|
131
|
+
"xo": "^0.54.0"
|
|
132
132
|
},
|
|
133
133
|
"directories": {
|
|
134
134
|
"lib": "lib"
|
|
135
135
|
},
|
|
136
136
|
"dependencies": {
|
|
137
137
|
"lodash": "4.17.21",
|
|
138
|
-
"moment-timezone": "0.5.
|
|
138
|
+
"moment-timezone": "0.5.43",
|
|
139
139
|
"rfc822-validate": "1.0.0",
|
|
140
|
-
"slugify": "1.6.
|
|
140
|
+
"slugify": "1.6.6",
|
|
141
141
|
"winston": "3.8.2"
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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: #598148;
|
|
9
|
+
$custom-banner-border-colour: #324829;
|
|
10
|
+
$custom-text-colour: #FEFEFE;
|
|
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
|
+
width: 100%;
|
|
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
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|