ffc-pay-schemes 1.0.1

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.
Files changed (133) hide show
  1. package/.github/workflows/secret-scanner.yml +16 -0
  2. package/.gitleaks-shared/.gitleaks.toml +139 -0
  3. package/.gitleaks.toml +15 -0
  4. package/.gitleaksignore +0 -0
  5. package/.husky/pre-commit +30 -0
  6. package/LICENCE +8 -0
  7. package/README.md +34 -0
  8. package/app/constants/account-codes/ap.js +48 -0
  9. package/app/constants/account-codes/ar-admin.js +48 -0
  10. package/app/constants/account-codes/ar-irregular.js +47 -0
  11. package/app/constants/delivery-bodies.js +6 -0
  12. package/app/constants/description-codes.js +34 -0
  13. package/app/constants/fund-codes.js +8 -0
  14. package/app/constants/pillars.js +18 -0
  15. package/app/constants/scheme-batch-properties.js +106 -0
  16. package/app/constants/scheme-ids.js +19 -0
  17. package/app/constants/scheme-names.js +19 -0
  18. package/app/constants/schemes-not-requiring-ppas.js +3 -0
  19. package/app/constants/schemes-providing-account-values.js +3 -0
  20. package/app/constants/schemes.js +127 -0
  21. package/app/constants/source-systems.js +19 -0
  22. package/app/create-invoice-number/create-default-invoice-number.js +11 -0
  23. package/app/create-invoice-number/create-es-invoice-number.js +7 -0
  24. package/app/create-invoice-number/create-imps-invoice-number.js +14 -0
  25. package/app/create-invoice-number/create-siti-agri-invoice-number.js +12 -0
  26. package/app/create-invoice-number/create-standard-scheme-invoice-number.js +12 -0
  27. package/app/create-invoice-number/index.js +38 -0
  28. package/app/create-invoice-number/use-invoice-number-as-is.js +7 -0
  29. package/app/create-split-invoice-number/create-default-invoice-number.js +12 -0
  30. package/app/create-split-invoice-number/create-siti-agri-invoice-number.js +12 -0
  31. package/app/create-split-invoice-number/index.js +21 -0
  32. package/app/get-account-code-map/bps-map.js +141 -0
  33. package/app/get-account-code-map/cohtc-map.js +21 -0
  34. package/app/get-account-code-map/cs-map.js +174 -0
  35. package/app/get-account-code-map/default-map.js +46 -0
  36. package/app/get-account-code-map/delinked-map.js +31 -0
  37. package/app/get-account-code-map/index.js +57 -0
  38. package/app/get-account-code-map/lump-sums-map.js +11 -0
  39. package/app/get-account-code-map/sfi-frps-map.js +15 -0
  40. package/app/get-account-code-map/vet-visits-map.js +11 -0
  41. package/app/get-scheme-batch-properties.js +9 -0
  42. package/app/get-scheme-properties.js +31 -0
  43. package/app/get-schemes.js +12 -0
  44. package/app/scheme-does-not-require-ppas.js +9 -0
  45. package/app/scheme-provides-accounting-values.js +9 -0
  46. package/azure-pipelines.yml +45 -0
  47. package/eslint.config.js +3 -0
  48. package/index.js +21 -0
  49. package/jest.config.js +40 -0
  50. package/jest.setup.js +2 -0
  51. package/package.json +34 -0
  52. package/sonar-project.properties +3 -0
  53. package/test/unit/create-invoice-number/create-default-invoice-number.test.js +15 -0
  54. package/test/unit/create-invoice-number/create-es-invoice-number.test.js +10 -0
  55. package/test/unit/create-invoice-number/create-imps-invoice-number.test.js +27 -0
  56. package/test/unit/create-invoice-number/create-siti-agri-invoice-number.test.js +26 -0
  57. package/test/unit/create-invoice-number/create-standard-scheme-invoice-number.test.js +31 -0
  58. package/test/unit/create-invoice-number/index.test.js +113 -0
  59. package/test/unit/create-invoice-number/use-invoice-number-as-is.test.js +9 -0
  60. package/test/unit/create-split-invoice-number/create-default-invoice-number.test.js +15 -0
  61. package/test/unit/create-split-invoice-number/create-siti-agri-invoice-number.test.js +15 -0
  62. package/test/unit/create-split-invoice-number/index.test.js +34 -0
  63. package/test/unit/get-account-code-map/bps-map.test.js +58 -0
  64. package/test/unit/get-account-code-map/cohtc-map.test.js +32 -0
  65. package/test/unit/get-account-code-map/cs-map.test.js +62 -0
  66. package/test/unit/get-account-code-map/default-map.test.js +60 -0
  67. package/test/unit/get-account-code-map/delinked-map.test.js +42 -0
  68. package/test/unit/get-account-code-map/index.test.js +53 -0
  69. package/test/unit/get-account-code-map/lump-sums-map.test.js +16 -0
  70. package/test/unit/get-account-code-map/sfi-frps-map.test.js +31 -0
  71. package/test/unit/get-account-code-map/vet-visits-map.test.js +16 -0
  72. package/test/unit/get-scheme-batch-properties.test.js +16 -0
  73. package/test/unit/get-scheme-properties.test.js +54 -0
  74. package/test/unit/get-schemes.test.js +24 -0
  75. package/test/unit/scheme-does-not-require-ppas.test.js +17 -0
  76. package/test/unit/scheme-provides-accounting-values.test.js +17 -0
  77. package/test-output/cobertura-coverage.xml +577 -0
  78. package/test-output/junit.xml +589 -0
  79. package/test-output/lcov-report/base.css +224 -0
  80. package/test-output/lcov-report/block-navigation.js +87 -0
  81. package/test-output/lcov-report/favicon.png +0 -0
  82. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ap.js.html +229 -0
  83. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-admin.js.html +229 -0
  84. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-irregular.js.html +226 -0
  85. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/index.html +146 -0
  86. package/test-output/lcov-report/ffc-pay-schemes/app/constants/delivery-bodies.js.html +103 -0
  87. package/test-output/lcov-report/ffc-pay-schemes/app/constants/description-codes.js.html +187 -0
  88. package/test-output/lcov-report/ffc-pay-schemes/app/constants/fund-codes.js.html +109 -0
  89. package/test-output/lcov-report/ffc-pay-schemes/app/constants/index.html +266 -0
  90. package/test-output/lcov-report/ffc-pay-schemes/app/constants/pillars.js.html +139 -0
  91. package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-batch-properties.js.html +403 -0
  92. package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-ids.js.html +142 -0
  93. package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-names.js.html +142 -0
  94. package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-not-requiring-ppas.js.html +94 -0
  95. package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-providing-account-values.js.html +94 -0
  96. package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes.js.html +466 -0
  97. package/test-output/lcov-report/ffc-pay-schemes/app/constants/source-systems.js.html +142 -0
  98. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-default-invoice-number.js.html +118 -0
  99. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-es-invoice-number.js.html +106 -0
  100. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-imps-invoice-number.js.html +127 -0
  101. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-siti-agri-invoice-number.js.html +121 -0
  102. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-standard-scheme-invoice-number.js.html +121 -0
  103. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.html +206 -0
  104. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.js.html +199 -0
  105. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/use-invoice-number-as-is.js.html +106 -0
  106. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-default-invoice-number.js.html +121 -0
  107. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-siti-agri-invoice-number.js.html +121 -0
  108. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.html +146 -0
  109. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.js.html +148 -0
  110. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/bps-map.js.html +508 -0
  111. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cohtc-map.js.html +148 -0
  112. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cs-map.js.html +607 -0
  113. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/default-map.js.html +223 -0
  114. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/delinked-map.js.html +178 -0
  115. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.html +236 -0
  116. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.js.html +256 -0
  117. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/lump-sums-map.js.html +118 -0
  118. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/sfi-frps-map.js.html +130 -0
  119. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/vet-visits-map.js.html +118 -0
  120. package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-batch-properties.js.html +112 -0
  121. package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-properties.js.html +178 -0
  122. package/test-output/lcov-report/ffc-pay-schemes/app/get-schemes.js.html +121 -0
  123. package/test-output/lcov-report/ffc-pay-schemes/app/index.html +176 -0
  124. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-does-not-require-ppas.js.html +112 -0
  125. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-provides-accounting-values.js.html +112 -0
  126. package/test-output/lcov-report/ffc-pay-schemes/index.html +116 -0
  127. package/test-output/lcov-report/ffc-pay-schemes/index.js.html +148 -0
  128. package/test-output/lcov-report/index.html +206 -0
  129. package/test-output/lcov-report/prettify.css +1 -0
  130. package/test-output/lcov-report/prettify.js +2 -0
  131. package/test-output/lcov-report/sort-arrow-sprite.png +0 -0
  132. package/test-output/lcov-report/sorter.js +210 -0
  133. package/test-output/lcov.info +644 -0
