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.
- package/CHANGELOG.md +25 -0
- package/LICENSE.md +3 -4
- package/README.md +2 -0
- package/audit-ci.jsonc +2 -27
- package/config/default.json +1 -0
- package/docker/mock-proxy/README.md +21 -0
- package/docker/mock-proxy/src/config.ts +7 -0
- package/docs/Proxy/Discovery.md +20 -0
- package/docs/Proxy/FXAPI_POC_payer_conversion_RECEIVE.plantuml +577 -0
- package/docs/Proxy/FXAPI_POC_payer_conversion_SEND.plantuml +1423 -0
- package/docs/Proxy/P2P.md +11 -0
- package/docs/Proxy/Proxy pattern - Happy path.plantuml +98 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.plantuml +105 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - No Oracles.png +0 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.plantuml +130 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery - Oracles.png +0 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.plantuml +72 -0
- package/docs/Proxy/Proxy pattern - Lazy Discovery Identifier Cache Invalid.png +0 -0
- package/docs/Proxy/Proxy pattern - P2P.plantuml +186 -0
- package/docs/Proxy/Proxy pattern - P2P.png +0 -0
- package/docs/Proxy/Proxy pattern - Unhappy path.plantuml +103 -0
- package/docs/Proxy/Proxy pattern - Unhappy path.png +0 -0
- package/docs/Proxy/Proxy pattern - happy path.png +0 -0
- package/docs/Proxy/Readme.md +39 -0
- package/docs/Proxy/SettingUpProxys.plantuml +31 -0
- package/docs/Proxy/SettingUpProxys.png +0 -0
- package/package.json +33 -18
- package/src/constants.js +2 -1
- package/src/domain/oracle/oracle.js +63 -4
- package/src/domain/participants/participants.js +246 -129
- package/src/domain/parties/getPartiesByTypeAndID.js +28 -7
- package/src/domain/parties/parties.js +43 -14
- package/src/domain/timeout/index.js +12 -1
- package/src/handlers/index.js +4 -4
- package/src/handlers/monitoring/index.js +1 -1
- package/src/interface/api-swagger-iso20022-parties.yaml +7 -6
- package/src/interface/api-swagger.yaml +7 -6
- package/src/lib/config.js +2 -1
- package/src/lib/db.js +2 -1
- package/src/models/currency/currency.js +10 -1
- package/src/models/endpointType/endpointType.js +10 -1
- package/src/models/oracle/facade.js +42 -16
- package/src/models/oracle/oracleEndpoint.js +65 -10
- package/src/models/oracle/oracleEndpointCached.js +29 -9
- package/src/models/participantEndpoint/facade.js +40 -4
- package/src/models/partyIdType/partyIdType.js +10 -1
- package/src/plugins.js +8 -21
- package/src/server.js +11 -0
- package/test/fixtures/index.js +30 -6
- package/test/unit/api/health.test.js +3 -0
- package/test/unit/api/participants/participants.test.js +5 -7
- package/test/unit/api/participants/{Type}/{ID}/{SubId}.test.js +0 -3
- package/test/unit/api/participants/{Type}/{ID}.test.js +0 -3
- package/test/unit/api/participants.test.js +36 -3
- package/test/unit/domain/oracle/oracle.test.js +8 -0
- package/test/unit/domain/participants/participants.test.js +83 -48
- package/test/unit/domain/parties/parties.test.js +8 -0
- package/test/unit/domain/timeout/index.test.js +8 -0
- package/test/unit/lib/config.test.js +7 -0
- package/test/unit/mocks.js +16 -11
- package/test/unit/models/oracle/oracleEndpointCached.test.js +32 -0
- package/test/unit/plugins.test.js +2 -2
- package/test/util/apiClients/BasicApiClient.js +2 -2
- package/src/lib/requestLogger.js +0 -54
- package/src/metrics/handler.js +0 -33
- package/src/metrics/plugin.js +0 -52
- package/src/metrics/routes.js +0 -43
- 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
|
-
})
|