@mojaloop/sdk-scheme-adapter 13.0.1 → 13.0.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/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # Changelog: [mojaloop/thirdparty-api-svc](https://github.com/mojaloop/thirdparty-api-svc)
2
+ ### [13.0.2](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.1...v13.0.2) (2022-05-12)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * 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))
8
+
2
9
  ### [13.0.1](https://github.com/mojaloop/sdk-scheme-adapter/compare/v13.0.0...v13.0.1) (2022-05-11)
3
10
 
4
11
 
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.2",
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:
@@ -58,12 +58,25 @@ 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: { ...message }
70
+ };
71
+ }
72
+
61
73
  // generate model
62
74
  const PartiesModel = Async2SyncModel.generate({
63
75
  modelName: 'PartiesModel',
64
76
  channelNameMethod: channelName,
65
77
  requestActionMethod: requestAction,
66
- argsValidationMethod: argsValidation
78
+ argsValidationMethod: argsValidation,
79
+ reformatMessageMethod: reformatMessage
67
80
  });
68
81
 
69
82
  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.
@@ -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,7 @@ describe('PartiesModel', () => {
175
178
 
176
179
  // check that this.context.data is updated
177
180
  expect(model.context.data).toEqual({
178
- ...message,
181
+ party: { ...message },
179
182
  // current state will be updated by onAfterTransition which isn't called
180
183
  // when manual invocation of transition handler happens
181
184
  currentState: 'start'
@@ -216,9 +219,12 @@ describe('PartiesModel', () => {
216
219
  model.run = jest.fn(() => Promise.resolve());
217
220
 
218
221
  const message = {
219
- party: {
220
- Iam: 'the-body'
221
- }
222
+ body: {
223
+ party: {
224
+ Iam: 'the-body'
225
+ }
226
+ },
227
+ headers: {}
222
228
  };
223
229
 
224
230
  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