account-lookup-service 15.6.0-snapshot.2 → 16.1.0-iso.0

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 (68) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE.md +3 -4
  3. package/README.md +2 -0
  4. package/audit-ci.jsonc +2 -27
  5. package/config/default.json +1 -0
  6. package/docker/mock-proxy/README.md +21 -0
  7. package/docker/mock-proxy/src/config.ts +7 -0
  8. package/docs/Proxy/Discovery.md +20 -0
  9. package/docs/Proxy/FXAPI_POC_payer_conversion_RECEIVE.plantuml +577 -0
  10. package/docs/Proxy/FXAPI_POC_payer_conversion_SEND.plantuml +1423 -0
  11. package/docs/Proxy/P2P.md +11 -0
  12. package/docs/Proxy/Proxy pattern - Happy path.plantuml +98 -0
  13. package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.plantuml +105 -0
  14. package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.png +0 -0
  15. package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.plantuml +130 -0
  16. package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.png +0 -0
  17. package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.plantuml +72 -0
  18. package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.png +0 -0
  19. package/docs/Proxy/Proxy pattern - P2P.plantuml +186 -0
  20. package/docs/Proxy/Proxy pattern - P2P.png +0 -0
  21. package/docs/Proxy/Proxy pattern - Unhappy path.plantuml +103 -0
  22. package/docs/Proxy/Proxy pattern - Unhappy path.png +0 -0
  23. package/docs/Proxy/Proxy pattern - happy path.png +0 -0
  24. package/docs/Proxy/Readme.md +39 -0
  25. package/docs/Proxy/SettingUpProxys.plantuml +31 -0
  26. package/docs/Proxy/SettingUpProxys.png +0 -0
  27. package/package.json +33 -18
  28. package/src/constants.js +2 -1
  29. package/src/domain/oracle/oracle.js +63 -4
  30. package/src/domain/participants/participants.js +246 -129
  31. package/src/domain/parties/getPartiesByTypeAndID.js +28 -7
  32. package/src/domain/parties/parties.js +43 -14
  33. package/src/domain/timeout/index.js +12 -1
  34. package/src/handlers/index.js +4 -4
  35. package/src/handlers/monitoring/index.js +1 -1
  36. package/src/interface/api-swagger-iso20022-parties.yaml +7 -6
  37. package/src/interface/api-swagger.yaml +7 -6
  38. package/src/lib/config.js +2 -1
  39. package/src/lib/db.js +2 -1
  40. package/src/models/currency/currency.js +10 -1
  41. package/src/models/endpointType/endpointType.js +10 -1
  42. package/src/models/oracle/facade.js +42 -16
  43. package/src/models/oracle/oracleEndpoint.js +65 -10
  44. package/src/models/oracle/oracleEndpointCached.js +29 -9
  45. package/src/models/participantEndpoint/facade.js +40 -4
  46. package/src/models/partyIdType/partyIdType.js +10 -1
  47. package/src/plugins.js +8 -21
  48. package/src/server.js +11 -0
  49. package/test/fixtures/index.js +30 -6
  50. package/test/unit/api/health.test.js +3 -0
  51. package/test/unit/api/participants/participants.test.js +5 -7
  52. package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +0 -3
  53. package/test/unit/api/participants/{Type}/{ID}.test.js +0 -3
  54. package/test/unit/api/participants.test.js +36 -3
  55. package/test/unit/domain/oracle/oracle.test.js +8 -0
  56. package/test/unit/domain/participants/participants.test.js +83 -48
  57. package/test/unit/domain/parties/parties.test.js +8 -0
  58. package/test/unit/domain/timeout/index.test.js +8 -0
  59. package/test/unit/lib/config.test.js +7 -0
  60. package/test/unit/mocks.js +16 -11
  61. package/test/unit/models/oracle/oracleEndpointCached.test.js +32 -0
  62. package/test/unit/plugins.test.js +2 -2
  63. package/test/util/apiClients/BasicApiClient.js +2 -2
  64. package/src/lib/requestLogger.js +0 -54
  65. package/src/metrics/handler.js +0 -33
  66. package/src/metrics/plugin.js +0 -52
  67. package/src/metrics/routes.js +0 -43
  68. package/test/unit/lib/requestLogger.test.js +0 -115
@@ -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
- })