@mojaloop/sdk-scheme-adapter 24.10.9-snapshot.0 → 24.10.9-snapshot.2
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/docker/k666/package.json +17 -0
- package/modules/api-svc/package.json +1 -1
- package/modules/api-svc/src/InboundServer/handlers.js +9 -9
- package/modules/api-svc/src/lib/model/InboundTransfersModel.js +14 -3
- package/modules/api-svc/test/unit/lib/model/InboundTransfersModel.test.js +4 -3
- 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.json +1 -1
- package/package.json +1 -1
- package/docker/k6/src/test.js +0 -43
- /package/{docker → audit}/k6/package.json +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "k6-tests",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "```bash docker run --rm -i grafana/k6 run --vus 1 --duration 10s - <./src/test.js ```",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "Eugen Klymniuk",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"k6": "0.0.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/k6": "1.1.1"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1071,19 +1071,19 @@ const postFxTransfers = async (ctx) => {
|
|
|
1071
1071
|
};
|
|
1072
1072
|
|
|
1073
1073
|
const patchFxTransfersById = async (ctx) => {
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1074
|
+
if (ctx.state.conf.isIsoApi) {
|
|
1075
|
+
ctx.state.logger.push(ctx.request.body).debug('Transforming incoming ISO20022 patch fxTransfers body to FSPIOP');
|
|
1076
|
+
const target = await TransformFacades.FSPIOPISO20022.fxTransfers.patch({ body: ctx.request.body }, { rollUpUnmappedAsExtensions: true });
|
|
1077
|
+
ctx.request.body = target.body;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
const data = { ...ctx.request.body };
|
|
1078
1081
|
const idValue = ctx.state.path.params.ID;
|
|
1079
1082
|
|
|
1080
1083
|
const model = createInboundTransfersModel(ctx);
|
|
1084
|
+
const response = await model.sendFxPutNotificationToBackend(data, idValue);
|
|
1081
1085
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
// log the result
|
|
1085
|
-
ctx.state.logger.isDebugEnabled && ctx.state.logger.push({response}).
|
|
1086
|
-
debug('Inbound Transfers model handled PATCH /fxTransfers/{ID} request');
|
|
1086
|
+
ctx.state.logger.push({ response }).debug('Inbound Transfers model handled PATCH /fxTransfers/{ID} request');
|
|
1087
1087
|
};
|
|
1088
1088
|
|
|
1089
1089
|
/**
|
|
@@ -956,7 +956,7 @@ class InboundTransfersModel {
|
|
|
956
956
|
async sendFxPutNotificationToBackend(body, conversionId) {
|
|
957
957
|
const log = this._logger.child({ conversionId });
|
|
958
958
|
try {
|
|
959
|
-
log.verbose('sendFxPutNotificationToBackend payload: ', { body });
|
|
959
|
+
log.verbose('sendFxPutNotificationToBackend incoming payload: ', { body });
|
|
960
960
|
this.data = await this.loadFxState(conversionId);
|
|
961
961
|
|
|
962
962
|
if(!this.data) {
|
|
@@ -976,7 +976,14 @@ class InboundTransfersModel {
|
|
|
976
976
|
|
|
977
977
|
await this.saveFxState();
|
|
978
978
|
|
|
979
|
-
const
|
|
979
|
+
const responseBody = {
|
|
980
|
+
conversionState: body.conversionState, // one of ABORTED, COMMITTED, RESERVED
|
|
981
|
+
completedTimestamp: new Date().toISOString(), // todo: get from body
|
|
982
|
+
};
|
|
983
|
+
log.verbose('sendFxPutNotificationToBackend sent body: ', { responseBody });
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
const res = await this._backendRequests.putFxTransfersNotification(responseBody, conversionId);
|
|
980
987
|
return res;
|
|
981
988
|
} catch (err) {
|
|
982
989
|
log.error('error in sendFxPutNotificationToBackend: ', err);
|
|
@@ -996,7 +1003,11 @@ class InboundTransfersModel {
|
|
|
996
1003
|
}
|
|
997
1004
|
|
|
998
1005
|
// tag the final notification body on to the state
|
|
999
|
-
|
|
1006
|
+
// According to the backend api it expects extensionList to be an array (see CSI-1680)
|
|
1007
|
+
this.data.finalNotification = {
|
|
1008
|
+
...body,
|
|
1009
|
+
...(body.extensionList && { extensionList: body.extensionList.extension })
|
|
1010
|
+
};
|
|
1000
1011
|
|
|
1001
1012
|
if(body.transferState === FSPIOPTransferStateEnum.COMMITTED) {
|
|
1002
1013
|
// if the transfer was successful in the switch, set the overall transfer state to COMPLETED
|
|
@@ -873,7 +873,8 @@ describe('inboundModel', () => {
|
|
|
873
873
|
await model.sendFxPutNotificationToBackend(notif.data, conversionId);
|
|
874
874
|
expect(BackendRequests.__putFxTransfersNotification).toHaveBeenCalledTimes(1);
|
|
875
875
|
const call = BackendRequests.__putFxTransfersNotification.mock.calls[0];
|
|
876
|
-
expect(call[0]).toEqual(fxNotificationToBackend.data);
|
|
876
|
+
expect(call[0].conversionState).toEqual(fxNotificationToBackend.data.conversionState);
|
|
877
|
+
expect(typeof call[0].completedTimestamp).toBe('string');
|
|
877
878
|
expect(call[1]).toEqual(conversionId);
|
|
878
879
|
});
|
|
879
880
|
|
|
@@ -891,7 +892,7 @@ describe('inboundModel', () => {
|
|
|
891
892
|
await model.sendFxPutNotificationToBackend(notif.data, conversionId);
|
|
892
893
|
expect(BackendRequests.__putFxTransfersNotification).toHaveBeenCalledTimes(1);
|
|
893
894
|
const call = BackendRequests.__putFxTransfersNotification.mock.calls[0];
|
|
894
|
-
expect(call[0]).toEqual(fxNotificationAbortedToBackend.data);
|
|
895
|
+
expect(call[0].conversionState).toEqual(fxNotificationAbortedToBackend.data.conversionState);
|
|
895
896
|
expect(call[1]).toEqual(conversionId);
|
|
896
897
|
});
|
|
897
898
|
|
|
@@ -909,7 +910,7 @@ describe('inboundModel', () => {
|
|
|
909
910
|
await model.sendFxPutNotificationToBackend(notif.data, conversionId);
|
|
910
911
|
expect(BackendRequests.__putFxTransfersNotification).toHaveBeenCalledTimes(1);
|
|
911
912
|
const call = BackendRequests.__putFxTransfersNotification.mock.calls[0];
|
|
912
|
-
expect(call[0]).toEqual(fxNotificationReservedToBackend.data);
|
|
913
|
+
expect(call[0].conversionState).toEqual(fxNotificationReservedToBackend.data.conversionState);
|
|
913
914
|
expect(call[1]).toEqual(conversionId);
|
|
914
915
|
});
|
|
915
916
|
|
|
@@ -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.50",
|
|
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.50",
|
|
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,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.50",
|
|
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
package/docker/k6/src/test.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import http from 'k6/http';
|
|
2
|
-
import { sleep } from 'k6';
|
|
3
|
-
// import { Options } from 'k6/options';
|
|
4
|
-
|
|
5
|
-
export const options = {
|
|
6
|
-
vus: 3,
|
|
7
|
-
iterations: 10,
|
|
8
|
-
duration: '3s'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// // The default exported function is gonna be picked up by k6 as the entry point for the test script. It will be executed repeatedly in "iterations" for the whole duration of the test.
|
|
12
|
-
// export default function () {
|
|
13
|
-
// // Make a GET request to the target URL
|
|
14
|
-
// http.get('https://quickpizza.grafana.com');
|
|
15
|
-
//
|
|
16
|
-
// // Sleep for 1 second to simulate real-world usage
|
|
17
|
-
// sleep(1);
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// const url = 'http://localhost:4000/parties/MSISDN/1233641534556178';
|
|
22
|
-
const url = 'https://quickpizza.grafana.com/api/put';
|
|
23
|
-
|
|
24
|
-
export default function () {
|
|
25
|
-
// const headers = {
|
|
26
|
-
// 'Content-Type': 'application/json',
|
|
27
|
-
// Accept: 'application/vnd.interoperability.iso20022.parties+json;version=2.0'
|
|
28
|
-
// };
|
|
29
|
-
// const data = {};
|
|
30
|
-
const headers = { 'Content-Type': 'application/json' };
|
|
31
|
-
const data = { name: 'Bert' };
|
|
32
|
-
|
|
33
|
-
const res = http.put(url, JSON.stringify(data), { headers });
|
|
34
|
-
|
|
35
|
-
let body = {};
|
|
36
|
-
try {
|
|
37
|
-
body = JSON.parse(res.body)
|
|
38
|
-
} catch {}
|
|
39
|
-
|
|
40
|
-
console.log(body);
|
|
41
|
-
|
|
42
|
-
sleep(0.5)
|
|
43
|
-
}
|
|
File without changes
|