@mojaloop/sdk-scheme-adapter 12.3.0 → 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/.env.example +3 -0
- package/CHANGELOG.md +25 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/trigger_templates/transaction_request_followup.json +2 -2
- package/docker/ml-testing-toolkit/spec_files/rules_callback/default.json +7 -7
- package/docker/ml-testing-toolkit/spec_files/rules_response/default.json +16 -16
- package/docker/ml-testing-toolkit/spec_files/rules_response/default_pisp_rules.json +5 -5
- package/docker/ml-testing-toolkit/spec_files/rules_validation/default.json +10 -10
- package/package.json +3 -3
- package/src/InboundServer/handlers.js +114 -52
- package/src/OutboundServer/api.yaml +105 -32
- package/src/OutboundServer/api_interfaces/openapi.d.ts +46 -16
- package/src/OutboundServer/api_template/components/schemas/accountsResponse.yaml +9 -0
- package/src/OutboundServer/api_template/components/schemas/partiesByIdResponse.yaml +10 -3
- package/src/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +42 -34
- package/src/OutboundServer/api_template/components/schemas/simpleTransfersPostResponse.yaml +9 -2
- package/src/OutboundServer/api_template/components/schemas/transferRequest.yaml +3 -0
- package/src/OutboundServer/api_template/components/schemas/transferResponse.yaml +28 -2
- package/src/OutboundServer/api_template/components/schemas/transferStatusResponse.yaml +8 -1
- package/src/OutboundServer/handlers.js +1 -1
- package/src/config.js +1 -1
- package/src/lib/model/AccountsModel.js +13 -11
- package/src/lib/model/InboundTransfersModel.js +166 -24
- package/src/lib/model/OutboundRequestToPayModel.js +5 -6
- package/src/lib/model/OutboundRequestToPayTransferModel.js +2 -2
- package/src/lib/model/OutboundTransfersModel.js +261 -56
- package/src/lib/model/PartiesModel.js +15 -2
- package/src/lib/model/common/BackendError.js +28 -4
- package/src/lib/model/common/index.js +2 -1
- package/test/__mocks__/@mojaloop/sdk-standard-components.js +3 -2
- package/test/integration/lib/Outbound/parties.test.js +2 -0
- package/test/integration/lib/Outbound/quotes.test.js +2 -0
- package/test/integration/lib/Outbound/simpleTransfers.test.js +2 -0
- package/test/unit/InboundServer.test.js +9 -9
- package/test/unit/TestServer.test.js +11 -13
- package/test/unit/api/accounts/data/postAccountsErrorMojaloopResponse.json +11 -3
- package/test/unit/api/accounts/data/postAccountsSuccessResponse.json +14 -0
- package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError1.json +13 -0
- package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError2.json +18 -0
- package/test/unit/api/accounts/utils.js +15 -1
- package/test/unit/api/transfers/data/getTransfersCommittedResponse.json +18 -15
- package/test/unit/api/transfers/data/getTransfersErrorNotFound.json +1 -0
- package/test/unit/api/transfers/data/postTransfersErrorMojaloopResponse.json +9 -0
- package/test/unit/api/transfers/data/postTransfersErrorTimeoutResponse.json +1 -0
- package/test/unit/api/transfers/data/postTransfersSuccessResponse.json +74 -47
- package/test/unit/api/transfers/utils.js +85 -4
- package/test/unit/data/commonHttpHeaders.json +1 -0
- package/test/unit/inboundApi/handlers.test.js +45 -14
- package/test/unit/lib/model/AccountsModel.test.js +9 -6
- package/test/unit/lib/model/InboundTransfersModel.test.js +210 -30
- package/test/unit/lib/model/OutboundRequestToPayModel.test.js +1 -1
- package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +3 -3
- package/test/unit/lib/model/OutboundTransfersModel.test.js +826 -157
- package/test/unit/lib/model/PartiesModel.test.js +13 -7
- package/test/unit/lib/model/QuotesModel.test.js +8 -2
- package/test/unit/lib/model/TransfersModel.test.js +8 -2
- package/test/unit/lib/model/data/defaultConfig.json +9 -9
- package/test/unit/lib/model/data/mockArguments.json +97 -40
- package/test/unit/lib/model/data/payeeParty.json +13 -11
- package/test/unit/lib/model/data/quoteResponse.json +36 -25
- package/test/unit/lib/model/data/transferFulfil.json +5 -3
|
@@ -1002,6 +1002,12 @@ components:
|
|
|
1002
1002
|
$ref: '#/components/schemas/extensionListEmptiable'
|
|
1003
1003
|
transferRequestExtensions:
|
|
1004
1004
|
$ref: '#/components/schemas/extensionListEmptiable'
|
|
1005
|
+
skipPartyLookup:
|
|
1006
|
+
description: >-
|
|
1007
|
+
Set to true if supplying an FSPID for the payee party and no party
|
|
1008
|
+
resolution is needed. This may be useful is a previous party
|
|
1009
|
+
resolution has been performed.
|
|
1010
|
+
type: boolean
|
|
1005
1011
|
CorrelationId:
|
|
1006
1012
|
title: CorrelationId
|
|
1007
1013
|
type: string
|
|
@@ -1273,8 +1279,24 @@ components:
|
|
|
1273
1279
|
$ref: '#/components/schemas/transferStatus'
|
|
1274
1280
|
quoteId:
|
|
1275
1281
|
$ref: '#/components/schemas/CorrelationId'
|
|
1282
|
+
getPartiesResponse:
|
|
1283
|
+
type: object
|
|
1284
|
+
required:
|
|
1285
|
+
- body
|
|
1286
|
+
properties:
|
|
1287
|
+
body:
|
|
1288
|
+
type: object
|
|
1289
|
+
headers:
|
|
1290
|
+
type: object
|
|
1276
1291
|
quoteResponse:
|
|
1277
|
-
|
|
1292
|
+
type: object
|
|
1293
|
+
required:
|
|
1294
|
+
- body
|
|
1295
|
+
properties:
|
|
1296
|
+
body:
|
|
1297
|
+
$ref: '#/components/schemas/QuotesIDPutResponse'
|
|
1298
|
+
headers:
|
|
1299
|
+
type: object
|
|
1278
1300
|
quoteResponseSource:
|
|
1279
1301
|
type: string
|
|
1280
1302
|
description: >
|
|
@@ -1283,7 +1305,14 @@ components:
|
|
|
1283
1305
|
account in the case of a FOREX transfer. i.e. it may be a FOREX
|
|
1284
1306
|
gateway.
|
|
1285
1307
|
fulfil:
|
|
1286
|
-
|
|
1308
|
+
type: object
|
|
1309
|
+
required:
|
|
1310
|
+
- body
|
|
1311
|
+
properties:
|
|
1312
|
+
body:
|
|
1313
|
+
$ref: '#/components/schemas/TransfersIDPutResponse'
|
|
1314
|
+
headers:
|
|
1315
|
+
type: object
|
|
1287
1316
|
lastError:
|
|
1288
1317
|
description: >
|
|
1289
1318
|
Object representing the last error to occur during a transfer
|
|
@@ -1291,6 +1320,12 @@ components:
|
|
|
1291
1320
|
entity in the scheme or an object representing other types of error
|
|
1292
1321
|
e.g. exceptions that may occur inside the scheme adapter.
|
|
1293
1322
|
$ref: '#/components/schemas/transferError'
|
|
1323
|
+
skipPartyLookup:
|
|
1324
|
+
description: >-
|
|
1325
|
+
Set to true if supplying an FSPID for the payee party and no party
|
|
1326
|
+
resolution is needed. This may be useful is a previous party
|
|
1327
|
+
resolution has been performed.
|
|
1328
|
+
type: boolean
|
|
1294
1329
|
errorResponse:
|
|
1295
1330
|
type: object
|
|
1296
1331
|
properties:
|
|
@@ -1321,7 +1356,14 @@ components:
|
|
|
1321
1356
|
currentState:
|
|
1322
1357
|
$ref: '#/components/schemas/transferStatus'
|
|
1323
1358
|
fulfil:
|
|
1324
|
-
|
|
1359
|
+
type: object
|
|
1360
|
+
required:
|
|
1361
|
+
- body
|
|
1362
|
+
properties:
|
|
1363
|
+
body:
|
|
1364
|
+
$ref: '#/components/schemas/TransfersIDPutResponse'
|
|
1365
|
+
headers:
|
|
1366
|
+
type: object
|
|
1325
1367
|
transferContinuationAcceptParty:
|
|
1326
1368
|
type: object
|
|
1327
1369
|
required:
|
|
@@ -1993,6 +2035,15 @@ components:
|
|
|
1993
2035
|
$ref: '#/components/schemas/accountsCreationState'
|
|
1994
2036
|
lastError:
|
|
1995
2037
|
$ref: '#/components/schemas/transferError'
|
|
2038
|
+
postAccountsResponse:
|
|
2039
|
+
type: object
|
|
2040
|
+
required:
|
|
2041
|
+
- body
|
|
2042
|
+
properties:
|
|
2043
|
+
body:
|
|
2044
|
+
type: object
|
|
2045
|
+
headers:
|
|
2046
|
+
type: object
|
|
1996
2047
|
errorAccountsResponse:
|
|
1997
2048
|
allOf:
|
|
1998
2049
|
- $ref: '#/components/schemas/errorResponse'
|
|
@@ -2073,8 +2124,15 @@ components:
|
|
|
2073
2124
|
description: 'GET /parties/{Type}/{ID} response object'
|
|
2074
2125
|
properties:
|
|
2075
2126
|
party:
|
|
2076
|
-
|
|
2077
|
-
|
|
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
|
|
2078
2136
|
currentState:
|
|
2079
2137
|
$ref: '#/components/schemas/async2SyncCurrentState'
|
|
2080
2138
|
required:
|
|
@@ -2184,33 +2242,41 @@ components:
|
|
|
2184
2242
|
type: object
|
|
2185
2243
|
description: 'The object sent in the PUT /quotes/{ID} callback.'
|
|
2186
2244
|
properties:
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
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
|
|
2209
2277
|
required:
|
|
2210
|
-
-
|
|
2211
|
-
-
|
|
2212
|
-
- ilpPacket
|
|
2213
|
-
- condition
|
|
2278
|
+
- body
|
|
2279
|
+
- headers
|
|
2214
2280
|
currentState:
|
|
2215
2281
|
$ref: '#/components/schemas/async2SyncCurrentState'
|
|
2216
2282
|
required:
|
|
@@ -2265,7 +2331,14 @@ components:
|
|
|
2265
2331
|
type: object
|
|
2266
2332
|
properties:
|
|
2267
2333
|
transfer:
|
|
2268
|
-
|
|
2334
|
+
properties:
|
|
2335
|
+
body:
|
|
2336
|
+
$ref: '#/components/schemas/TransfersIDPutResponse'
|
|
2337
|
+
headers:
|
|
2338
|
+
type: object
|
|
2339
|
+
required:
|
|
2340
|
+
- body
|
|
2341
|
+
- headers
|
|
2269
2342
|
currentState:
|
|
2270
2343
|
$ref: '#/components/schemas/async2SyncCurrentState'
|
|
2271
2344
|
required:
|
|
@@ -633,6 +633,8 @@ export interface components {
|
|
|
633
633
|
note?: components["schemas"]["Note"];
|
|
634
634
|
quoteRequestExtensions?: components["schemas"]["extensionListEmptiable"];
|
|
635
635
|
transferRequestExtensions?: components["schemas"]["extensionListEmptiable"];
|
|
636
|
+
/** Set to true if supplying an FSPID for the payee party and no party resolution is needed. This may be useful is a previous party resolution has been performed. */
|
|
637
|
+
skipPartyLookup?: boolean;
|
|
636
638
|
};
|
|
637
639
|
/** Identifier that correlates all messages of the same sequence. The API data type UUID (Universally Unique Identifier) is a JSON String in canonical format, conforming to [RFC 4122](https://tools.ietf.org/html/rfc4122), that is restricted by a regular expression for interoperability reasons. A UUID is always 36 characters long, 32 hexadecimal symbols and 4 dashes (‘-‘). */
|
|
638
640
|
CorrelationId: string;
|
|
@@ -728,12 +730,24 @@ export interface components {
|
|
|
728
730
|
note?: components["schemas"]["Note"];
|
|
729
731
|
currentState?: components["schemas"]["transferStatus"];
|
|
730
732
|
quoteId?: components["schemas"]["CorrelationId"];
|
|
731
|
-
|
|
733
|
+
getPartiesResponse?: {
|
|
734
|
+
body: { [key: string]: unknown };
|
|
735
|
+
headers?: { [key: string]: unknown };
|
|
736
|
+
};
|
|
737
|
+
quoteResponse?: {
|
|
738
|
+
body: components["schemas"]["QuotesIDPutResponse"];
|
|
739
|
+
headers?: { [key: string]: unknown };
|
|
740
|
+
};
|
|
732
741
|
/** FSPID of the entity that supplied the quote response. This may not be the same as the FSPID of the entity which owns the end user account in the case of a FOREX transfer. i.e. it may be a FOREX gateway. */
|
|
733
742
|
quoteResponseSource?: string;
|
|
734
|
-
fulfil?:
|
|
743
|
+
fulfil?: {
|
|
744
|
+
body: components["schemas"]["TransfersIDPutResponse"];
|
|
745
|
+
headers?: { [key: string]: unknown };
|
|
746
|
+
};
|
|
735
747
|
/** Object representing the last error to occur during a transfer process. This may be a Mojaloop API error returned from another entity in the scheme or an object representing other types of error e.g. exceptions that may occur inside the scheme adapter. */
|
|
736
748
|
lastError?: components["schemas"]["transferError"];
|
|
749
|
+
/** Set to true if supplying an FSPID for the payee party and no party resolution is needed. This may be useful is a previous party resolution has been performed. */
|
|
750
|
+
skipPartyLookup?: boolean;
|
|
737
751
|
};
|
|
738
752
|
errorResponse: {
|
|
739
753
|
/** Error code as string. */
|
|
@@ -747,7 +761,10 @@ export interface components {
|
|
|
747
761
|
transferStatusResponse: {
|
|
748
762
|
transferId: components["schemas"]["CorrelationId"];
|
|
749
763
|
currentState: components["schemas"]["transferStatus"];
|
|
750
|
-
fulfil:
|
|
764
|
+
fulfil: {
|
|
765
|
+
body: components["schemas"]["TransfersIDPutResponse"];
|
|
766
|
+
headers?: { [key: string]: unknown };
|
|
767
|
+
};
|
|
751
768
|
};
|
|
752
769
|
transferContinuationAcceptParty: {
|
|
753
770
|
acceptParty: true;
|
|
@@ -1011,6 +1028,10 @@ export interface components {
|
|
|
1011
1028
|
response?: components["schemas"]["accountCreationStatus"];
|
|
1012
1029
|
currentState?: components["schemas"]["accountsCreationState"];
|
|
1013
1030
|
lastError?: components["schemas"]["transferError"];
|
|
1031
|
+
postAccountsResponse?: {
|
|
1032
|
+
body: { [key: string]: unknown };
|
|
1033
|
+
headers?: { [key: string]: unknown };
|
|
1034
|
+
};
|
|
1014
1035
|
};
|
|
1015
1036
|
errorAccountsResponse: components["schemas"]["errorResponse"] & {
|
|
1016
1037
|
executionState: components["schemas"]["accountsResponse"];
|
|
@@ -1049,8 +1070,11 @@ export interface components {
|
|
|
1049
1070
|
| "ERROR_OCCURRED";
|
|
1050
1071
|
/** GET /parties/{Type}/{ID} response object */
|
|
1051
1072
|
partiesByIdResponse: {
|
|
1052
|
-
|
|
1053
|
-
|
|
1073
|
+
party: {
|
|
1074
|
+
/** Information regarding the requested Party. */
|
|
1075
|
+
body: components["schemas"]["Party"];
|
|
1076
|
+
headers: { [key: string]: unknown };
|
|
1077
|
+
};
|
|
1054
1078
|
currentState: components["schemas"]["async2SyncCurrentState"];
|
|
1055
1079
|
};
|
|
1056
1080
|
/** The object sent in the POST /quotes request. */
|
|
@@ -1089,16 +1113,19 @@ export interface components {
|
|
|
1089
1113
|
quotesPostResponse: {
|
|
1090
1114
|
/** The object sent in the PUT /quotes/{ID} callback. */
|
|
1091
1115
|
quotes: {
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
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 };
|
|
1102
1129
|
};
|
|
1103
1130
|
currentState: components["schemas"]["async2SyncCurrentState"];
|
|
1104
1131
|
};
|
|
@@ -1121,7 +1148,10 @@ export interface components {
|
|
|
1121
1148
|
transfersPostRequest: components["schemas"]["TransfersPostRequest"];
|
|
1122
1149
|
};
|
|
1123
1150
|
simpleTransfersPostResponse: {
|
|
1124
|
-
transfer:
|
|
1151
|
+
transfer: {
|
|
1152
|
+
body: components["schemas"]["TransfersIDPutResponse"];
|
|
1153
|
+
headers: { [key: string]: unknown };
|
|
1154
|
+
};
|
|
1125
1155
|
currentState: components["schemas"]["async2SyncCurrentState"];
|
|
1126
1156
|
};
|
|
1127
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
|
|
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
|
-
|
|
6
|
-
|
|
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:
|
|
@@ -35,3 +35,6 @@ properties:
|
|
|
35
35
|
$ref: ./extensionListEmptiable.yaml
|
|
36
36
|
transferRequestExtensions:
|
|
37
37
|
$ref: ./extensionListEmptiable.yaml
|
|
38
|
+
skipPartyLookup:
|
|
39
|
+
description: Set to true if supplying an FSPID for the payee party and no party resolution is needed. This may be useful is a previous party resolution has been performed.
|
|
40
|
+
type: boolean
|
|
@@ -39,8 +39,24 @@ properties:
|
|
|
39
39
|
quoteId:
|
|
40
40
|
$ref: >-
|
|
41
41
|
../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
|
|
42
|
+
getPartiesResponse:
|
|
43
|
+
type: object
|
|
44
|
+
required:
|
|
45
|
+
- body
|
|
46
|
+
properties:
|
|
47
|
+
body:
|
|
48
|
+
type: object
|
|
49
|
+
headers:
|
|
50
|
+
type: object
|
|
42
51
|
quoteResponse:
|
|
43
|
-
|
|
52
|
+
type: object
|
|
53
|
+
required:
|
|
54
|
+
- body
|
|
55
|
+
properties:
|
|
56
|
+
body:
|
|
57
|
+
$ref: './quote.yaml'
|
|
58
|
+
headers:
|
|
59
|
+
type: object
|
|
44
60
|
quoteResponseSource:
|
|
45
61
|
type: string
|
|
46
62
|
description: >
|
|
@@ -48,7 +64,14 @@ properties:
|
|
|
48
64
|
same as the FSPID of the entity which owns the end user account in the
|
|
49
65
|
case of a FOREX transfer. i.e. it may be a FOREX gateway.
|
|
50
66
|
fulfil:
|
|
51
|
-
|
|
67
|
+
type: object
|
|
68
|
+
required:
|
|
69
|
+
- body
|
|
70
|
+
properties:
|
|
71
|
+
body:
|
|
72
|
+
$ref: ./transferFulfilment.yaml
|
|
73
|
+
headers:
|
|
74
|
+
type: object
|
|
52
75
|
lastError:
|
|
53
76
|
description: >
|
|
54
77
|
Object representing the last error to occur during a transfer process.
|
|
@@ -56,3 +79,6 @@ properties:
|
|
|
56
79
|
scheme or an object representing other types of error e.g. exceptions that
|
|
57
80
|
may occur inside the scheme adapter.
|
|
58
81
|
$ref: ./transferError.yaml
|
|
82
|
+
skipPartyLookup:
|
|
83
|
+
description: Set to true if supplying an FSPID for the payee party and no party resolution is needed. This may be useful is a previous party resolution has been performed.
|
|
84
|
+
type: boolean
|
|
@@ -182,7 +182,7 @@ const putTransfers = async (ctx) => {
|
|
|
182
182
|
// load the transfer model from cache and start it running again
|
|
183
183
|
await model.load(ctx.state.path.params.transferId);
|
|
184
184
|
|
|
185
|
-
const response = await model.run();
|
|
185
|
+
const response = await model.run(ctx.request.body);
|
|
186
186
|
|
|
187
187
|
// return the result
|
|
188
188
|
ctx.response.status = 200;
|
package/src/config.js
CHANGED
|
@@ -182,5 +182,5 @@ module.exports = {
|
|
|
182
182
|
// the `transactionId` to retrieve the quote from cache
|
|
183
183
|
allowDifferentTransferTransactionId: env.get('ALLOW_DIFFERENT_TRANSFER_TRANSACTION_ID').default('false').asBool(),
|
|
184
184
|
|
|
185
|
-
pm4mlEnabled: env.get('PM4ML_ENABLED').default('false').asBool()
|
|
185
|
+
pm4mlEnabled: env.get('PM4ML_ENABLED').default('false').asBool(),
|
|
186
186
|
};
|
|
@@ -133,20 +133,23 @@ class AccountsModel {
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
async _executeCreateAccountsRequest(request) {
|
|
136
|
+
const accountRequest = request;
|
|
137
|
+
|
|
136
138
|
// eslint-disable-next-line no-async-promise-executor
|
|
137
139
|
return new Promise(async (resolve, reject) => {
|
|
138
|
-
const requestKey = `ac_${
|
|
140
|
+
const requestKey = `ac_${accountRequest.requestId}`;
|
|
139
141
|
|
|
140
142
|
const subId = await this._cache.subscribe(requestKey, async (cn, msg, subId) => {
|
|
141
143
|
try {
|
|
142
144
|
let error;
|
|
143
|
-
|
|
145
|
+
const message = JSON.parse(msg);
|
|
146
|
+
this._data.postAccountsResponse = message.data;
|
|
144
147
|
|
|
145
148
|
if (message.type === 'accountsCreationErrorResponse') {
|
|
146
|
-
error = new BackendError(`Got an error response creating accounts: ${util.inspect(
|
|
147
|
-
error.mojaloopError =
|
|
149
|
+
error = new BackendError(`Got an error response creating accounts: ${util.inspect(this._data.postAccountsResponse.body)}`, 500);
|
|
150
|
+
error.mojaloopError = this._data.postAccountsResponse.body;
|
|
148
151
|
} else if (message.type !== 'accountsCreationSuccessfulResponse') {
|
|
149
|
-
this._logger.push(
|
|
152
|
+
this._logger.push(util.inspect(this._data.postAccountsResponse)).log(
|
|
150
153
|
`Ignoring cache notification for request ${requestKey}. ` +
|
|
151
154
|
`Unknown message type ${message.type}.`
|
|
152
155
|
);
|
|
@@ -167,7 +170,7 @@ class AccountsModel {
|
|
|
167
170
|
return reject(error);
|
|
168
171
|
}
|
|
169
172
|
|
|
170
|
-
const response =
|
|
173
|
+
const response = this._data.postAccountsResponse;
|
|
171
174
|
this._logger.push({ response }).log('Account creation response received');
|
|
172
175
|
return resolve(response);
|
|
173
176
|
}
|
|
@@ -178,7 +181,7 @@ class AccountsModel {
|
|
|
178
181
|
|
|
179
182
|
// set up a timeout for the request
|
|
180
183
|
const timeout = setTimeout(() => {
|
|
181
|
-
const err = new BackendError(`Timeout waiting for response to account creation request ${
|
|
184
|
+
const err = new BackendError(`Timeout waiting for response to account creation request ${accountRequest.requestId}`, 504);
|
|
182
185
|
|
|
183
186
|
// we dont really care if the unsubscribe fails but we should log it regardless
|
|
184
187
|
this._cache.unsubscribe(requestKey, subId).catch(e => {
|
|
@@ -191,7 +194,7 @@ class AccountsModel {
|
|
|
191
194
|
// now we have a timeout handler and a cache subscriber hooked up we can fire off
|
|
192
195
|
// a POST /participants request to the switch
|
|
193
196
|
try {
|
|
194
|
-
const res = await this._requests.postParticipants(
|
|
197
|
+
const res = await this._requests.postParticipants(accountRequest);
|
|
195
198
|
this._logger.push({ res }).log('Account creation request sent to peer');
|
|
196
199
|
}
|
|
197
200
|
catch(err) {
|
|
@@ -218,11 +221,11 @@ class AccountsModel {
|
|
|
218
221
|
}
|
|
219
222
|
|
|
220
223
|
_buildClientResponse(response) {
|
|
221
|
-
return response.partyList.map(party => ({
|
|
224
|
+
return response.body.partyList.map(party => ({
|
|
222
225
|
idType: party.partyId.partyIdType,
|
|
223
226
|
idValue: party.partyId.partyIdentifier,
|
|
224
227
|
idSubValue: party.partyId.partySubIdOrType,
|
|
225
|
-
...!response.currency && {
|
|
228
|
+
...!response.body.currency && {
|
|
226
229
|
error: {
|
|
227
230
|
statusCode: Errors.MojaloopApiErrorCodes.CLIENT_ERROR.code,
|
|
228
231
|
message: 'Provided currency not supported',
|
|
@@ -295,7 +298,6 @@ class AccountsModel {
|
|
|
295
298
|
resp.currentState = stateEnum.ERROR_OCCURRED;
|
|
296
299
|
break;
|
|
297
300
|
}
|
|
298
|
-
|
|
299
301
|
return resp;
|
|
300
302
|
}
|
|
301
303
|
|