ffc-pay-schemes 1.0.13 → 1.0.14

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 (81) hide show
  1. package/README.md +9 -7
  2. package/app/constants/manual-sources.js +79 -0
  3. package/app/constants/pillars.js +21 -0
  4. package/app/helpers/get-journal-source-from-pillar.js +15 -0
  5. package/index.js +2 -0
  6. package/package.json +1 -1
  7. package/test/unit/helpers/get-journal-source-from-pillar.test.js +25 -0
  8. package/test-output/cobertura-coverage.xml +33 -5
  9. package/test-output/junit.xml +374 -364
  10. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ap.js.html +1 -1
  11. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-admin.js.html +1 -1
  12. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-irregular.js.html +1 -1
  13. package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/index.html +1 -1
  14. package/test-output/lcov-report/ffc-pay-schemes/app/constants/delivery-bodies.js.html +1 -1
  15. package/test-output/lcov-report/ffc-pay-schemes/app/constants/description-codes.js.html +1 -1
  16. package/test-output/lcov-report/ffc-pay-schemes/app/constants/file-masks.js.html +1 -1
  17. package/test-output/lcov-report/ffc-pay-schemes/app/constants/frps-schemes.js.html +1 -1
  18. package/test-output/lcov-report/ffc-pay-schemes/app/constants/fund-codes.js.html +1 -1
  19. package/test-output/lcov-report/ffc-pay-schemes/app/constants/index.html +20 -5
  20. package/test-output/lcov-report/ffc-pay-schemes/app/constants/manual-sources.js.html +322 -0
  21. package/test-output/lcov-report/ffc-pay-schemes/app/constants/pillars.js.html +65 -2
  22. package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-batch-properties.js.html +1 -1
  23. package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-ids.js.html +2 -2
  24. package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-names.js.html +1 -1
  25. package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-not-requiring-ppas.js.html +1 -1
  26. package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-providing-account-values.js.html +1 -1
  27. package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes.js.html +1 -1
  28. package/test-output/lcov-report/ffc-pay-schemes/app/constants/sequence-positions.js.html +1 -1
  29. package/test-output/lcov-report/ffc-pay-schemes/app/constants/siti-agri-schemes.js.html +1 -1
  30. package/test-output/lcov-report/ffc-pay-schemes/app/constants/source-systems.js.html +1 -1
  31. package/test-output/lcov-report/ffc-pay-schemes/app/constants/unknown.js.html +1 -1
  32. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-default-invoice-number.js.html +1 -1
  33. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-es-invoice-number.js.html +1 -1
  34. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-imps-invoice-number.js.html +1 -1
  35. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
  36. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-standard-scheme-invoice-number.js.html +1 -1
  37. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.html +1 -1
  38. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.js.html +1 -1
  39. package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/use-invoice-number-as-is.js.html +1 -1
  40. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-default-invoice-number.js.html +1 -1
  41. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
  42. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.html +1 -1
  43. package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.js.html +1 -1
  44. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/bps-map.js.html +1 -1
  45. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cohtc-map.js.html +1 -1
  46. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cs-map.js.html +1 -1
  47. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/default-map.js.html +1 -1
  48. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/delinked-map.js.html +1 -1
  49. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.html +1 -1
  50. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.js.html +1 -1
  51. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/lump-sums-map.js.html +1 -1
  52. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/sfi-frps-map.js.html +1 -1
  53. package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/vet-visits-map.js.html +1 -1
  54. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/get-batch-sequence-from-file-name.js.html +1 -1
  55. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/get-journal-source-from-pillar.js.html +130 -0
  56. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/get-reporting-data-filter.js.html +1 -1
  57. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/index.html +20 -5
  58. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-frps.js.html +1 -1
  59. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-siti-agri.js.html +1 -1
  60. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-valid-scheme-id.js.html +1 -1
  61. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/scheme-does-not-require-ppas.js.html +1 -1
  62. package/test-output/lcov-report/ffc-pay-schemes/app/helpers/scheme-provides-accounting-values.js.html +1 -1
  63. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-id-from-pillar.js.html +1 -1
  64. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-id-from-source-system.js.html +1 -1
  65. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-ids.js.html +1 -1
  66. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/index.html +1 -1
  67. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/get-scheme-name-from-scheme-id.js.html +1 -1
  68. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/get-scheme-names.js.html +1 -1
  69. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/index.html +1 -1
  70. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-batch-properties.js.html +1 -1
  71. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-from-batch-file-name.js.html +1 -1
  72. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-properties.js.html +1 -1
  73. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-schemes.js.html +1 -1
  74. package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/index.html +1 -1
  75. package/test-output/lcov-report/ffc-pay-schemes/app/source-system/get-source-system-from-scheme-id.js.html +1 -1
  76. package/test-output/lcov-report/ffc-pay-schemes/app/source-system/get-source-systems.js.html +1 -1
  77. package/test-output/lcov-report/ffc-pay-schemes/app/source-system/index.html +1 -1
  78. package/test-output/lcov-report/ffc-pay-schemes/index.html +5 -5
  79. package/test-output/lcov-report/ffc-pay-schemes/index.js.html +10 -4
  80. package/test-output/lcov-report/index.html +18 -18
  81. package/test-output/lcov.info +39 -4
