@mojaloop/sdk-scheme-adapter 24.10.7 → 24.10.9-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/{@babel-core-npm-7.28.0-2c03249042-1c86eec8d7.zip → @babel-core-npm-7.28.3-fb967e901c-0faded84ed.zip} +0 -0
- package/.yarn/cache/@babel-generator-npm-7.28.3-1529434ded-d00d1e6b51.zip +0 -0
- package/.yarn/cache/@babel-helper-create-class-features-plugin-npm-7.28.3-de056c24da-32d01bdd60.zip +0 -0
- package/.yarn/cache/@babel-helper-module-transforms-npm-7.28.3-7b69ec189a-598fdd8aa5.zip +0 -0
- package/.yarn/cache/{@babel-helpers-npm-7.28.2-20c7a44ade-09fd7965e8.zip → @babel-helpers-npm-7.28.3-8e4849da45-6d39031bf0.zip} +0 -0
- package/.yarn/cache/@babel-parser-npm-7.28.3-8acaa30019-9fa08282e3.zip +0 -0
- package/.yarn/cache/@babel-plugin-bugfix-v8-static-class-fields-redefine-readonly-npm-7.28.3-19e1b3699f-eeacdb7fa5.zip +0 -0
- package/.yarn/cache/@babel-plugin-transform-class-static-block-npm-7.28.3-13af84b676-c0ba8f0cbf.zip +0 -0
- package/.yarn/cache/{@babel-plugin-transform-classes-npm-7.28.0-3815bda6ff-1a812a02f6.zip → @babel-plugin-transform-classes-npm-7.28.3-22fe11bcef-0aefcabe68.zip} +0 -0
- package/.yarn/cache/{@babel-plugin-transform-regenerator-npm-7.28.1-2cc4798981-45e3a63bf2.zip → @babel-plugin-transform-regenerator-npm-7.28.3-36bb1b5a59-f95e929d41.zip} +0 -0
- package/.yarn/cache/{@babel-preset-env-npm-7.28.0-964e29aeee-8814453ffe.zip → @babel-preset-env-npm-7.28.3-ec87d1a73a-b09991276a.zip} +0 -0
- package/.yarn/cache/@babel-traverse-npm-7.28.3-7786c501c7-fe521591b7.zip +0 -0
- package/.yarn/cache/{@redis-bloom-npm-5.8.0-436cff1687-a4ab9add75.zip → @redis-bloom-npm-5.8.1-139b45b8e4-f691b1dce2.zip} +0 -0
- package/.yarn/cache/{@redis-client-npm-5.8.0-3bdc0e2d9d-7db93f3e6f.zip → @redis-client-npm-5.8.1-66d46a9ca1-329d76de06.zip} +0 -0
- package/.yarn/cache/{@redis-json-npm-5.8.0-c6aea5063f-3347bfd1ec.zip → @redis-json-npm-5.8.1-1374d9e2de-9eabbf9a2c.zip} +0 -0
- package/.yarn/cache/{@redis-search-npm-5.8.0-cd8c59f8e9-055c9804f9.zip → @redis-search-npm-5.8.1-ebc7760a31-a5e12dd2c7.zip} +0 -0
- package/.yarn/cache/{@redis-time-series-npm-5.8.0-a8eada922a-98a8123a5b.zip → @redis-time-series-npm-5.8.1-1f5e30ede4-c9440ce935.zip} +0 -0
- package/.yarn/cache/@redocly-openapi-core-npm-1.34.5-6e131049a1-9ecce1975b.zip +0 -0
- package/.yarn/cache/{@typescript-eslint-eslint-plugin-npm-8.39.0-7cc58b0ab6-31f879990a.zip → @typescript-eslint-eslint-plugin-npm-8.39.1-8ad46b0385-446050aa43.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-parser-npm-8.39.0-c138f72ca9-9785994ff0.zip → @typescript-eslint-parser-npm-8.39.1-e931b25728-ff45ce7635.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-project-service-npm-8.39.0-4cecf00a1b-990ae23308.zip → @typescript-eslint-project-service-npm-8.39.1-f6db73ca22-1970633d1a.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-scope-manager-npm-8.39.0-45f3f86773-c2b232a172.zip → @typescript-eslint-scope-manager-npm-8.39.1-bf78e0253c-8874f74790.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-tsconfig-utils-npm-8.39.0-444fac8997-3457da49e7.zip → @typescript-eslint-tsconfig-utils-npm-8.39.1-e46dac00aa-38c1e19825.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-type-utils-npm-8.39.0-02f1fd51a1-3efe4001b6.zip → @typescript-eslint-type-utils-npm-8.39.1-41cbec8085-1195d65970.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-types-npm-8.39.0-c051b2516d-b08a42e8b5.zip → @typescript-eslint-types-npm-8.39.1-8cea531133-8013f4f48a.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-typescript-estree-npm-8.39.0-73bf7427a0-7e9dc461fe.zip → @typescript-eslint-typescript-estree-npm-8.39.1-eb0cf5436f-07ed9d7ab4.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-utils-npm-8.39.0-26129b3d3c-ed340f36fa.zip → @typescript-eslint-utils-npm-8.39.1-a6c63e4cf7-39bb105f26.zip} +0 -0
- package/.yarn/cache/{@typescript-eslint-visitor-keys-npm-8.39.0-76eaf78702-2eb89b9e4d.zip → @typescript-eslint-visitor-keys-npm-8.39.1-d0b0654c5b-6d4e4d0b19.zip} +0 -0
- package/.yarn/cache/openapi-backend-npm-5.14.0-231377503b-1bd3e6cb71.zip +0 -0
- package/.yarn/cache/openapi-typescript-npm-7.9.1-753f55d26c-1d2d967e40.zip +0 -0
- package/.yarn/cache/{redis-npm-5.8.0-e751103f9d-8a645185df.zip → redis-npm-5.8.1-201a0a72a3-26d97c6ddf.zip} +0 -0
- package/.yarn/cache/supports-color-npm-10.1.0-48517f80a7-28d191c4ad.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +12 -0
- package/docker/k6/package.json +17 -0
- package/docker/k6/src/test.js +43 -0
- package/docker-compose.yml +1 -0
- package/modules/api-svc/package.json +5 -5
- package/modules/api-svc/src/InboundServer/handlers.js +1 -1
- package/modules/api-svc/src/lib/cache.js +106 -0
- package/modules/api-svc/src/lib/model/InboundTransfersModel.js +5 -3
- package/modules/api-svc/src/lib/model/OutboundTransfersModel.js +93 -118
- package/modules/api-svc/src/lib/model/common/TimeoutError.js +41 -0
- package/modules/api-svc/src/lib/model/common/index.js +2 -0
- package/modules/api-svc/src/lib/model/lib/requests/backendRequests.js +2 -2
- package/modules/api-svc/test/unit/api/transfers/transfers.test.js +1 -1
- package/modules/api-svc/test/unit/inboundApi/handlers.test.js +2 -2
- package/modules/api-svc/test/unit/lib/cache.test.js +150 -0
- package/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js +16 -32
- package/modules/api-svc/test/unit/lib/model/mockedLibRequests.js +2 -2
- package/modules/outbound-command-event-handler/package.json +5 -5
- package/modules/outbound-domain-event-handler/package.json +5 -5
- package/modules/private-shared-lib/package.json +4 -4
- package/package.json +3 -3
- package/{sbom-v24.10.6.csv → sbom-v24.10.8.csv} +36 -36
- package/.yarn/cache/@babel-plugin-bugfix-v8-static-class-fields-redefine-readonly-npm-7.27.1-424bedd466-dfa68da5f6.zip +0 -0
- package/.yarn/cache/@babel-plugin-transform-class-static-block-npm-7.27.1-a1a8a0d79f-2d49de0f5f.zip +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
- Name Surname <name.surname@mojaloop.io>
|
|
24
|
+
|
|
25
|
+
* Infitx
|
|
26
|
+
- Vijay Kumar Guthi - <vijaya.guthi@infitx.com>
|
|
27
|
+
--------------
|
|
28
|
+
******/
|
|
29
|
+
'use strict';
|
|
30
|
+
|
|
31
|
+
class TimeoutError extends Error {
|
|
32
|
+
constructor(msg) {
|
|
33
|
+
super(msg);
|
|
34
|
+
this.name = 'TimeoutError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
TimeoutError
|
|
41
|
+
};
|
|
@@ -28,10 +28,12 @@
|
|
|
28
28
|
******/
|
|
29
29
|
const Enums = require('./Enums');
|
|
30
30
|
const { BackendError } = require('./BackendError');
|
|
31
|
+
const { TimeoutError } = require('./TimeoutError');
|
|
31
32
|
const PersistentStateMachine = require('./PersistentStateMachine');
|
|
32
33
|
|
|
33
34
|
module.exports = {
|
|
34
35
|
...Enums,
|
|
35
36
|
BackendError,
|
|
37
|
+
TimeoutError,
|
|
36
38
|
PersistentStateMachine
|
|
37
39
|
};
|
|
@@ -124,9 +124,9 @@ class BackendRequests {
|
|
|
124
124
|
return this._post('fxTransfers', payload);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
async
|
|
127
|
+
async putFxTransfersNotification(notification, conversionId) {
|
|
128
128
|
const url = `fxTransfers/${conversionId}`;
|
|
129
|
-
return this.
|
|
129
|
+
return this._put(url, notification);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
@@ -147,7 +147,7 @@ describe('Outbound Transfers API', () => {
|
|
|
147
147
|
parties: {
|
|
148
148
|
put: () => new Promise(
|
|
149
149
|
resolve => setTimeout(() => resolve(putPartiesBody),
|
|
150
|
-
|
|
150
|
+
3000)),
|
|
151
151
|
},
|
|
152
152
|
};
|
|
153
153
|
return testPostTransfers(putBodyFn, 504, postTransfersErrorTimeoutResponse);
|
|
@@ -1075,8 +1075,8 @@ describe('Inbound API handlers:', () => {
|
|
|
1075
1075
|
};
|
|
1076
1076
|
});
|
|
1077
1077
|
|
|
1078
|
-
test('calls `model.
|
|
1079
|
-
const notificationSpy = jest.spyOn(Model.prototype, '
|
|
1078
|
+
test('calls `model.sendFxPutNotificationToBackend with expected arguments', async () => {
|
|
1079
|
+
const notificationSpy = jest.spyOn(Model.prototype, 'sendFxPutNotificationToBackend');
|
|
1080
1080
|
|
|
1081
1081
|
await expect(handlers['/fxTransfers/{ID}'].patch(mockNotificationMessage)).resolves.toBe(undefined);
|
|
1082
1082
|
expect(notificationSpy).toHaveBeenCalledTimes(1);
|
|
@@ -210,4 +210,154 @@ describe('Cache Tests -->', () => {
|
|
|
210
210
|
expect(result).toEqual(error);
|
|
211
211
|
expect(unsubscribeSpy).not.toHaveBeenCalled();
|
|
212
212
|
});
|
|
213
|
+
|
|
214
|
+
test('subscribeToOneMessageWithTimerNew should resolve with parsed message when received before timeout', async () => {
|
|
215
|
+
const channel = `ch-${randomUUID()}`;
|
|
216
|
+
const message = { id: randomUUID(), data: 'test-data' };
|
|
217
|
+
const requestProcessingTimeoutSeconds = 1;
|
|
218
|
+
|
|
219
|
+
const subscribing = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
220
|
+
|
|
221
|
+
// Simulate a message being published to the channel via EventEmitter
|
|
222
|
+
setTimeout(() => {
|
|
223
|
+
cache._channelEmitter.emit(channel, JSON.stringify(message));
|
|
224
|
+
}, 100);
|
|
225
|
+
|
|
226
|
+
const result = await subscribing;
|
|
227
|
+
expect(result).toStrictEqual(message);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('subscribeToOneMessageWithTimerNew should resolve with unparsed message when needParse is false', async () => {
|
|
231
|
+
const channel = `ch-${randomUUID()}`;
|
|
232
|
+
const message = 'raw-string-message';
|
|
233
|
+
const requestProcessingTimeoutSeconds = 1;
|
|
234
|
+
|
|
235
|
+
const subscribing = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds, false);
|
|
236
|
+
|
|
237
|
+
// Simulate a message being published to the channel via EventEmitter
|
|
238
|
+
setTimeout(() => {
|
|
239
|
+
cache._channelEmitter.emit(channel, message);
|
|
240
|
+
}, 100);
|
|
241
|
+
|
|
242
|
+
const result = await subscribing;
|
|
243
|
+
expect(result).toBe(message);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
test('subscribeToOneMessageWithTimerNew should reject with TimeoutError when no message received within timeout', async () => {
|
|
247
|
+
const channel = `ch-${randomUUID()}`;
|
|
248
|
+
const requestProcessingTimeoutSeconds = 0.1; // 100ms timeout
|
|
249
|
+
|
|
250
|
+
const subscribing = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
251
|
+
|
|
252
|
+
await expect(subscribing).rejects.toThrow(`Subscription timeout after ${requestProcessingTimeoutSeconds}s`);
|
|
253
|
+
|
|
254
|
+
// Test that it's a TimeoutError instance
|
|
255
|
+
try {
|
|
256
|
+
await subscribing;
|
|
257
|
+
expect(true).toBe(false); // Should not reach here
|
|
258
|
+
} catch (error) {
|
|
259
|
+
expect(error.constructor.name).toBe('TimeoutError');
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test('subscribeToOneMessageWithTimerNew should reject when JSON parsing fails', async () => {
|
|
264
|
+
const channel = `ch-${randomUUID()}`;
|
|
265
|
+
const invalidJson = '{ invalid json }';
|
|
266
|
+
const requestProcessingTimeoutSeconds = 1;
|
|
267
|
+
|
|
268
|
+
const subscribing = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds, true);
|
|
269
|
+
|
|
270
|
+
// Simulate a message with invalid JSON
|
|
271
|
+
setTimeout(() => {
|
|
272
|
+
cache._channelEmitter.emit(channel, invalidJson);
|
|
273
|
+
}, 100);
|
|
274
|
+
|
|
275
|
+
await expect(subscribing).rejects.toThrow();
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test('subscribeToOneMessageWithTimerNew should handle multiple subscribers to same channel', async () => {
|
|
279
|
+
const channel1 = `ch-${randomUUID()}`;
|
|
280
|
+
const channel2 = `ch-${randomUUID()}`;
|
|
281
|
+
const message1 = { id: 'msg1', data: 'test1' };
|
|
282
|
+
const message2 = { id: 'msg2', data: 'test2' };
|
|
283
|
+
const requestProcessingTimeoutSeconds = 1;
|
|
284
|
+
|
|
285
|
+
// Create two subscriptions to different channels to avoid interference
|
|
286
|
+
const subscribing1 = cache.subscribeToOneMessageWithTimerNew(channel1, requestProcessingTimeoutSeconds);
|
|
287
|
+
const subscribing2 = cache.subscribeToOneMessageWithTimerNew(channel2, requestProcessingTimeoutSeconds);
|
|
288
|
+
|
|
289
|
+
// Emit messages to each channel separately
|
|
290
|
+
setTimeout(() => {
|
|
291
|
+
cache._channelEmitter.emit(channel1, JSON.stringify(message1));
|
|
292
|
+
cache._channelEmitter.emit(channel2, JSON.stringify(message2));
|
|
293
|
+
}, 100);
|
|
294
|
+
|
|
295
|
+
// Both should resolve with their respective messages
|
|
296
|
+
const results = await Promise.all([subscribing1, subscribing2]);
|
|
297
|
+
expect(results[0]).toStrictEqual(message1);
|
|
298
|
+
expect(results[1]).toStrictEqual(message2);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
test('subscribeToOneMessageWithTimerNew should handle concurrent subscribers to same channel (party lookup scenario)', async () => {
|
|
302
|
+
const channel = `party-lookup-${randomUUID()}`;
|
|
303
|
+
const partyResponse = { party: { partyIdInfo: { partyIdType: 'MSISDN', partyIdentifier: '123456789' }}};
|
|
304
|
+
const requestProcessingTimeoutSeconds = 1;
|
|
305
|
+
|
|
306
|
+
// Create multiple concurrent subscriptions to same channel (simulating concurrent party lookups)
|
|
307
|
+
const subscribing1 = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
308
|
+
const subscribing2 = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
309
|
+
const subscribing3 = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
310
|
+
|
|
311
|
+
// Simulate a single party response that should resolve all subscribers
|
|
312
|
+
setTimeout(() => {
|
|
313
|
+
cache._channelEmitter.emit(channel, JSON.stringify(partyResponse));
|
|
314
|
+
}, 100);
|
|
315
|
+
|
|
316
|
+
// All subscribers should resolve with the same party response
|
|
317
|
+
const results = await Promise.all([subscribing1, subscribing2, subscribing3]);
|
|
318
|
+
expect(results[0]).toStrictEqual(partyResponse);
|
|
319
|
+
expect(results[1]).toStrictEqual(partyResponse);
|
|
320
|
+
expect(results[2]).toStrictEqual(partyResponse);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
test('subscribeToOneMessageWithTimerNew should clean up resources on timeout', async () => {
|
|
324
|
+
const channel = `ch-${randomUUID()}`;
|
|
325
|
+
const requestProcessingTimeoutSeconds = 0.1;
|
|
326
|
+
|
|
327
|
+
const removeListenerSpy = jest.spyOn(cache._channelEmitter, 'removeListener');
|
|
328
|
+
|
|
329
|
+
const subscribing = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
330
|
+
|
|
331
|
+
await expect(subscribing).rejects.toThrow(`Subscription timeout after ${requestProcessingTimeoutSeconds}s`);
|
|
332
|
+
|
|
333
|
+
// Test that it's a TimeoutError instance
|
|
334
|
+
try {
|
|
335
|
+
await subscribing;
|
|
336
|
+
expect(true).toBe(false); // Should not reach here
|
|
337
|
+
} catch (error) {
|
|
338
|
+
expect(error.constructor.name).toBe('TimeoutError');
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Verify cleanup was called
|
|
342
|
+
expect(removeListenerSpy).toHaveBeenCalledWith(channel, expect.any(Function));
|
|
343
|
+
|
|
344
|
+
removeListenerSpy.mockRestore();
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
test('subscribeToOneMessageWithTimerNew should reject when subscription fails', async () => {
|
|
348
|
+
const channel = `ch-${randomUUID()}`;
|
|
349
|
+
const requestProcessingTimeoutSeconds = 1;
|
|
350
|
+
const subscriptionError = new Error('subscription failed');
|
|
351
|
+
|
|
352
|
+
// Mock the _subscriptionClient.subscribe to reject
|
|
353
|
+
const originalSubscribe = cache._subscriptionClient.subscribe;
|
|
354
|
+
cache._subscriptionClient.subscribe = jest.fn().mockRejectedValue(subscriptionError);
|
|
355
|
+
|
|
356
|
+
const subscribing = cache.subscribeToOneMessageWithTimerNew(channel, requestProcessingTimeoutSeconds);
|
|
357
|
+
|
|
358
|
+
await expect(subscribing).rejects.toThrow('subscription failed');
|
|
359
|
+
|
|
360
|
+
// Restore original method
|
|
361
|
+
cache._subscriptionClient.subscribe = originalSubscribe;
|
|
362
|
+
});
|
|
213
363
|
});
|
|
@@ -842,7 +842,7 @@ describe('inboundModel', () => {
|
|
|
842
842
|
|
|
843
843
|
});
|
|
844
844
|
|
|
845
|
-
describe('
|
|
845
|
+
describe('sendFxPutNotificationToBackend:', () => {
|
|
846
846
|
const conversionId = '1234';
|
|
847
847
|
let cache;
|
|
848
848
|
|
|
@@ -860,14 +860,9 @@ describe('inboundModel', () => {
|
|
|
860
860
|
});
|
|
861
861
|
|
|
862
862
|
test('sends notification to fsp backend', async () => {
|
|
863
|
-
BackendRequests.
|
|
863
|
+
BackendRequests.__putFxTransfersNotification = jest.fn().mockReturnValue(Promise.resolve({}));
|
|
864
864
|
const notif = JSON.parse(JSON.stringify(fxNotificationToBackend));
|
|
865
865
|
|
|
866
|
-
const expectedRequest = {
|
|
867
|
-
currentState: SDKStateEnum.COMPLETED,
|
|
868
|
-
finalNotification: notif.data,
|
|
869
|
-
};
|
|
870
|
-
|
|
871
866
|
const model = new Model({
|
|
872
867
|
...config,
|
|
873
868
|
cache,
|
|
@@ -875,22 +870,17 @@ describe('inboundModel', () => {
|
|
|
875
870
|
});
|
|
876
871
|
model.saveFxState = jest.fn().mockReturnValue(Promise.resolve({}));
|
|
877
872
|
|
|
878
|
-
await model.
|
|
879
|
-
expect(BackendRequests.
|
|
880
|
-
const call = BackendRequests.
|
|
881
|
-
expect(call[0]).toEqual(
|
|
873
|
+
await model.sendFxPutNotificationToBackend(notif.data, conversionId);
|
|
874
|
+
expect(BackendRequests.__putFxTransfersNotification).toHaveBeenCalledTimes(1);
|
|
875
|
+
const call = BackendRequests.__putFxTransfersNotification.mock.calls[0];
|
|
876
|
+
expect(call[0]).toEqual(fxNotificationToBackend.data);
|
|
882
877
|
expect(call[1]).toEqual(conversionId);
|
|
883
878
|
});
|
|
884
879
|
|
|
885
880
|
test('sends ABORTED notification to fsp backend', async () => {
|
|
886
|
-
BackendRequests.
|
|
881
|
+
BackendRequests.__putFxTransfersNotification = jest.fn().mockReturnValue(Promise.resolve({}));
|
|
887
882
|
const notif = JSON.parse(JSON.stringify(fxNotificationAbortedToBackend));
|
|
888
883
|
|
|
889
|
-
const expectedRequest = {
|
|
890
|
-
currentState: SDKStateEnum.ABORTED,
|
|
891
|
-
finalNotification: notif.data,
|
|
892
|
-
};
|
|
893
|
-
|
|
894
884
|
const model = new Model({
|
|
895
885
|
...config,
|
|
896
886
|
cache,
|
|
@@ -898,23 +888,17 @@ describe('inboundModel', () => {
|
|
|
898
888
|
});
|
|
899
889
|
model.saveFxState = jest.fn().mockReturnValue(Promise.resolve({}));
|
|
900
890
|
|
|
901
|
-
await model.
|
|
902
|
-
expect(BackendRequests.
|
|
903
|
-
const call = BackendRequests.
|
|
904
|
-
expect(call[0]).toEqual(
|
|
891
|
+
await model.sendFxPutNotificationToBackend(notif.data, conversionId);
|
|
892
|
+
expect(BackendRequests.__putFxTransfersNotification).toHaveBeenCalledTimes(1);
|
|
893
|
+
const call = BackendRequests.__putFxTransfersNotification.mock.calls[0];
|
|
894
|
+
expect(call[0]).toEqual(fxNotificationAbortedToBackend.data);
|
|
905
895
|
expect(call[1]).toEqual(conversionId);
|
|
906
896
|
});
|
|
907
897
|
|
|
908
898
|
test('sends RESERVED notification to fsp backend', async () => {
|
|
909
|
-
BackendRequests.
|
|
899
|
+
BackendRequests.__putFxTransfersNotification = jest.fn().mockReturnValue(Promise.resolve({}));
|
|
910
900
|
const notif = JSON.parse(JSON.stringify(fxNotificationReservedToBackend));
|
|
911
901
|
|
|
912
|
-
const expectedRequest = {
|
|
913
|
-
currentState: SDKStateEnum.ERROR_OCCURRED,
|
|
914
|
-
finalNotification: notif.data,
|
|
915
|
-
lastError: 'Final notification state not COMMITTED or ABORTED',
|
|
916
|
-
};
|
|
917
|
-
|
|
918
902
|
const model = new Model({
|
|
919
903
|
...config,
|
|
920
904
|
cache,
|
|
@@ -922,10 +906,10 @@ describe('inboundModel', () => {
|
|
|
922
906
|
});
|
|
923
907
|
model.saveFxState = jest.fn().mockReturnValue(Promise.resolve({}));
|
|
924
908
|
|
|
925
|
-
await model.
|
|
926
|
-
expect(BackendRequests.
|
|
927
|
-
const call = BackendRequests.
|
|
928
|
-
expect(call[0]).toEqual(
|
|
909
|
+
await model.sendFxPutNotificationToBackend(notif.data, conversionId);
|
|
910
|
+
expect(BackendRequests.__putFxTransfersNotification).toHaveBeenCalledTimes(1);
|
|
911
|
+
const call = BackendRequests.__putFxTransfersNotification.mock.calls[0];
|
|
912
|
+
expect(call[0]).toEqual(fxNotificationReservedToBackend.data);
|
|
929
913
|
expect(call[1]).toEqual(conversionId);
|
|
930
914
|
});
|
|
931
915
|
|
|
@@ -52,7 +52,7 @@ class MockBackendRequests extends BackendRequests {
|
|
|
52
52
|
this.putTransfersNotification = MockBackendRequests.__putTransfersNotification;
|
|
53
53
|
this.postFxQuotes = MockBackendRequests.__postFxQuotes;
|
|
54
54
|
this.postFxTransfers = MockBackendRequests.__postFxTransfers;
|
|
55
|
-
this.
|
|
55
|
+
this.putFxTransfersNotification = MockBackendRequests.__putFxTransfersNotification;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
MockBackendRequests.__getParties = jest.fn(() => Promise.resolve({body: {}}));
|
|
@@ -68,7 +68,7 @@ MockBackendRequests.__postBulkTransfers = jest.fn(() => Promise.resolve({body: {
|
|
|
68
68
|
MockBackendRequests.__putTransfersNotification = jest.fn(() => Promise.resolve({body: {}}));
|
|
69
69
|
MockBackendRequests.__postFxQuotes = jest.fn(async () => ({ body: {} }));
|
|
70
70
|
MockBackendRequests.__postFxTransfers = jest.fn(async () => ({ body: {} }));
|
|
71
|
-
MockBackendRequests.
|
|
71
|
+
MockBackendRequests.__putFxTransfersNotification = jest.fn(() => Promise.resolve({body: {}}));
|
|
72
72
|
|
|
73
73
|
class HTTPResponseError extends Error {
|
|
74
74
|
constructor(params) {
|
|
@@ -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.48",
|
|
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/",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"ajv-formats": "3.0.1",
|
|
51
51
|
"convict": "6.2.4",
|
|
52
52
|
"express": "4.21.2",
|
|
53
|
-
"openapi-backend": "5.
|
|
54
|
-
"redis": "5.8.
|
|
53
|
+
"openapi-backend": "5.14.0",
|
|
54
|
+
"redis": "5.8.1",
|
|
55
55
|
"swagger-ui-express": "5.0.1",
|
|
56
56
|
"yamljs": "0.3.0"
|
|
57
57
|
},
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@types/supertest": "6.0.3",
|
|
66
66
|
"@types/swagger-ui-express": "4.1.8",
|
|
67
67
|
"@types/yamljs": "0.2.34",
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "8.39.
|
|
69
|
-
"@typescript-eslint/parser": "8.39.
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
69
|
+
"@typescript-eslint/parser": "8.39.1",
|
|
70
70
|
"copyfiles": "2.4.1",
|
|
71
71
|
"eslint": "9.15.0",
|
|
72
72
|
"jest": "29.7.0",
|
|
@@ -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.48",
|
|
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/",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"ajv-formats": "3.0.1",
|
|
49
49
|
"convict": "6.2.4",
|
|
50
50
|
"express": "4.21.2",
|
|
51
|
-
"openapi-backend": "5.
|
|
52
|
-
"redis": "5.8.
|
|
51
|
+
"openapi-backend": "5.14.0",
|
|
52
|
+
"redis": "5.8.1",
|
|
53
53
|
"swagger-ui-express": "5.0.1",
|
|
54
54
|
"yamljs": "0.3.0"
|
|
55
55
|
},
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@types/supertest": "6.0.3",
|
|
63
63
|
"@types/swagger-ui-express": "4.1.8",
|
|
64
64
|
"@types/yamljs": "0.2.34",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "8.39.
|
|
66
|
-
"@typescript-eslint/parser": "8.39.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
66
|
+
"@typescript-eslint/parser": "8.39.1",
|
|
67
67
|
"copyfiles": "2.4.1",
|
|
68
68
|
"eslint": "9.15.0",
|
|
69
69
|
"jest": "29.7.0",
|
|
@@ -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.48",
|
|
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",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"@mojaloop/platform-shared-lib-messaging-types-lib": "0.7.3",
|
|
36
36
|
"@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": "0.5.18",
|
|
37
37
|
"ajv": "8.17.1",
|
|
38
|
-
"redis": "5.8.
|
|
38
|
+
"redis": "5.8.1",
|
|
39
39
|
"uuid": "11.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/compat": "1.3.2",
|
|
43
43
|
"@types/node": "24.2.1",
|
|
44
44
|
"@types/uuid": "10.0.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "8.39.
|
|
46
|
-
"@typescript-eslint/parser": "8.39.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
46
|
+
"@typescript-eslint/parser": "8.39.1",
|
|
47
47
|
"eslint": "9.15.0",
|
|
48
48
|
"jest": "29.7.0",
|
|
49
49
|
"npm-check-updates": "16.7.10",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter",
|
|
3
|
-
"version": "24.10.
|
|
3
|
+
"version": "24.10.9-snapshot.0",
|
|
4
4
|
"description": "mojaloop sdk-scheme-adapter",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"@types/jest": "30.0.0",
|
|
85
85
|
"@types/node": "24.2.1",
|
|
86
86
|
"@types/node-cache": "4.2.5",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "8.39.
|
|
88
|
-
"@typescript-eslint/parser": "8.39.
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
88
|
+
"@typescript-eslint/parser": "8.39.1",
|
|
89
89
|
"audit-ci": "7.1.0",
|
|
90
90
|
"eslint": "9.15.0",
|
|
91
91
|
"eslint-config-airbnb-typescript": "18.0.0",
|