@mojaloop/sdk-scheme-adapter 24.1.0-snapshot.5 → 24.1.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/{@eslint-compat-npm-1.2.6-9efc700114-116c277749.zip → @eslint-compat-npm-1.2.7-b26d41d869-bdb5102a1e.zip} +0 -0
- package/.yarn/cache/@mojaloop-central-services-shared-npm-18.18.1-69bf11c401-704023ed97.zip +0 -0
- package/.yarn/cache/@mojaloop-central-services-shared-npm-18.18.2-8137f1eb81-a820a25d55.zip +0 -0
- package/.yarn/cache/{@mojaloop-event-sdk-npm-14.1.4-06eb082f24-5cab6c2cee.zip → @mojaloop-event-sdk-npm-14.1.5-97dbf6c0e3-9d5836df5a.zip} +0 -0
- package/.yarn/cache/@mojaloop-inter-scheme-proxy-cache-lib-npm-2.3.3-ca0069f863-f1f9e228ec.zip +0 -0
- package/.yarn/cache/@mojaloop-ml-schema-transformer-lib-npm-2.5.3-61baad09fa-f459689d3c.zip +0 -0
- package/.yarn/cache/@mojaloop-ml-schema-transformer-lib-npm-2.5.4-e84e9bcf4f-2ce61a546e.zip +0 -0
- package/.yarn/cache/{@mojaloop-sdk-standard-components-npm-19.6.5-eb738c4a25-4088204a4c.zip → @mojaloop-sdk-standard-components-npm-19.6.6-b23ec9b40c-016d0ea60e.zip} +0 -0
- package/.yarn/cache/@mojaloop-sdk-standard-components-npm-19.7.0-04e9d9d599-fefb01a635.zip +0 -0
- package/.yarn/cache/@rollup-rollup-linux-x64-musl-npm-4.34.8-ee9cc4ca11-8.zip +0 -0
- package/.yarn/cache/{@types-node-npm-22.13.4-80985669cb-39ecbd84fc.zip → @types-node-npm-22.13.5-4c5912eee2-8789d9bc3e.zip} +0 -0
- package/.yarn/cache/@types-swagger-ui-express-npm-4.1.8-29e7e3e560-bf4d84fb21.zip +0 -0
- package/.yarn/cache/@typescript-eslint-eslint-plugin-npm-8.25.0-f1ecf3f166-8e6f525d9c.zip +0 -0
- package/.yarn/cache/@typescript-eslint-parser-npm-8.25.0-31c155428a-5de468b96b.zip +0 -0
- package/.yarn/cache/@typescript-eslint-scope-manager-npm-8.25.0-091dbcfc8f-0778232545.zip +0 -0
- package/.yarn/cache/@typescript-eslint-type-utils-npm-8.25.0-948ec177d4-ee4bccb650.zip +0 -0
- package/.yarn/cache/@typescript-eslint-types-npm-8.25.0-3b5d366120-958395fb20.zip +0 -0
- package/.yarn/cache/@typescript-eslint-typescript-estree-npm-8.25.0-3d5d32528c-b103847df2.zip +0 -0
- package/.yarn/cache/@typescript-eslint-utils-npm-8.25.0-8fbe62cef1-60572c8880.zip +0 -0
- package/.yarn/cache/@typescript-eslint-visitor-keys-npm-8.25.0-d1f59eb977-e9570dd2ff.zip +0 -0
- package/.yarn/cache/semver-npm-7.7.1-4572475307-586b825d36.zip +0 -0
- package/.yarn/cache/{ts-jest-npm-29.2.5-3012d53ff5-d60d1e1d80.zip → ts-jest-npm-29.2.6-81e5c09384-ff71b27e99.zip} +0 -0
- package/.yarn/cache/{ws-npm-8.18.0-56f68bc4d6-91d4d35bc9.zip → ws-npm-8.18.1-369b0f5491-4658357185.zip} +0 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +14 -0
- package/modules/api-svc/package.json +5 -5
- package/modules/api-svc/src/OutboundServer/handlers.js +13 -17
- package/modules/api-svc/src/config.js +3 -2
- package/modules/api-svc/src/index.js +5 -5
- package/modules/api-svc/src/lib/model/InboundTransfersModel.js +20 -23
- package/modules/api-svc/src/lib/model/OutboundBulkQuotesModel.js +8 -7
- package/modules/api-svc/src/lib/model/OutboundBulkTransfersModel.js +8 -7
- package/modules/api-svc/src/lib/model/OutboundRequestToPayModel.js +9 -6
- package/modules/api-svc/src/lib/model/OutboundTransfersModel.js +48 -40
- package/modules/api-svc/test/unit/config.test.js +1 -0
- package/modules/api-svc/test/unit/outboundApi/handlers.test.js +13 -85
- package/modules/outbound-command-event-handler/package.json +7 -7
- package/modules/outbound-domain-event-handler/package.json +5 -5
- package/modules/private-shared-lib/package-lock.json +2 -2
- package/modules/private-shared-lib/package.json +6 -6
- package/package.json +5 -5
- package/.yarn/cache/@mojaloop-central-services-shared-npm-18.18.0-d791b2e2d2-5b03977f4a.zip +0 -0
- package/.yarn/cache/@types-swagger-ui-express-npm-4.1.7-51b9c74afb-c9b285018e.zip +0 -0
- package/.yarn/cache/@typescript-eslint-eslint-plugin-npm-8.24.1-43fd154139-9627eb794d.zip +0 -0
- package/.yarn/cache/@typescript-eslint-parser-npm-8.24.1-fedd86ba37-859b78630a.zip +0 -0
- package/.yarn/cache/@typescript-eslint-scope-manager-npm-8.24.1-bbbd19850f-193c072cd0.zip +0 -0
- package/.yarn/cache/@typescript-eslint-type-utils-npm-8.24.1-a739e69814-18a4431890.zip +0 -0
- package/.yarn/cache/@typescript-eslint-types-npm-8.24.1-599b1de09d-6304b153de.zip +0 -0
- package/.yarn/cache/@typescript-eslint-typescript-estree-npm-8.24.1-006a219495-9a4055ebed.zip +0 -0
- package/.yarn/cache/@typescript-eslint-utils-npm-8.24.1-d8e526dcfa-87b62de9d0.zip +0 -0
- package/.yarn/cache/@typescript-eslint-visitor-keys-npm-8.24.1-7dbb0c7cb9-82b91cf090.zip +0 -0
|
@@ -210,7 +210,7 @@ class OutboundTransfersModel {
|
|
|
210
210
|
* Updates the internal state representation to reflect that of the state machine itself
|
|
211
211
|
*/
|
|
212
212
|
_afterTransition() {
|
|
213
|
-
this._logger.
|
|
213
|
+
this._logger.isVerboseEnabled && this._logger.verbose(`State machine transitioned: ${this.data.currentState} -> ${this.stateMachine.state} for transfer ${this.data.transferId}`);
|
|
214
214
|
this.data.currentState = this.stateMachine.state;
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -348,7 +348,7 @@ class OutboundTransfersModel {
|
|
|
348
348
|
// cancel the timeout handler
|
|
349
349
|
clearTimeout(timeout);
|
|
350
350
|
|
|
351
|
-
this._logger.
|
|
351
|
+
this._logger.isVerboseEnabled && this._logger.push({ payee }).verbose('Payee resolved');
|
|
352
352
|
|
|
353
353
|
// stop listening for payee resolution messages
|
|
354
354
|
// no need to await for the unsubscribe to complete.
|
|
@@ -392,7 +392,7 @@ class OutboundTransfersModel {
|
|
|
392
392
|
}
|
|
393
393
|
this.data.to.dateOfBirth = payee.personalInfo.dateOfBirth;
|
|
394
394
|
}
|
|
395
|
-
|
|
395
|
+
|
|
396
396
|
if (Array.isArray(payee.supportedCurrencies)) {
|
|
397
397
|
if (!payee.supportedCurrencies.length) {
|
|
398
398
|
throw new Error(ErrorMessages.noSupportedCurrencies);
|
|
@@ -586,7 +586,7 @@ class OutboundTransfersModel {
|
|
|
586
586
|
body: payload,
|
|
587
587
|
headers: originalRequest.headers
|
|
588
588
|
};
|
|
589
|
-
this._logger.
|
|
589
|
+
this._logger.isVerboseEnabled && this._logger.push({ fxQuotePayload: payload }).verbose('fxQuote request is sent to hub');
|
|
590
590
|
|
|
591
591
|
const message = await subscribing;
|
|
592
592
|
|
|
@@ -665,7 +665,7 @@ class OutboundTransfersModel {
|
|
|
665
665
|
error.mojaloopError = message.data.body;
|
|
666
666
|
}
|
|
667
667
|
else {
|
|
668
|
-
this._logger.
|
|
668
|
+
this._logger.isVerboseEnabled && this._logger.push({ quoteKey, message }).verbose(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`);
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
671
|
|
|
@@ -689,7 +689,7 @@ class OutboundTransfersModel {
|
|
|
689
689
|
body: message.data.body,
|
|
690
690
|
originalIso20022QuoteResponse: message.data.originalIso20022QuoteResponse,
|
|
691
691
|
};
|
|
692
|
-
this._logger.push({ quoteResponse: this.data.quoteResponse.body }).
|
|
692
|
+
this._logger.isVerboseEnabled && this._logger.push({ quoteResponse: this.data.quoteResponse.body }).verbose('Quote response received');
|
|
693
693
|
|
|
694
694
|
this.data.quoteResponseSource = this.data.quoteResponse.headers['fspiop-source'];
|
|
695
695
|
|
|
@@ -897,7 +897,7 @@ class OutboundTransfersModel {
|
|
|
897
897
|
error = new BackendError(`Got an error response preparing transfer: ${safeStringify(message.data.body, { depth: Infinity })}`, 500);
|
|
898
898
|
error.mojaloopError = message.data.body;
|
|
899
899
|
} else {
|
|
900
|
-
this._logger.
|
|
900
|
+
this._logger.isVerboseEnabled && this._logger.push({ message }).verbose(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`);
|
|
901
901
|
return;
|
|
902
902
|
}
|
|
903
903
|
|
|
@@ -914,7 +914,7 @@ class OutboundTransfersModel {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
const fulfil = message.data;
|
|
917
|
-
this._logger.
|
|
917
|
+
this._logger.isInfoEnabled && this._logger.push({ fulfil: fulfil.body }).info('Transfer fulfil received');
|
|
918
918
|
this.data.fulfil = fulfil;
|
|
919
919
|
if(this._checkIlp && !this._ilp.validateFulfil(fulfil.body.fulfilment, this.data.quoteResponse.body.condition)) {
|
|
920
920
|
throw new Error('Invalid fulfilment received from peer DFSP.');
|
|
@@ -934,7 +934,7 @@ class OutboundTransfersModel {
|
|
|
934
934
|
const res = this._requests.patchTransfers(this.data.transferId,
|
|
935
935
|
patchNotification, this.data.quoteResponseSource);
|
|
936
936
|
this.data.patch = res.originalRequest;
|
|
937
|
-
this._logger.
|
|
937
|
+
this._logger.isInfoEnabled && this._logger.info(`PATCH final notification sent to peer for transfer ${this.data.transferId}`);
|
|
938
938
|
}
|
|
939
939
|
return resolve(fulfil.body);
|
|
940
940
|
}
|
|
@@ -980,7 +980,7 @@ class OutboundTransfersModel {
|
|
|
980
980
|
};
|
|
981
981
|
|
|
982
982
|
this.metrics.transferPrepares.inc();
|
|
983
|
-
this._logger.
|
|
983
|
+
this._logger.isVerboseEnabled && this._logger.push({ prepare, res }).verbose('Transfer prepare sent to peer');
|
|
984
984
|
}
|
|
985
985
|
catch(err) {
|
|
986
986
|
// cancel the timeout and unsubscribe before rejecting the promise
|
|
@@ -1013,7 +1013,7 @@ class OutboundTransfersModel {
|
|
|
1013
1013
|
error = new BackendError(`Got an error response retrieving transfer: ${safeStringify(message.data.body, { depth: Infinity })}`, 500);
|
|
1014
1014
|
error.mojaloopError = message.data.body;
|
|
1015
1015
|
} else if (message.type !== 'transferFulfil') {
|
|
1016
|
-
this._logger.
|
|
1016
|
+
this._logger.isVerboseEnabled && this._logger.push({ message }).verbose(`Ignoring cache notification for transfer ${transferKey}. Unknown message type ${message.type}.`);
|
|
1017
1017
|
return;
|
|
1018
1018
|
}
|
|
1019
1019
|
// cancel the timeout handler
|
|
@@ -1026,7 +1026,7 @@ class OutboundTransfersModel {
|
|
|
1026
1026
|
return reject(error);
|
|
1027
1027
|
}
|
|
1028
1028
|
const fulfil = message.data;
|
|
1029
|
-
this._logger.
|
|
1029
|
+
this._logger.isVerboseEnabled && this._logger.push({ fulfil: fulfil.body }).verbose('Transfer fulfil received');
|
|
1030
1030
|
this.data.fulfil = fulfil;
|
|
1031
1031
|
return resolve(this.data.fulfil);
|
|
1032
1032
|
}
|
|
@@ -1051,7 +1051,7 @@ class OutboundTransfersModel {
|
|
|
1051
1051
|
// a GET /transfers request to the switch
|
|
1052
1052
|
try {
|
|
1053
1053
|
const res = await this._requests.getTransfers(this.data.transferId);
|
|
1054
|
-
this._logger.
|
|
1054
|
+
this._logger.isVerboseEnabled && this._logger.push({ peer: res }).verbose(`getTransfers ${this.data.transferId} sent to peer`);
|
|
1055
1055
|
}
|
|
1056
1056
|
catch(err) {
|
|
1057
1057
|
// cancel the timout and unsubscribe before rejecting the promise
|
|
@@ -1114,7 +1114,7 @@ class OutboundTransfersModel {
|
|
|
1114
1114
|
'CdtTrfTxInf.InstrForCdtrAgt.',
|
|
1115
1115
|
'CdtTrfTxInf.InstrForNxtAgt.'
|
|
1116
1116
|
];
|
|
1117
|
-
const filteredExtensions = quoteResponseExtensions.filter(ext =>
|
|
1117
|
+
const filteredExtensions = quoteResponseExtensions.filter(ext =>
|
|
1118
1118
|
prefixes.some(prefix => ext.key.startsWith(prefix))
|
|
1119
1119
|
);
|
|
1120
1120
|
if (filteredExtensions.length > 0) {
|
|
@@ -1236,7 +1236,7 @@ class OutboundTransfersModel {
|
|
|
1236
1236
|
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Determines if FX is needed for the transfer
|
|
1239
|
-
*
|
|
1239
|
+
*
|
|
1240
1240
|
* @param {Array} payerCurrencies - Array of supported currencies for the payer
|
|
1241
1241
|
* @param {Array} payeeCurrencies - Array of supported currencies for the payee
|
|
1242
1242
|
* @param {string} amountCurrency - Currency of the amount being transferred
|
|
@@ -1291,6 +1291,8 @@ class OutboundTransfersModel {
|
|
|
1291
1291
|
* @param mergeData {object} - an object to merge with the model state (data) before running the state machine
|
|
1292
1292
|
*/
|
|
1293
1293
|
async run(mergeData = null) {
|
|
1294
|
+
const log = this._logger.push({ transferId: this.data?.transferId });
|
|
1295
|
+
|
|
1294
1296
|
try {
|
|
1295
1297
|
// if we were passed a mergeData object...
|
|
1296
1298
|
// merge it with our existing state, overwriting any existing matching root level keys
|
|
@@ -1317,7 +1319,7 @@ class OutboundTransfersModel {
|
|
|
1317
1319
|
|
|
1318
1320
|
if (typeof(this.data.to.fspId) !== 'undefined' && this.data.skipPartyLookup) {
|
|
1319
1321
|
// we already have the payee DFSP and we have bee asked to skip party resolution
|
|
1320
|
-
|
|
1322
|
+
log.isInfoEnabled && log.info('Skipping payee resolution for transfer as to.fspId was provided and skipPartyLookup is truthy');
|
|
1321
1323
|
this.data.currentState = States.PAYEE_RESOLVED;
|
|
1322
1324
|
// (!) this.data.currentState and this.stateMachine.state are different now!
|
|
1323
1325
|
break;
|
|
@@ -1325,10 +1327,10 @@ class OutboundTransfersModel {
|
|
|
1325
1327
|
|
|
1326
1328
|
// next transition is to resolvePayee
|
|
1327
1329
|
await this.stateMachine.resolvePayee();
|
|
1328
|
-
|
|
1330
|
+
log.isInfoEnabled && log.info('Payee resolved for transfer');
|
|
1329
1331
|
|
|
1330
1332
|
if (this.stateMachine.state === States.PAYEE_RESOLVED && !this._autoAcceptParty) {
|
|
1331
|
-
|
|
1333
|
+
log.isInfoEnabled && log.info('Transfer waits for async acceptParty');
|
|
1332
1334
|
await this._save();
|
|
1333
1335
|
return this.getResponse();
|
|
1334
1336
|
}
|
|
@@ -1337,20 +1339,23 @@ class OutboundTransfersModel {
|
|
|
1337
1339
|
case States.PAYEE_RESOLVED:
|
|
1338
1340
|
if (!this._autoAcceptParty && !this.data.acceptParty && !this.data.skipPartyLookup) {
|
|
1339
1341
|
// resuming after a party resolution halt, backend did not accept the party.
|
|
1340
|
-
|
|
1342
|
+
const abortMessage = 'Payee rejected by backend';
|
|
1343
|
+
log.isInfoEnabled && log.info(abortMessage);
|
|
1344
|
+
await this.stateMachine.abort(abortMessage);
|
|
1341
1345
|
await this._save();
|
|
1342
1346
|
return this.getResponse();
|
|
1343
1347
|
}
|
|
1344
1348
|
|
|
1345
1349
|
if (this.data.needFx) {
|
|
1346
1350
|
await this.stateMachine.requestServicesFxp();
|
|
1347
|
-
|
|
1351
|
+
log.isInfoEnabled && log.info('Services FXP received for transfer');
|
|
1348
1352
|
} else {
|
|
1349
1353
|
await this.stateMachine.requestQuote();
|
|
1350
|
-
|
|
1354
|
+
log.isInfoEnabled && log.info('Quote received for transfer');
|
|
1351
1355
|
if (this.stateMachine.state === States.QUOTE_RECEIVED && !this._autoAcceptQuotes) {
|
|
1352
1356
|
//we break execution here and return the quote response details to allow asynchronous accept or reject
|
|
1353
1357
|
//of the quote
|
|
1358
|
+
log.isInfoEnabled && log.info('Transfer waits for async accept or reject of quotes');
|
|
1354
1359
|
await this._save();
|
|
1355
1360
|
return this.getResponse();
|
|
1356
1361
|
}
|
|
@@ -1363,11 +1368,11 @@ class OutboundTransfersModel {
|
|
|
1363
1368
|
: Transitions.REQUEST_QUOTE;
|
|
1364
1369
|
|
|
1365
1370
|
await this.stateMachine[transition]();
|
|
1366
|
-
|
|
1371
|
+
log.isInfoEnabled && log.info(`Transition ${transition} for transfer has been completed`);
|
|
1367
1372
|
|
|
1368
1373
|
if ([States.QUOTE_RECEIVED, States.FX_QUOTE_RECEIVED].includes(this.stateMachine.state)) {
|
|
1369
1374
|
//we break execution here and return the quotes/fxQuote response details to allow asynchronous accept or reject
|
|
1370
|
-
|
|
1375
|
+
log.isInfoEnabled && log.info(`Transfer waits for async accept or reject of ${transition}`);
|
|
1371
1376
|
await this._save();
|
|
1372
1377
|
return this.getResponse();
|
|
1373
1378
|
}
|
|
@@ -1378,7 +1383,9 @@ class OutboundTransfersModel {
|
|
|
1378
1383
|
if ((this.data.acceptConversion !== undefined && this.data.acceptConversion === false) ||
|
|
1379
1384
|
(this.data.acceptQuoteOrConversion !== undefined && this.data.acceptQuoteOrConversion === false) ||
|
|
1380
1385
|
(this.data.acceptConversion === undefined && this.data.acceptQuoteOrConversion === undefined)) {
|
|
1381
|
-
|
|
1386
|
+
const abortMessage = ErrorMessages.fxQuoteRejectedByBackend;
|
|
1387
|
+
log.isInfoEnabled && log.info(abortMessage);
|
|
1388
|
+
await this.stateMachine.abort(abortMessage);
|
|
1382
1389
|
await this._save();
|
|
1383
1390
|
return this.getResponse();
|
|
1384
1391
|
}
|
|
@@ -1388,10 +1395,10 @@ class OutboundTransfersModel {
|
|
|
1388
1395
|
: Transitions.EXECUTE_FX_TRANSFER;
|
|
1389
1396
|
|
|
1390
1397
|
await this.stateMachine[transition]();
|
|
1391
|
-
|
|
1398
|
+
log.isInfoEnabled && log.info(`Transition ${transition} for transfer is done`);
|
|
1392
1399
|
|
|
1393
1400
|
if (this.stateMachine.state === States.QUOTE_RECEIVED && !this._autoAcceptQuotes) {
|
|
1394
|
-
|
|
1401
|
+
log.isInfoEnabled && log.info('Transfer waits for async acceptQuotes');
|
|
1395
1402
|
await this._save();
|
|
1396
1403
|
return this.getResponse();
|
|
1397
1404
|
}
|
|
@@ -1404,7 +1411,9 @@ class OutboundTransfersModel {
|
|
|
1404
1411
|
(this.data.acceptQuoteOrConversion !== undefined && this.data.acceptQuoteOrConversion === false) ||
|
|
1405
1412
|
(this.data.acceptQuote === undefined && this.data.acceptQuoteOrConversion === undefined))) {
|
|
1406
1413
|
// resuming after a party resolution halt, backend did not accept the party.
|
|
1407
|
-
|
|
1414
|
+
const abortMessage = ErrorMessages.quoteRejectedByBackend;
|
|
1415
|
+
log.isInfoEnabled && log.info(abortMessage);
|
|
1416
|
+
await this.stateMachine.abort(abortMessage);
|
|
1408
1417
|
await this._save();
|
|
1409
1418
|
return this.getResponse();
|
|
1410
1419
|
}
|
|
@@ -1416,10 +1425,10 @@ class OutboundTransfersModel {
|
|
|
1416
1425
|
: Transitions.REQUEST_FX_QUOTE);
|
|
1417
1426
|
|
|
1418
1427
|
await this.stateMachine[transition]();
|
|
1419
|
-
|
|
1428
|
+
log.isInfoEnabled && log.info(`Transition ${transition} for transfer has been completed`);
|
|
1420
1429
|
|
|
1421
1430
|
if (this.stateMachine.state === States.FX_QUOTE_RECEIVED) { // todo: think, if we need to add _autoAcceptConversion
|
|
1422
|
-
|
|
1431
|
+
log.isInfoEnabled && log.info('Transfer waits for async acceptConversion');
|
|
1423
1432
|
await this._save();
|
|
1424
1433
|
return this.getResponse();
|
|
1425
1434
|
}
|
|
@@ -1428,52 +1437,51 @@ class OutboundTransfersModel {
|
|
|
1428
1437
|
|
|
1429
1438
|
case States.FX_TRANSFER_SUCCEEDED:
|
|
1430
1439
|
await this.stateMachine.executeTransfer();
|
|
1431
|
-
|
|
1440
|
+
log.isInfoEnabled && log.info('FxTransfer has been completed');
|
|
1432
1441
|
break;
|
|
1433
1442
|
|
|
1434
1443
|
case States.SUCCEEDED:
|
|
1435
1444
|
// all steps complete so return
|
|
1436
|
-
|
|
1445
|
+
log.isInfoEnabled && log.info('Transfer completed successfully');
|
|
1437
1446
|
await this._save();
|
|
1438
1447
|
return this.getResponse();
|
|
1439
1448
|
|
|
1440
1449
|
case States.ERRORED:
|
|
1441
1450
|
// stopped in errored state
|
|
1442
1451
|
await this._save();
|
|
1443
|
-
|
|
1452
|
+
log.isErrorEnabled && log.error('State machine in errored state');
|
|
1444
1453
|
return;
|
|
1445
1454
|
|
|
1446
1455
|
case States.ABORTED:
|
|
1447
1456
|
// stopped in aborted state
|
|
1448
|
-
|
|
1457
|
+
log.isWarnEnabled && log.warn('State machine in aborted state');
|
|
1449
1458
|
await this._save();
|
|
1450
1459
|
return this.getResponse();
|
|
1451
1460
|
|
|
1452
1461
|
// todo: no such state!
|
|
1453
1462
|
case 'getTransfer':
|
|
1454
1463
|
await this.stateMachine.getTransfer();
|
|
1455
|
-
|
|
1464
|
+
log.isInfoEnabled && log.info('getTransfer has been completed');
|
|
1456
1465
|
break;
|
|
1457
1466
|
|
|
1458
1467
|
default:
|
|
1459
1468
|
// The state is not handled here, throwing an error to avoid an infinite recursion of this function
|
|
1460
1469
|
await this._save();
|
|
1461
|
-
|
|
1470
|
+
log.isErrorEnabled && log.error(`State machine in unhandled state: ${this.data.currentState}`);
|
|
1462
1471
|
return;
|
|
1463
1472
|
}
|
|
1464
1473
|
|
|
1465
1474
|
// now call ourselves recursively to deal with the next transition
|
|
1466
|
-
|
|
1475
|
+
log.isVerboseEnabled && log.verbose(`Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`);
|
|
1467
1476
|
return this.run();
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
this._logger.isErrorEnabled && this._logger.error(`error running outbound transfer model ${this.data.transferId}: ${err?.message}`);
|
|
1477
|
+
} catch (err) {
|
|
1478
|
+
log.isErrorEnabled && log.push({ err }).error(`error running outbound transfer model: ${err?.message}`);
|
|
1471
1479
|
|
|
1472
1480
|
// as this function is recursive, we dont want to error the state machine multiple times
|
|
1473
1481
|
if (this.data.currentState !== States.ERRORED) {
|
|
1474
1482
|
// err should not have a transferState property here!
|
|
1475
1483
|
if (err.transferState) {
|
|
1476
|
-
|
|
1484
|
+
log.isWarnEnabled && log.warn(`State machine is broken: ${safeStringify(err)}`);
|
|
1477
1485
|
}
|
|
1478
1486
|
// transition to errored state
|
|
1479
1487
|
await this.stateMachine.error(err);
|
|
@@ -33,6 +33,7 @@ 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 uuid = require('@mojaloop/central-services-shared').Util.id({ type: 'ulid' });
|
|
36
37
|
const mockError = require('./data/mockError');
|
|
37
38
|
const mockBulkQuoteError = require('./data/mockBulkQuoteError');
|
|
38
39
|
const mockBulkTransferError = require('./data/mockBulkTransferError');
|
|
@@ -46,7 +47,6 @@ const bulkQuoteRequest = require('./data/bulkQuoteRequest');
|
|
|
46
47
|
const requestToPayPayload = require('./data/requestToPay');
|
|
47
48
|
const requestToPayTransferRequest = require('./data/requestToPayTransferRequest');
|
|
48
49
|
const mockLogger = require('../mockLogger');
|
|
49
|
-
const uuid = require('@mojaloop/central-services-shared').Util.id({type: 'ulid'});
|
|
50
50
|
|
|
51
51
|
jest.mock('~/lib/model');
|
|
52
52
|
|
|
@@ -170,13 +170,7 @@ describe('Outbound API handlers:', () => {
|
|
|
170
170
|
response: {},
|
|
171
171
|
state: {
|
|
172
172
|
conf: {},
|
|
173
|
-
logger:
|
|
174
|
-
log: () => {},
|
|
175
|
-
debug: () => {},
|
|
176
|
-
error: () => {},
|
|
177
|
-
isDebugEnabled: () => {},
|
|
178
|
-
isErrorEnabled: () => {}
|
|
179
|
-
},
|
|
173
|
+
logger: mockLogger(),
|
|
180
174
|
}
|
|
181
175
|
};
|
|
182
176
|
|
|
@@ -204,13 +198,7 @@ describe('Outbound API handlers:', () => {
|
|
|
204
198
|
conf: {
|
|
205
199
|
outboundErrorStatusCodeExtensionKey: 'extErrorKey' // <- tell the handler to use this extensionList item as source of statusCode
|
|
206
200
|
},
|
|
207
|
-
logger:
|
|
208
|
-
log: () => {},
|
|
209
|
-
debug: () => {},
|
|
210
|
-
error: () => {},
|
|
211
|
-
isDebugEnabled: () => {},
|
|
212
|
-
isErrorEnabled: () => {}
|
|
213
|
-
},
|
|
201
|
+
logger: mockLogger(),
|
|
214
202
|
}
|
|
215
203
|
};
|
|
216
204
|
|
|
@@ -242,13 +230,7 @@ describe('Outbound API handlers:', () => {
|
|
|
242
230
|
response: {},
|
|
243
231
|
state: {
|
|
244
232
|
conf: {},
|
|
245
|
-
logger:
|
|
246
|
-
log: () => {},
|
|
247
|
-
debug: () => {},
|
|
248
|
-
error: () => {},
|
|
249
|
-
isDebugEnabled: () => {},
|
|
250
|
-
isErrorEnabled: () => {}
|
|
251
|
-
},
|
|
233
|
+
logger: mockLogger(),
|
|
252
234
|
path: {
|
|
253
235
|
params: {
|
|
254
236
|
transferId: '12345'
|
|
@@ -280,13 +262,7 @@ describe('Outbound API handlers:', () => {
|
|
|
280
262
|
response: {},
|
|
281
263
|
state: {
|
|
282
264
|
conf: {},
|
|
283
|
-
logger:
|
|
284
|
-
log: () => {},
|
|
285
|
-
debug: () => {},
|
|
286
|
-
error: () => {},
|
|
287
|
-
isDebugEnabled: () => {},
|
|
288
|
-
isErrorEnabled: () => {}
|
|
289
|
-
},
|
|
265
|
+
logger: mockLogger(),
|
|
290
266
|
}
|
|
291
267
|
};
|
|
292
268
|
|
|
@@ -314,13 +290,7 @@ describe('Outbound API handlers:', () => {
|
|
|
314
290
|
conf: {
|
|
315
291
|
outboundErrorStatusCodeExtensionKey: 'extErrorKey' // <- tell the handler to use this extensionList item as source of statusCode
|
|
316
292
|
},
|
|
317
|
-
logger:
|
|
318
|
-
log: () => {},
|
|
319
|
-
debug: () => {},
|
|
320
|
-
error: () => {},
|
|
321
|
-
isDebugEnabled: () => {},
|
|
322
|
-
isErrorEnabled: () => {}
|
|
323
|
-
},
|
|
293
|
+
logger: mockLogger(),
|
|
324
294
|
}
|
|
325
295
|
};
|
|
326
296
|
|
|
@@ -350,13 +320,7 @@ describe('Outbound API handlers:', () => {
|
|
|
350
320
|
response: {},
|
|
351
321
|
state: {
|
|
352
322
|
conf: {},
|
|
353
|
-
logger:
|
|
354
|
-
log: () => {},
|
|
355
|
-
debug: () => {},
|
|
356
|
-
error: () => {},
|
|
357
|
-
isDebugEnabled: () => {},
|
|
358
|
-
isErrorEnabled: () => {}
|
|
359
|
-
},
|
|
323
|
+
logger: mockLogger(),
|
|
360
324
|
}
|
|
361
325
|
};
|
|
362
326
|
|
|
@@ -384,13 +348,7 @@ describe('Outbound API handlers:', () => {
|
|
|
384
348
|
conf: {
|
|
385
349
|
outboundErrorStatusCodeExtensionKey: 'extErrorKey' // <- tell the handler to use this extensionList item as source of statusCode
|
|
386
350
|
},
|
|
387
|
-
logger:
|
|
388
|
-
log: () => {},
|
|
389
|
-
debug: () => {},
|
|
390
|
-
error: () => {},
|
|
391
|
-
isDebugEnabled: () => {},
|
|
392
|
-
isErrorEnabled: () => {}
|
|
393
|
-
},
|
|
351
|
+
logger: mockLogger(),
|
|
394
352
|
}
|
|
395
353
|
};
|
|
396
354
|
|
|
@@ -420,13 +378,7 @@ describe('Outbound API handlers:', () => {
|
|
|
420
378
|
response: {},
|
|
421
379
|
state: {
|
|
422
380
|
conf: {},
|
|
423
|
-
logger:
|
|
424
|
-
log: () => {},
|
|
425
|
-
debug: () => {},
|
|
426
|
-
error: () => {},
|
|
427
|
-
isDebugEnabled: () => {},
|
|
428
|
-
isErrorEnabled: () => {}
|
|
429
|
-
},
|
|
381
|
+
logger: mockLogger(),
|
|
430
382
|
eventLogger: { info: () => {}},
|
|
431
383
|
eventProducer: { sendDomainEvent: jest.fn() },
|
|
432
384
|
}
|
|
@@ -465,13 +417,7 @@ describe('Outbound API handlers:', () => {
|
|
|
465
417
|
response: {},
|
|
466
418
|
state: {
|
|
467
419
|
conf: {},
|
|
468
|
-
logger:
|
|
469
|
-
log: () => {},
|
|
470
|
-
debug: () => {},
|
|
471
|
-
error: () => {},
|
|
472
|
-
isDebugEnabled: () => {},
|
|
473
|
-
isErrorEnabled: () => {}
|
|
474
|
-
},
|
|
420
|
+
logger: mockLogger(),
|
|
475
421
|
eventLogger: { info: () => {}},
|
|
476
422
|
eventProducer: { sendDomainEvent: jest.fn() },
|
|
477
423
|
path: {
|
|
@@ -513,13 +459,7 @@ describe('Outbound API handlers:', () => {
|
|
|
513
459
|
response: {},
|
|
514
460
|
state: {
|
|
515
461
|
conf: {},
|
|
516
|
-
logger:
|
|
517
|
-
log: () => {},
|
|
518
|
-
debug: () => {},
|
|
519
|
-
error: () => {},
|
|
520
|
-
isDebugEnabled: () => {},
|
|
521
|
-
isErrorEnabled: () => {}
|
|
522
|
-
},
|
|
462
|
+
logger: mockLogger(),
|
|
523
463
|
eventLogger: { info: () => {}},
|
|
524
464
|
eventProducer: { sendDomainEvent: jest.fn() },
|
|
525
465
|
path: {
|
|
@@ -553,13 +493,7 @@ describe('Outbound API handlers:', () => {
|
|
|
553
493
|
response: {},
|
|
554
494
|
state: {
|
|
555
495
|
conf: {},
|
|
556
|
-
logger:
|
|
557
|
-
log: () => {},
|
|
558
|
-
debug: () => {},
|
|
559
|
-
error: () => {},
|
|
560
|
-
isDebugEnabled: () => {},
|
|
561
|
-
isErrorEnabled: () => {}
|
|
562
|
-
},
|
|
496
|
+
logger: mockLogger(),
|
|
563
497
|
}
|
|
564
498
|
};
|
|
565
499
|
|
|
@@ -586,13 +520,7 @@ describe('Outbound API handlers:', () => {
|
|
|
586
520
|
response: {},
|
|
587
521
|
state: {
|
|
588
522
|
conf: {},
|
|
589
|
-
logger:
|
|
590
|
-
log: () => {},
|
|
591
|
-
debug: () => {},
|
|
592
|
-
error: () => {},
|
|
593
|
-
isDebugEnabled: () => {},
|
|
594
|
-
isErrorEnabled: () => {},
|
|
595
|
-
},
|
|
523
|
+
logger: mockLogger(),
|
|
596
524
|
}
|
|
597
525
|
};
|
|
598
526
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@mojaloop/api-snippets": "17.8.0",
|
|
45
|
-
"@mojaloop/central-services-shared": "^18.18.
|
|
45
|
+
"@mojaloop/central-services-shared": "^18.18.2",
|
|
46
46
|
"@mojaloop/logging-bc-client-lib": "^0.5.8",
|
|
47
47
|
"@mojaloop/logging-bc-public-types-lib": "^0.5.4",
|
|
48
48
|
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
|
|
@@ -55,17 +55,17 @@
|
|
|
55
55
|
"yamljs": "^0.3.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@eslint/compat": "^1.2.
|
|
58
|
+
"@eslint/compat": "^1.2.7",
|
|
59
59
|
"@types/convict": "^6.1.6",
|
|
60
60
|
"@types/express": "^5.0.0",
|
|
61
61
|
"@types/jest": "^29.5.14",
|
|
62
|
-
"@types/node": "^22.13.
|
|
62
|
+
"@types/node": "^22.13.5",
|
|
63
63
|
"@types/node-cache": "^4.2.5",
|
|
64
64
|
"@types/supertest": "^6.0.2",
|
|
65
|
-
"@types/swagger-ui-express": "4.1.
|
|
65
|
+
"@types/swagger-ui-express": "4.1.8",
|
|
66
66
|
"@types/yamljs": "^0.2.34",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
68
|
-
"@typescript-eslint/parser": "^8.
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
68
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
69
69
|
"copyfiles": "^2.4.1",
|
|
70
70
|
"eslint": "^9.15.0",
|
|
71
71
|
"jest": "^29.7.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"npm-check-updates": "^16.7.10",
|
|
74
74
|
"replace": "^1.2.2",
|
|
75
75
|
"standard-version": "^9.5.0",
|
|
76
|
-
"ts-jest": "^29.2.
|
|
76
|
+
"ts-jest": "^29.2.6",
|
|
77
77
|
"ts-node": "^10.9.2",
|
|
78
78
|
"typescript": "^5.7.3"
|
|
79
79
|
},
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"@types/convict": "^6.1.6",
|
|
57
57
|
"@types/express": "^5.0.0",
|
|
58
58
|
"@types/jest": "^29.5.14",
|
|
59
|
-
"@types/node": "^22.13.
|
|
59
|
+
"@types/node": "^22.13.5",
|
|
60
60
|
"@types/node-cache": "^4.2.5",
|
|
61
61
|
"@types/supertest": "^6.0.2",
|
|
62
|
-
"@types/swagger-ui-express": "^4.1.
|
|
62
|
+
"@types/swagger-ui-express": "^4.1.8",
|
|
63
63
|
"@types/yamljs": "^0.2.34",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
65
|
-
"@typescript-eslint/parser": "^8.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
65
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
66
66
|
"copyfiles": "^2.4.1",
|
|
67
67
|
"eslint": "^9.15.0",
|
|
68
68
|
"jest": "^29.7.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"npm-check-updates": "^16.7.10",
|
|
71
71
|
"replace": "^1.2.2",
|
|
72
72
|
"standard-version": "^9.5.0",
|
|
73
|
-
"ts-jest": "^29.2.
|
|
73
|
+
"ts-jest": "^29.2.6",
|
|
74
74
|
"ts-node": "^10.9.2",
|
|
75
75
|
"typescript": "^5.7.3"
|
|
76
76
|
},
|
|
@@ -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.24",
|
|
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.24",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@mojaloop/api-snippets": "17.7.9",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@mojaloop/api-snippets": "17.8.0",
|
|
33
|
-
"@mojaloop/central-services-shared": "^18.18.
|
|
33
|
+
"@mojaloop/central-services-shared": "^18.18.2",
|
|
34
34
|
"@mojaloop/logging-bc-public-types-lib": "^0.5.4",
|
|
35
35
|
"@mojaloop/platform-shared-lib-messaging-types-lib": "^0.7.1",
|
|
36
36
|
"@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": "0.5.18",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"uuid": "^11.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@eslint/compat": "^1.2.
|
|
43
|
-
"@types/node": "^22.13.
|
|
42
|
+
"@eslint/compat": "^1.2.7",
|
|
43
|
+
"@types/node": "^22.13.5",
|
|
44
44
|
"@types/uuid": "^10.0.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
46
|
-
"@typescript-eslint/parser": "^8.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
47
47
|
"eslint": "^9.15.0",
|
|
48
48
|
"jest": "^29.7.0",
|
|
49
49
|
"npm-check-updates": "^16.7.10",
|
|
50
50
|
"replace": "^1.2.2",
|
|
51
51
|
"standard-version": "^9.5.0",
|
|
52
|
-
"ts-jest": "^29.2.
|
|
52
|
+
"ts-jest": "^29.2.6",
|
|
53
53
|
"tslib": "^2.8.1",
|
|
54
54
|
"typescript": "^5.7.3"
|
|
55
55
|
},
|