@mojaloop/sdk-scheme-adapter 24.2.0 → 24.2.1-snapshot.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/.yarn/cache/@hapi-hapi-npm-21.4.0-2644a983d1-4e6ccd65ba.zip +0 -0
- package/.yarn/cache/@hapi-statehood-npm-8.2.0-5844e85740-0ebe5fa44e.zip +0 -0
- package/.yarn/cache/@mojaloop-central-services-shared-npm-18.22.1-afa19f2925-27182cd5be.zip +0 -0
- package/.yarn/cache/{@mojaloop-event-sdk-npm-14.1.5-97dbf6c0e3-9d5836df5a.zip → @mojaloop-event-sdk-npm-14.3.0-2aa8149477-6173c7d96f.zip} +0 -0
- package/.yarn/cache/@mojaloop-inter-scheme-proxy-cache-lib-npm-2.3.7-87034262d3-37fe9b388c.zip +0 -0
- package/.yarn/cache/@mojaloop-sdk-standard-components-npm-19.10.0-snapshot.1-e9bbd7866c-90ec21d0f6.zip +0 -0
- package/.yarn/cache/{@types-node-npm-22.13.9-565bb4cd14-d36ae841fa.zip → @types-node-npm-22.13.10-af5336e62b-1cd6b899df.zip} +0 -0
- package/.yarn/cache/axios-npm-1.8.2-55671cda10-c47a43b79a.zip +0 -0
- package/.yarn/cache/ioredis-npm-5.6.0-2140ad9baf-b085cec251.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/modules/api-svc/package.json +5 -5
- package/modules/api-svc/src/config.js +2 -2
- package/modules/api-svc/src/index.js +2 -1
- package/modules/api-svc/src/lib/logger.js +47 -0
- package/modules/api-svc/src/lib/utils.js +1 -19
- package/modules/api-svc/test/integration/lib/cache.test.js +2 -7
- package/modules/api-svc/test/integration-pm4ml/mockServers/managementService/config.js +3 -2
- package/modules/api-svc/test/integration-pm4ml/mockServers/managementService/index.js +25 -24
- package/modules/api-svc/test/integration-pm4ml/mockServers/managementService/server.js +0 -1
- package/modules/api-svc/test/unit/BackendEventHandler.test.js +2 -2
- package/modules/api-svc/test/unit/ControlClient.test.js +5 -4
- package/modules/api-svc/test/unit/FSPIOPEventHandler.test.js +6 -5
- package/modules/api-svc/test/unit/InboundServer-iso20022.test.js +3 -3
- package/modules/api-svc/test/unit/InboundServer.test.js +3 -2
- package/modules/api-svc/test/unit/TestServer.test.js +10 -11
- package/modules/api-svc/test/unit/api/transfers/utils.js +2 -2
- package/modules/api-svc/test/unit/api/utils.js +4 -3
- package/modules/api-svc/test/unit/ilp.test.js +3 -2
- package/modules/api-svc/test/unit/inboundApi/handlers-iso20022.test.js +5 -5
- package/modules/api-svc/test/unit/inboundApi/handlers.test.js +28 -27
- package/modules/api-svc/test/unit/index.test.js +9 -13
- package/modules/api-svc/test/unit/lib/cache.test.js +2 -2
- package/modules/api-svc/test/unit/lib/model/AccountsModel.test.js +3 -2
- package/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js +10 -8
- package/modules/api-svc/test/unit/lib/model/OutboundBulkQuotesModel.test.js +4 -4
- package/modules/api-svc/test/unit/lib/model/OutboundBulkTransfersModel.test.js +3 -2
- package/modules/api-svc/test/unit/lib/model/OutboundRequestToPayModel.test.js +5 -4
- package/modules/api-svc/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +4 -4
- package/modules/api-svc/test/unit/lib/model/OutboundTransfersISO20022.test.js +5 -6
- package/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js +4 -3
- package/modules/api-svc/test/unit/lib/model/lib/requests/backendRequests.test.js +3 -2
- package/modules/api-svc/test/unit/mockLogger.js +10 -7
- package/modules/outbound-command-event-handler/package.json +3 -3
- package/modules/outbound-domain-event-handler/package.json +2 -2
- package/modules/private-shared-lib/package.json +3 -3
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.yarn/cache/@mojaloop-inter-scheme-proxy-cache-lib-npm-2.3.7-87034262d3-37fe9b388c.zip
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-api-svc",
|
|
3
|
-
"version": "21.0.0-snapshot.
|
|
3
|
+
"version": "21.0.0-snapshot.27",
|
|
4
4
|
"description": "An adapter for connecting to Mojaloop API enabled switches.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"@mojaloop/central-services-error-handling": "13.0.7",
|
|
69
69
|
"@mojaloop/central-services-logger": "11.5.5",
|
|
70
70
|
"@mojaloop/central-services-metrics": "12.4.5",
|
|
71
|
-
"@mojaloop/central-services-shared": "18.
|
|
72
|
-
"@mojaloop/event-sdk": "14.
|
|
71
|
+
"@mojaloop/central-services-shared": "18.22.1",
|
|
72
|
+
"@mojaloop/event-sdk": "14.3.0",
|
|
73
73
|
"@mojaloop/logging-bc-client-lib": "0.5.8",
|
|
74
74
|
"@mojaloop/ml-schema-transformer-lib": "2.5.6",
|
|
75
75
|
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
|
|
76
|
-
"@mojaloop/sdk-standard-components": "19.
|
|
76
|
+
"@mojaloop/sdk-standard-components": "19.10.0-snapshot.1",
|
|
77
77
|
"ajv": "8.17.1",
|
|
78
|
-
"axios": "1.8.
|
|
78
|
+
"axios": "1.8.2",
|
|
79
79
|
"body-parser": "1.20.3",
|
|
80
80
|
"co-body": "6.2.0",
|
|
81
81
|
"dotenv": "16.4.7",
|
|
@@ -30,7 +30,7 @@ require('dotenv').config();
|
|
|
30
30
|
const fs = require('node:fs');
|
|
31
31
|
const yaml = require('js-yaml');
|
|
32
32
|
const { from } = require('env-var');
|
|
33
|
-
const {
|
|
33
|
+
const { LOG_LEVELS } = require('./lib/logger');
|
|
34
34
|
const { API_TYPES, RESOURCE_VERSIONS_STRING } = require('./constants');
|
|
35
35
|
|
|
36
36
|
function getFileContent (path) {
|
|
@@ -90,7 +90,7 @@ module.exports = {
|
|
|
90
90
|
mgmtAPILatencyAssumption: env.get('MGMT_API_LATENCY_ASSUMPTION').default('2000').asIntPositive(),
|
|
91
91
|
},
|
|
92
92
|
idGenerator: env.get('ID_GENERATOR').default('{"type":"ulid"}').asJsonObject(),
|
|
93
|
-
logLevel: env.get('LOG_LEVEL').default('info').asEnum(
|
|
93
|
+
logLevel: env.get('LOG_LEVEL').default('info').asEnum(LOG_LEVELS),
|
|
94
94
|
inbound: {
|
|
95
95
|
port: env.get('INBOUND_LISTEN_PORT').default('4000').asPortNumber(),
|
|
96
96
|
tls: {
|
|
@@ -48,7 +48,8 @@ const Router = require('./lib/router');
|
|
|
48
48
|
const Validate = require('./lib/validate');
|
|
49
49
|
const Cache = require('./lib/cache');
|
|
50
50
|
const { SDKStateEnum } = require('./lib/model/common');
|
|
51
|
-
const { createAuthClient
|
|
51
|
+
const { createAuthClient } = require('./lib/utils');
|
|
52
|
+
const { createLogger } = require('./lib/logger');
|
|
52
53
|
|
|
53
54
|
const LOG_ID = {
|
|
54
55
|
INBOUND: { app: 'mojaloop-connector-inbound-api' },
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*****
|
|
2
|
+
License
|
|
3
|
+
--------------
|
|
4
|
+
Copyright © 2020-2025 Mojaloop Foundation
|
|
5
|
+
The Mojaloop files are made available by the Mojaloop 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
|
+
Mojaloop Foundation 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
|
+
* Mojaloop Foundation
|
|
23
|
+
* Eugen Klymniuk <eugen.klymniuk@infitx.com>
|
|
24
|
+
|
|
25
|
+
--------------
|
|
26
|
+
******/
|
|
27
|
+
|
|
28
|
+
const { hostname } = require('node:os');
|
|
29
|
+
const { loggerFactory, LOG_LEVELS } = require('@mojaloop/sdk-standard-components').Logger;
|
|
30
|
+
|
|
31
|
+
const createLogger = (conf = {}) => {
|
|
32
|
+
const {
|
|
33
|
+
context = {
|
|
34
|
+
// If we're running from a Mojaloop helm chart deployment, we'll have a SIM_NAME
|
|
35
|
+
simulator: process.env['SIM_NAME'],
|
|
36
|
+
hostname: hostname(),
|
|
37
|
+
},
|
|
38
|
+
isJsonOutput = false,
|
|
39
|
+
} = conf;
|
|
40
|
+
|
|
41
|
+
return loggerFactory({ context, isJsonOutput });
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
createLogger,
|
|
46
|
+
LOG_LEVELS,
|
|
47
|
+
};
|
|
@@ -25,25 +25,8 @@
|
|
|
25
25
|
--------------
|
|
26
26
|
******/
|
|
27
27
|
|
|
28
|
-
const { hostname } = require('node:os');
|
|
29
28
|
const { randomBytes } = require('node:crypto');
|
|
30
|
-
const { WSO2Auth
|
|
31
|
-
|
|
32
|
-
const SDK_LOGGER_HIERARCHY = Logger.Logger.logLevels.reverse();
|
|
33
|
-
|
|
34
|
-
const createLogger = (conf) => new Logger.Logger({
|
|
35
|
-
context: {
|
|
36
|
-
// If we're running from a Mojaloop helm chart deployment, we'll have a SIM_NAME
|
|
37
|
-
simulator: process.env['SIM_NAME'],
|
|
38
|
-
hostname: hostname(),
|
|
39
|
-
},
|
|
40
|
-
opts: {
|
|
41
|
-
// todo: should be done inside Logger code
|
|
42
|
-
levels: SDK_LOGGER_HIERARCHY.slice(SDK_LOGGER_HIERARCHY.indexOf(conf.logLevel)),
|
|
43
|
-
isJsonOutput: conf.isJsonOutput,
|
|
44
|
-
},
|
|
45
|
-
stringify: Logger.buildStringify({ isJsonOutput: conf.isJsonOutput }),
|
|
46
|
-
});
|
|
29
|
+
const { WSO2Auth } = require('@mojaloop/sdk-standard-components');
|
|
47
30
|
|
|
48
31
|
const createAuthClient = (conf, logger) => {
|
|
49
32
|
const { wso2, outbound } = conf;
|
|
@@ -88,7 +71,6 @@ const generateTraceparent = (traceId = randomBytes(16).toString('hex')) => {
|
|
|
88
71
|
|
|
89
72
|
module.exports = {
|
|
90
73
|
createAuthClient,
|
|
91
|
-
createLogger,
|
|
92
74
|
generateTraceparent,
|
|
93
75
|
transformHeadersIsoToFspiop
|
|
94
76
|
};
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
jest.dontMock('redis');
|
|
32
32
|
|
|
33
33
|
const Cache = require('~/lib/cache');
|
|
34
|
-
const {
|
|
34
|
+
const { createLogger } = require('~/lib/logger');
|
|
35
35
|
const env = require('../testEnv');
|
|
36
36
|
|
|
37
37
|
const defaultCacheConfig = {
|
|
@@ -40,12 +40,7 @@ const defaultCacheConfig = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const createCache = async (config) => {
|
|
43
|
-
config.logger =
|
|
44
|
-
context: {
|
|
45
|
-
app: 'mojaloop-sdk-inboundCache'
|
|
46
|
-
},
|
|
47
|
-
stringify: Logger.buildStringify({ space: 4 }),
|
|
48
|
-
});
|
|
43
|
+
config.logger = createLogger({ context: { app: 'mojaloop-sdk-inboundCache' } });
|
|
49
44
|
const cache = new Cache(config);
|
|
50
45
|
await cache.connect();
|
|
51
46
|
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
******/
|
|
27
27
|
'use strict';
|
|
28
28
|
|
|
29
|
-
const fs = require('fs');
|
|
30
29
|
require('dotenv').config();
|
|
30
|
+
const fs = require('fs');
|
|
31
31
|
const { from } = require('env-var');
|
|
32
|
+
const { LOG_LEVELS } = require('../../../../src/lib/logger');
|
|
32
33
|
|
|
33
34
|
function getFileContent (path) {
|
|
34
35
|
if (!fs.existsSync(path)) {
|
|
@@ -43,7 +44,7 @@ const env = from(process.env, {
|
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
module.exports = {
|
|
46
|
-
logLevel: env.get('LOG_LEVEL').default('info').asEnum(
|
|
47
|
+
logLevel: env.get('LOG_LEVEL').default('info').asEnum(LOG_LEVELS),
|
|
47
48
|
server: {
|
|
48
49
|
port: env.get('SERVER_LISTEN_PORT').default('4005').asPortNumber(),
|
|
49
50
|
},
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const { createLogger } = require('../../../../src/lib/logger');
|
|
1
3
|
const Config = require('./config');
|
|
2
4
|
const ManagementService = require('./server');
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
hostname: 'test',
|
|
5
|
+
|
|
6
|
+
const app = express();
|
|
7
|
+
|
|
8
|
+
const logger = createLogger({
|
|
9
|
+
context: {
|
|
10
|
+
simulator: 'test',
|
|
11
|
+
hostname: 'test',
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
});
|
|
13
14
|
|
|
14
15
|
const managementServer = new ManagementService.Server({
|
|
15
16
|
port: Config.server.port,
|
|
16
|
-
logger
|
|
17
|
+
logger,
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
// Test API Server
|
|
20
21
|
app.use(express.json());
|
|
21
22
|
|
|
22
23
|
app.get('/health', (req, res) => {
|
|
23
|
-
|
|
24
|
-
})
|
|
24
|
+
res.send('OK');
|
|
25
|
+
});
|
|
25
26
|
|
|
26
27
|
app.post('/updateOutboundTLSConfig', (req, res) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
28
|
+
managementServer.updateOutboundTLSConfig(req.body);
|
|
29
|
+
res.status(200).json({
|
|
30
|
+
message: 'Updated configuration'
|
|
31
|
+
});
|
|
32
|
+
});
|
|
32
33
|
|
|
33
34
|
app.post('/resetConfig', (req, res) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
35
|
+
managementServer.resetConfig();
|
|
36
|
+
res.status(200).json({
|
|
37
|
+
message: 'Reset Done'
|
|
38
|
+
});
|
|
39
|
+
});
|
|
39
40
|
|
|
40
41
|
app.listen(Config.testAPIServer.port, () => {
|
|
41
|
-
|
|
42
|
-
})
|
|
42
|
+
logger.log(`Test API Server listening on port ${Config.testAPIServer.port}`);
|
|
43
|
+
});
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
const { BackendEventHandler } = require('../../src/BackendEventHandler');
|
|
29
29
|
const { BackendRequests } = require('../../src/lib/model/lib/requests');
|
|
30
30
|
const { SDKStateEnum } = require('../../src/lib/model/common');
|
|
31
|
-
const {
|
|
31
|
+
const { createLogger } = require('../../src/lib/logger');
|
|
32
32
|
const config = require('./data/defaultConfig.json');
|
|
33
33
|
const bulkTransactionResponse = require('./lib/model/data/bulkTransactionResponse.json');
|
|
34
34
|
const {
|
|
@@ -42,7 +42,7 @@ const {
|
|
|
42
42
|
KafkaDomainEventProducer,
|
|
43
43
|
} = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
|
|
44
44
|
|
|
45
|
-
const logger =
|
|
45
|
+
const logger = createLogger({ context: { app: 'BackendEventHandler' }, stringify: () => '' });
|
|
46
46
|
|
|
47
47
|
describe('BackendEventHandler', () => {
|
|
48
48
|
const putBulkTransactions = jest.spyOn(BackendRequests.prototype, 'putBulkTransactions').mockImplementation(async () => ({}));
|
|
@@ -24,12 +24,13 @@
|
|
|
24
24
|
|
|
25
25
|
--------------
|
|
26
26
|
******/
|
|
27
|
-
const ControlAgent = require('~/ControlAgent');
|
|
28
|
-
const TestControlServer = require('./ControlServer');
|
|
29
|
-
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
30
27
|
|
|
31
28
|
jest.mock('~/lib/cache');
|
|
32
29
|
|
|
30
|
+
const ControlAgent = require('~/ControlAgent');
|
|
31
|
+
const { createLogger } = require('~/lib/logger');
|
|
32
|
+
const TestControlServer = require('./ControlServer');
|
|
33
|
+
|
|
33
34
|
// TODO:
|
|
34
35
|
// - diff against master to determine what else needs testing
|
|
35
36
|
// - especially look for assertions in the code
|
|
@@ -59,7 +60,7 @@ describe('ControlAgent', () => {
|
|
|
59
60
|
const changedConfig = { ...appConfig, some: 'thing' };
|
|
60
61
|
|
|
61
62
|
beforeAll(async () => {
|
|
62
|
-
logger =
|
|
63
|
+
logger = createLogger({ stringify: () => '' });
|
|
63
64
|
server = new TestControlServer.Server({ logger, appConfig });
|
|
64
65
|
client = await ControlAgent.Client.Create({
|
|
65
66
|
address: 'localhost',
|
|
@@ -33,10 +33,6 @@ process.env.CACHE_URL = 'redis://172.17.0.2:6379';
|
|
|
33
33
|
process.env.MGMT_API_WS_URL = '0.0.0.0';
|
|
34
34
|
process.env.SUPPORTED_CURRENCIES='USD';
|
|
35
35
|
|
|
36
|
-
const { FSPIOPEventHandler } = require('../../src/FSPIOPEventHandler');
|
|
37
|
-
const bulkQuoteRequest = require('../unit/lib/model/data/bulkQuoteRequest.json');
|
|
38
|
-
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
39
|
-
const config = require('./data/defaultConfig.json');
|
|
40
36
|
const {
|
|
41
37
|
PartyInfoRequestedDmEvt,
|
|
42
38
|
BulkQuotesRequestedDmEvt,
|
|
@@ -45,6 +41,8 @@ const {
|
|
|
45
41
|
KafkaDomainEventProducer,
|
|
46
42
|
} = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
|
|
47
43
|
|
|
44
|
+
const { FSPIOPEventHandler } = require('../../src/FSPIOPEventHandler');
|
|
45
|
+
const { createLogger } = require('../../src/lib/logger');
|
|
48
46
|
const {
|
|
49
47
|
OutboundBulkQuotesModel,
|
|
50
48
|
PartiesModel,
|
|
@@ -52,7 +50,10 @@ const {
|
|
|
52
50
|
SDKStateEnum
|
|
53
51
|
} = require('../../src/lib/model');
|
|
54
52
|
|
|
55
|
-
const
|
|
53
|
+
const bulkQuoteRequest = require('../unit/lib/model/data/bulkQuoteRequest.json');
|
|
54
|
+
const config = require('./data/defaultConfig.json');
|
|
55
|
+
|
|
56
|
+
const logger = createLogger({ context: { app: 'FSPIOPEventHandler' }, stringify: () => '' });
|
|
56
57
|
|
|
57
58
|
describe('FSPIOPEventHandler', () => {
|
|
58
59
|
let fspiopEventHandler;
|
|
@@ -37,17 +37,17 @@ jest.mock('../../src/lib/cache');
|
|
|
37
37
|
jest.mock('../../src/lib/model/lib/requests', () => require('./lib/model/mockedLibRequests'));
|
|
38
38
|
|
|
39
39
|
const supertest = require('supertest');
|
|
40
|
-
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
41
|
-
|
|
42
40
|
const InboundServer = require('../../src/InboundServer');
|
|
43
41
|
const Cache = require('../../src/lib/cache');
|
|
44
42
|
const config = require('../../src/config');
|
|
45
43
|
const helpers = require('../helpers');
|
|
44
|
+
const { createLogger } = require('../../src/lib/logger');
|
|
45
|
+
|
|
46
46
|
const isoBodies = require('./inboundApi/data/isoBodies');
|
|
47
47
|
const commonHttpHeaders = require('./data/commonHttpHeaders');
|
|
48
48
|
const transactionRequestResponse = require('./lib/model/data/transactionRequestResponse');
|
|
49
49
|
|
|
50
|
-
const logger =
|
|
50
|
+
const logger = createLogger();
|
|
51
51
|
|
|
52
52
|
const createIsoHeaders = resource => ({
|
|
53
53
|
...commonHttpHeaders,
|
|
@@ -47,16 +47,17 @@ jest.mock('@mojaloop/sdk-standard-components');
|
|
|
47
47
|
jest.mock('~/lib/cache');
|
|
48
48
|
jest.mock('~/lib/model/lib/requests', () => require('./lib/model/mockedLibRequests'));
|
|
49
49
|
|
|
50
|
+
const { Jws } = require('@mojaloop/sdk-standard-components');
|
|
51
|
+
const { createLogger } = require('~/lib/logger');
|
|
50
52
|
const InboundServer = require('~/InboundServer');
|
|
51
53
|
const Cache = require('~/lib/cache');
|
|
52
|
-
const { Jws, Logger } = require('@mojaloop/sdk-standard-components');
|
|
53
54
|
const path = require('path');
|
|
54
55
|
const fs = require('fs');
|
|
55
56
|
const os = require('os');
|
|
56
57
|
const http = require('http');
|
|
57
58
|
const https = require('https');
|
|
58
59
|
|
|
59
|
-
const logger =
|
|
60
|
+
const logger = createLogger();
|
|
60
61
|
|
|
61
62
|
describe('Inbound Server', () => {
|
|
62
63
|
describe('PUT /parties', () => {
|
|
@@ -33,23 +33,22 @@ process.env.CACHE_URL = 'redis://172.17.0.2:6379';
|
|
|
33
33
|
process.env.MGMT_API_WS_URL = '0.0.0.0';
|
|
34
34
|
process.env.SUPPORTED_CURRENCIES='USD';
|
|
35
35
|
|
|
36
|
+
jest.mock('@mojaloop/sdk-standard-components');
|
|
37
|
+
jest.mock('~/lib/cache');
|
|
38
|
+
jest.mock('~/lib/model/lib/requests', () => require('./lib/model/mockedLibRequests'));
|
|
39
|
+
|
|
36
40
|
const supertest = require('supertest');
|
|
41
|
+
const WebSocket = require('ws');
|
|
42
|
+
const TestServer = require('~/TestServer');
|
|
43
|
+
const Cache = require('~/lib/cache');
|
|
44
|
+
const InboundServer = require('~/InboundServer');
|
|
45
|
+
const { createLogger } = require('~/lib/logger');
|
|
37
46
|
|
|
38
47
|
const defaultConfig = require('./data/defaultConfig');
|
|
39
48
|
const putPartiesBody = require('./data/putPartiesBody');
|
|
40
49
|
const postQuotesBody = require('./data/postQuotesBody');
|
|
41
50
|
const putParticipantsBody = require('./data/putParticipantsBody');
|
|
42
51
|
const commonHttpHeaders = require('./data/commonHttpHeaders');
|
|
43
|
-
const WebSocket = require('ws');
|
|
44
|
-
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
45
|
-
|
|
46
|
-
jest.mock('~/lib/cache');
|
|
47
|
-
jest.mock('@mojaloop/sdk-standard-components');
|
|
48
|
-
jest.mock('~/lib/model/lib/requests', () => require('./lib/model/mockedLibRequests'));
|
|
49
|
-
|
|
50
|
-
const Cache = require('~/lib/cache');
|
|
51
|
-
const InboundServer = require('~/InboundServer');
|
|
52
|
-
const TestServer = require('~/TestServer');
|
|
53
52
|
|
|
54
53
|
const createWsClient = async (port, path) => {
|
|
55
54
|
const result = new WebSocket(`ws://127.0.0.1:${port}${path}`);
|
|
@@ -67,7 +66,7 @@ describe('Test Server', () => {
|
|
|
67
66
|
beforeEach(async () => {
|
|
68
67
|
Cache.mockClear();
|
|
69
68
|
|
|
70
|
-
logger =
|
|
69
|
+
logger = createLogger({ stringify: () => '' });
|
|
71
70
|
|
|
72
71
|
serverConfig = {
|
|
73
72
|
...JSON.parse(JSON.stringify(defaultConfig)),
|
|
@@ -2,7 +2,7 @@ const { mockAxios, jsonContentTypeHeader} = require('../../../helpers');
|
|
|
2
2
|
|
|
3
3
|
const OpenAPIResponseValidator = require('openapi-response-validator').default;
|
|
4
4
|
|
|
5
|
-
const {
|
|
5
|
+
const { createLogger } = require('../../../../src/lib/logger');
|
|
6
6
|
const postTransfersSimpleBody = require('./data/postTransfersSimpleBody');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -112,7 +112,7 @@ function createGetTransfersTester({ reqInbound, reqOutbound, apiSpecsOutbound })
|
|
|
112
112
|
function createPostTransfersTester({
|
|
113
113
|
requestValidatorInbound, reqInbound, reqOutbound, apiSpecsOutbound
|
|
114
114
|
}) {
|
|
115
|
-
const logger =
|
|
115
|
+
const logger =createLogger({ context: { app: 'outbound-model-unit-tests' } });
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
*
|
|
@@ -2,12 +2,13 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const yaml = require('js-yaml');
|
|
4
4
|
const supertest = require('supertest');
|
|
5
|
-
const {
|
|
5
|
+
const { WSO2Auth } = require('@mojaloop/sdk-standard-components');
|
|
6
6
|
|
|
7
|
+
const { createLogger } = require('~/lib/logger');
|
|
8
|
+
const { MetricsClient } = require('~/lib/metrics');
|
|
7
9
|
const Validate = require('~/lib/validate');
|
|
8
10
|
const InboundServer = require('~/InboundServer');
|
|
9
11
|
const OutboundServer = require('~/OutboundServer');
|
|
10
|
-
const { MetricsClient } = require('~/lib/metrics');
|
|
11
12
|
const Cache = require('~/lib/cache');
|
|
12
13
|
|
|
13
14
|
const ServerType = {
|
|
@@ -50,7 +51,7 @@ const createValidators = async () => {
|
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
const createTestServers = async (config) => {
|
|
53
|
-
const logger =
|
|
54
|
+
const logger = createLogger({ stringify: () => '' });
|
|
54
55
|
const defConfig = structuredClone(config);
|
|
55
56
|
const cache = new Cache({
|
|
56
57
|
cacheUrl: defConfig.cacheUrl,
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
--------------
|
|
26
26
|
******/
|
|
27
27
|
|
|
28
|
-
const { Ilp
|
|
28
|
+
const { Ilp } = jest.requireActual('@mojaloop/sdk-standard-components');
|
|
29
|
+
const { createLogger } = require('../../src/lib/logger');
|
|
29
30
|
const mocks = require('./lib/model/data/mocks');
|
|
30
31
|
|
|
31
32
|
describe('ILP Tests -->', () => {
|
|
@@ -36,7 +37,7 @@ describe('ILP Tests -->', () => {
|
|
|
36
37
|
beforeEach(() => {
|
|
37
38
|
ilp = Ilp.ilpFactory(Ilp.ILP_VERSIONS.v4, {
|
|
38
39
|
secret: 'test',
|
|
39
|
-
logger:
|
|
40
|
+
logger: createLogger(),
|
|
40
41
|
});
|
|
41
42
|
fxQuotesPayload = mocks.mockFxQuotesPayload();
|
|
42
43
|
fxpBeResponse = mocks.mockFxQuotesInternalResponse();
|
|
@@ -21,17 +21,17 @@ process.env.SUPPORTED_CURRENCIES='USD';
|
|
|
21
21
|
|
|
22
22
|
jest.mock('../../../src/lib/model');
|
|
23
23
|
|
|
24
|
-
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
25
24
|
const handlers = require('../../../src/InboundServer/handlers');
|
|
26
25
|
const Model = require('../../../src/lib/model').InboundTransfersModel;
|
|
27
26
|
const QuotesModel = require('../../../src/lib/model').QuotesModel;
|
|
28
27
|
const PartiesModel = require('../../../src/lib/model').PartiesModel;
|
|
29
28
|
const TransfersModel = require('../../../src/lib/model').TransfersModel;
|
|
29
|
+
const { createLogger } = require('../../../src/lib/logger');
|
|
30
30
|
|
|
31
31
|
const { createIsoHeader } = require('../../helpers');
|
|
32
32
|
const isoBodies = require('./data/isoBodies.json');
|
|
33
33
|
|
|
34
|
-
const logger =
|
|
34
|
+
const logger = createLogger({ context: { app: 'inbound-handlers-unit-test' } });
|
|
35
35
|
|
|
36
36
|
describe('Inbound API handlers transforming incoming ISO20022 message bodies', () => {
|
|
37
37
|
describe('POST /quotes', () => {
|
|
@@ -92,7 +92,7 @@ describe('Inbound API handlers transforming incoming ISO20022 message bodies', (
|
|
|
92
92
|
'ID': '1234567890'
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
-
logger
|
|
95
|
+
logger,
|
|
96
96
|
cache: {
|
|
97
97
|
publish: jest.fn(() => Promise.resolve(true))
|
|
98
98
|
}
|
|
@@ -142,7 +142,7 @@ describe('Inbound API handlers transforming incoming ISO20022 message bodies', (
|
|
|
142
142
|
'ID': '1234567890'
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
|
-
logger
|
|
145
|
+
logger,
|
|
146
146
|
cache: {
|
|
147
147
|
publish: jest.fn(() => Promise.resolve(true))
|
|
148
148
|
}
|
|
@@ -212,7 +212,7 @@ describe('Inbound API handlers transforming incoming ISO20022 message bodies', (
|
|
|
212
212
|
conf: {
|
|
213
213
|
isIsoApi: true,
|
|
214
214
|
},
|
|
215
|
-
logger
|
|
215
|
+
logger,
|
|
216
216
|
cache: {
|
|
217
217
|
publish: jest.fn(() => Promise.resolve(true))
|
|
218
218
|
}
|