package/README.md CHANGED
@@ -18,6 +18,7 @@ const {
18
18
  createSplitInvoiceNumber,
19
19
  getAccountCodeMap,
20
20
  getBatchSequenceFromFileName,
21
+ getJournalSourceFromPillar,
21
22
  getReportingDataFilter,
22
23
  getSchemeBatchProperties,
23
24
  getSchemeFromBatchFileName,
@@ -42,6 +43,7 @@ const {
42
43
  - `createSplitInvoiceNumber(paymentRequest)` creates a split invoice number for a given `paymentRequest`.
43
44
  - `getAccountCodeMap(schemeId)` returns the account code mapping used for a given `schemeId`.
44
45
  - `getBatchSequenceFromFileName(schemeId, fileName)` returns the sequence as identified in the supplied `fileName`, checking the correct position using the `schemeId`.
46
+ - `getJournalSourceFromPillar(schemeId, source, pillar)` returns the appropriate manual source used in Payment journals for manual schemes, based on the supplied `pillar`. If `schemeId` is not the MANUAL scheme, or a match is not found, the supplied `source` will be returned.
45
47
  - `getReportingDataFilter(schemeId)` returns the fields which should be added to any data filters applied in reporting checks, for a given `schemeId`.
46
48
  - `getSchemeBatchProperties(schemeId)` returns the batch processing properties for a given `schemeId`.
47
49
  - `getSchemeFromBatchFileName(fileName)` returns the supported scheme details based on the expected file mask matching the supplied `fileName`.
@@ -65,18 +67,20 @@ const {
65
67
  ```js
66
68
  const {
67
69
  getSchemes,
70
+ getSchemeIds,
68
71
  getSchemeProperties,
69
72
  schemeDoesNotRequirePPAs,
70
- schemeProvidesAccountingValues,
71
- schemeIds
73
+ schemeProvidesAccountingValues
72
74
  } = require('ffc-pay-schemes')
73
75
 
74
76
  const schemes = getSchemes()
75
77
 
76
- const scheme = getSchemeProperties(schemeIds.BPS)
78
+ const { BPS } = getSchemeIds()
79
+
80
+ const scheme = getSchemeProperties(BPS)
77
81
 
78
- const doesNotRequirePPAs = schemeDoesNotRequirePPAs(schemeIds.BPS)
79
- const providesAccountingValues = schemeProvidesAccountingValues(schemeIds.BPS)
82
+ const doesNotRequirePPAs = schemeDoesNotRequirePPAs(BPS)
83
+ const providesAccountingValues = schemeProvidesAccountingValues(BPS)
80
84
  ```
81
85
 
82
86
  ## Payment Hub usage
@@ -85,7 +89,6 @@ The following services are intended to be used with the ffc-pay-schemes package:
85
89
 
86
90
  - ffc-pay-alerting
87
91
  - ffc-pay-batch-processor
88
- - ffc-pay-dps
89
92
  - ffc-pay-enrichment
90
93
  - ffc-pay-event-hub
91
94
  - ffc-pay-gateway
@@ -95,7 +98,6 @@ The following services are intended to be used with the ffc-pay-schemes package:
95
98
  - ffc-pay-submission
96
99
  - ffc-pay-tracking
97
100
  - ffc-pay-web
98
- - ffc-pay-xb
99
101
 
100
102
  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.
101
103
 
@@ -0,0 +1,79 @@
1
+ const {
2
+ DA,
3
+ IP,
4
+ SPS,
5
+ DF,
6
+ FCCS,
7
+ XG,
8
+ TR,
9
+ RDPECS,
10
+ RDPELS,
11
+ BK,
12
+ INT,
13
+ OPA,
14
+ NELS,
15
+ FCLS,
16
+ RDTLS,
17
+ NECS,
18
+ RDTCP,
19
+ P1,
20
+ EA,
21
+ RDTEXQ,
22
+ EXNRDPE,
23
+ SFI,
24
+ SFI_PILOT,
25
+ LUMP_SUMS,
26
+ VET_VISITS,
27
+ CS,
28
+ BPS,
29
+ ES,
30
+ FC,
31
+ IMPS,
32
+ SFI23,
33
+ DELINKED,
34
+ SFI_EXPANDED,
35
+ COHT_CAPITAL,
36
+ COHT_REVENUE,
37
+ FPTT,
38
+ WMP
39
+ } = require('./pillars')
40
+
41
+ module.exports = {
42
+ [DA]: 'NMAN_DA',
43
+ [IP]: 'NMAN_IP',
44
+ [SPS]: 'NMAN_SPS',
45
+ [DF]: 'NMAN_DF',
46
+ [FCCS]: 'NMAN_FC',
47
+ [XG]: 'NMAN_XG',
48
+ [TR]: 'NMAN_TR',
49
+ [RDPECS]: 'NMAN_RDPE',
50
+ [RDPELS]: 'NMAN_RDPE',
51
+ [BK]: 'NMAN_BK',
52
+ [INT]: 'NMAN_INT',
53
+ [OPA]: 'NMAN_OPA',
54
+ [NELS]: 'NMAN_NELS',
55
+ [FCLS]: 'NMAN_FCLS',
56
+ [RDTLS]: 'NMAN_RDT',
57
+ [NECS]: 'NMAN_NE',
58
+ [RDTCP]: 'NMAN_RDT',
59
+ [P1]: 'NMAN_NE',
60
+ [EA]: 'NMAN_EA',
61
+ [RDTEXQ]: 'NMAN_RDT',
62
+ [EXNRDPE]: 'NMAN_RDT',
63
+ [SFI]: 'PMAN_SFI',
64
+ [SFI_PILOT]: 'PMAN_SFIP',
65
+ [LUMP_SUMS]: 'NMAN_DA',
66
+ [VET_VISITS]: 'NMAN_DA',
67
+ [CS]: 'PMAN_CS',
68
+ [BPS]: 'NMAN_DA',
69
+ [ES]: 'NMAN_DA',
70
+ [FC]: 'NMAN_DA',
71
+ [IMPS]: 'NMAN_DA',
72
+ [SFI23]: 'PMAN_SFIA',
73
+ [DELINKED]: 'PMAN_DP',
74
+ [SFI_EXPANDED]: 'PMAN_ESFIO',
75
+ [COHT_CAPITAL]: 'PMAN_COHTC',
76
+ [COHT_REVENUE]: 'PMAN_COHTR',
77
+ [FPTT]: 'PMAN_FPTT',
78
+ [WMP]: 'PMAN_WMP'
79
+ }
@@ -1,4 +1,25 @@
1
1
  module.exports = {
2
+ DA: 'DA',
3
+ IP: 'IP',
4
+ SPS: 'SPS',
5
+ DF: 'DF',
6
+ FCCS: 'FCCS',
7
+ XG: 'XG',
8
+ TR: 'TR',
9
+ RDPECS: 'RDPECS',
10
+ RDPELS: 'RDPELS',
11
+ BK: 'BK',
12
+ INT: 'INT',
13
+ OPA: 'OPA',
14
+ NELS: 'NELS',
15
+ FCLS: 'FCLS',
16
+ RDTLS: 'RDTLS',
17
+ NECS: 'NECS',
18
+ RDTCP: 'RDTCP',
19
+ P1: 'P1',
20
+ EA: 'EA',
21
+ RDTEXQ: 'RDTEXQ',
22
+ EXNRDPE: 'ExNRDPE',
2
23
  SFI: 'SFI',
3
24
  SFI_PILOT: 'SFIP',
4
25
  LUMP_SUMS: 'LSES',
@@ -0,0 +1,15 @@
1
+ const { MANUAL } = require('../constants/scheme-ids')
2
+ const manualSources = require('../constants/manual-sources')
3
+
4
+ const getJournalSourceFromPillar = (schemeId, source, pillar) => {
5
+ if (schemeId !== MANUAL) {
6
+ return source
7
+ }
8
+
9
+ const manualSource = manualSources[pillar]
10
+ return manualSource ?? source
11
+ }
12
+
13
+ module.exports = {
14
+ getJournalSourceFromPillar
15
+ }
package/index.js CHANGED
@@ -2,6 +2,7 @@ const { createInvoiceNumber } = require('./app/create-invoice-number')
2
2
  const { createSplitInvoiceNumber } = require('./app/create-split-invoice-number')
3
3
  const { getAccountCodeMap } = require('./app/get-account-code-map')
4
4
  const { getBatchSequenceFromFileName } = require('./app/helpers/get-batch-sequence-from-file-name')
5
+ const { getJournalSourceFromPillar } = require('./app/helpers/get-journal-source-from-pillar')
5
6
  const { getReportingDataFilter } = require('./app/helpers/get-reporting-data-filter')
6
7
  const { getSchemeBatchProperties } = require('./app/scheme-properties/get-scheme-batch-properties')
7
8
  const { getSchemeFromBatchFileName } = require('./app/scheme-properties/get-scheme-from-batch-file-name')
@@ -25,6 +26,7 @@ module.exports = {
25
26
  createSplitInvoiceNumber,
26
27
  getAccountCodeMap,
27
28
  getBatchSequenceFromFileName,
29
+ getJournalSourceFromPillar,
28
30
  getReportingDataFilter,
29
31
  getSchemeBatchProperties,
30
32
  getSchemeFromBatchFileName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ffc-pay-schemes",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Module for defining and providing details for the payment schemes supported by the Payment Hub.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,25 @@
1
+ const { MANUAL, SFI } = require('../../../app/constants/scheme-ids')
2
+ const { DA, SFI: SFI_PILLAR } = require('../../../app/constants/pillars')
3
+ const manualSources = require('../../../app/constants/manual-sources')
4
+ const { getJournalSourceFromPillar } = require('../../../app/helpers/get-journal-source-from-pillar')
5
+
6
+ describe('getJournalSourceFromPillar', () => {
7
+ test('returns the source for non-manual schemes', () => {
8
+ expect(getJournalSourceFromPillar(SFI, 'SOURCE', DA)).toBe('SOURCE')
9
+ })
10
+
11
+ test('returns the manual source for a matching pillar', () => {
12
+ expect(getJournalSourceFromPillar(MANUAL, 'SOURCE', DA))
13
+ .toBe(manualSources[DA])
14
+ })
15
+
16
+ test('returns the manual source for the SFI pillar', () => {
17
+ expect(getJournalSourceFromPillar(MANUAL, 'SOURCE', SFI_PILLAR))
18
+ .toBe(manualSources[SFI_PILLAR])
19
+ })
20
+
21
+ test('returns the original source when the pillar has no manual source', () => {
22
+ expect(getJournalSourceFromPillar(MANUAL, 'SOURCE', 'UNKNOWN'))
23
+ .toBe('SOURCE')
24
+ })
25
+ })
@@ -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="303" lines-covered="280" line-rate="0.924" branches-valid="61" branches-covered="61" branch-rate="1" timestamp="1788866911565" complexity="0" version="0.1">
3
+ <coverage lines-valid="314" lines-covered="290" line-rate="0.9235" branches-valid="65" branches-covered="65" branch-rate="1" timestamp="1789380885826" complexity="0" version="0.1">
4
4
  <sources>
5
5
  <source>/home/samplackett/ffc-pay-schemes</source>
6
6
  </sources>
@@ -32,12 +32,13 @@
32
32
  <line number="19" hits="0" branch="false"/>
33
33
  <line number="20" hits="0" branch="false"/>
34
34
  <line number="21" hits="0" branch="false"/>
35
- <line number="23" hits="0" branch="false"/>
35
+ <line number="22" hits="0" branch="false"/>
36
+ <line number="24" hits="0" branch="false"/>
36
37
  </lines>
37
38
  </class>
38
39
  </classes>
39
40
  </package>
40
- <package name="ffc-pay-schemes.app.constants" line-rate="0.9629000000000001" branch-rate="1">
41
+ <package name="ffc-pay-schemes.app.constants" line-rate="0.9655" branch-rate="1">
41
42
  <classes>
42
43
  <class name="delivery-bodies.js" filename="app/constants/delivery-bodies.js" line-rate="1" branch-rate="1">
43
44
  <methods>
@@ -75,11 +76,19 @@
75
76
  <line number="1" hits="1" branch="false"/>
76
77
  </lines>
77
78
  </class>
79
+ <class name="manual-sources.js" filename="app/constants/manual-sources.js" line-rate="1" branch-rate="1">
80
+ <methods>
81
+ </methods>
82
+ <lines>
83
+ <line number="39" hits="1" branch="false"/>
84
+ <line number="41" hits="1" branch="false"/>
85
+ </lines>
86
+ </class>
78
87
  <class name="pillars.js" filename="app/constants/pillars.js" line-rate="1" branch-rate="1">
79
88
  <methods>
80
89
  </methods>
81
90
  <lines>
82
- <line number="1" hits="2" branch="false"/>
91
+ <line number="1" hits="3" branch="false"/>
83
92
  </lines>
84
93
  </class>
85
94
  <class name="scheme-batch-properties.js" filename="app/constants/scheme-batch-properties.js" line-rate="1" branch-rate="1">
@@ -94,7 +103,7 @@
94
103
  <methods>
95
104
  </methods>
96
105
  <lines>
97
- <line number="1" hits="12" branch="false"/>
106
+ <line number="1" hits="13" branch="false"/>
98
107
  </lines>
99
108
  </class>
100
109
  <class name="scheme-names.js" filename="app/constants/scheme-names.js" line-rate="1" branch-rate="1">
@@ -543,6 +552,25 @@
543
552
  <line number="32" hits="1" branch="false"/>
544
553
  </lines>
545
554
  </class>
555
+ <class name="get-journal-source-from-pillar.js" filename="app/helpers/get-journal-source-from-pillar.js" line-rate="1" branch-rate="1">
556
+ <methods>
557
+ <method name="(anonymous_0)" hits="4" signature="()V">
558
+ <lines>
559
+ <line number="4" hits="4"/>
560
+ </lines>
561
+ </method>
562
+ </methods>
563
+ <lines>
564
+ <line number="1" hits="1" branch="false"/>
565
+ <line number="2" hits="1" branch="false"/>
566
+ <line number="4" hits="1" branch="false"/>
567
+ <line number="5" hits="4" branch="true" condition-coverage="100% (2/2)"/>
568
+ <line number="6" hits="1" branch="false"/>
569
+ <line number="9" hits="3" branch="false"/>
570
+ <line number="10" hits="3" branch="true" condition-coverage="100% (2/2)"/>
571
+ <line number="13" hits="1" branch="false"/>
572
+ </lines>
573
+ </class>
546
574
  <class name="get-reporting-data-filter.js" filename="app/helpers/get-reporting-data-filter.js" line-rate="1" branch-rate="1">
547
575
  <methods>
548
576
  <method name="(anonymous_0)" hits="5" signature="()V">