@@ -0,0 +1,16 @@
1
+ name: Secret Scanner
2
+ on:
3
+ workflow_call:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ types:
11
+ - opened # PR created
12
+ - synchronize # new commits pushed to an existing PR
13
+ - reopened # PR reopened after being closed
14
+ jobs:
15
+ secret-scan:
16
+ uses: DEFRA/ffc-shared-actions/.github/workflows/secret-scanner.yml@main
@@ -0,0 +1,139 @@
1
+ # Gitleaks configuration — shared by the GitHub Actions workflow and the
2
+ # local pre-commit hook so both environments enforce identical rules.
3
+ #
4
+ # Docs: https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml
5
+
6
+ title = "ffc secret scanner action"
7
+
8
+ # ---------------------------------------------------------------------------
9
+ # Extend the default ruleset shipped with gitleaks so we inherit all the
10
+ # built-in detectors (AWS keys, GitHub tokens, generic high-entropy strings,
11
+ # etc.) and only need to declare project-specific additions below.
12
+ # ---------------------------------------------------------------------------
13
+ [extend]
14
+ useDefault = true
15
+
16
+ # ---------------------------------------------------------------------------
17
+ # Project-specific rules
18
+ # Add deny rules here for patterns specific to this service that the default
19
+ # ruleset would not already catch.
20
+ # ---------------------------------------------------------------------------
21
+
22
+ # Example: Azure client secrets (adjust the prefix/pattern to match your
23
+ # actual format once you know it).
24
+ [[rules]]
25
+ id = "azure-client-secret"
26
+ description = "Azure client secret"
27
+ regex = '''(?i)azure[_\-]?client[_\-]?secret[\s\S]{0,20}[=:]\s*["']?([a-zA-Z0-9+/~._-]{32,})'''
28
+ tags = ["azure", "secret"]
29
+
30
+ # Example: catch raw connection strings that include a password component.
31
+ [[rules]]
32
+ id = "db-connection-string"
33
+ description = "Database connection string with embedded password"
34
+ regex = '''(?i)(postgres|postgresql|mssql|mysql):\/\/[^:]+:[^@]{8,}@'''
35
+ tags = ["database", "secret"]
36
+
37
+ [[rules]]
38
+ id = "notify-api-key"
39
+ description = "GOV.UK Notify API key"
40
+ regex = '''(?i)notify[_\-]?api[_\-]?key[a-zA-Z]*[\s\S]{0,20}[=:]\s*["']?([a-z0-9_\-]{72,})'''
41
+ tags = ["notify", "secret"]
42
+
43
+ [[rules]]
44
+ id = "plaintext-email-address"
45
+ description = "Plain text email address (potential PII leak)"
46
+ regex = '''[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}'''
47
+ tags = ["email", "pii"]
48
+
49
+ [rules.allowlist]
50
+ description = "Email addresses are expected in npm package metadata files and as example values in code"
51
+ paths = [
52
+ '''(^|/)package\.json$''',
53
+ '''(^|/)package-lock\.json$''',
54
+ '''(?i)(^|/)changelog(/|$)''',
55
+ '''(?i)(^|/)test(/|$)''',
56
+ '''(^|/)asyncapi\.ya?ml$''',
57
+ ]
58
+ regexes = [
59
+ # Emails using universally-recognised placeholder domains — not real credentials
60
+ '''[a-zA-Z0-9._%+\-]+@(example\.(com|org|net)|domain\.com|test\.com|localhost)''',
61
+ ]
62
+
63
+ [[rules]]
64
+ id = "appconfig-literal-secret"
65
+ description = "Literal secret value found in appconfig file - use KeyVault reference instead"
66
+ regex = '''(?i)(?:password|secret|key|token|credential|connectionstring)[a-zA-Z_\-]*:\s*["']?[a-zA-Z0-9+/=._\-]{20,}'''
67
+ path = '''appconfig/(prod|pre|pr|dev|test|snd2)\.yaml'''
68
+ tags = ["appconfig", "keyvault", "secret"]
69
+
70
+ [rules.allowlist]
71
+ description = "Allow KeyVault structural keywords and Kubernetes secret mapping fields"
72
+ regexes = [
73
+ '''objectName:''',
74
+ '''objectType:''',
75
+ '''secretName:''',
76
+ '''keyvaultName:''',
77
+ # Kubernetes 'key:' fields in secret store mappings hold env var names
78
+ # (ALL_CAPS convention), never literal credential values
79
+ '''key:\s*[A-Z][A-Z0-9_]+''',
80
+ ]
81
+
82
+
83
+ # ---------------------------------------------------------------------------
84
+ # Allow-list — entries here are NEVER flagged, regardless of matching rules.
85
+ #
86
+ # Guidelines:
87
+ # - Add an entry only for well-understood test/mock values.
88
+ # - Include a comment explaining WHY the value is safe to allow.
89
+ # - Prefer allowing by file path rather than by regex where possible so the
90
+ # noise surface is as small as possible.
91
+ # ---------------------------------------------------------------------------
92
+
93
+ [allowlist]
94
+ description = "Known-safe test values and intentional mock data"
95
+
96
+ # Specific commits that contain only test/fixture data (replace with real SHA).
97
+ # commits = ["<commit-sha>"]
98
+
99
+ # Files that are allowed to contain secret-like patterns (e.g. unit test
100
+ # fixtures, mock objects). Add only what is genuinely safe.
101
+ paths = [
102
+ # Jest snapshot or mock-object files are populated with fake tokens.
103
+ '''(^|/)package\.json$''',
104
+ '''(^|/)package-lock\.json$''',
105
+ '''(^|/)CHANGELOG''',
106
+ '''(^|/)CONTRIBUTORS''',
107
+ '''(^|/)LICENSE''',
108
+ '''(^|/)\.secrets\.baseline$''',
109
+ '''\.github/.*''',
110
+ '''test/mock-objects/.*''',
111
+ '''test/mock-modules/.*''',
112
+ '''test/mocks/.*''',
113
+ ]
114
+
115
+ # Individual regex patterns that should never be flagged, regardless of file.
116
+ # Each entry should be as specific as possible — prefer an exact literal over
117
+ # a broad pattern.
118
+ #
119
+ regexTarget = "line"
120
+ regexes = [
121
+ # Well-known Azurite (Azure Storage Emulator) development AccountKey.
122
+ # The AccountKey is hardcoded and publicly documented by Microsoft — it is
123
+ # identical across every Azurite instance and is never a live secret.
124
+ # Matching on AccountName+AccountKey alone makes this universal: the env var
125
+ # name and BlobEndpoint hostname are irrelevant and vary per service.
126
+ # Ref: https://learn.microsoft.com/azure/storage/common/storage-use-azurite#well-known-storage-account-and-key
127
+ '''AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==''',
128
+ '''Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw''',
129
+ # rpa email found in many ffc-doc statement templates
130
+ '''ruralpayments@defra.gov.uk''',
131
+ #Notify simulation addresses
132
+ '''perm-fail@simulator.notify''',
133
+ '''temp-fail@simulator.notify''',
134
+ #dev-account-Emails
135
+ '''defra-ad2-fcp@atos.net''',
136
+ '''payment-document-services@defra.gov.uk''',
137
+ # Historic commit containing log in doc-publisher
138
+ '''eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiJodHRwczovL3N0b3JhZ2UuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvYzlkNzQwOTAtYjRlNi00YjA0LTk4MWQtZTY3NTdhMTYwODEyLyIsImlhdCI6MTY3ODExMDIyNiwibmJmIjoxNjc4MTEwMjI2LCJleHAiOjE2NzgxOTY5MjYsImFpbyI6IkUyWmdZQ2dTQ0kzS1c3K3JTWTZ4MDhoVG9DNERBQT09IiwiYXBwaWQiOiI3NTNhNjYwYy0xMjkyLTQ4NWMtYTY1ZS1kYzUxNTI5YTg2YWUiLCJhcHBpZGFjciI6IjIiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9jOWQ3NDA5MC1iNGU2LTRiMDQtOTgxZC1lNjc1N2ExNjA4MTIvIiwib2lkIjoiZWQ0YmRmZDItYjJlOS00NjI5LTg2NjktMTMzMjZkZmFhNTBiIiwicmgiOiIwLkFBQUFrRURYeWVhMEJFdVlIZVoxZWhZSUVvR21CdVRVODZoQ2tMYkNzQ2xKZXZGSEFBQS4iLCJzdWIiOiJlZDRiZGZkMi1iMmU5LTQ2MjktODY2OS0xMzMyNmRmYWE1MGIiLCJ0aWQiOiJjOWQ3NDA5MC1iNGU2LTRiMDQtOTgxZC1lNjc1N2ExNjA4MTIiLCJ1dGkiOiJ0VWU4a2JlRFkwU0w5LXNuRDNZNEFRIiwidmVyIjoiMS4wIiwieG1zX2F6X3JpZCI6Ii9zdWJzY3JpcHRpb25zL2NkNGU5YTAwLTk5ZDgtNDVhMi05OGJiLTc2NDhlZjEyYzI2ZC9yZXNvdXJjZWdyb3Vwcy9NQ19TTkRGRkNBS1NSRzEwMDFfU05ERkZDQUtTQ0wxMDAxX25vcnRoZXVyb3BlL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tcHV0ZS92aXJ0dWFsTWFjaGluZVNjYWxlU2V0cy9ha3MtYWdlbnRwb29sLTE0NjU0MTgzLXZtc3MiLCJ4bXNfbWlyaWQiOiIvc3Vic2NyaXB0aW9ucy9jZDRlOWEwMC05OWQ4LTQ1YTItOThiYi03NjQ4ZWYxMmMyNmQvcmVzb3VyY2Vncm91cHMvU05ERkZDQUtTUkcxMDAxL3Byb3ZpZGVycy9NaWNyb3NvZnQuTWFuYWdlZElkZW50aXR5L3VzZXJBc3NpZ25lZElkZW50aXRpZXMvZmZjLXNuZC1wci1yb2xlIn0.ow6tLyOvyqUp9nkyUoB9pMJBiA9-0I4U9B8z4De3p9ypOhLUpR34v-WgtKISe7G97hxBvUqvlBZUSgSEREblURLMdUFONx1vFVoDTAgFP-Rq9ttR-X8f6m11rJdgGzWanCUk-btbF1-tOHcYdqU4Szipl_7sJpvvnBd3Vn5SFmBItT0F2AZLQEXJFQFdVXklzYOVxVZBJjoEwFzFR01n2xOnbAQa0T0w5JefESkcAb8z4HGCapSe2y4j8SY8oF-PuOk7EUYuhRVY8K-xV1SaMIhJt-_dJegrYpmtkb9GHRU341CJZhVDfnoPTgLM-FuePItk5IvF20YRu0cw-XLa7g'''
139
+ ]
package/.gitleaks.toml ADDED
@@ -0,0 +1,15 @@
1
+ # ffc-pay-schemes/.gitleaks.toml
2
+ title = "ffc-pay-schemes"
3
+ [extend]
4
+ path = ".gitleaks-shared/.gitleaks.toml"
5
+ # Service-specific additions only below this line, use [[ ]] for multiple allowlist instances
6
+ [allowlist]
7
+ description = "Service-specific exclusions"
8
+ paths = [
9
+ '''test/mock-objects/.*''',
10
+ '''test/mock-modules/.*''',
11
+ '''test/unit/.*'''
12
+ ]
13
+ #enter regex here wrapped in triple ''' to exclude specific keys
14
+ #regexes = [
15
+ #]
File without changes
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+
3
+ GITLEAKS_VERSION="8.30.0"
4
+ GITLEAKS_BIN="$HOME/.local/bin/gitleaks"
5
+ GITLEAKS_URL="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
6
+
7
+ # get installed version (if any)
8
+ INSTALLED_VERSION=""
9
+ if [ -x "$GITLEAKS_BIN" ]; then
10
+ INSTALLED_VERSION=$("$GITLEAKS_BIN" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || true)
11
+ fi
12
+
13
+ if [ "$INSTALLED_VERSION" != "$GITLEAKS_VERSION" ]; then
14
+ echo "⚠️ Installing/updating gitleaks v${GITLEAKS_VERSION} (was: ${INSTALLED_VERSION:-none})..."
15
+ mkdir -p "$HOME/.local/bin"
16
+ curl -sSfL "$GITLEAKS_URL" | tar -xz -C "$HOME/.local/bin" gitleaks
17
+ chmod +x "$GITLEAKS_BIN"
18
+ fi
19
+
20
+ # Always fetch latest shared gitleaks config
21
+ echo "Fetching shared gitleaks config..."
22
+ mkdir -p .gitleaks-shared
23
+ if ! curl -sSfL https://raw.githubusercontent.com/DEFRA/ffc-shared-actions/main/.gitleaks.toml \
24
+ -o .gitleaks-shared/.gitleaks.toml; then
25
+ echo "❌ Failed to fetch shared gitleaks config from ffc-shared-actions." >&2
26
+ exit 1
27
+ fi
28
+
29
+ echo "🔍 Running gitleaks scan..."
30
+ "$GITLEAKS_BIN" protect --staged --config .gitleaks.toml --verbose --exit-code=2
package/LICENCE ADDED
@@ -0,0 +1,8 @@
1
+ The Open Government Licence (OGL) Version 3
2
+
3
+ Copyright (c) 2020 Defra
4
+
5
+ This source code is licensed under the Open Government Licence v3.0. To view this
6
+ licence, visit www.nationalarchives.gov.uk/doc/open-government-licence/version/3
7
+ or write to the Information Policy Team, The National Archives, Kew, Richmond,
8
+ Surrey, TW9 4DU.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # ffc-pay-schemes
2
+
3
+ Module for defining and providing details for the payment schemes supported by the Payment Hub.
4
+
5
+ ## Usage
6
+
7
+ ### Installation
8
+
9
+ ```
10
+ npm install --save ffc-pay-schemes
11
+ ```
12
+
13
+ ## Licence
14
+
15
+ THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT
16
+ LICENCE found at:
17
+
18
+ <http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3>
19
+
20
+ The following attribution statement MUST be cited in your products and
21
+ applications when using this information.
22
+
23
+ > Contains public sector information licensed under the Open Government license
24
+ > v3
25
+
26
+ ### About the licence
27
+
28
+ The Open Government Licence (OGL) was developed by the Controller of Her
29
+ Majesty's Stationery Office (HMSO) to enable information providers in the
30
+ public sector to license the use and re-use of their information under a common
31
+ open licence.
32
+
33
+ It is designed to encourage use and re-use of information freely and flexibly,
34
+ with only a few conditions.
@@ -0,0 +1,48 @@
1
+ module.exports = {
2
+ SOS210: 'SOS210',
3
+ SOS216: 'SOS216',
4
+ SOS228: 'SOS228',
5
+ SOS229: 'SOS229',
6
+ SOS231: 'SOS231',
7
+ SOS232: 'SOS232',
8
+ SOS233: 'SOS233',
9
+ SOS234: 'SOS234',
10
+ SOS236: 'SOS236',
11
+ SOS237: 'SOS237',
12
+ SOS238: 'SOS238',
13
+ SOS239: 'SOS239',
14
+ SOS260: 'SOS260',
15
+ SOS266: 'SOS266',
16
+ SOS350: 'SOS350',
17
+ SOS351: 'SOS351',
18
+ SOS361: 'SOS361',
19
+ SOS362: 'SOS362',
20
+ SOS363: 'SOS363',
21
+ SOS364: 'SOS364',
22
+ SOS367: 'SOS367',
23
+ SOS368: 'SOS368',
24
+ SOS369: 'SOS369',
25
+ SOS400: 'SOS400',
26
+ SOS402: 'SOS402',
27
+ SOS404: 'SOS404',
28
+ SOS410: 'SOS410',
29
+ SOS415: 'SOS415',
30
+ SOS416: 'SOS416',
31
+ SOS417: 'SOS417',
32
+ SOS420: 'SOS420',
33
+ SOS471: 'SOS471',
34
+ SOS472: 'SOS472',
35
+ SOS473: 'SOS473',
36
+ SOS474: 'SOS474',
37
+ SOS710: 'SOS710',
38
+ SOS920: 'SOS920',
39
+ SOS921: 'SOS921',
40
+ SOS922: 'SOS922',
41
+ SOS923: 'SOS923',
42
+ SOS924: 'SOS924',
43
+ SOS925: 'SOS925',
44
+ SOS926: 'SOS926',
45
+ SOS927: 'SOS927',
46
+ SOS928: 'SOS928',
47
+ SOS929: 'SOS929'
48
+ }
@@ -0,0 +1,48 @@
1
+ module.exports = {
2
+ SOS217: 'SOS217',
3
+ SOS267: 'SOS267',
4
+ SOS330: 'SOS330',
5
+ SOS336: 'SOS336',
6
+ SOS352: 'SOS352',
7
+ SOS466: 'SOS466',
8
+ SOS450: 'SOS450',
9
+ SOS451: 'SOS451',
10
+ SOS452: 'SOS452',
11
+ SOS453: 'SOS453',
12
+ SOS454: 'SOS454',
13
+ SOS455: 'SOS455',
14
+ SOS456: 'SOS456',
15
+ SOS457: 'SOS457',
16
+ SOS458: 'SOS458',
17
+ SOS459: 'SOS459',
18
+ SOS460: 'SOS460',
19
+ SOS461: 'SOS461',
20
+ SOS462: 'SOS462',
21
+ SOS463: 'SOS463',
22
+ SOS464: 'SOS464',
23
+ SOS465: 'SOS465',
24
+ SOS471: 'SOS471',
25
+ SOS472: 'SOS472',
26
+ SOS473: 'SOS473',
27
+ SOS474: 'SOS474',
28
+ SOS553: 'SOS553',
29
+ SOS554: 'SOS554',
30
+ SOS555: 'SOS555',
31
+ SOS556: 'SOS556',
32
+ SOS557: 'SOS557',
33
+ SOS558: 'SOS558',
34
+ SOS559: 'SOS559',
35
+ SOS560: 'SOS560',
36
+ SOS746: 'SOS746',
37
+ SOS750: 'SOS750',
38
+ SOS940: 'SOS940',
39
+ SOS941: 'SOS941',
40
+ SOS942: 'SOS942',
41
+ SOS943: 'SOS943',
42
+ SOS944: 'SOS944',
43
+ SOS945: 'SOS945',
44
+ SOS946: 'SOS946',
45
+ SOS947: 'SOS947',
46
+ SOS948: 'SOS948',
47
+ SOS949: 'SOS949'
48
+ }
@@ -0,0 +1,47 @@
1
+ module.exports = {
2
+ SOS218: 'SOS218',
3
+ SOS268: 'SOS268',
4
+ SOS310: 'SOS310',
5
+ SOS316: 'SOS316',
6
+ SOS352: 'SOS352',
7
+ SOS430: 'SOS430',
8
+ SOS431: 'SOS431',
9
+ SOS432: 'SOS432',
10
+ SOS433: 'SOS433',
11
+ SOS434: 'SOS434',
12
+ SOS435: 'SOS435',
13
+ SOS436: 'SOS436',
14
+ SOS437: 'SOS437',
15
+ SOS438: 'SOS438',
16
+ SOS439: 'SOS439',
17
+ SOS445: 'SOS445',
18
+ SOS446: 'SOS446',
19
+ SOS440: 'SOS440',
20
+ SOS441: 'SOS441',
21
+ SOS442: 'SOS442',
22
+ SOS443: 'SOS443',
23
+ SOS444: 'SOS444',
24
+ SOS471: 'SOS471',
25
+ SOS472: 'SOS472',
26
+ SOS473: 'SOS473',
27
+ SOS474: 'SOS474',
28
+ SOS553: 'SOS553',
29
+ SOS554: 'SOS554',
30
+ SOS555: 'SOS555',
31
+ SOS556: 'SOS556',
32
+ SOS557: 'SOS557',
33
+ SOS558: 'SOS558',
34
+ SOS559: 'SOS559',
35
+ SOS560: 'SOS560',
36
+ SOS770: 'SOS770',
37
+ SOS960: 'SOS960',
38
+ SOS961: 'SOS961',
39
+ SOS962: 'SOS962',
40
+ SOS963: 'SOS963',
41
+ SOS964: 'SOS964',
42
+ SOS965: 'SOS965',
43
+ SOS966: 'SOS966',
44
+ SOS967: 'SOS967',
45
+ SOS968: 'SOS968',
46
+ SOS969: 'SOS969'
47
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ RP00: 'RP00',
3
+ RP10: 'RP10',
4
+ NE00: 'NE00',
5
+ FC00: 'FC00'
6
+ }
@@ -0,0 +1,34 @@
1
+ module.exports = {
2
+ G00: 'G00',
3
+ G01: 'G01',
4
+ P01: 'P01',
5
+ P02: 'P02',
6
+ P03: 'P03',
7
+ P04: 'P04',
8
+ P05: 'P05',
9
+ P06: 'P06',
10
+ P07: 'P07',
11
+ P08: 'P08',
12
+ P09: 'P09',
13
+ P10: 'P10',
14
+ P11: 'P11',
15
+ P12: 'P12',
16
+ P13: 'P13',
17
+ P14: 'P14',
18
+ P15: 'P15',
19
+ P16: 'P16',
20
+ P17: 'P17',
21
+ P18: 'P18',
22
+ P19: 'P19',
23
+ P20: 'P20',
24
+ P21: 'P21',
25
+ P22: 'P22',
26
+ P23: 'P23',
27
+ P24: 'P24',
28
+ P25: 'P25',
29
+ R00: 'R00',
30
+ X01: 'X01',
31
+ X02: 'X02',
32
+ X03: 'X03',
33
+ X04: 'X04'
34
+ }
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ DOM00: 'DOM00',
3
+ DOM10: 'DOM10',
4
+ DRD10: 'DRD10',
5
+ ERD14: 'ERD14',
6
+ EGF00: 'EGF00',
7
+ EXQ00: 'EXQ00'
8
+ }
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ SFI: 'SFI',
3
+ SFI_PILOT: 'SFIP',
4
+ LUMP_SUMS: 'LSES',
5
+ VET_VISITS: 'AHWR',
6
+ CS: 'CS',
7
+ BPS: 'BPS',
8
+ ES: 'ES',
9
+ FC: 'FC',
10
+ IMPS: 'IMPS',
11
+ SFI23: 'SFI23',
12
+ DELINKED: 'DP',
13
+ SFI_EXPANDED: 'ESFIO',
14
+ COHT_REVENUE: 'COHTR',
15
+ COHT_CAPITAL: 'COHTC',
16
+ FPTT: 'FPTT',
17
+ WMP: 'WMP'
18
+ }
@@ -0,0 +1,106 @@
1
+ const schemeIds = require('./scheme-ids')
2
+
3
+ module.exports = Object.freeze([
4
+ {
5
+ schemeId: schemeIds.SFI,
6
+ prefix: 'FFCSFI',
7
+ suffix: ' (SITI_SFI)',
8
+ source: 'SITI_SFI'
9
+ },
10
+ {
11
+ schemeId: schemeIds.SFI_PILOT,
12
+ prefix: 'FFCSFIP',
13
+ suffix: ' (SITISFI)',
14
+ source: 'SITISFI'
15
+ },
16
+ {
17
+ schemeId: schemeIds.LUMP_SUMS,
18
+ prefix: 'FFCLS',
19
+ suffix: ' (LUMP)',
20
+ source: 'SitiLUMP'
21
+ },
22
+ {
23
+ schemeId: schemeIds.VET_VISITS,
24
+ prefix: 'FFCVV',
25
+ suffix: ' (Vet Visits)',
26
+ source: 'AHWR'
27
+ },
28
+ {
29
+ schemeId: schemeIds.CS,
30
+ prefix: 'FFCCS',
31
+ suffix: ' (SITICS)',
32
+ source: 'SITICS'
33
+ },
34
+ {
35
+ schemeId: schemeIds.BPS,
36
+ prefix: 'FFCBPS',
37
+ suffix: ' (SITI)',
38
+ source: 'SITIAgri'
39
+ },
40
+ {
41
+ schemeId: schemeIds.MANUAL,
42
+ prefix: 'FFCManual',
43
+ suffix: ' (Manual)',
44
+ source: 'M_TEMPLATE'
45
+ },
46
+ {
47
+ schemeId: schemeIds.ES,
48
+ prefix: 'FFCES',
49
+ suffix: ' (Genesis)',
50
+ source: 'Genesis'
51
+ },
52
+ {
53
+ schemeId: schemeIds.FC,
54
+ prefix: 'FFCFC',
55
+ suffix: ' (GLOS)',
56
+ source: 'GLOS'
57
+ },
58
+ {
59
+ schemeId: schemeIds.IMPS,
60
+ prefix: 'FFCIMPS',
61
+ suffix: ' (IMPS)',
62
+ source: '04'
63
+ },
64
+ {
65
+ schemeId: schemeIds.SFI23,
66
+ prefix: 'FFCSFIA',
67
+ suffix: ' (SFI_SFIA)',
68
+ source: 'SITI_SFIA'
69
+ },
70
+ {
71
+ schemeId: schemeIds.DELINKED,
72
+ prefix: 'FFCDP',
73
+ suffix: ' (SITIDP)',
74
+ source: 'SITIDP'
75
+ },
76
+ {
77
+ schemeId: schemeIds.SFI_EXPANDED,
78
+ prefix: 'FFCESFIO',
79
+ suffix: ' (SITI_ESFIO)',
80
+ source: 'SITI_ESFIO'
81
+ },
82
+ {
83
+ schemeId: schemeIds.COHT_REVENUE,
84
+ prefix: 'FFCSITICOHTR',
85
+ suffix: ' (SITICOHTR)',
86
+ source: 'SITICOHTR'
87
+ },
88
+ {
89
+ schemeId: schemeIds.COHT_CAPITAL,
90
+ prefix: 'FFCSITICOHTC',
91
+ suffix: ' (SITICOHTC)',
92
+ source: 'SITICOHTC'
93
+ },
94
+ {
95
+ schemeId: schemeIds.FPTT,
96
+ prefix: 'FFCFALS_FPTT',
97
+ suffix: ' (FALS_FPTT)',
98
+ source: 'FALS_FPTT'
99
+ },
100
+ {
101
+ schemeId: schemeIds.WMP,
102
+ prefix: 'FFCFALS_WMP',
103
+ suffix: ' (FALS_WMP)',
104
+ source: 'FALS_WMP'
105
+ }
106
+ ])
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ SFI: 1,
3
+ SFI_PILOT: 2,
4
+ LUMP_SUMS: 3,
5
+ VET_VISITS: 4,
6
+ CS: 5,
7
+ BPS: 6,
8
+ MANUAL: 8,
9
+ ES: 9,
10
+ FC: 10,
11
+ IMPS: 11,
12
+ SFI23: 12,
13
+ DELINKED: 13,
14
+ SFI_EXPANDED: 14,
15
+ COHT_REVENUE: 15,
16
+ COHT_CAPITAL: 16,
17
+ FPTT: 17,
18
+ WMP: 18
19
+ }
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ SFI: 'Sustainable Farming Incentive 22',
3
+ SFI_PILOT: 'Sustainable Farming Incentive Pilot',
4
+ LUMP_SUMS: 'Lump Sums',
5
+ VET_VISITS: 'Annual Health and Welfare Review',
6
+ CS: 'Countryside Stewardship',
7
+ BPS: 'Basic Payment Scheme',
8
+ MANUAL: 'Manual Injection',
9
+ ES: 'Environmental Stewardship',
10
+ FC: 'Forestry Commission',
11
+ IMPS: 'Internal Market Payment Scheme',
12
+ SFI23: 'Sustainable Farming Incentive 23',
13
+ DELINKED: 'Delinked Payments',
14
+ SFI_EXPANDED: 'Sustainable Farming Incentive Expanded Offer',
15
+ COHT_REVENUE: 'Combined Offer Higher Tier (Revenue)',
16
+ COHT_CAPITAL: 'Combined Offer Higher Tier (Capital)',
17
+ FPTT: 'Farm Payments Technical Test',
18
+ WMP: 'Woodland Management Plan'
19
+ }
@@ -0,0 +1,3 @@
1
+ const { MANUAL, ES, IMPS, FC, FPTT, WMP } = require('./scheme-ids')
2
+
3
+ module.exports = [MANUAL, ES, IMPS, FC, FPTT, WMP]
@@ -0,0 +1,3 @@
1
+ const { FPTT, WMP } = require('./scheme-ids')
2
+
3
+ module.exports = [FPTT, WMP]