account-lookup-service 15.6.0-iso.2 → 15.6.0-iso.20

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 (43) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/.ncurc.yaml +1 -2
  3. package/audit-ci.jsonc +3 -1
  4. package/jest.config.js +2 -0
  5. package/package.json +14 -16
  6. package/src/constants.js +2 -1
  7. package/src/domain/participants/participants.js +173 -130
  8. package/src/domain/parties/getPartiesByTypeAndID.js +15 -14
  9. package/src/domain/parties/parties.js +13 -12
  10. package/src/domain/parties/utils.js +13 -6
  11. package/src/domain/timeout/dto.js +4 -10
  12. package/src/handlers/index.js +4 -4
  13. package/src/handlers/monitoring/index.js +1 -1
  14. package/src/interface/api-swagger-iso20022-parties.yaml +7 -6
  15. package/src/interface/api-swagger.yaml +7 -6
  16. package/src/interface/fspiop-rest-v2.0-ISO20022_parties.yaml +2043 -1583
  17. package/src/lib/config.js +1 -1
  18. package/src/lib/index.js +1 -2
  19. package/src/models/participantEndpoint/facade.js +21 -19
  20. package/src/plugins.js +20 -9
  21. package/src/server.js +3 -19
  22. package/test/fixtures/index.js +30 -6
  23. package/test/fixtures/iso.js +1 -1
  24. package/test/unit/api/health.test.js +3 -0
  25. package/test/unit/api/participants/participants.test.js +5 -7
  26. package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +0 -3
  27. package/test/unit/api/participants/{Type}/{ID}.test.js +0 -3
  28. package/test/unit/api/participants.test.js +36 -3
  29. package/test/unit/domain/participants/participants.test.js +76 -48
  30. package/test/unit/domain/parties/parties.test.js +3 -3
  31. package/test/unit/domain/parties/utils.test.js +60 -0
  32. package/test/unit/domain/timeout/dto.test.js +1 -2
  33. package/test/unit/lib/TransformFacades.test.js +2 -1
  34. package/test/unit/lib/config.test.js +7 -0
  35. package/test/unit/models/participantEndpoint/facade.test.js +25 -8
  36. package/test/unit/plugins.test.js +4 -2
  37. package/test/util/apiClients/BasicApiClient.js +2 -2
  38. package/src/handlers/monitoring/plugins/metrics.js +0 -48
  39. package/src/lib/requestLogger.js +0 -54
  40. package/src/metrics/handler.js +0 -33
  41. package/src/metrics/plugin.js +0 -52
  42. package/src/metrics/routes.js +0 -43
  43. package/test/unit/lib/requestLogger.test.js +0 -115
