@mojaloop/sdk-scheme-adapter 13.0.1 → 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 CHANGED
@@ -1,4 +1,25 @@
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
+
9
+ ### [13.0.3](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.2...v13.0.3) (2022-05-12)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * correct party outbound response ([#317](https://github.com/mojaloop/sdk-scheme-adapter/issues/317)) ([752e8b4](https://github.com/mojaloop/sdk-scheme-adapter/commit/752e8b4d315a6e9c3b8ad4ff1b65761c41e3d721))
15
+
16
+ ### [13.0.2](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.1...v13.0.2) (2022-05-12)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * update outbound interface and response oa3 defs ([#316](https://github.com/mojaloop/sdk-scheme-adapter/issues/316)) ([50d23d8](https://github.com/mojaloop/sdk-scheme-adapter/commit/50d23d8562afdeeeef2203d6196473c7b0e484a5))
22
+
2
23
  ### [13.0.1](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.0...v13.0.1) (2022-05-11)
3
24
 
4
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "13.0.1",
3
+ "version": "13.0.4",
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",
@@ -2124,8 +2124,15 @@ components:
2124
2124
  description: 'GET /parties/{Type}/{ID} response object'
2125
2125
  properties:
2126
2126
  party:
2127
- $ref: '#/components/schemas/Party'
2128
- description: Information regarding the requested Party.
2127
+ properties:
2128
+ body:
2129
+ $ref: '#/components/schemas/Party'
2130
+ description: Information regarding the requested Party.
2131
+ headers:
2132
+ type: object
2133
+ required:
2134
+ - body
2135
+ - headers
2129
2136
  currentState:
2130
2137
  $ref: '#/components/schemas/async2SyncCurrentState'
2131
2138
  required:
@@ -2235,33 +2242,41 @@ components:
2235
2242
  type: object
2236
2243
  description: 'The object sent in the PUT /quotes/{ID} callback.'
2237
2244
  properties:
2238
- transferAmount:
2239
- $ref: '#/components/schemas/Money'
2240
- payeeReceiveAmount:
2241
- $ref: '#/components/schemas/Money'
2242
- payeeFspFee:
2243
- $ref: '#/components/schemas/Money'
2244
- payeeFspCommission:
2245
- $ref: '#/components/schemas/Money'
2246
- expiration:
2247
- type: string
2248
- description: >-
2249
- Date and time until when the quotation is valid and can be
2250
- honored when used in the subsequent transaction.
2251
- example: '2016-05-24T08:38:08.699-04:00'
2252
- geoCode:
2253
- $ref: '#/components/schemas/GeoCode'
2254
- ilpPacket:
2255
- $ref: '#/components/schemas/IlpPacket'
2256
- condition:
2257
- $ref: '#/components/schemas/IlpCondition'
2258
- extensionList:
2259
- $ref: '#/components/schemas/ExtensionList'
2245
+ body:
2246
+ type: object
2247
+ properties:
2248
+ transferAmount:
2249
+ $ref: '#/components/schemas/Money'
2250
+ payeeReceiveAmount:
2251
+ $ref: '#/components/schemas/Money'
2252
+ payeeFspFee:
2253
+ $ref: '#/components/schemas/Money'
2254
+ payeeFspCommission:
2255
+ $ref: '#/components/schemas/Money'
2256
+ expiration:
2257
+ type: string
2258
+ description: >-
2259
+ Date and time until when the quotation is valid and can be
2260
+ honored when used in the subsequent transaction.
2261
+ example: '2016-05-24T08:38:08.699-04:00'
2262
+ geoCode:
2263
+ $ref: '#/components/schemas/GeoCode'
2264
+ ilpPacket:
2265
+ $ref: '#/components/schemas/IlpPacket'
2266
+ condition:
2267
+ $ref: '#/components/schemas/IlpCondition'
2268
+ extensionList:
2269
+ $ref: '#/components/schemas/ExtensionList'
2270
+ required:
2271
+ - transferAmount
2272
+ - expiration
2273
+ - ilpPacket
2274
+ - condition
2275
+ headers:
2276
+ type: object
2260
2277
  required:
2261
- - transferAmount
2262
- - expiration
2263
- - ilpPacket
2264
- - condition
2278
+ - body
2279
+ - headers
2265
2280
  currentState:
2266
2281
  $ref: '#/components/schemas/async2SyncCurrentState'
2267
2282
  required:
@@ -2316,7 +2331,14 @@ components:
2316
2331
  type: object
2317
2332
  properties:
2318
2333
  transfer:
2319
- $ref: '#/components/schemas/TransfersIDPutResponse'
2334
+ properties:
2335
+ body:
2336
+ $ref: '#/components/schemas/TransfersIDPutResponse'
2337
+ headers:
2338
+ type: object
2339
+ required:
2340
+ - body
2341
+ - headers
2320
2342
  currentState:
