@mojaloop/sdk-scheme-adapter 13.0.3 → 13.0.4
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/lib/model/OutboundBulkQuotesModel.js +4 -4
- package/src/lib/model/OutboundBulkTransfersModel.js +4 -4
- package/src/lib/model/OutboundRequestToPayTransferModel.js +9 -10
- package/src/lib/model/OutboundTransfersModel.js +2 -2
- package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +8 -5
- package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +8 -5
- package/test/unit/lib/model/OutboundTransfersModel.test.js +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
# Changelog: [mojaloop/thirdparty-api-svc](https://github.com/mojaloop/thirdparty-api-svc)
|
|
2
|
+
### [13.0.4](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.3...v13.0.4) (2022-05-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* reformat error information response ([#318](https://github.com/mojaloop/sdk-scheme-adapter/issues/318)) ([ed844b1](https://github.com/mojaloop/sdk-scheme-adapter/commit/ed844b1d2da6c58d3c61622c07c326bda3ca3b86))
|
|
8
|
+
|
|
2
9
|
### [13.0.3](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.2...v13.0.3) (2022-05-12)
|
|
3
10
|
|
|
4
11
|
|
package/package.json
CHANGED
|
@@ -162,8 +162,8 @@ class OutboundBulkQuotesModel {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
} else if (message.type === 'bulkQuoteResponseError') {
|
|
165
|
-
error = new BackendError(`Got an error response requesting bulk quote: ${util.inspect(message.data, { depth: Infinity })}`, 500);
|
|
166
|
-
error.mojaloopError = message.data;
|
|
165
|
+
error = new BackendError(`Got an error response requesting bulk quote: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
|
|
166
|
+
error.mojaloopError = message.data.body;
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
169
169
|
this._logger.push({ message }).log(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Unknown message type ${message.type}.`);
|
|
@@ -297,8 +297,8 @@ class OutboundBulkQuotesModel {
|
|
|
297
297
|
let message = JSON.parse(msg);
|
|
298
298
|
|
|
299
299
|
if (message.type === 'bulkQuoteError') {
|
|
300
|
-
error = new BackendError(`Got an error response retrieving bulk quote: ${util.inspect(message.data, { depth: Infinity })}`, 500);
|
|
301
|
-
error.mojaloopError = message.data;
|
|
300
|
+
error = new BackendError(`Got an error response retrieving bulk quote: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
|
|
301
|
+
error.mojaloopError = message.data.body;
|
|
302
302
|
} else if (message.type !== 'bulkQuoteResponse') {
|
|
303
303
|
this._logger.push({ message }).log(`Ignoring cache notification for bulk quote ${bulkQuoteKey}. Uknokwn message type ${message.type}.`);
|
|
304
304
|
return;
|
|
@@ -161,8 +161,8 @@ class OutboundBulkTransfersModel {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
} else if (message.type === 'bulkTransferError') {
|
|
164
|
-
error = new BackendError(`Got an error response preparing bulk transfer: ${util.inspect(message.data, { depth: Infinity })}`, 500);
|
|
165
|
-
error.mojaloopError = message.data;
|
|
164
|
+
error = new BackendError(`Got an error response preparing bulk transfer: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
|
|
165
|
+
error.mojaloopError = message.data.body;
|
|
166
166
|
}
|
|
167
167
|
else {
|
|
168
168
|
this._logger.push({ message }).log(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Unknown message type ${message.type}.`);
|
|
@@ -289,8 +289,8 @@ class OutboundBulkTransfersModel {
|
|
|
289
289
|
let message = JSON.parse(msg);
|
|
290
290
|
|
|
291
291
|
if (message.type === 'bulkTransferError') {
|
|
292
|
-
error = new BackendError(`Got an error response retrieving bulk transfer: ${util.inspect(message.data, { depth: Infinity })}`, 500);
|
|
293
|
-
error.mojaloopError = message.data;
|
|
292
|
+
error = new BackendError(`Got an error response retrieving bulk transfer: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
|
|
293
|
+
error.mojaloopError = message.data.body;
|
|
294
294
|
} else if (message.type !== 'bulkTransferFulfil') {
|
|
295
295
|
this._logger.push({ message }).log(`Ignoring cache notification for bulk transfer ${bulkTransferKey}. Uknokwn message type ${message.type}.`);
|
|
296
296
|
return;
|
|
@@ -267,11 +267,10 @@ class OutboundRequestToPayTransferModel {
|
|
|
267
267
|
const subId = await this._cache.subscribe(payeeKey, (cn, msg, subId) => {
|
|
268
268
|
try {
|
|
269
269
|
let payee = JSON.parse(msg);
|
|
270
|
-
|
|
271
|
-
if(payee.errorInformation) {
|
|
270
|
+
if(payee.body && payee.body.errorInformation) {
|
|
272
271
|
// this is an error response to our GET /parties request
|
|
273
|
-
const err = new BackendError(`Got an error response resolving party: ${util.inspect(payee)}`, 500);
|
|
274
|
-
err.mojaloopError = payee;
|
|
272
|
+
const err = new BackendError(`Got an error response resolving party: ${util.inspect(payee.body)}`, 500);
|
|
273
|
+
err.mojaloopError = payee.body;
|
|
275
274
|
|
|
276
275
|
// cancel the timeout handler
|
|
277
276
|
clearTimeout(timeout);
|
|
@@ -405,8 +404,8 @@ class OutboundRequestToPayTransferModel {
|
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
406
|
} else if (message.type === 'quoteResponseError') {
|
|
408
|
-
error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data)}`, 500);
|
|
409
|
-
error.mojaloopError = message.data;
|
|
407
|
+
error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data.body)}`, 500);
|
|
408
|
+
error.mojaloopError = message.data.body;
|
|
410
409
|
}
|
|
411
410
|
else {
|
|
412
411
|
this._logger.push({ message }).log(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`);
|
|
@@ -620,8 +619,8 @@ class OutboundRequestToPayTransferModel {
|
|
|
620
619
|
}
|
|
621
620
|
}
|
|
622
621
|
} else if (message.type === 'transferError') {
|
|
623
|
-
error = new BackendError(`Got an error response preparing transfer: ${util.inspect(message.data)}`, 500);
|
|
624
|
-
error.mojaloopError = message.data;
|
|
622
|
+
error = new BackendError(`Got an error response preparing transfer: ${util.inspect(message.data.body)}`, 500);
|
|
623
|
+
error.mojaloopError = message.data.body;
|
|
625
624
|
} else {
|
|
626
625
|
this._logger.push({ message }).log(`Ignoring cache notification for transfer ${transferKey}. Uknokwn message type ${message.type}.`);
|
|
627
626
|
return;
|
|
@@ -701,8 +700,8 @@ class OutboundRequestToPayTransferModel {
|
|
|
701
700
|
let message = JSON.parse(msg);
|
|
702
701
|
|
|
703
702
|
if (message.type === 'transferError') {
|
|
704
|
-
error = new BackendError(`Got an error response retrieving transfer: ${util.inspect(message.data)}`, 500);
|
|
705
|
-
error.mojaloopError = message.data;
|
|
703
|
+
error = new BackendError(`Got an error response retrieving transfer: ${util.inspect(message.data.body)}`, 500);
|
|
704
|
+
error.mojaloopError = message.data.body;
|
|
706
705
|
} else if (message.type !== 'transferFulfil') {
|
|
707
706
|
this._logger.push({ message }).log(`Ignoring cache notification for transfer ${transferKey}. Uknokwn message type ${message.type}.`);
|
|
708
707
|
return;
|
|
@@ -497,8 +497,8 @@ class OutboundTransfersModel {
|
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
} else if (message.type === 'quoteResponseError') {
|
|
500
|
-
error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data, { depth: Infinity })}`, 500);
|
|
501
|
-
error.mojaloopError = message.data;
|
|
500
|
+
error = new BackendError(`Got an error response requesting quote: ${util.inspect(message.data.body, { depth: Infinity })}`, 500);
|
|
501
|
+
error.mojaloopError = message.data.body;
|
|
502
502
|
}
|
|
503
503
|
else {
|
|
504
504
|
this._logger.push({ message }).log(`Ignoring cache notification for quote ${quoteKey}. Unknown message type ${message.type}.`);
|
|
@@ -207,10 +207,13 @@ describe('OutboundBulkQuotesModel', () => {
|
|
|
207
207
|
const expectError = {
|
|
208
208
|
type: 'bulkQuoteResponseError',
|
|
209
209
|
data: {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
body: {
|
|
211
|
+
errorInformation: {
|
|
212
|
+
errorCode: '3205',
|
|
213
|
+
errorDescription: 'Bulk quote ID not found'
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
headers: {}
|
|
214
217
|
}
|
|
215
218
|
};
|
|
216
219
|
|
|
@@ -239,7 +242,7 @@ describe('OutboundBulkQuotesModel', () => {
|
|
|
239
242
|
expect(err.message.replace(/[ \n]/g,'')).toEqual(errMsg.replace(/[ \n]/g,''));
|
|
240
243
|
expect(err.bulkQuoteState).toBeTruthy();
|
|
241
244
|
expect(err.bulkQuoteState.lastError).toBeTruthy();
|
|
242
|
-
expect(err.bulkQuoteState.lastError.mojaloopError).toEqual(expectError.data);
|
|
245
|
+
expect(err.bulkQuoteState.lastError.mojaloopError).toEqual(expectError.data.body);
|
|
243
246
|
expect(err.bulkQuoteState.lastError.bulkQuoteState).toBe(undefined);
|
|
244
247
|
return;
|
|
245
248
|
}
|
|
@@ -202,10 +202,13 @@ describe('outboundBulkTransferModel', () => {
|
|
|
202
202
|
const expectError = {
|
|
203
203
|
type: 'bulkTransferError',
|
|
204
204
|
data: {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
body: {
|
|
206
|
+
errorInformation: {
|
|
207
|
+
errorCode: '4001',
|
|
208
|
+
errorDescription: 'Payer FSP insufficient liquidity'
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
headers: {}
|
|
209
212
|
}
|
|
210
213
|
};
|
|
211
214
|
|
|
@@ -234,7 +237,7 @@ describe('outboundBulkTransferModel', () => {
|
|
|
234
237
|
expect(err.message.replace(/[ \n]/g,'')).toEqual(errMsg.replace(/[ \n]/g,''));
|
|
235
238
|
expect(err.bulkTransferState).toBeTruthy();
|
|
236
239
|
expect(err.bulkTransferState.lastError).toBeTruthy();
|
|
237
|
-
expect(err.bulkTransferState.lastError.mojaloopError).toEqual(expectError.data);
|
|
240
|
+
expect(err.bulkTransferState.lastError.mojaloopError).toEqual(expectError.data.body);
|
|
238
241
|
expect(err.bulkTransferState.lastError.bulkTransferState).toBe(undefined);
|
|
239
242
|
return;
|
|
240
243
|
}
|
|
@@ -1390,10 +1390,13 @@ describe('outboundModel', () => {
|
|
|
1390
1390
|
const expectError = {
|
|
1391
1391
|
type: 'quoteResponseError',
|
|
1392
1392
|
data: {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1393
|
+
body: {
|
|
1394
|
+
errorInformation: {
|
|
1395
|
+
errorCode: '3205',
|
|
1396
|
+
errorDescription: 'Quote ID not found'
|
|
1397
|
+
}
|
|
1398
|
+
},
|
|
1399
|
+
headers: {}
|
|
1397
1400
|
}
|
|
1398
1401
|
};
|
|
1399
1402
|
|
|
@@ -1430,7 +1433,7 @@ describe('outboundModel', () => {
|
|
|
1430
1433
|
expect(err.message.replace(/[ \n]/g,'')).toEqual(errMsg.replace(/[ \n]/g,''));
|
|
1431
1434
|
expect(err.transferState).toBeTruthy();
|
|
1432
1435
|
expect(err.transferState.lastError).toBeTruthy();
|
|
1433
|
-
expect(err.transferState.lastError.mojaloopError).toEqual(expectError.data);
|
|
1436
|
+
expect(err.transferState.lastError.mojaloopError).toEqual(expectError.data.body);
|
|
1434
1437
|
expect(err.transferState.lastError.transferState).toBe(undefined);
|
|
1435
1438
|
return;
|
|
1436
1439
|
}
|