@mojaloop/sdk-scheme-adapter 24.2.1-snapshot.0 → 24.3.0-snapshot.1
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/{@mojaloop-sdk-standard-components-npm-19.10.0-snapshot.1-e9bbd7866c-90ec21d0f6.zip → @mojaloop-sdk-standard-components-npm-19.10.0-snapshot.2-c380c8c569-c7ec67c802.zip} +0 -0
- package/.yarn/install-state.gz +0 -0
- package/modules/api-svc/package.json +2 -2
- package/modules/api-svc/src/BackendEventHandler/index.js +1 -1
- package/modules/api-svc/src/ControlAgent/index.js +1 -1
- package/modules/api-svc/src/FSPIOPEventHandler/index.js +1 -1
- package/modules/api-svc/src/InboundServer/index.js +3 -3
- package/modules/api-svc/src/OAuthTestServer/index.js +1 -1
- package/modules/api-svc/src/OutboundServer/index.js +3 -3
- package/modules/api-svc/src/TestServer/index.js +3 -3
- package/modules/api-svc/src/index.js +23 -45
- package/modules/api-svc/src/lib/cache.js +1 -1
- package/modules/api-svc/src/lib/logger.js +3 -1
- package/modules/api-svc/src/lib/metrics.js +2 -2
- package/modules/api-svc/src/lib/model/InboundTransfersModel.js +1 -1
- package/modules/api-svc/src/lib/model/OutboundTransfersModel.js +1 -1
- package/modules/api-svc/src/lib/model/lib/requests/backendRequests.js +1 -1
- package/modules/api-svc/test/integration/lib/cache.test.js +2 -2
- package/modules/api-svc/test/integration-pm4ml/mockServers/managementService/index.js +1 -8
- package/modules/api-svc/test/unit/BackendEventHandler.test.js +1 -3
- package/modules/api-svc/test/unit/ControlClient.test.js +2 -3
- package/modules/api-svc/test/unit/FSPIOPEventHandler.test.js +1 -3
- package/modules/api-svc/test/unit/InboundServer-iso20022.test.js +1 -3
- package/modules/api-svc/test/unit/InboundServer.test.js +1 -3
- package/modules/api-svc/test/unit/TestServer.test.js +2 -5
- package/modules/api-svc/test/unit/api/transfers/utils.js +1 -2
- package/modules/api-svc/test/unit/api/utils.js +1 -2
- package/modules/api-svc/test/unit/ilp.test.js +2 -2
- package/modules/api-svc/test/unit/inboundApi/handlers-iso20022.test.js +1 -3
- package/modules/api-svc/test/unit/inboundApi/handlers.test.js +1 -3
- package/modules/api-svc/test/unit/index.test.js +2 -3
- package/modules/api-svc/test/unit/lib/cache.test.js +1 -2
- package/modules/api-svc/test/unit/lib/model/AccountsModel.test.js +1 -6
- package/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js +1 -6
- package/modules/api-svc/test/unit/lib/model/OutboundBulkQuotesModel.test.js +1 -3
- package/modules/api-svc/test/unit/lib/model/OutboundBulkTransfersModel.test.js +1 -6
- package/modules/api-svc/test/unit/lib/model/OutboundRequestToPayModel.test.js +1 -3
- package/modules/api-svc/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +1 -3
- package/modules/api-svc/test/unit/lib/model/OutboundTransfersISO20022.test.js +1 -3
- package/modules/api-svc/test/unit/lib/model/OutboundTransfersModel.test.js +2 -4
- package/modules/api-svc/test/unit/lib/model/lib/requests/backendRequests.test.js +2 -2
- package/modules/api-svc/test/unit/mockLogger.js +2 -2
- package/modules/outbound-command-event-handler/package.json +1 -1
- package/modules/outbound-domain-event-handler/package.json +1 -1
- package/modules/private-shared-lib/package-lock.json +2 -2
- package/modules/private-shared-lib/package.json +1 -1
- package/package.json +1 -1
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.29",
|
|
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",
|
|
@@ -73,7 +73,7 @@
|
|
|
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.10.0-snapshot.
|
|
76
|
+
"@mojaloop/sdk-standard-components": "19.10.0-snapshot.2",
|
|
77
77
|
"ajv": "8.17.1",
|
|
78
78
|
"axios": "1.8.2",
|
|
79
79
|
"body-parser": "1.20.3",
|
|
@@ -50,7 +50,7 @@ class BackendEventHandler {
|
|
|
50
50
|
constructor({ config, logger }) {
|
|
51
51
|
this._conf = config;
|
|
52
52
|
|
|
53
|
-
this._logger = logger;
|
|
53
|
+
this._logger = logger.push({ component: this.constructor.name });
|
|
54
54
|
this._loggerFromLoggingBC = new DefaultLogger(BC_CONFIG.bcName, 'backend-event-handler', '0.0.1', config.logLevel);
|
|
55
55
|
|
|
56
56
|
this._backendRequests = new BackendRequests({
|
|
@@ -143,7 +143,7 @@ class Client extends ws {
|
|
|
143
143
|
*/
|
|
144
144
|
constructor({ address = 'localhost', port, logger, appConfig }) {
|
|
145
145
|
super(`ws://${address}:${port}`);
|
|
146
|
-
this._logger = logger;
|
|
146
|
+
this._logger = logger.push({ component: 'ControlClient' });
|
|
147
147
|
this._appConfig = appConfig;
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -62,7 +62,7 @@ class InboundApi extends EventEmitter {
|
|
|
62
62
|
}
|
|
63
63
|
this._api = InboundApi._SetupApi({
|
|
64
64
|
conf,
|
|
65
|
-
logger,
|
|
65
|
+
logger: logger.push({ component: this.constructor.name }),
|
|
66
66
|
validator,
|
|
67
67
|
cache,
|
|
68
68
|
jwsVerificationKeys: this._jwsVerificationKeys,
|
|
@@ -159,10 +159,10 @@ class InboundServer extends EventEmitter {
|
|
|
159
159
|
constructor(conf, logger, cache, wso2) {
|
|
160
160
|
super({ captureExceptions: true });
|
|
161
161
|
this._conf = conf;
|
|
162
|
-
this._logger = logger;
|
|
162
|
+
this._logger = logger.push({ app: this.constructor.name });
|
|
163
163
|
this._api = new InboundApi(
|
|
164
164
|
conf,
|
|
165
|
-
this._logger
|
|
165
|
+
this._logger,
|
|
166
166
|
cache,
|
|
167
167
|
_validator,
|
|
168
168
|
wso2,
|
|
@@ -47,7 +47,7 @@ class OAuthTestServer {
|
|
|
47
47
|
*/
|
|
48
48
|
constructor({ port, clientKey, clientSecret, logger }) {
|
|
49
49
|
this._port = port;
|
|
50
|
-
this._logger = logger;
|
|
50
|
+
this._logger = logger.push({ component: this.constructor.name });
|
|
51
51
|
this._clientKey = clientKey;
|
|
52
52
|
this._clientSecret = clientSecret;
|
|
53
53
|
}
|
|
@@ -53,7 +53,7 @@ let _initialize;
|
|
|
53
53
|
class OutboundApi extends EventEmitter {
|
|
54
54
|
constructor(conf, logger, cache, validator, metricsClient, wso2, eventProducer, eventLogger) {
|
|
55
55
|
super({ captureExceptions: true });
|
|
56
|
-
this._logger = logger;
|
|
56
|
+
this._logger = logger.push({ component: this.constructor.name });
|
|
57
57
|
this._api = new Koa();
|
|
58
58
|
this._conf = conf;
|
|
59
59
|
this._cache = cache;
|
|
@@ -109,7 +109,7 @@ class OutboundServer extends EventEmitter {
|
|
|
109
109
|
constructor(conf, logger, cache, metricsClient, wso2) {
|
|
110
110
|
super({ captureExceptions: true });
|
|
111
111
|
this._conf = conf;
|
|
112
|
-
this._logger = logger;
|
|
112
|
+
this._logger = logger.push({ app: this.constructor.name });
|
|
113
113
|
this._server = null;
|
|
114
114
|
if (conf.backendEventHandler.enabled) {
|
|
115
115
|
this._eventLogger = new DefaultLogger(BC_CONFIG.bcName, 'backend-api-handler', '0.0.1', conf.logLevel);
|
|
@@ -118,7 +118,7 @@ class OutboundServer extends EventEmitter {
|
|
|
118
118
|
}
|
|
119
119
|
this._api = new OutboundApi(
|
|
120
120
|
conf,
|
|
121
|
-
this._logger
|
|
121
|
+
this._logger,
|
|
122
122
|
cache,
|
|
123
123
|
_validator,
|
|
124
124
|
metricsClient,
|
|
@@ -194,12 +194,12 @@ class TestServer {
|
|
|
194
194
|
constructor({ port, logger, cache, config }) {
|
|
195
195
|
_initialize ||= _validator.initialise(yaml.load(require('fs').readFileSync(path.join(__dirname, 'api.yaml'))), config);
|
|
196
196
|
this._port = port;
|
|
197
|
-
this._logger = logger;
|
|
198
|
-
this._api = new TestApi(this._logger.push({ component: '
|
|
197
|
+
this._logger = logger.push({ app: this.constructor.name });
|
|
198
|
+
this._api = new TestApi(this._logger.push({ component: 'TestApi' }), _validator, cache, config);
|
|
199
199
|
this._server = http.createServer(this._api.callback());
|
|
200
200
|
// TODO: why does this appear to need to be called after creating this._server (try reorder
|
|
201
201
|
// it then run the tests)
|
|
202
|
-
this._wsapi = new WsServer(this._logger.push({ component: '
|
|
202
|
+
this._wsapi = new WsServer(this._logger.push({ component: 'WsServer' }), cache);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
async start() {
|
|
@@ -49,25 +49,13 @@ const Validate = require('./lib/validate');
|
|
|
49
49
|
const Cache = require('./lib/cache');
|
|
50
50
|
const { SDKStateEnum } = require('./lib/model/common');
|
|
51
51
|
const { createAuthClient } = require('./lib/utils');
|
|
52
|
-
const {
|
|
53
|
-
|
|
54
|
-
const LOG_ID = {
|
|
55
|
-
INBOUND: { app: 'mojaloop-connector-inbound-api' },
|
|
56
|
-
OUTBOUND: { app: 'mojaloop-connector-outbound-api' },
|
|
57
|
-
BACKEND_EVENT_HANDLER: { app: 'backend-event-handler' },
|
|
58
|
-
FSPIOP_EVENT_HANDLER: { app: 'fspiop-event-handler' },
|
|
59
|
-
TEST: { app: 'mojaloop-connector-test-api' },
|
|
60
|
-
OAUTHTEST: { app: 'mojaloop-connector-oauth-test-server' },
|
|
61
|
-
CONTROL: { app: 'mojaloop-connector-control-client' },
|
|
62
|
-
METRICS: { app: 'mojaloop-connector-metrics' },
|
|
63
|
-
CACHE: { component: 'cache' },
|
|
64
|
-
};
|
|
52
|
+
const { logger } = require('./lib/logger');
|
|
65
53
|
|
|
66
54
|
const PING_INTERVAL_MS = 30000;
|
|
67
55
|
|
|
68
|
-
const createCache = (config
|
|
56
|
+
const createCache = (config) => new Cache({
|
|
57
|
+
logger,
|
|
69
58
|
cacheUrl: config.cacheUrl,
|
|
70
|
-
logger: logger.push(LOG_ID.CACHE),
|
|
71
59
|
enableTestFeatures: config.enableTestFeatures,
|
|
72
60
|
subscribeTimeoutSeconds: config.requestProcessingTimeoutSeconds,
|
|
73
61
|
});
|
|
@@ -80,14 +68,14 @@ class Server extends EventEmitter {
|
|
|
80
68
|
super({ captureExceptions: true });
|
|
81
69
|
this.conf = conf;
|
|
82
70
|
this.logger = logger;
|
|
83
|
-
this.cache = createCache(conf
|
|
71
|
+
this.cache = createCache(conf);
|
|
84
72
|
this.pingTimeout;
|
|
85
73
|
|
|
86
74
|
this.metricsClient = new MetricsClient();
|
|
87
75
|
|
|
88
76
|
this.metricsServer = new MetricsServer({
|
|
89
77
|
port: this.conf.metrics.port,
|
|
90
|
-
logger: this.logger
|
|
78
|
+
logger: this.logger
|
|
91
79
|
});
|
|
92
80
|
|
|
93
81
|
this.wso2 = createAuthClient(conf, logger);
|
|
@@ -97,7 +85,7 @@ class Server extends EventEmitter {
|
|
|
97
85
|
|
|
98
86
|
this.inboundServer = new InboundServer(
|
|
99
87
|
this.conf,
|
|
100
|
-
this.logger
|
|
88
|
+
this.logger,
|
|
101
89
|
this.cache,
|
|
102
90
|
this.wso2,
|
|
103
91
|
);
|
|
@@ -108,7 +96,7 @@ class Server extends EventEmitter {
|
|
|
108
96
|
|
|
109
97
|
this.outboundServer = new OutboundServer(
|
|
110
98
|
this.conf,
|
|
111
|
-
this.logger
|
|
99
|
+
this.logger,
|
|
112
100
|
this.cache,
|
|
113
101
|
this.metricsClient,
|
|
114
102
|
this.wso2,
|
|
@@ -123,7 +111,7 @@ class Server extends EventEmitter {
|
|
|
123
111
|
clientKey: this.conf.oauthTestServer.clientKey,
|
|
124
112
|
clientSecret: this.conf.oauthTestServer.clientSecret,
|
|
125
113
|
port: this.conf.oauthTestServer.listenPort,
|
|
126
|
-
logger: this.logger
|
|
114
|
+
logger: this.logger,
|
|
127
115
|
});
|
|
128
116
|
}
|
|
129
117
|
|
|
@@ -131,7 +119,7 @@ class Server extends EventEmitter {
|
|
|
131
119
|
this.testServer = new TestServer({
|
|
132
120
|
config: this.conf,
|
|
133
121
|
port: this.conf.test.port,
|
|
134
|
-
logger: this.logger
|
|
122
|
+
logger: this.logger,
|
|
135
123
|
cache: this.cache,
|
|
136
124
|
});
|
|
137
125
|
}
|
|
@@ -139,14 +127,14 @@ class Server extends EventEmitter {
|
|
|
139
127
|
if (this.conf.backendEventHandler.enabled) {
|
|
140
128
|
this.backendEventHandler = new BackendEventHandler({
|
|
141
129
|
config: this.conf,
|
|
142
|
-
logger: this.logger
|
|
130
|
+
logger: this.logger,
|
|
143
131
|
});
|
|
144
132
|
}
|
|
145
133
|
|
|
146
134
|
if (this.conf.fspiopEventHandler.enabled) {
|
|
147
135
|
this.fspiopEventHandler = new FSPIOPEventHandler({
|
|
148
136
|
config: this.conf,
|
|
149
|
-
logger: this.logger
|
|
137
|
+
logger: this.logger,
|
|
150
138
|
cache: this.cache,
|
|
151
139
|
wso2: this.wso2,
|
|
152
140
|
});
|
|
@@ -166,7 +154,7 @@ class Server extends EventEmitter {
|
|
|
166
154
|
this.controlClient = await ControlAgent.Client.Create({
|
|
167
155
|
address: this.conf.control.mgmtAPIWsUrl,
|
|
168
156
|
port: this.conf.control.mgmtAPIWsPort,
|
|
169
|
-
logger: this.logger
|
|
157
|
+
logger: this.logger,
|
|
170
158
|
appConfig: this.conf,
|
|
171
159
|
});
|
|
172
160
|
this.controlClient.on(ControlAgent.EVENT.RECONFIGURE, this.restart.bind(this));
|
|
@@ -212,13 +200,7 @@ class Server extends EventEmitter {
|
|
|
212
200
|
|
|
213
201
|
async restart(newConf) {
|
|
214
202
|
const restartActionsTaken = {};
|
|
215
|
-
|
|
216
203
|
this.logger.isDebugEnabled && this.logger.debug('Server is restarting...');
|
|
217
|
-
const updateLogger = !_.isEqual(newConf.isJsonOutput, this.conf.isJsonOutput);
|
|
218
|
-
if (updateLogger) {
|
|
219
|
-
this.logger = createLogger(newConf);
|
|
220
|
-
restartActionsTaken.updateLogger = true;
|
|
221
|
-
}
|
|
222
204
|
|
|
223
205
|
let oldCache;
|
|
224
206
|
const updateCache = !_.isEqual(this.conf.cacheUrl, newConf.cacheUrl)
|
|
@@ -226,7 +208,7 @@ class Server extends EventEmitter {
|
|
|
226
208
|
if (updateCache) {
|
|
227
209
|
oldCache = this.cache;
|
|
228
210
|
await this.cache.disconnect();
|
|
229
|
-
this.cache = createCache(newConf
|
|
211
|
+
this.cache = createCache(newConf);
|
|
230
212
|
await this.cache.connect();
|
|
231
213
|
restartActionsTaken.updateCache = true;
|
|
232
214
|
}
|
|
@@ -250,7 +232,7 @@ class Server extends EventEmitter {
|
|
|
250
232
|
await this.inboundServer.stop();
|
|
251
233
|
this.inboundServer = new InboundServer(
|
|
252
234
|
newConf,
|
|
253
|
-
this.logger
|
|
235
|
+
this.logger,
|
|
254
236
|
this.cache,
|
|
255
237
|
this.wso2,
|
|
256
238
|
);
|
|
@@ -269,7 +251,7 @@ class Server extends EventEmitter {
|
|
|
269
251
|
await this.outboundServer.stop();
|
|
270
252
|
this.outboundServer = new OutboundServer(
|
|
271
253
|
newConf,
|
|
272
|
-
this.logger
|
|
254
|
+
this.logger,
|
|
273
255
|
this.cache,
|
|
274
256
|
this.metricsClient,
|
|
275
257
|
this.wso2,
|
|
@@ -289,7 +271,7 @@ class Server extends EventEmitter {
|
|
|
289
271
|
await this.fspiopEventHandler.stop();
|
|
290
272
|
this.fspiopEventHandler = new FSPIOPEventHandler({
|
|
291
273
|
config: newConf,
|
|
292
|
-
logger: this.logger
|
|
274
|
+
logger: this.logger,
|
|
293
275
|
cache: this.cache,
|
|
294
276
|
wso2: this.wso2,
|
|
295
277
|
});
|
|
@@ -305,7 +287,7 @@ class Server extends EventEmitter {
|
|
|
305
287
|
this.controlClient = await ControlAgent.Client.Create({
|
|
306
288
|
address: newConf.control.mgmtAPIWsUrl,
|
|
307
289
|
port: newConf.control.mgmtAPIWsPort,
|
|
308
|
-
logger: this.logger
|
|
290
|
+
logger: this.logger,
|
|
309
291
|
appConfig: newConf,
|
|
310
292
|
});
|
|
311
293
|
this.controlClient.on(ControlAgent.EVENT.RECONFIGURE, this.restart.bind(this));
|
|
@@ -348,7 +330,7 @@ class Server extends EventEmitter {
|
|
|
348
330
|
clientKey: newConf.oauthTestServer.clientKey,
|
|
349
331
|
clientSecret: newConf.oauthTestServer.clientSecret,
|
|
350
332
|
port: newConf.oauthTestServer.listenPort,
|
|
351
|
-
logger: this.logger
|
|
333
|
+
logger: this.logger,
|
|
352
334
|
});
|
|
353
335
|
await this.oauthTestServer.start();
|
|
354
336
|
restartActionsTaken.updateOAuthTestServer = true;
|
|
@@ -361,7 +343,7 @@ class Server extends EventEmitter {
|
|
|
361
343
|
if (this.conf.enableTestFeatures) {
|
|
362
344
|
this.testServer = new TestServer({
|
|
363
345
|
port: newConf.test.port,
|
|
364
|
-
logger: this.logger
|
|
346
|
+
logger: this.logger,
|
|
365
347
|
cache: this.cache,
|
|
366
348
|
});
|
|
367
349
|
await this.testServer.start();
|
|
@@ -371,14 +353,12 @@ class Server extends EventEmitter {
|
|
|
371
353
|
|
|
372
354
|
this.conf = newConf;
|
|
373
355
|
|
|
374
|
-
await
|
|
375
|
-
oldCache?.disconnect(),
|
|
376
|
-
]);
|
|
356
|
+
await oldCache?.disconnect();
|
|
377
357
|
|
|
378
358
|
if (Object.keys(restartActionsTaken).length > 0) {
|
|
379
|
-
this.logger.
|
|
359
|
+
this.logger.info('Server is restarted', { restartActionsTaken });
|
|
380
360
|
} else {
|
|
381
|
-
this.logger.
|
|
361
|
+
this.logger.verbose('Server not restarted, no config changes detected');
|
|
382
362
|
}
|
|
383
363
|
}
|
|
384
364
|
|
|
@@ -414,8 +394,6 @@ async function _GetUpdatedConfigFromMgmtAPI(conf, logger, client) {
|
|
|
414
394
|
}
|
|
415
395
|
|
|
416
396
|
async function start(config) {
|
|
417
|
-
const logger = createLogger(config);
|
|
418
|
-
|
|
419
397
|
if (config.pm4mlEnabled) {
|
|
420
398
|
const controlClient = await ControlAgent.Client.Create({
|
|
421
399
|
appConfig: config,
|
|
@@ -447,7 +425,7 @@ async function start(config) {
|
|
|
447
425
|
process.exit(1);
|
|
448
426
|
});
|
|
449
427
|
|
|
450
|
-
logger.
|
|
428
|
+
logger.info('SDK server is started!', { name, version });
|
|
451
429
|
}
|
|
452
430
|
|
|
453
431
|
if (require.main === module) {
|
|
@@ -46,7 +46,7 @@ class Cache {
|
|
|
46
46
|
throw new Error('Cache config requires cacheUrl and logger properties');
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
this._logger = config.logger;
|
|
49
|
+
this._logger = config.logger.push({ component: this.constructor.name });
|
|
50
50
|
this._url = config.cacheUrl;
|
|
51
51
|
|
|
52
52
|
// a redis connection to handle get, set and publish operations
|
|
@@ -113,12 +113,12 @@ class MetricsClient {
|
|
|
113
113
|
class MetricsServer {
|
|
114
114
|
/**
|
|
115
115
|
* @param {number} port metrics server listen port
|
|
116
|
-
* @param {Logger} logger
|
|
116
|
+
* @param {Logger} logger SdkLogger
|
|
117
117
|
* @param {Object} prometheusClient Prometheus client instance
|
|
118
118
|
*/
|
|
119
119
|
constructor({ port, logger }) {
|
|
120
120
|
this._port = port;
|
|
121
|
-
this._logger = logger;
|
|
121
|
+
this._logger = logger.push({ component: this.constructor.name });
|
|
122
122
|
this._prometheusClient = PrometheusClient;
|
|
123
123
|
this._prometheusRegister = PrometheusClient.register;
|
|
124
124
|
this._api = this.setupApi();
|
|
@@ -44,7 +44,7 @@ const TRACESTATE_KEY_CALLBACK_START_TS = 'tx_callback_start_ts';
|
|
|
44
44
|
class InboundTransfersModel {
|
|
45
45
|
constructor(config) {
|
|
46
46
|
this._cache = config.cache;
|
|
47
|
-
this._logger = config.logger;
|
|
47
|
+
this._logger = config.logger.push({ component: this.constructor.name });
|
|
48
48
|
this._dfspId = config.dfspId;
|
|
49
49
|
this._expirySeconds = config.expirySeconds;
|
|
50
50
|
this._rejectTransfersOnExpiredQuotes = config.rejectTransfersOnExpiredQuotes;
|
|
@@ -59,7 +59,7 @@ class OutboundTransfersModel {
|
|
|
59
59
|
constructor(config) {
|
|
60
60
|
this._idGenerator = idGenerator(config.idGenerator);
|
|
61
61
|
this._cache = config.cache;
|
|
62
|
-
this._logger = config.logger.push({ component:
|
|
62
|
+
this._logger = config.logger.push({ component: this.constructor.name });
|
|
63
63
|
this._requestProcessingTimeoutSeconds = config.requestProcessingTimeoutSeconds;
|
|
64
64
|
this._dfspId = config.dfspId;
|
|
65
65
|
this._expirySeconds = config.expirySeconds;
|
|
@@ -37,7 +37,7 @@ const { buildUrl, HTTPResponseError } = require('./common');
|
|
|
37
37
|
class BackendRequests {
|
|
38
38
|
constructor(config) {
|
|
39
39
|
this.config = config;
|
|
40
|
-
this.logger = config.logger.push({ component:
|
|
40
|
+
this.logger = config.logger.push({ component: this.constructor.name });
|
|
41
41
|
this.requester = createHttpRequester({ logger: this.logger });
|
|
42
42
|
|
|
43
43
|
// FSPID of THIS DFSP
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
jest.dontMock('redis');
|
|
32
32
|
|
|
33
33
|
const Cache = require('~/lib/cache');
|
|
34
|
-
const {
|
|
34
|
+
const { logger } = require('~/lib/logger');
|
|
35
35
|
const env = require('../testEnv');
|
|
36
36
|
|
|
37
37
|
const defaultCacheConfig = {
|
|
@@ -40,7 +40,7 @@ const defaultCacheConfig = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const createCache = async (config) => {
|
|
43
|
-
config.logger =
|
|
43
|
+
config.logger = logger.push({ context: { app: 'mojaloop-sdk-inboundCache' } });
|
|
44
44
|
const cache = new Cache(config);
|
|
45
45
|
await cache.connect();
|
|
46
46
|
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
const express = require('express');
|
|
2
|
-
const {
|
|
2
|
+
const { logger } = require('../../../../src/lib/logger');
|
|
3
3
|
const Config = require('./config');
|
|
4
4
|
const ManagementService = require('./server');
|
|
5
5
|
|
|
6
6
|
const app = express();
|
|
7
7
|
|
|
8
|
-
const logger = createLogger({
|
|
9
|
-
context: {
|
|
10
|
-
simulator: 'test',
|
|
11
|
-
hostname: 'test',
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
|
|
15
8
|
const managementServer = new ManagementService.Server({
|
|
16
9
|
port: Config.server.port,
|
|
17
10
|
logger,
|
|
@@ -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 { logger } = 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,8 +42,6 @@ const {
|
|
|
42
42
|
KafkaDomainEventProducer,
|
|
43
43
|
} = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
|
|
44
44
|
|
|
45
|
-
const logger = createLogger({ context: { app: 'BackendEventHandler' }, stringify: () => '' });
|
|
46
|
-
|
|
47
45
|
describe('BackendEventHandler', () => {
|
|
48
46
|
const putBulkTransactions = jest.spyOn(BackendRequests.prototype, 'putBulkTransactions').mockImplementation(async () => ({}));
|
|
49
47
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
jest.mock('~/lib/cache');
|
|
29
29
|
|
|
30
30
|
const ControlAgent = require('~/ControlAgent');
|
|
31
|
-
const {
|
|
31
|
+
const { logger } = require('~/lib/logger');
|
|
32
32
|
const TestControlServer = require('./ControlServer');
|
|
33
33
|
|
|
34
34
|
// TODO:
|
|
@@ -55,12 +55,11 @@ describe('ControlAgent', () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
describe('API', () => {
|
|
58
|
-
let server,
|
|
58
|
+
let server, client;
|
|
59
59
|
const appConfig = { control: { port: 4005 }, what: 'ever' };
|
|
60
60
|
const changedConfig = { ...appConfig, some: 'thing' };
|
|
61
61
|
|
|
62
62
|
beforeAll(async () => {
|
|
63
|
-
logger = createLogger({ stringify: () => '' });
|
|
64
63
|
server = new TestControlServer.Server({ logger, appConfig });
|
|
65
64
|
client = await ControlAgent.Client.Create({
|
|
66
65
|
address: 'localhost',
|
|
@@ -42,7 +42,7 @@ const {
|
|
|
42
42
|
} = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
|
|
43
43
|
|
|
44
44
|
const { FSPIOPEventHandler } = require('../../src/FSPIOPEventHandler');
|
|
45
|
-
const {
|
|
45
|
+
const { logger } = require('../../src/lib/logger');
|
|
46
46
|
const {
|
|
47
47
|
OutboundBulkQuotesModel,
|
|
48
48
|
PartiesModel,
|
|
@@ -53,8 +53,6 @@ const {
|
|
|
53
53
|
const bulkQuoteRequest = require('../unit/lib/model/data/bulkQuoteRequest.json');
|
|
54
54
|
const config = require('./data/defaultConfig.json');
|
|
55
55
|
|
|
56
|
-
const logger = createLogger({ context: { app: 'FSPIOPEventHandler' }, stringify: () => '' });
|
|
57
|
-
|
|
58
56
|
describe('FSPIOPEventHandler', () => {
|
|
59
57
|
let fspiopEventHandler;
|
|
60
58
|
|
|
@@ -41,14 +41,12 @@ const InboundServer = require('../../src/InboundServer');
|
|
|
41
41
|
const Cache = require('../../src/lib/cache');
|
|
42
42
|
const config = require('../../src/config');
|
|
43
43
|
const helpers = require('../helpers');
|
|
44
|
-
const {
|
|
44
|
+
const { logger } = require('../../src/lib/logger');
|
|
45
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 = createLogger();
|
|
51
|
-
|
|
52
50
|
const createIsoHeaders = resource => ({
|
|
53
51
|
...commonHttpHeaders,
|
|
54
52
|
'content-type': helpers.createIsoHeader(resource)
|
|
@@ -48,7 +48,7 @@ jest.mock('~/lib/cache');
|
|
|
48
48
|
jest.mock('~/lib/model/lib/requests', () => require('./lib/model/mockedLibRequests'));
|
|
49
49
|
|
|
50
50
|
const { Jws } = require('@mojaloop/sdk-standard-components');
|
|
51
|
-
const {
|
|
51
|
+
const { logger } = require('~/lib/logger');
|
|
52
52
|
const InboundServer = require('~/InboundServer');
|
|
53
53
|
const Cache = require('~/lib/cache');
|
|
54
54
|
const path = require('path');
|
|
@@ -57,8 +57,6 @@ const os = require('os');
|
|
|
57
57
|
const http = require('http');
|
|
58
58
|
const https = require('https');
|
|
59
59
|
|
|
60
|
-
const logger = createLogger();
|
|
61
|
-
|
|
62
60
|
describe('Inbound Server', () => {
|
|
63
61
|
describe('PUT /parties', () => {
|
|
64
62
|
let serverConfig;
|
|
@@ -42,7 +42,7 @@ const WebSocket = require('ws');
|
|
|
42
42
|
const TestServer = require('~/TestServer');
|
|
43
43
|
const Cache = require('~/lib/cache');
|
|
44
44
|
const InboundServer = require('~/InboundServer');
|
|
45
|
-
const {
|
|
45
|
+
const { logger } = require('~/lib/logger');
|
|
46
46
|
|
|
47
47
|
const defaultConfig = require('./data/defaultConfig');
|
|
48
48
|
const putPartiesBody = require('./data/putPartiesBody');
|
|
@@ -60,14 +60,11 @@ const createWsClient = async (port, path) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
describe('Test Server', () => {
|
|
63
|
-
let testServer, inboundServer, inboundReq, testReq, serverConfig, wsClients, testServerPort,
|
|
64
|
-
logger, cache;
|
|
63
|
+
let testServer, inboundServer, inboundReq, testReq, serverConfig, wsClients, testServerPort, cache;
|
|
65
64
|
|
|
66
65
|
beforeEach(async () => {
|
|
67
66
|
Cache.mockClear();
|
|
68
67
|
|
|
69
|
-
logger = createLogger({ stringify: () => '' });
|
|
70
|
-
|
|
71
68
|
serverConfig = {
|
|
72
69
|
...JSON.parse(JSON.stringify(defaultConfig)),
|
|
73
70
|
enableTestFeatures: true,
|
|
@@ -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 { logger } = require('../../../../src/lib/logger');
|
|
6
6
|
const postTransfersSimpleBody = require('./data/postTransfersSimpleBody');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -112,7 +112,6 @@ function createGetTransfersTester({ reqInbound, reqOutbound, apiSpecsOutbound })
|
|
|
112
112
|
function createPostTransfersTester({
|
|
113
113
|
requestValidatorInbound, reqInbound, reqOutbound, apiSpecsOutbound
|
|
114
114
|
}) {
|
|
115
|
-
const logger =createLogger({ context: { app: 'outbound-model-unit-tests' } });
|
|
116
115
|
|
|
117
116
|
/**
|
|
118
117
|
*
|
|
@@ -4,7 +4,7 @@ const yaml = require('js-yaml');
|
|
|
4
4
|
const supertest = require('supertest');
|
|
5
5
|
const { WSO2Auth } = require('@mojaloop/sdk-standard-components');
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { logger } = require('~/lib/logger');
|
|
8
8
|
const { MetricsClient } = require('~/lib/metrics');
|
|
9
9
|
const Validate = require('~/lib/validate');
|
|
10
10
|
const InboundServer = require('~/InboundServer');
|
|
@@ -51,7 +51,6 @@ const createValidators = async () => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const createTestServers = async (config) => {
|
|
54
|
-
const logger = createLogger({ stringify: () => '' });
|
|
55
54
|
const defConfig = structuredClone(config);
|
|
56
55
|
const cache = new Cache({
|
|
57
56
|
cacheUrl: defConfig.cacheUrl,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
******/
|
|
27
27
|
|
|
28
28
|
const { Ilp } = jest.requireActual('@mojaloop/sdk-standard-components');
|
|
29
|
-
const {
|
|
29
|
+
const { logger } = require('../../src/lib/logger');
|
|
30
30
|
const mocks = require('./lib/model/data/mocks');
|
|
31
31
|
|
|
32
32
|
describe('ILP Tests -->', () => {
|
|
@@ -37,7 +37,7 @@ describe('ILP Tests -->', () => {
|
|
|
37
37
|
beforeEach(() => {
|
|
38
38
|
ilp = Ilp.ilpFactory(Ilp.ILP_VERSIONS.v4, {
|
|
39
39
|
secret: 'test',
|
|
40
|
-
logger
|
|
40
|
+
logger,
|
|
41
41
|
});
|
|
42
42
|
fxQuotesPayload = mocks.mockFxQuotesPayload();
|
|
43
43
|
fxpBeResponse = mocks.mockFxQuotesInternalResponse();
|
|
@@ -26,13 +26,11 @@ const Model = require('../../../src/lib/model').InboundTransfersModel;
|
|
|
26
26
|
const QuotesModel = require('../../../src/lib/model').QuotesModel;
|
|
27
27
|
const PartiesModel = require('../../../src/lib/model').PartiesModel;
|
|
28
28
|
const TransfersModel = require('../../../src/lib/model').TransfersModel;
|
|
29
|
-
const {
|
|
29
|
+
const { logger } = 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 = createLogger({ context: { app: 'inbound-handlers-unit-test' } });
|
|
35
|
-
|
|
36
34
|
describe('Inbound API handlers transforming incoming ISO20022 message bodies', () => {
|
|
37
35
|
describe('POST /quotes', () => {
|
|
38
36
|
let mockContext;
|
|
@@ -24,13 +24,11 @@ const Model = require('~/lib/model').InboundTransfersModel;
|
|
|
24
24
|
const QuotesModel = require('~/lib/model').QuotesModel;
|
|
25
25
|
const PartiesModel = require('~/lib/model').PartiesModel;
|
|
26
26
|
const TransfersModel = require('~/lib/model').TransfersModel;
|
|
27
|
-
const {
|
|
27
|
+
const { logger } = require('~/lib/logger');
|
|
28
28
|
|
|
29
29
|
const mockArguments = require('./data/mockArguments');
|
|
30
30
|
const mockTransactionRequestData = require('./data/mockTransactionRequest');
|
|
31
31
|
|
|
32
|
-
const logger = createLogger({ context: { app: 'inbound-handlers-unit-test' }, stringify: () => '' });
|
|
33
|
-
|
|
34
32
|
describe('Inbound API handlers:', () => {
|
|
35
33
|
let mockArgs;
|
|
36
34
|
let mockTransactionRequest;
|
|
@@ -37,7 +37,7 @@ jest.mock('dotenv', () => ({
|
|
|
37
37
|
|
|
38
38
|
const promClient = require('prom-client');
|
|
39
39
|
const index = require('~/index');
|
|
40
|
-
const {
|
|
40
|
+
const { logger } = require('~/lib/logger');
|
|
41
41
|
|
|
42
42
|
const defaultConfig = require('./data/defaultConfig.json');
|
|
43
43
|
const TestControlServer = require('./ControlServer');
|
|
@@ -58,11 +58,10 @@ describe('index.js', () => {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
describe('Server', () => {
|
|
61
|
-
let server, controlServer, conf
|
|
61
|
+
let server, controlServer, conf;
|
|
62
62
|
|
|
63
63
|
beforeEach(async () => {
|
|
64
64
|
promClient.register.clear();
|
|
65
|
-
logger = createLogger({ stringify: () => '' });
|
|
66
65
|
conf = JSON.parse(JSON.stringify(defaultConfig));
|
|
67
66
|
conf.enableTestFeatures = true;
|
|
68
67
|
conf.pm4mlEnabled = true;
|
|
@@ -31,10 +31,9 @@ jest.mock('redis');
|
|
|
31
31
|
|
|
32
32
|
const randomUUID = require('@mojaloop/central-services-shared').Util.id({ type: 'ulid' });
|
|
33
33
|
const Cache = require('~/lib/cache');
|
|
34
|
-
const {
|
|
34
|
+
const { logger } = require('~/lib/logger');
|
|
35
35
|
|
|
36
36
|
const createCache = async () => {
|
|
37
|
-
const logger = createLogger({ context: { app: 'model-unit-tests-cache' } });
|
|
38
37
|
const cache = new Cache({
|
|
39
38
|
cacheUrl: 'redis://dummy:1234',
|
|
40
39
|
logger,
|
|
@@ -44,7 +44,7 @@ const { AccountsModel } = require('~/lib/model');
|
|
|
44
44
|
|
|
45
45
|
const StateMachine = require('javascript-state-machine');
|
|
46
46
|
const { MojaloopRequests } = require('@mojaloop/sdk-standard-components');
|
|
47
|
-
const {
|
|
47
|
+
const { logger } = require('~/lib/logger');
|
|
48
48
|
const { SDKStateEnum } = require('../../../../src/lib/model/common');
|
|
49
49
|
|
|
50
50
|
const defaultConfig = require('./data/defaultConfig');
|
|
@@ -67,7 +67,6 @@ function generateAccounts(count, currencies) {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
describe('AccountsModel', () => {
|
|
70
|
-
let logger;
|
|
71
70
|
let cache;
|
|
72
71
|
|
|
73
72
|
async function testCreateAccount(count, currencies) {
|
|
@@ -114,10 +113,6 @@ describe('AccountsModel', () => {
|
|
|
114
113
|
expect(StateMachine.__instance.state).toBe('succeeded');
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
beforeAll(() => {
|
|
118
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
119
|
-
});
|
|
120
|
-
|
|
121
116
|
beforeEach(async () => {
|
|
122
117
|
cache = new Cache({
|
|
123
118
|
cacheUrl: 'redis://dummy:1234',
|
|
@@ -41,7 +41,7 @@ jest.mock('~/lib/model/lib/requests',() => require('./mockedLibRequests'));
|
|
|
41
41
|
|
|
42
42
|
const randomUUID = require('@mojaloop/central-services-shared').Util.id({type: 'ulid'});
|
|
43
43
|
const { MojaloopRequests, Ilp } = require('@mojaloop/sdk-standard-components');
|
|
44
|
-
const {
|
|
44
|
+
const { logger } = require('~/lib/logger');
|
|
45
45
|
const { BackendRequests, HTTPResponseError } = require('~/lib/model/lib/requests');
|
|
46
46
|
const Cache = require('~/lib/cache');
|
|
47
47
|
const shared = require('~/lib/model/lib/shared');
|
|
@@ -72,11 +72,6 @@ describe('inboundModel', () => {
|
|
|
72
72
|
let config;
|
|
73
73
|
let mockArgs;
|
|
74
74
|
let mockTxnReqArgs;
|
|
75
|
-
let logger;
|
|
76
|
-
|
|
77
|
-
beforeAll(async () => {
|
|
78
|
-
logger = createLogger({ context: { app: 'inbound-model-unit-tests' }, stringify: () => '' });
|
|
79
|
-
});
|
|
80
75
|
|
|
81
76
|
beforeEach(async () => {
|
|
82
77
|
config = JSON.parse(JSON.stringify(defaultConfig));
|
|
@@ -42,7 +42,7 @@ jest.mock('redis');
|
|
|
42
42
|
|
|
43
43
|
const StateMachine = require('javascript-state-machine');
|
|
44
44
|
const { MojaloopRequests } = require('@mojaloop/sdk-standard-components');
|
|
45
|
-
const {
|
|
45
|
+
const { logger } = require('~/lib/logger');
|
|
46
46
|
const Cache = require('~/lib/cache');
|
|
47
47
|
const Model = require('~/lib/model').OutboundBulkQuotesModel;
|
|
48
48
|
|
|
@@ -60,7 +60,6 @@ const emitBulkQuoteResponseCacheMessage = (cache, bulkQuoteId, bulkQuoteResponse
|
|
|
60
60
|
describe('OutboundBulkQuotesModel', () => {
|
|
61
61
|
let bulkQuoteResponse;
|
|
62
62
|
let config;
|
|
63
|
-
let logger;
|
|
64
63
|
let cache;
|
|
65
64
|
|
|
66
65
|
/**
|
|
@@ -107,7 +106,6 @@ describe('OutboundBulkQuotesModel', () => {
|
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
beforeAll(async () => {
|
|
110
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
111
109
|
bulkQuoteResponse = JSON.parse(JSON.stringify(bulkQuoteResponseTemplate));
|
|
112
110
|
});
|
|
113
111
|
|
|
@@ -45,7 +45,7 @@ const Model = require('~/lib/model').OutboundBulkTransfersModel;
|
|
|
45
45
|
|
|
46
46
|
const StateMachine = require('javascript-state-machine');
|
|
47
47
|
const { MojaloopRequests } = require('@mojaloop/sdk-standard-components');
|
|
48
|
-
const {
|
|
48
|
+
const { logger } = require('~/lib/logger');
|
|
49
49
|
const { SDKStateEnum } = require('../../../../src/lib/model/common');
|
|
50
50
|
|
|
51
51
|
const defaultConfig = require('./data/defaultConfig');
|
|
@@ -57,7 +57,6 @@ const emitBulkTransferFulfilCacheMessage = (cache, bulkTransferId, fulfils) => c
|
|
|
57
57
|
|
|
58
58
|
describe('outboundBulkTransferModel', () => {
|
|
59
59
|
let config;
|
|
60
|
-
let logger;
|
|
61
60
|
let cache;
|
|
62
61
|
|
|
63
62
|
/**
|
|
@@ -102,10 +101,6 @@ describe('outboundBulkTransferModel', () => {
|
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
beforeAll(async () => {
|
|
106
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
107
|
-
});
|
|
108
|
-
|
|
109
104
|
beforeEach(async () => {
|
|
110
105
|
config = JSON.parse(JSON.stringify(defaultConfig));
|
|
111
106
|
MojaloopRequests.__postBulkTransfers = jest.fn(() => Promise.resolve());
|
|
@@ -40,7 +40,7 @@ jest.mock('redis');
|
|
|
40
40
|
|
|
41
41
|
const StateMachine = require('javascript-state-machine');
|
|
42
42
|
const { MojaloopRequests } = require('@mojaloop/sdk-standard-components');
|
|
43
|
-
const {
|
|
43
|
+
const { logger } = require('~/lib/logger');
|
|
44
44
|
const Cache = require('~/lib/cache');
|
|
45
45
|
const Model = require('~/lib/model').OutboundRequestToPayModel;
|
|
46
46
|
const PartiesModel = require('~/lib/model').PartiesModel;
|
|
@@ -70,7 +70,6 @@ const emitTransactionRequestResponseCacheMessage = (cache, transactionRequestId,
|
|
|
70
70
|
describe('outboundModel', () => {
|
|
71
71
|
let transactionRequestResponse;
|
|
72
72
|
let config;
|
|
73
|
-
let logger;
|
|
74
73
|
let cache;
|
|
75
74
|
|
|
76
75
|
/**
|
|
@@ -86,7 +85,6 @@ describe('outboundModel', () => {
|
|
|
86
85
|
*/
|
|
87
86
|
|
|
88
87
|
beforeAll(async () => {
|
|
89
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
90
88
|
transactionRequestResponse = JSON.parse(JSON.stringify(transactionRequestResponseTemplate));
|
|
91
89
|
});
|
|
92
90
|
|
|
@@ -40,7 +40,7 @@ jest.mock('redis');
|
|
|
40
40
|
|
|
41
41
|
const StateMachine = require('javascript-state-machine');
|
|
42
42
|
const { MojaloopRequests } = require('@mojaloop/sdk-standard-components');
|
|
43
|
-
const {
|
|
43
|
+
const { logger } = require('~/lib/logger');
|
|
44
44
|
const Cache = require('~/lib/cache');
|
|
45
45
|
const Model = require('~/lib/model').OutboundRequestToPayTransferModel;
|
|
46
46
|
|
|
@@ -64,7 +64,6 @@ const emitTransferFulfilCacheMessage = (cache, transferId, fulfil) => cache.publ
|
|
|
64
64
|
describe('outboundRequestToPayTransferModel', () => {
|
|
65
65
|
let quoteResponse;
|
|
66
66
|
let config;
|
|
67
|
-
let logger;
|
|
68
67
|
let cache;
|
|
69
68
|
|
|
70
69
|
/**
|
|
@@ -81,7 +80,6 @@ describe('outboundRequestToPayTransferModel', () => {
|
|
|
81
80
|
|
|
82
81
|
|
|
83
82
|
beforeAll(async () => {
|
|
84
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
85
83
|
quoteResponse = JSON.parse(JSON.stringify(quoteResponseTemplate));
|
|
86
84
|
});
|
|
87
85
|
|
|
@@ -41,7 +41,7 @@ const { MojaloopRequests } = jest.requireActual('@mojaloop/sdk-standard-componen
|
|
|
41
41
|
const Cache = require('~/lib/cache');
|
|
42
42
|
const Model = require('~/lib/model').OutboundTransfersModel;
|
|
43
43
|
const PartiesModel = require('~/lib/model').PartiesModel;
|
|
44
|
-
const {
|
|
44
|
+
const { logger } = require('~/lib/logger');
|
|
45
45
|
const { MetricsClient } = require('~/lib/metrics');
|
|
46
46
|
|
|
47
47
|
const defaultConfig = require('./data/defaultConfig');
|
|
@@ -154,12 +154,10 @@ const emitTransferFulfilCacheMessage = (cache, transferId, fulfil) => cache.publ
|
|
|
154
154
|
describe('API_TYPE="iso20022"', () => {
|
|
155
155
|
let config;
|
|
156
156
|
let cache;
|
|
157
|
-
let logger;
|
|
158
157
|
let metricsClient;
|
|
159
158
|
|
|
160
159
|
beforeEach(async () => {
|
|
161
160
|
config = JSON.parse(JSON.stringify(defaultConfig));
|
|
162
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
163
161
|
cache = new Cache({
|
|
164
162
|
cacheUrl: 'redis://dummy:1234',
|
|
165
163
|
logger,
|
|
@@ -45,7 +45,7 @@ const Model = require('~/lib/model').OutboundTransfersModel;
|
|
|
45
45
|
const PartiesModel = require('~/lib/model').PartiesModel;
|
|
46
46
|
const Cache = require('~/lib/cache');
|
|
47
47
|
const { MetricsClient } = require('~/lib/metrics');
|
|
48
|
-
const {
|
|
48
|
+
const { logger } = require('~/lib/logger');
|
|
49
49
|
|
|
50
50
|
const mocks = require('./data/mocks');
|
|
51
51
|
const defaultConfig = require('./data/defaultConfig');
|
|
@@ -82,7 +82,6 @@ const dummyRequestsModuleResponse = {
|
|
|
82
82
|
describe('OutboundTransfersModel Tests', () => {
|
|
83
83
|
let quoteResponse;
|
|
84
84
|
let config;
|
|
85
|
-
let logger;
|
|
86
85
|
let cache;
|
|
87
86
|
let metricsClient;
|
|
88
87
|
|
|
@@ -179,7 +178,6 @@ describe('OutboundTransfersModel Tests', () => {
|
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
beforeAll(async () => {
|
|
182
|
-
logger = createLogger({ context: { app: 'outbound-model-unit-tests-cache' }, stringify: () => '' });
|
|
183
181
|
quoteResponse = JSON.parse(JSON.stringify(quoteResponseTemplate));
|
|
184
182
|
metricsClient = new MetricsClient();
|
|
185
183
|
});
|
|
@@ -1660,7 +1658,7 @@ describe('OutboundTransfersModel Tests', () => {
|
|
|
1660
1658
|
beforeEach(() => {
|
|
1661
1659
|
model = new Model({
|
|
1662
1660
|
cache,
|
|
1663
|
-
logger
|
|
1661
|
+
logger,
|
|
1664
1662
|
metricsClient,
|
|
1665
1663
|
...config,
|
|
1666
1664
|
});
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
jest.unmock('@mojaloop/sdk-standard-components');
|
|
30
30
|
|
|
31
31
|
const { mockAxios } = require('../../../../../helpers');
|
|
32
|
-
const {
|
|
32
|
+
const { logger } = require('~/lib/logger');
|
|
33
33
|
|
|
34
34
|
const { BackendRequests, HTTPResponseError } = require('../../../../../../src/lib/model/lib/requests');
|
|
35
35
|
const defaultConfig = require('../../data/defaultConfig');
|
|
36
36
|
|
|
37
37
|
const config = {
|
|
38
38
|
...defaultConfig,
|
|
39
|
-
logger
|
|
39
|
+
logger,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
describe('backendRequests Tests -->', () => {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--------------
|
|
28
28
|
******/
|
|
29
29
|
|
|
30
|
-
const {
|
|
30
|
+
const { logger } = require('../../src/lib/logger');
|
|
31
31
|
|
|
32
32
|
function mockLogger(context, keepQuiet) {
|
|
33
33
|
// if keepQuite is undefined then be quiet
|
|
@@ -64,7 +64,7 @@ function mockLogger(context, keepQuiet) {
|
|
|
64
64
|
|
|
65
65
|
return mockLogger;
|
|
66
66
|
}
|
|
67
|
-
return
|
|
67
|
+
return logger.push({ component: 'mockLogger' });
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
module.exports = mockLogger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.27",
|
|
4
4
|
"description": "Mojaloop sdk scheme adapter command event handler",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.27",
|
|
4
4
|
"description": "mojaloop sdk scheme adapter outbound domain event handler",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
|
|
3
|
-
"version": "0.4.0-snapshot.
|
|
3
|
+
"version": "0.4.0-snapshot.26",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
|
|
9
|
-
"version": "0.4.0-snapshot.
|
|
9
|
+
"version": "0.4.0-snapshot.26",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@mojaloop/api-snippets": "17.7.9",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
|
|
3
|
-
"version": "0.4.0-snapshot.
|
|
3
|
+
"version": "0.4.0-snapshot.27",
|
|
4
4
|
"description": "SDK Scheme Adapter private shared library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
|
package/package.json
CHANGED