@@ -1,52 +0,0 @@
1
- /*****
2
- License
3
- --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
-
11
- Contributors
12
- --------------
13
- This is the official list of the Mojaloop project contributors for this file.
14
- Names of the original copyright holders (individuals or organizations)
15
- should be listed with a '*' in the first column. People who have
16
- contributed from an organization can be listed under the organization
17
- that actually holds the copyright for their contributions (see the
18
- Gates Foundation organization for an example). Those individuals should have
19
- their names indented and be marked with a '-'. Email address can be added
20
- optionally within square brackets <email>.
21
-
22
- * Gates Foundation
23
- - Name Surname <name.surname@gatesfoundation.com>
24
-
25
- * Lazola Lucas <lazola.lucas@modusbox.com>
26
- * Rajiv Mothilal <rajiv.mothilal@modusbox.com>
27
- * Miguel de Barros <miguel.debarros@modusbox.com>
28
- * Shashikant Hirugade <shashikant.hirugade@modusbox.com>
29
-
30
- --------------
31
-
32
- ******/
33
- 'use strict'
34
-
35
- /**
36
- * @module src/metrics/plugin
37
- */
38
-
39
- /**
40
- * @function Register Handler Routes HAPI
41
- *
42
- * @async
43
- * @description Registers registers plugins on HAPI server. This retrieves all routes to be exposed from the routes.js file
44
- * @returns {Promise} - Returns a promise: resolve if successful, or rejection if failed
45
- */
46
-
47
- exports.plugin = {
48
- name: 'handler metrics routes',
49
- register: function (server) {
50
- server.route(require('./routes'))
51
- }
52
- }
@@ -1,43 +0,0 @@
1
- /*****
2
- License
3
- --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
- Contributors
9
- --------------
10
- This is the official list of the Mojaloop project contributors for this file.
11
- Names of the original copyright holders (individuals or organizations)
12
- should be listed with a '*' in the first column. People who have
13
- contributed from an organization can be listed under the organization
14
- that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
16
- their names indented and be marked with a '-'. Email address can be added
17
- optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
20
-
21
- - Pedro Barreto <pedrob@crosslaketech.com>
22
- - Rajiv Mothilal <rajivmothilal@gmail.com>
23
- - Shashikant Hirugade <shashikant.hirugade@modusbox.com>
24
- --------------
25
- ******/
26
-
27
- 'use strict'
28
-
29
- const Handler = require('./handler')
30
- const tags = ['api', 'metrics']
31
-
32
- module.exports = [
33
- {
34
- method: 'GET',
35
- path: '/metrics',
36
- handler: Handler.metrics,
37
- config: {
38
- tags,
39
- description: 'Prometheus metrics endpoint',
40
- id: 'metrics'
41
- }
42
- }
43
- ]
@@ -1,115 +0,0 @@
1
- /*****
2
- License
3
- --------------
4
- Copyright © 2017 Bill & Melinda Gates Foundation
5
- The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
- Contributors
9
- --------------
10
- This is the official list of the Mojaloop project contributors for this file.
11
- Names of the original copyright holders (individuals or organizations)
12
- should be listed with a '*' in the first column. People who have
13
- contributed from an organization can be listed under the organization
14
- that actually holds the copyright for their contributions (see the
15
- Gates Foundation organization for an example). Those individuals should have
16
- their names indented and be marked with a '-'. Email address can be added
17
- optionally within square brackets <email>.
18
- * Gates Foundation
19
- - Name Surname <name.surname@gatesfoundation.com>
20
-
21
- * Crosslake
22
- - Lewis Daly <lewisd@crosslaketech.com>
23
-
24
- --------------
25
- ******/
26
-
27
- 'use strict'
28
-
29
- const Sinon = require('sinon')
30
- const ErrorHandler = require('@mojaloop/central-services-error-handling')
31
-
32
- const requestLogger = require('../../../src/lib/requestLogger')
33
- const { logger } = require('../../../src/lib')
34
- const fixtures = require('../../fixtures')
35
-
36
- let sandbox
37
-
38
- describe('requestLogger', () => {
39
- beforeEach(() => {
40
- sandbox = Sinon.createSandbox()
41
- })
42
-
43
- afterEach(() => {
44
- sandbox.restore()
45
- })
46
-
47
- describe('logRequest', () => {
48
- it('prints the request.payload if it exists', async () => {
49
- // Arrange
50
- const infoSpy = sandbox.spy(logger.mlLogger, 'info')
51
- const req = {
52
- ...fixtures.mockHapiRequestDto(),
53
- url: {
54
- path: '/123/456'
55
- },
56
- query: {},
57
- payload: {
58
- itemA: 123,
59
- itemB: 456
60
- }
61
- }
62
-
63
- // Act
64
- requestLogger.logRequest(req)
65
-
66
- // Assert
67
- expect(infoSpy.calledOnce).toBe(true)
68
- const logLine = infoSpy.firstCall.args[0]
69
- expect(logLine).toContain(JSON.stringify(req.headers))
70
- expect(logLine).toContain(JSON.stringify(req.query))
71
- expect(logLine).toContain(JSON.stringify(req.payload))
72
- })
73
- })
74
-
75
- describe('logResponse', () => {
76
- it('should log response statusCode', async () => {
77
- // Arrange
78
- const infoSpy = sandbox.spy(logger.mlLogger, 'info')
79
- const req = {
80
- ...fixtures.mockHapiRequestDto(),
81
- response: {
82
- statusCode: 500
83
- }
84
- }
85
-
86
- // Act
87
- requestLogger.logResponse(req)
88
-
89
- // Assert
90
- const logLine = infoSpy.firstCall.args[0]
91
- expect(logLine).toContain(JSON.stringify(req.response.statusCode))
92
- })
93
-
94
- it('handles valid json error response', async () => {
95
- // Arrange
96
- const infoSpy = sandbox.spy(logger.mlLogger, 'info')
97
- const response = ErrorHandler.Factory.createFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.VALIDATION_ERROR, 'Invalid currency code')
98
- const statusCode = 123
99
- response.output = {
100
- statusCode
101
- }
102
- const req = {
103
- ...fixtures.mockHapiRequestDto(),
104
- response
105
- }
106
-
107
- // Act
108
- requestLogger.logResponse(req)
109
-
110
- // Assert
111
- const logLine = infoSpy.firstCall.args[0]
112
- expect(logLine).toContain(JSON.stringify(statusCode))
113
- })
114
- })
115
- })