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,127 @@
1
+ const schemeIds = require('./scheme-ids')
2
+ const sourceSystems = require('./source-systems')
3
+ const pillars = require('./pillars')
4
+ const { RP00, NE00, FC00, RP10 } = require('./delivery-bodies')
5
+ const { DRD10, DOM10, ERD14, EGF00, EXQ00, DOM00 } = require('./fund-codes')
6
+
7
+ module.exports = Object.freeze([
8
+ {
9
+ schemeId: schemeIds.SFI,
10
+ sourceSystem: sourceSystems.SFI,
11
+ pillar: pillars.SFI,
12
+ deliveryBody: RP00,
13
+ fundCode: DRD10
14
+ },
15
+ {
16
+ schemeId: schemeIds.SFI_PILOT,
17
+ sourceSystem: sourceSystems.SFI_PILOT,
18
+ pillar: pillars.SFI_PILOT,
19
+ deliveryBody: RP00,
20
+ fundCode: DRD10
21
+ },
22
+ {
23
+ schemeId: schemeIds.LUMP_SUMS,
24
+ sourceSystem: sourceSystems.LUMP_SUMS,
25
+ pillar: pillars.LUMP_SUMS,
26
+ deliveryBody: RP00,
27
+ fundCode: DOM10
28
+ },
29
+ {
30
+ schemeId: schemeIds.VET_VISITS,
31
+ sourceSystem: sourceSystems.VET_VISITS,
32
+ pillar: pillars.VET_VISITS,
33
+ deliveryBody: RP00,
34
+ fundCode: DOM10
35
+ },
36
+ {
37
+ schemeId: schemeIds.CS,
38
+ sourceSystem: sourceSystems.CS,
39
+ pillar: pillars.CS,
40
+ deliveryBody: NE00,
41
+ fundCode: ERD14
42
+ },
43
+ {
44
+ schemeId: schemeIds.BPS,
45
+ sourceSystem: sourceSystems.BPS,
46
+ pillar: pillars.BPS,
47
+ deliveryBody: RP00,
48
+ fundCode: EGF00
49
+ },
50
+ {
51
+ schemeId: schemeIds.MANUAL,
52
+ sourceSystem: sourceSystems.MANUAL,
53
+ pillar: null,
54
+ deliveryBody: RP00,
55
+ fundCode: DRD10
56
+ },
57
+ {
58
+ schemeId: schemeIds.ES,
59
+ sourceSystem: sourceSystems.ES,
60
+ pillar: pillars.ES,
61
+ deliveryBody: NE00,
62
+ fundCode: EXQ00
63
+ },
64
+ {
65
+ schemeId: schemeIds.FC,
66
+ sourceSystem: sourceSystems.FC,
67
+ pillar: pillars.FC,
68
+ deliveryBody: FC00,
69
+ fundCode: DOM00
70
+ },
71
+ {
72
+ schemeId: schemeIds.IMPS,
73
+ sourceSystem: sourceSystems.IMPS,
74
+ pillar: pillars.IMPS,
75
+ deliveryBody: RP00,
76
+ fundCode: DOM00
77
+ },
78
+ {
79
+ schemeId: schemeIds.SFI23,
80
+ sourceSystem: sourceSystems.SFI23,
81
+ pillar: pillars.SFI23,
82
+ deliveryBody: RP00,
83
+ fundCode: DRD10
84
+ },
85
+ {
86
+ schemeId: schemeIds.DELINKED,
87
+ sourceSystem: sourceSystems.DELINKED,
88
+ pillar: pillars.DELINKED,
89
+ deliveryBody: RP00,
90
+ fundCode: DOM10
91
+ },
92
+ {
93
+ schemeId: schemeIds.SFI_EXPANDED,
94
+ sourceSystem: sourceSystems.SFI_EXPANDED,
95
+ pillar: pillars.SFI_EXPANDED,
96
+ deliveryBody: RP00,
97
+ fundCode: DRD10
98
+ },
99
+ {
100
+ schemeId: schemeIds.COHT_REVENUE,
101
+ sourceSystem: sourceSystems.COHT_REVENUE,
102
+ pillar: pillars.COHT_REVENUE,
103
+ deliveryBody: RP00,
104
+ fundCode: DRD10
105
+ },
106
+ {
107
+ schemeId: schemeIds.COHT_CAPITAL,
108
+ sourceSystem: sourceSystems.COHT_CAPITAL,
109
+ pillar: pillars.COHT_CAPITAL,
110
+ deliveryBody: RP00,
111
+ fundCode: DRD10
112
+ },
113
+ {
114
+ schemeId: schemeIds.FPTT,
115
+ sourceSystem: sourceSystems.FPTT,
116
+ pillar: pillars.FPTT,
117
+ deliveryBody: RP00,
118
+ fundCode: DRD10
119
+ },
120
+ {
121
+ schemeId: schemeIds.WMP,
122
+ sourceSystem: sourceSystems.WMP,
123
+ pillar: pillars.WMP,
124
+ deliveryBody: RP10,
125
+ fundCode: DRD10
126
+ }
127
+ ])
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ SFI: 'SFI',
3
+ SFI_PILOT: 'SFIP',
4
+ LUMP_SUMS: 'LSES',
5
+ VET_VISITS: 'AHWR',
6
+ CS: 'SITI AGRI CS SYS',
7
+ BPS: 'SITI AGRI SYS',
8
+ MANUAL: 'Injection',
9
+ ES: 'Genesis',
10
+ FC: 'GLOS',
11
+ IMPS: 'IMPS',
12
+ SFI23: 'SFIA',
13
+ DELINKED: 'DP',
14
+ SFI_EXPANDED: 'ESFIO',
15
+ COHT_REVENUE: 'COHTR',
16
+ COHT_CAPITAL: 'COHTC',
17
+ FPTT: 'FPTT',
18
+ WMP: 'WMP'
19
+ }
@@ -0,0 +1,11 @@
1
+ const createDefaultInvoiceNumber = (paymentRequest) => {
2
+ const suffixLength = 3
3
+ if (paymentRequest.agreementNumber && paymentRequest.paymentRequestNumber) {
4
+ return `${paymentRequest.agreementNumber}V${paymentRequest.paymentRequestNumber.toString().padStart(suffixLength, '0')}`
5
+ }
6
+ return null
7
+ }
8
+
9
+ module.exports = {
10
+ createDefaultInvoiceNumber
11
+ }
@@ -0,0 +1,7 @@
1
+ const createESInvoiceNumber = (paymentRequest) => {
2
+ return `I(${paymentRequest.invoiceNumber})${paymentRequest.contractNumber}`
3
+ }
4
+
5
+ module.exports = {
6
+ createESInvoiceNumber
7
+ }
@@ -0,0 +1,14 @@
1
+ const createIMPSInvoiceNumber = (paymentRequest) => {
2
+ if (paymentRequest.invoiceNumber.includes('/')) {
3
+ if (paymentRequest.invoiceNumber.includes(`/${paymentRequest.trader}`)) {
4
+ return paymentRequest.invoiceNumber
5
+ }
6
+ const invoiceParts = paymentRequest.invoiceNumber.split('/')
7
+ return `${invoiceParts[0]}/${paymentRequest.trader}${invoiceParts[1]}`
8
+ }
9
+ return null
10
+ }
11
+
12
+ module.exports = {
13
+ createIMPSInvoiceNumber
14
+ }
@@ -0,0 +1,12 @@
1
+ const createSitiAgriInvoiceNumber = (paymentRequest) => {
2
+ const sitiInvoiceNumberElementLength = 7
3
+ const suffixLength = 3
4
+ if (paymentRequest.invoiceNumber.length >= sitiInvoiceNumberElementLength && paymentRequest.contractNumber && paymentRequest.paymentRequestNumber) {
5
+ return `S${paymentRequest.invoiceNumber.slice(-sitiInvoiceNumberElementLength)}${paymentRequest.contractNumber}V${paymentRequest.paymentRequestNumber.toString().padStart(suffixLength, '0')}`
6
+ }
7
+ return null
8
+ }
9
+
10
+ module.exports = {
11
+ createSitiAgriInvoiceNumber
12
+ }
@@ -0,0 +1,12 @@
1
+ const createStandardSchemeInvoiceNumber = (paymentRequest) => {
2
+ const sitiInvoiceNumberElementLength = 7
3
+ const suffixLength = 3
4
+ if (paymentRequest.invoiceNumber.length >= sitiInvoiceNumberElementLength && paymentRequest.contractNumber && paymentRequest.paymentRequestNumber) {
5
+ return `${paymentRequest.invoiceNumber.charAt(0)}${paymentRequest.invoiceNumber.slice(-sitiInvoiceNumberElementLength)}${paymentRequest.contractNumber}V${paymentRequest.paymentRequestNumber.toString().padStart(suffixLength, '0')}`
6
+ }
7
+ return null
8
+ }
9
+
10
+ module.exports = {
11
+ createStandardSchemeInvoiceNumber
12
+ }
@@ -0,0 +1,38 @@
1
+ const { MANUAL: MANUAL_SOURCE } = require('../constants/source-systems')
2
+ const { MANUAL, FC, FPTT, WMP, DELINKED, SFI_EXPANDED, COHT_REVENUE, COHT_CAPITAL, SFI, SFI_PILOT, LUMP_SUMS, CS, BPS, SFI23, ES, IMPS } = require('../constants/scheme-ids')
3
+ const { createStandardSchemeInvoiceNumber } = require('./create-standard-scheme-invoice-number')
4
+ const { createSitiAgriInvoiceNumber } = require('./create-siti-agri-invoice-number')
5
+ const { createESInvoiceNumber } = require('./create-es-invoice-number')
6
+ const { createIMPSInvoiceNumber } = require('./create-imps-invoice-number')
7
+ const { createDefaultInvoiceNumber } = require('./create-default-invoice-number')
8
+
9
+ const createInvoiceNumber = (paymentRequest) => {
10
+ try {
11
+ const schemesWithAcceptedInvoiceNumbers = new Set([MANUAL, FC, FPTT, WMP])
12
+ if (schemesWithAcceptedInvoiceNumbers.has(paymentRequest.schemeId) || paymentRequest?.sourceSystem === MANUAL_SOURCE) {
13
+ return paymentRequest.invoiceNumber
14
+ }
15
+ const standardSchemeInvoices = new Set([DELINKED, SFI_EXPANDED, COHT_REVENUE, COHT_CAPITAL])
16
+ if (standardSchemeInvoices.has(paymentRequest.schemeId)) {
17
+ return createStandardSchemeInvoiceNumber(paymentRequest)
18
+ }
19
+ const sitiAgriSchemeInvoices = new Set([SFI, SFI_PILOT, LUMP_SUMS, CS, BPS, SFI23])
20
+ if (sitiAgriSchemeInvoices.has(paymentRequest.schemeId)) {
21
+ return createSitiAgriInvoiceNumber(paymentRequest)
22
+ }
23
+ switch (paymentRequest.schemeId) {
24
+ case ES:
25
+ return createESInvoiceNumber(paymentRequest)
26
+ case IMPS:
27
+ return createIMPSInvoiceNumber(paymentRequest)
28
+ default:
29
+ return createDefaultInvoiceNumber(paymentRequest)
30
+ }
31
+ } catch {
32
+ return null
33
+ }
34
+ }
35
+
36
+ module.exports = {
37
+ createInvoiceNumber
38
+ }
@@ -0,0 +1,7 @@
1
+ const useInvoiceNumberAsIs = (invoiceNumber) => {
2
+ return invoiceNumber
3
+ }
4
+
5
+ module.exports = {
6
+ useInvoiceNumberAsIs
7
+ }
@@ -0,0 +1,12 @@
1
+ const createDefaultInvoiceNumber = (invoiceNumber, splitId) => {
2
+ // an invoice number is a string made up of two elements, to inject a split id character into the string we need to identify the position of those elements
3
+ // we also need to trim the first character of the final element
4
+ const finalElementIndexLength = 4
5
+ const originalFinalElementLength = 3
6
+ const newFinalElementLength = 2
7
+ return `${invoiceNumber.slice(0, invoiceNumber.length - finalElementIndexLength)}${splitId}${invoiceNumber.slice(invoiceNumber.length - finalElementIndexLength, invoiceNumber.length - originalFinalElementLength)}${invoiceNumber.slice(invoiceNumber.length - newFinalElementLength)}`
8
+ }
9
+
10
+ module.exports = {
11
+ createDefaultInvoiceNumber
12
+ }
@@ -0,0 +1,12 @@
1
+ const createSitiAgriInvoiceNumber = (invoiceNumber, splitId) => {
2
+ // an invoice number is a string made up of three elements, to inject a split id character into the string we need to identify the position of those elements
3
+ // we also need to trim the first character of the final element
4
+ const firstElementLength = 8
5
+ const originalFinalElementLength = 3
6
+ const newFinalElementLength = 2
7
+ return `${invoiceNumber.slice(0, firstElementLength)}${splitId}${invoiceNumber.slice(firstElementLength, invoiceNumber.length - originalFinalElementLength)}${invoiceNumber.slice(invoiceNumber.length - newFinalElementLength)}`
8
+ }
9
+
10
+ module.exports = {
11
+ createSitiAgriInvoiceNumber
12
+ }
@@ -0,0 +1,21 @@
1
+ const { SFI, LUMP_SUMS, SFI_PILOT, SFI23, DELINKED, SFI_EXPANDED } = require('../constants/scheme-ids')
2
+ const { createDefaultInvoiceNumber } = require('./create-default-invoice-number')
3
+ const { createSitiAgriInvoiceNumber } = require('./create-siti-agri-invoice-number')
4
+
5
+ const createSplitInvoiceNumber = (invoiceNumber, splitId, schemeId) => {
6
+ switch (schemeId) {
7
+ case SFI:
8
+ case SFI_PILOT:
9
+ case LUMP_SUMS:
10
+ case SFI23:
11
+ case DELINKED:
12
+ case SFI_EXPANDED:
13
+ return createSitiAgriInvoiceNumber(invoiceNumber, splitId)
14
+ default:
15
+ return createDefaultInvoiceNumber(invoiceNumber, splitId)
16
+ }
17
+ }
18
+
19
+ module.exports = {
20
+ createSplitInvoiceNumber
21
+ }
@@ -0,0 +1,141 @@
1
+ const { SOS210, SOS404, SOS362, SOS351, SOS363, SOS367, SOS368, SOS369, SOS361, SOS400, SOS402, SOS260, SOS266, SOS410, SOS350, SOS364, SOS415, SOS416, SOS417, SOS420, SOS216, SOS471, SOS472, SOS473, SOS474 } = require('../constants/account-codes/ap')
2
+ const { SOS330, SOS465, SOS450, SOS451, SOS452, SOS453, SOS454, SOS455, SOS456, SOS457, SOS458, SOS466, SOS267, SOS459, SOS464, SOS336, SOS460, SOS461, SOS462, SOS463, SOS217 } = require('../constants/account-codes/ar-admin')
3
+ const { SOS310, SOS445, SOS430, SOS431, SOS432, SOS433, SOS434, SOS435, SOS436, SOS437, SOS438, SOS446, SOS268, SOS439, SOS444, SOS316, SOS440, SOS441, SOS442, SOS443, SOS218 } = require('../constants/account-codes/ar-irregular')
4
+ const { G00, P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R00, X01, X02, X03, X04 } = require('../constants/description-codes')
5
+
6
+ module.exports = [{
7
+ lineCode: G00,
8
+ ap: SOS210,
9
+ arAdmin: SOS330,
10
+ arIrregular: SOS310
11
+ }, {
12
+ lineCode: P01,
13
+ ap: SOS404,
14
+ arAdmin: SOS465,
15
+ arIrregular: SOS445
16
+ }, {
17
+ lineCode: P02,
18
+ ap: SOS362,
19
+ arAdmin: SOS450,
20
+ arIrregular: SOS430
21
+ }, {
22
+ lineCode: P03,
23
+ ap: SOS351,
24
+ arAdmin: SOS451,
25
+ arIrregular: SOS431
26
+ }, {
27
+ lineCode: P04,
28
+ ap: SOS363,
29
+ arAdmin: SOS452,
30
+ arIrregular: SOS432
31
+ }, {
32
+ lineCode: P05,
33
+ ap: SOS367,
34
+ arAdmin: SOS453,
35
+ arIrregular: SOS433
36
+ }, {
37
+ lineCode: P06,
38
+ ap: SOS368,
39
+ arAdmin: SOS454,
40
+ arIrregular: SOS434
41
+ }, {
42
+ lineCode: P07,
43
+ ap: SOS369,
44
+ arAdmin: SOS455,
45
+ arIrregular: SOS435
46
+ }, {
47
+ lineCode: P08,
48
+ ap: SOS361,
49
+ arAdmin: SOS456,
50
+ arIrregular: SOS436
51
+ }, {
52
+ lineCode: P09,
53
+ ap: SOS400,
54
+ arAdmin: SOS457,
55
+ arIrregular: SOS437
56
+ }, {
57
+ lineCode: P10,
58
+ ap: SOS402,
59
+ arAdmin: SOS458,
60
+ arIrregular: SOS438
61
+ }, {
62
+ lineCode: P11,
63
+ ap: SOS260,
64
+ arAdmin: SOS466,
65
+ arIrregular: SOS446
66
+ }, {
67
+ lineCode: P12,
68
+ ap: SOS266,
69
+ arAdmin: SOS267,
70
+ arIrregular: SOS268
71
+ }, {
72
+ lineCode: P13,
73
+ ap: SOS410,
74
+ arAdmin: SOS459,
75
+ arIrregular: SOS439
76
+ }, {
77
+ lineCode: P14,
78
+ ap: SOS350,
79
+ arAdmin: SOS464,
80
+ arIrregular: SOS444
81
+ }, {
82
+ lineCode: P15,
83
+ ap: SOS364,
84
+ arAdmin: SOS336,
85
+ arIrregular: SOS316
86
+ }, {
87
+ lineCode: P16,
88
+ ap: SOS415,
89
+ arAdmin: SOS460,
90
+ arIrregular: SOS440
91
+ }, {
92
+ lineCode: P17,
93
+ ap: SOS416,
94
+ arAdmin: SOS461,
95
+ arIrregular: SOS441
96
+ }, {
97
+ lineCode: P18,
98
+ ap: SOS417,
99
+ arAdmin: SOS462,
100
+ arIrregular: SOS442
101
+ }, {
102
+ lineCode: P19,
103
+ ap: SOS420,
104
+ arAdmin: SOS463,
105
+ arIrregular: SOS443
106
+ }, {
107
+ lineCode: P20,
108
+ ap: SOS420,
109
+ arAdmin: SOS463,
110
+ arIrregular: SOS443
111
+ }, {
112
+ lineCode: P21,
113
+ ap: SOS420,
114
+ arAdmin: SOS463,
115
+ arIrregular: SOS443
116
+ }, {
117
+ lineCode: R00,
118
+ ap: SOS216,
119
+ arAdmin: SOS217,
120
+ arIrregular: SOS218
121
+ }, {
122
+ lineCode: X01,
123
+ ap: SOS471,
124
+ arAdmin: SOS471,
125
+ arIrregular: SOS471
126
+ }, {
127
+ lineCode: X02,
128
+ ap: SOS472,
129
+ arAdmin: SOS472,
130
+ arIrregular: SOS472
131
+ }, {
132
+ lineCode: X03,
133
+ ap: SOS473,
134
+ arAdmin: SOS473,
135
+ arIrregular: SOS473
136
+ }, {
137
+ lineCode: X04,
138
+ ap: SOS474,
139
+ arAdmin: SOS474,
140
+ arIrregular: SOS474
141
+ }]
@@ -0,0 +1,21 @@
1
+ const { SOS710, SOS920, SOS929 } = require('../constants/account-codes/ap')
2
+ const { SOS750, SOS940, SOS949 } = require('../constants/account-codes/ar-admin')
3
+ const { SOS770, SOS960, SOS969 } = require('../constants/account-codes/ar-irregular')
4
+ const { G00, P02, P24 } = require('../constants/description-codes')
5
+
6
+ module.exports = [{
7
+ lineCode: G00,
8
+ ap: SOS710,
9
+ arAdmin: SOS750,
10
+ arIrregular: SOS770
11
+ }, {
12
+ lineCode: P02,
13
+ ap: SOS920,
14
+ arAdmin: SOS940,
15
+ arIrregular: SOS960
16
+ }, {
17
+ lineCode: P24,
18
+ ap: SOS929,
19
+ arAdmin: SOS949,
20
+ arIrregular: SOS969
21
+ }]
@@ -0,0 +1,174 @@
1
+ const { SOS710, SOS920, SOS921, SOS922, SOS923, SOS924, SOS925, SOS926, SOS927, SOS928, SOS228, SOS229, SOS231, SOS232, SOS233, SOS234, SOS236, SOS237, SOS238, SOS239, SOS929 } = require('../constants/account-codes/ap')
2
+ const { SOS750, SOS940, SOS941, SOS942, SOS943, SOS944, SOS945, SOS946, SOS948, SOS352, SOS553, SOS554, SOS555, SOS556, SOS558, SOS559, SOS560, SOS557, SOS947, SOS949 } = require('../constants/account-codes/ar-admin')
3
+ const { SOS770, SOS960, SOS961, SOS962, SOS963, SOS964, SOS965, SOS966, SOS967, SOS968, SOS969 } = require('../constants/account-codes/ar-irregular')
4
+ const { G00, P02, P05, P06, P08, P14, P22, P23, P24 } = require('../constants/description-codes')
5
+
6
+ module.exports = [{
7
+ lineCode: G00,
8
+ ap: SOS710,
9
+ arAdmin: SOS750,
10
+ arIrregular: SOS770,
11
+ capital: true,
12
+ revenue: true,
13
+ stateAid: false
14
+ }, {
15
+ lineCode: G00,
16
+ ap: SOS228,
17
+ arAdmin: SOS352,
18
+ arIrregular: SOS352,
19
+ capital: true,
20
+ revenue: true,
21
+ stateAid: true
22
+ }, {
23
+ lineCode: G00,
24
+ ap: SOS229,
25
+ arAdmin: SOS352,
26
+ arIrregular: SOS352,
27
+ capital: true,
28
+ revenue: true,
29
+ stateAid: true
30
+ }, {
31
+ lineCode: P02,
32
+ ap: SOS929,
33
+ arAdmin: SOS949,
34
+ arIrregular: SOS969,
35
+ capital: true,
36
+ revenue: false,
37
+ stateAid: false
38
+ }, {
39
+ lineCode: P02,
40
+ ap: SOS928,
41
+ arAdmin: SOS948,
42
+ arIrregular: SOS968,
43
+ capital: false,
44
+ revenue: true,
45
+ stateAid: false
46
+ }, {
47
+ lineCode: P02,
48
+ ap: SOS231,
49
+ arAdmin: SOS553,
50
+ arIrregular: SOS553,
51
+ capital: true,
52
+ revenue: true,
53
+ stateAid: true
54
+ }, {
55
+ lineCode: P05,
56
+ ap: SOS921,
57
+ arAdmin: SOS941,
58
+ arIrregular: SOS961,
59
+ capital: true,
60
+ revenue: true,
61
+ stateAid: false
62
+ }, {
63
+ lineCode: P05,
64
+ ap: SOS233,
65
+ arAdmin: SOS555,
66
+ arIrregular: SOS555,
67
+ capital: true,
68
+ revenue: true,
69
+ stateAid: true
70
+ }, {
71
+ lineCode: P06,
72
+ ap: SOS922,
73
+ arAdmin: SOS942,
74
+ arIrregular: SOS962,
75
+ capital: true,
76
+ revenue: true,
77
+ stateAid: false
78
+ }, {
79
+ lineCode: P06,
80
+ ap: SOS234,
81
+ arAdmin: SOS556,
82
+ arIrregular: SOS556,
83
+ capital: true,
84
+ revenue: true,
85
+ stateAid: true
86
+ }, {
87
+ lineCode: P08,
88
+ ap: SOS923,
89
+ arAdmin: SOS943,
90
+ arIrregular: SOS963,
91
+ capital: true,
92
+ revenue: true,
93
+ stateAid: false
94
+ }, {
95
+ lineCode: P08,
96
+ ap: SOS239,
97
+ arAdmin: SOS557,
98
+ arIrregular: SOS557,
99
+ capital: true,
100
+ revenue: true,
101
+ stateAid: true
102
+ }, {
103
+ lineCode: P14,
104
+ ap: SOS924,
105
+ arAdmin: SOS944,
106
+ arIrregular: SOS964,
107
+ capital: true,
108
+ revenue: true,
109
+ stateAid: false
110
+ }, {
111
+ lineCode: P14,
112
+ ap: SOS236,
113
+ arAdmin: SOS558,
114
+ arIrregular: SOS558,
115
+ capital: true,
116
+ revenue: true,
117
+ stateAid: true
118
+ }, {
119
+ lineCode: P22,
120
+ ap: SOS925,
121
+ arAdmin: SOS945,
122
+ arIrregular: SOS965,
123
+ capital: true,
124
+ revenue: true,
125
+ stateAid: false
126
+ }, {
127
+ lineCode: P22,
128
+ ap: SOS237,
129
+ arAdmin: SOS559,
130
+ arIrregular: SOS559,
131
+ capital: true,
132
+ revenue: true,
133
+ stateAid: true
134
+ }, {
135
+ lineCode: P23,
136
+ ap: SOS926,
137
+ arAdmin: SOS946,
138
+ arIrregular: SOS966,
139
+ capital: true,
140
+ revenue: true,
141
+ stateAid: false
142
+ }, {
143
+ lineCode: P23,
144
+ ap: SOS238,
145
+ arAdmin: SOS560,
146
+ arIrregular: SOS560,
147
+ capital: true,
148
+ revenue: true,
149
+ stateAid: true
150
+ }, {
151
+ lineCode: P24,
152
+ ap: SOS920,
153
+ arAdmin: SOS940,
154
+ arIrregular: SOS960,
155
+ capital: true,
156
+ revenue: false,
157
+ stateAid: false
158
+ }, {
159
+ lineCode: P24,
160
+ ap: SOS927,
161
+ arAdmin: SOS947,
162
+ arIrregular: SOS967,
163
+ capital: false,
164
+ revenue: true,
165
+ stateAid: false
166
+ }, {
167
+ lineCode: P24,
168
+ ap: SOS232,
169
+ arAdmin: SOS554,
170
+ arIrregular: SOS554,
171
+ capital: true,
172
+ revenue: true,
173
+ stateAid: true
174
+ }]
@@ -0,0 +1,46 @@
1
+ const { SOS710, SOS921, SOS922, SOS923, SOS924, SOS925, SOS926, SOS927 } = require('../constants/account-codes/ap')
2
+ const { SOS750, SOS941, SOS942, SOS943, SOS944, SOS945, SOS946, SOS947 } = require('../constants/account-codes/ar-admin')
3
+ const { SOS770, SOS961, SOS962, SOS963, SOS964, SOS965, SOS966, SOS967 } = require('../constants/account-codes/ar-irregular')
4
+ const { G00, P05, P06, P08, P14, P22, P23, P24 } = require('../constants/description-codes')
5
+
6
+ module.exports = [{
7
+ lineCode: G00,
8
+ ap: SOS710,
9
+ arAdmin: SOS750,
10
+ arIrregular: SOS770
11
+ }, {
12
+ lineCode: P05,
13
+ ap: SOS921,
14
+ arAdmin: SOS941,
15
+ arIrregular: SOS961
16
+ }, {
17
+ lineCode: P06,
18
+ ap: SOS922,
19
+ arAdmin: SOS942,
20
+ arIrregular: SOS962
21
+ }, {
22
+ lineCode: P08,
23
+ ap: SOS923,
24
+ arAdmin: SOS943,
25
+ arIrregular: SOS963
26
+ }, {
27
+ lineCode: P14,
28
+ ap: SOS924,
29
+ arAdmin: SOS944,
30
+ arIrregular: SOS964
31
+ }, {
32
+ lineCode: P22,
33
+ ap: SOS925,
34
+ arAdmin: SOS945,
35
+ arIrregular: SOS965
36
+ }, {
37
+ lineCode: P23,
38
+ ap: SOS926,
39
+ arAdmin: SOS946,
40
+ arIrregular: SOS966
41
+ }, {
42
+ lineCode: P24,
43
+ ap: SOS927,
44
+ arAdmin: SOS947,
45
+ arIrregular: SOS967
46
+ }]