ffc-pay-schemes 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/app/constants/siti-agri-schemes.js +3 -0
- package/app/create-split-invoice-number/index.js +5 -11
- package/app/helpers/is-siti-agri.js +9 -0
- package/package.json +1 -1
- package/test/unit/create-split-invoice-number/index.test.js +26 -24
- package/test/unit/helpers/is-siti-agri.test.js +17 -0
- package/test-output/cobertura-coverage.xml +20 -20
- package/test-output/junit.xml +341 -373
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ap.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-admin.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-irregular.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/delivery-bodies.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/description-codes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/frps-schemes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/fund-codes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/pillars.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-batch-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-ids.js.html +2 -2
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-names.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-not-requiring-ppas.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-providing-account-values.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/siti-agri-schemes.js.html +94 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/source-systems.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/unknown.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-default-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-es-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-imps-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-standard-scheme-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/use-invoice-number-as-is.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-default-invoice-number.js.html +5 -5
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-siti-agri-invoice-number.js.html +5 -5
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.html +3 -3
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.js.html +11 -29
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/bps-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cohtc-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cs-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/default-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/delinked-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/lump-sums-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/sfi-frps-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/vet-visits-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/get-reporting-data-filter.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-frps.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-siti-agri.js.html +112 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-valid-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/scheme-does-not-require-ppas.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/scheme-provides-accounting-values.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-id-from-pillar.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-id-from-source-system.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-ids.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/get-scheme-name-from-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/get-scheme-names.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-batch-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-schemes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/source-system/get-source-system-from-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/source-system/get-source-systems.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/source-system/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/index.js.html +1 -1
- package/test-output/lcov-report/index.html +3 -3
- package/test-output/lcov.info +19 -24
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ const {
|
|
|
29
29
|
getSourceSystemFromSchemeId,
|
|
30
30
|
getSourceSystems,
|
|
31
31
|
isFRPS,
|
|
32
|
+
isSitiAgri,
|
|
32
33
|
isValidSchemeId,
|
|
33
34
|
schemeDoesNotRequirePPAs,
|
|
34
35
|
schemeProvidesAccountingValues
|
|
@@ -50,6 +51,7 @@ const {
|
|
|
50
51
|
- `getSourceSystemFromSchemeId(schemeId)` returns the source system name for a given `schemeId`.
|
|
51
52
|
- `getSourceSystems()` returns all supported source systems.
|
|
52
53
|
- `isFRPS(schemeId)` returns `true` if the scheme ID comes from FRPS, or `false` if not.
|
|
54
|
+
- `isSitiAgri(schemeId)` returns `true` if the scheme ID comes from Siti Agri, or `false` if not.
|
|
53
55
|
- `isValidSchemeId(schemeId)` returns `true` if the scheme ID is recognised, or `false` if not, including converting the scheme ID to a numeric value first if required.
|
|
54
56
|
- `schemeDoesNotRequirePPAs(schemeId)` returns `true` if Payment Hub does not support Post Payment Adjustments (PPAs) for a given `schemeId`; otherwise, it returns `false`.
|
|
55
57
|
- `schemeProvidesAccountingValues(schemeId)` returns `true` if a given `schemeId` provides accounting values within its payment requests; otherwise, it returns `false`.
|
|
@@ -73,6 +75,26 @@ const doesNotRequirePPAs = schemeDoesNotRequirePPAs(schemeIds.BPS)
|
|
|
73
75
|
const providesAccountingValues = schemeProvidesAccountingValues(schemeIds.BPS)
|
|
74
76
|
```
|
|
75
77
|
|
|
78
|
+
## Payment Hub usage
|
|
79
|
+
|
|
80
|
+
The following services are intended to be used with the ffc-pay-schemes package:
|
|
81
|
+
|
|
82
|
+
- ffc-pay-alerting
|
|
83
|
+
- ffc-pay-batch-processor
|
|
84
|
+
- ffc-pay-dps
|
|
85
|
+
- ffc-pay-enrichment
|
|
86
|
+
- ffc-pay-event-hub
|
|
87
|
+
- ffc-pay-gateway
|
|
88
|
+
- ffc-pay-injection
|
|
89
|
+
- ffc-pay-processing
|
|
90
|
+
- ffc-pay-request-editor
|
|
91
|
+
- ffc-pay-submission
|
|
92
|
+
- ffc-pay-tracking
|
|
93
|
+
- ffc-pay-web
|
|
94
|
+
- ffc-pay-xb
|
|
95
|
+
|
|
96
|
+
In the event a new payment scheme is added to the package, all of the above services must be bumped to the latest package version to ensure that Payment Hub can process associated payments.
|
|
97
|
+
|
|
76
98
|
## Licence
|
|
77
99
|
|
|
78
100
|
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { isSitiAgri } = require('../helpers/is-siti-agri')
|
|
2
2
|
const { createDefaultInvoiceNumber } = require('./create-default-invoice-number')
|
|
3
3
|
const { createSitiAgriInvoiceNumber } = require('./create-siti-agri-invoice-number')
|
|
4
4
|
|
|
5
5
|
const createSplitInvoiceNumber = (invoiceNumber, splitId, schemeId) => {
|
|
6
|
-
|
|
7
|
-
|
|
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)
|
|
6
|
+
if (isSitiAgri(schemeId)) {
|
|
7
|
+
return createSitiAgriInvoiceNumber(invoiceNumber, splitId)
|
|
16
8
|
}
|
|
9
|
+
|
|
10
|
+
return createDefaultInvoiceNumber(invoiceNumber, splitId)
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
+
jest.mock('../../../app/helpers/is-siti-agri', () => ({
|
|
2
|
+
isSitiAgri: jest.fn()
|
|
3
|
+
}))
|
|
4
|
+
|
|
5
|
+
const { isSitiAgri } = require('../../../app/helpers/is-siti-agri')
|
|
1
6
|
const { createSplitInvoiceNumber } = require('../../../app/create-split-invoice-number')
|
|
2
7
|
const { createDefaultInvoiceNumber } = require('../../../app/create-split-invoice-number/create-default-invoice-number')
|
|
3
8
|
const { createSitiAgriInvoiceNumber } = require('../../../app/create-split-invoice-number/create-siti-agri-invoice-number')
|
|
4
|
-
const schemeIds = require('../../../app/constants/scheme-ids')
|
|
5
9
|
|
|
6
10
|
describe('createSplitInvoiceNumber', () => {
|
|
7
11
|
const invoiceNumber = '1234567890123'
|
|
8
12
|
const splitId = 'A'
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
test('uses the default format for an unknown schemeId', () => {
|
|
31
|
-
expect(createSplitInvoiceNumber(invoiceNumber, splitId, 'unknown-scheme'))
|
|
13
|
+
const schemeId = 'SFI'
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
jest.clearAllMocks()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('uses the Siti Agri invoice format when the scheme is Siti Agri', () => {
|
|
20
|
+
isSitiAgri.mockReturnValue(true)
|
|
21
|
+
|
|
22
|
+
expect(createSplitInvoiceNumber(invoiceNumber, splitId, schemeId))
|
|
23
|
+
.toBe(createSitiAgriInvoiceNumber(invoiceNumber, splitId))
|
|
24
|
+
|
|
25
|
+
expect(isSitiAgri).toHaveBeenCalledWith(schemeId)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('uses the default invoice format when the scheme is not Siti Agri', () => {
|
|
29
|
+
isSitiAgri.mockReturnValue(false)
|
|
30
|
+
|
|
31
|
+
expect(createSplitInvoiceNumber(invoiceNumber, splitId, schemeId))
|
|
32
32
|
.toBe(createDefaultInvoiceNumber(invoiceNumber, splitId))
|
|
33
|
+
|
|
34
|
+
expect(isSitiAgri).toHaveBeenCalledWith(schemeId)
|
|
33
35
|
})
|
|
34
36
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const sitiAgriSchemes = require('../../../app/constants/siti-agri-schemes')
|
|
2
|
+
const { isSitiAgri } = require('../../../app/helpers/is-siti-agri')
|
|
3
|
+
|
|
4
|
+
describe('isSitiAgri', () => {
|
|
5
|
+
test.each(sitiAgriSchemes)('returns true for SITI scheme: %s', (schemeId) => {
|
|
6
|
+
expect(isSitiAgri(schemeId)).toBe(true)
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test.each([
|
|
10
|
+
'unknown-scheme',
|
|
11
|
+
'',
|
|
12
|
+
null,
|
|
13
|
+
undefined
|
|
14
|
+
])('returns false for non-SITI scheme: %s', (schemeId) => {
|
|
15
|
+
expect(isSitiAgri(schemeId)).toBe(false)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" ?>
|
|
2
2
|
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
|
3
|
-
<coverage lines-valid="269" lines-covered="250" line-rate="0.9293" branches-valid="
|
|
3
|
+
<coverage lines-valid="269" lines-covered="250" line-rate="0.9293" branches-valid="55" branches-covered="55" branch-rate="1" timestamp="1788777087732" complexity="0" version="0.1">
|
|
4
4
|
<sources>
|
|
5
5
|
<source>/home/samplackett/ffc-pay-schemes</source>
|
|
6
6
|
</sources>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<methods>
|
|
85
85
|
</methods>
|
|
86
86
|
<lines>
|
|
87
|
-
<line number="1" hits="
|
|
87
|
+
<line number="1" hits="11" branch="false"/>
|
|
88
88
|
</lines>
|
|
89
89
|
</class>
|
|
90
90
|
<class name="scheme-names.js" filename="app/constants/scheme-names.js" line-rate="1" branch-rate="1">
|
|
@@ -306,43 +306,43 @@
|
|
|
306
306
|
<classes>
|
|
307
307
|
<class name="create-default-invoice-number.js" filename="app/create-split-invoice-number/create-default-invoice-number.js" line-rate="1" branch-rate="1">
|
|
308
308
|
<methods>
|
|
309
|
-
<method name="(anonymous_0)" hits="
|
|
309
|
+
<method name="(anonymous_0)" hits="5" signature="()V">
|
|
310
310
|
<lines>
|
|
311
|
-
<line number="1" hits="
|
|
311
|
+
<line number="1" hits="5"/>
|
|
312
312
|
</lines>
|
|
313
313
|
</method>
|
|
314
314
|
</methods>
|
|
315
315
|
<lines>
|
|
316
316
|
<line number="1" hits="2" branch="false"/>
|
|
317
|
-
<line number="4" hits="
|
|
318
|
-
<line number="5" hits="
|
|
319
|
-
<line number="6" hits="
|
|
320
|
-
<line number="7" hits="
|
|
317
|
+
<line number="4" hits="5" branch="false"/>
|
|
318
|
+
<line number="5" hits="5" branch="false"/>
|
|
319
|
+
<line number="6" hits="5" branch="false"/>
|
|
320
|
+
<line number="7" hits="5" branch="false"/>
|
|
321
321
|
<line number="10" hits="2" branch="false"/>
|
|
322
322
|
</lines>
|
|
323
323
|
</class>
|
|
324
324
|
<class name="create-siti-agri-invoice-number.js" filename="app/create-split-invoice-number/create-siti-agri-invoice-number.js" line-rate="1" branch-rate="1">
|
|
325
325
|
<methods>
|
|
326
|
-
<method name="(anonymous_0)" hits="
|
|
326
|
+
<method name="(anonymous_0)" hits="5" signature="()V">
|
|
327
327
|
<lines>
|
|
328
|
-
<line number="1" hits="
|
|
328
|
+
<line number="1" hits="5"/>
|
|
329
329
|
</lines>
|
|
330
330
|
</method>
|
|
331
331
|
</methods>
|
|
332
332
|
<lines>
|
|
333
333
|
<line number="1" hits="2" branch="false"/>
|
|
334
|
-
<line number="4" hits="
|
|
335
|
-
<line number="5" hits="
|
|
336
|
-
<line number="6" hits="
|
|
337
|
-
<line number="7" hits="
|
|
334
|
+
<line number="4" hits="5" branch="false"/>
|
|
335
|
+
<line number="5" hits="5" branch="false"/>
|
|
336
|
+
<line number="6" hits="5" branch="false"/>
|
|
337
|
+
<line number="7" hits="5" branch="false"/>
|
|
338
338
|
<line number="10" hits="2" branch="false"/>
|
|
339
339
|
</lines>
|
|
340
340
|
</class>
|
|
341
341
|
<class name="index.js" filename="app/create-split-invoice-number/index.js" line-rate="1" branch-rate="1">
|
|
342
342
|
<methods>
|
|
343
|
-
<method name="(anonymous_0)" hits="
|
|
343
|
+
<method name="(anonymous_0)" hits="2" signature="()V">
|
|
344
344
|
<lines>
|
|
345
|
-
<line number="5" hits="
|
|
345
|
+
<line number="5" hits="2"/>
|
|
346
346
|
</lines>
|
|
347
347
|
</method>
|
|
348
348
|
</methods>
|
|
@@ -351,10 +351,10 @@
|
|
|
351
351
|
<line number="2" hits="1" branch="false"/>
|
|
352
352
|
<line number="3" hits="1" branch="false"/>
|
|
353
353
|
<line number="5" hits="1" branch="false"/>
|
|
354
|
-
<line number="6" hits="
|
|
355
|
-
<line number="
|
|
356
|
-
<line number="
|
|
357
|
-
<line number="
|
|
354
|
+
<line number="6" hits="2" branch="true" condition-coverage="100% (2/2)"/>
|
|
355
|
+
<line number="7" hits="1" branch="false"/>
|
|
356
|
+
<line number="10" hits="1" branch="false"/>
|
|
357
|
+
<line number="13" hits="1" branch="false"/>
|
|
358
358
|
</lines>
|
|
359
359
|
</class>
|
|
360
360
|
</classes>
|