2321
2343
  $ref: '#/components/schemas/async2SyncCurrentState'
2322
2344
  required:
@@ -1070,8 +1070,11 @@ export interface components {
1070
1070
  | "ERROR_OCCURRED";
1071
1071
  /** GET /parties/{Type}/{ID} response object */
1072
1072
  partiesByIdResponse: {
1073
- /** Information regarding the requested Party. */
1074
- party: components["schemas"]["Party"];
1073
+ party: {
1074
+ /** Information regarding the requested Party. */
1075
+ body: components["schemas"]["Party"];
1076
+ headers: { [key: string]: unknown };
1077
+ };
1075
1078
  currentState: components["schemas"]["async2SyncCurrentState"];
1076
1079
  };
1077
1080
  /** The object sent in the POST /quotes request. */
@@ -1110,16 +1113,19 @@ export interface components {
1110
1113
  quotesPostResponse: {
1111
1114
  /** The object sent in the PUT /quotes/{ID} callback. */
1112
1115
  quotes: {
1113
- transferAmount: components["schemas"]["Money"];
1114
- payeeReceiveAmount?: components["schemas"]["Money"];
1115
- payeeFspFee?: components["schemas"]["Money"];
1116
- payeeFspCommission?: components["schemas"]["Money"];
1117
- /** Date and time until when the quotation is valid and can be honored when used in the subsequent transaction. */
1118
- expiration: string;
1119
- geoCode?: components["schemas"]["GeoCode"];
1120
- ilpPacket: components["schemas"]["IlpPacket"];
1121
- condition: components["schemas"]["IlpCondition"];
1122
- extensionList?: components["schemas"]["ExtensionList"];
1116
+ body: {
1117
+ transferAmount: components["schemas"]["Money"];
1118
+ payeeReceiveAmount?: components["schemas"]["Money"];
1119
+ payeeFspFee?: components["schemas"]["Money"];
1120
+ payeeFspCommission?: components["schemas"]["Money"];
1121
+ /** Date and time until when the quotation is valid and can be honored when used in the subsequent transaction. */
1122
+ expiration: string;
1123
+ geoCode?: components["schemas"]["GeoCode"];
1124
+ ilpPacket: components["schemas"]["IlpPacket"];
1125
+ condition: components["schemas"]["IlpCondition"];
1126
+ extensionList?: components["schemas"]["ExtensionList"];
1127
+ };
1128
+ headers: { [key: string]: unknown };
1123
1129
  };
1124
1130
  currentState: components["schemas"]["async2SyncCurrentState"];
1125
1131
  };
@@ -1142,7 +1148,10 @@ export interface components {
1142
1148
  transfersPostRequest: components["schemas"]["TransfersPostRequest"];
1143
1149
  };
1144
1150
  simpleTransfersPostResponse: {
1145
- transfer: components["schemas"]["TransfersIDPutResponse"];
1151
+ transfer: {
1152
+ body: components["schemas"]["TransfersIDPutResponse"];
1153
+ headers: { [key: string]: unknown };
1154
+ };
1146
1155
  currentState: components["schemas"]["async2SyncCurrentState"];
1147
1156
  };
1148
1157
  errorSimpleTransfersResponse: components["schemas"]["errorResponse"] & {
@@ -3,9 +3,16 @@
3
3
  description: 'GET /parties/{Type}/{ID} response object'
4
4
  properties:
5
5
  party:
6
- $ref: >-
7
- ../../../../../node_modules/@mojaloop/api-snippets/thirdparty/v1_0/openapi3/components/schemas/Party.yaml
8
- description: Information regarding the requested Party.
6
+ properties:
7
+ body:
8
+ $ref: >-
9
+ ../../../../../node_modules/@mojaloop/api-snippets/thirdparty/v1_0/openapi3/components/schemas/Party.yaml
10
+ description: Information regarding the requested Party.
11
+ headers:
12
+ type: object
13
+ required:
14
+ - body
15
+ - headers
9
16
  currentState:
10
17
  $ref: ../schemas/async2SyncCurrentState.yaml
11
18
  required:
@@ -6,41 +6,49 @@ properties:
6
6
  type: object
7
7
  description: 'The object sent in the PUT /quotes/{ID} callback.'
8
8
  properties:
9
- transferAmount:
10
- $ref: >-
11
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
12
- payeeReceiveAmount:
13
- $ref: >-
14
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
15
- payeeFspFee:
16
- $ref: >-
17
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
18
- payeeFspCommission:
19
- $ref: >-
20
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
21
- expiration:
22
- type: string
23
- description: >-
24
- Date and time until when the quotation is valid and can be honored when
25
- used in the subsequent transaction.
26
- example: '2016-05-24T08:38:08.699-04:00'
27
- geoCode:
28
- $ref: >-
29
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/GeoCode.yaml
30
- ilpPacket:
31
- $ref: >-
32
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/IlpPacket.yaml
33
- condition:
34
- $ref: >-
35
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/IlpCondition.yaml
36
- extensionList:
37
- $ref: >-
38
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/ExtensionList.yaml
9
+ body:
10
+ type: object
11
+ properties:
12
+ transferAmount:
13
+ $ref: >-
14
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
15
+ payeeReceiveAmount:
16
+ $ref: >-
17
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
18
+ payeeFspFee:
19
+ $ref: >-
20
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
21
+ payeeFspCommission:
22
+ $ref: >-
23
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Money.yaml
24
+ expiration:
25
+ type: string
26
+ description: >-
27
+ Date and time until when the quotation is valid and can be honored when
28
+ used in the subsequent transaction.
29
+ example: '2016-05-24T08:38:08.699-04:00'
30
+ geoCode:
31
+ $ref: >-
32
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/GeoCode.yaml
33
+ ilpPacket:
34
+ $ref: >-
35
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/IlpPacket.yaml
36
+ condition:
37
+ $ref: >-
38
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/IlpCondition.yaml
39
+ extensionList:
40
+ $ref: >-
41
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/ExtensionList.yaml
42
+ required:
43
+ - transferAmount
44
+ - expiration
45
+ - ilpPacket
46
+ - condition
47
+ headers:
48
+ type: object
39
49
  required:
40
- - transferAmount
41
- - expiration
42
- - ilpPacket
43
- - condition
50
+ - body
51
+ - headers
44
52
  currentState:
45
53
  $ref: ../schemas/async2SyncCurrentState.yaml
46
54
  required:
@@ -2,8 +2,15 @@ title: SimpleTransfersPostResponse
2
2
  type: object
3
3
  properties:
4
4
  transfer:
5
- $ref: >-
6
- ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/TransfersIDPutResponse.yaml
5
+ properties:
6
+ body:
7
+ $ref: >-
8
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/TransfersIDPutResponse.yaml
9
+ headers:
10
+ type: object
11
+ required:
12
+ - body
13
+ - headers
7
14
  currentState:
8
15
  $ref: ../schemas/async2SyncCurrentState.yaml
9
16
  required:
@@ -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}.`);
@@ -58,12 +58,28 @@ function argsValidation({ type, id, subId }) {
58
58
  }
59
59
  }
60
60
 
61
+ /**
62
+ * @name reformatMessage
63
+ * @description reformats message received from PUB/SUB channel, it is optional method, if not specified identify function is used by default
64
+ * @param {object} message - message received
65
+ * @returns {object} - reformatted message
66
+ */
67
+ function reformatMessage(message) {
68
+ return {
69
+ party: {
70
+ body: { ...message.body.party },
71
+ headers: { ...message.headers }
72
+ }
73
+ };
74
+ }
75
+
61
76
  // generate model
62
77
  const PartiesModel = Async2SyncModel.generate({
63
78
  modelName: 'PartiesModel',
64
79
  channelNameMethod: channelName,
65
80
  requestActionMethod: requestAction,
66
- argsValidationMethod: argsValidation
81
+ argsValidationMethod: argsValidation,
82
+ reformatMessageMethod: reformatMessage
67
83
  });
68
84
 
69
85
  module.exports = PartiesModel;
@@ -13,7 +13,9 @@ describe('/parties', () => {
13
13
 
14
14
  expect(res.status).toEqual(200);
15
15
  expect(res.data.currentState).toEqual('COMPLETED');
16
- expect(typeof res.data.body.party).toEqual('object');
16
+ expect(typeof res.data.party).toEqual('object');
17
+ expect(typeof res.data.party.body).toEqual('object');
18
+ expect(typeof res.data.party.headers).toEqual('object');
17
19
  });
18
20
 
19
21
  test('get - timeout', (done) => {
@@ -30,6 +30,8 @@ describe('/quotes', () => {
30
30
  expect(res.status).toEqual(200);
31
31
  expect(res.data.currentState).toEqual('COMPLETED');
32
32
  expect(typeof res.data.quotes).toEqual('object');
33
+ expect(typeof res.data.quotes.body).toEqual('object');
34
+ expect(typeof res.data.quotes.headers).toEqual('object');
33
35
  });
34
36
 
35
37
  test('post - timeout', (done) => {
@@ -39,6 +39,8 @@ describe('/simpleTransfers', () => {
39
39
  expect(res.status).toEqual(200);
40
40
  expect(res.data.currentState).toEqual('COMPLETED');
41
41
  expect(typeof res.data.transfer).toEqual('object');
42
+ expect(typeof res.data.transfer.body).toEqual('object');
43
+ expect(typeof res.data.transfer.headers).toEqual('object');
42
44
  });
43
45
 
44
46
  test('post - timeout', async () => {
@@ -202,7 +202,7 @@ function createPostTransfersTester(
202
202
 
203
203
  const res = await reqOutbound.post('/transfers').send(postTransfersSimpleBody);
204
204
  const {body} = res;
205
- console.log(body)
205
+
206
206
  expect(res.statusCode).toEqual(responseCode);
207
207
 
208
208
  // remove elements of the response we do not want/need to compare for correctness.
@@ -207,10 +207,13 @@ describe('OutboundBulkQuotesModel', () => {
207
207
  const expectError = {
208
208
  type: 'bulkQuoteResponseError',
209
209
  data: {
210
- errorInformation: {
211
- errorCode: '3205',
212
- errorDescription: 'Bulk quote ID not found'
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
- errorInformation: {
206
- errorCode: '4001',
207
- errorDescription: 'Payer FSP insufficient liquidity'
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
- errorInformation: {
1394
- errorCode: '3205',
1395
- errorDescription: 'Quote ID not found'
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
  }
@@ -155,9 +155,12 @@ describe('PartiesModel', () => {
155
155
  model.run = jest.fn(() => Promise.resolve());
156
156
 
157
157
  const message = {
158
- party: {
159
- Iam: 'the-body'
160
- }
158
+ body: {
159
+ party: {
160
+ Iam: 'the-body'
161
+ }
162
+ },
163
+ headers: {}
161
164
  };
162
165
 
163
166
  const onRequestActionPromise = new Promise((resolve, reject) => {
@@ -175,7 +178,10 @@ describe('PartiesModel', () => {
175
178
 
176
179
  // check that this.context.data is updated
177
180
  expect(model.context.data).toEqual({
178
- ...message,
181
+ party: {
182
+ body: { ...message.body.party },
183
+ headers: { ...message.headers }
184
+ },
179
185
  // current state will be updated by onAfterTransition which isn't called
180
186
  // when manual invocation of transition handler happens
181
187
  currentState: 'start'
@@ -216,9 +222,12 @@ describe('PartiesModel', () => {
216
222
  model.run = jest.fn(() => Promise.resolve());
217
223
 
218
224
  const message = {
219
- party: {
220
- Iam: 'the-body'
221
- }
225
+ body: {
226
+ party: {
227
+ Iam: 'the-body'
228
+ }
229
+ },
230
+ headers: {}
222
231
  };
223
232
 
224
233
  const onRequestActionPromise = new Promise((resolve, reject) => {
@@ -142,7 +142,10 @@ describe('QuotesModel', () => {
142
142
  // mock workflow execution which is tested in separate case
143
143
  model.run = jest.fn(() => Promise.resolve());
144
144
 
145
- const message = { ...putQuotesResponse };
145
+ const message = {
146
+ body: { ...putQuotesResponse },
147
+ headers: {}
148
+ };
146
149
 
147
150
  const onRequestActionPromise = new Promise((resolve, reject) => {
148
151
  // manually invoke transition handler
@@ -200,7 +203,10 @@ describe('QuotesModel', () => {
200
203
  // mock workflow execution which is tested in separate case
201
204
  model.run = jest.fn(() => Promise.resolve());
202
205
 
203
- const message = { ...putQuotesResponse };
206
+ const message = {
207
+ body: { ...putQuotesResponse },
208
+ headers: {}
209
+ };
204
210
 
205
211
  const onRequestActionPromise = new Promise((resolve, reject) => {
206
212
  // manually invoke transition handler
@@ -142,7 +142,10 @@ describe('TransfersModel', () => {
142
142
  // mock workflow execution which is tested in separate case
143
143
  model.run = jest.fn(() => Promise.resolve());
144
144
 
145
- const message = { ...putTransfersResponse };
145
+ const message = {
146
+ body: { ...putTransfersResponse },
147
+ headers: {}
148
+ };
146
149
 
147
150
  const onRequestActionPromise = new Promise((resolve, reject) => {
148
151
  // manually invoke transition handler
@@ -200,7 +203,10 @@ describe('TransfersModel', () => {
200
203
  // mock workflow execution which is tested in separate case
201
204
  model.run = jest.fn(() => Promise.resolve());
202
205
 
203
- const message = { ...putTransfersResponse };
206
+ const message = {
207
+ body: { ...putTransfersResponse },
208
+ headers: {}
209
+ };
204
210
 
205
211
  const onRequestActionPromise = new Promise((resolve, reject) => {
206
212
  // manually invoke transition handler