@mojaloop/sdk-scheme-adapter 18.0.0 → 18.0.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/.dockerignore +18 -0
- package/.eslintignore +2 -0
- package/CHANGELOG.md +8 -0
- package/audit-resolve.json +5 -0
- package/package.json +2 -2
- package/test/__mocks__/@mojaloop/sdk-standard-components.js +0 -151
- package/test/__mocks__/javascript-state-machine.js +0 -21
- package/test/__mocks__/redis.js +0 -78
- package/test/__mocks__/uuidv4.js +0 -16
- package/test/config/integration.env +0 -146
- package/test/integration/lib/Outbound/data/quotesPostRequest.json +0 -52
- package/test/integration/lib/Outbound/data/transfersPostRequest.json +0 -24
- package/test/integration/lib/Outbound/parties.test.js +0 -31
- package/test/integration/lib/Outbound/quotes.test.js +0 -62
- package/test/integration/lib/Outbound/simpleTransfers.test.js +0 -70
- package/test/integration/lib/cache.test.js +0 -79
- package/test/integration/testEnv.js +0 -4
- package/test/unit/ControlClient.test.js +0 -69
- package/test/unit/ControlServer/events.js +0 -41
- package/test/unit/ControlServer/index.js +0 -227
- package/test/unit/ControlServer.test.js +0 -66
- package/test/unit/InboundServer.test.js +0 -443
- package/test/unit/TestServer.test.js +0 -392
- package/test/unit/api/accounts/accounts.test.js +0 -128
- package/test/unit/api/accounts/data/postAccountsBody.json +0 -7
- package/test/unit/api/accounts/data/postAccountsErrorMojaloopResponse.json +0 -33
- package/test/unit/api/accounts/data/postAccountsErrorTimeoutResponse.json +0 -19
- package/test/unit/api/accounts/data/postAccountsSuccessResponse.json +0 -31
- package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError1.json +0 -34
- package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError2.json +0 -39
- package/test/unit/api/accounts/utils.js +0 -79
- package/test/unit/api/proxy/data/proxyConfig.yaml +0 -82
- package/test/unit/api/proxy/data/requestBody.json +0 -22
- package/test/unit/api/proxy/data/requestHeaders.json +0 -5
- package/test/unit/api/proxy/data/requestQuery.json +0 -6
- package/test/unit/api/proxy/data/responseBody.json +0 -21
- package/test/unit/api/proxy/data/responseHeaders.json +0 -5
- package/test/unit/api/proxy/proxy.test.js +0 -220
- package/test/unit/api/proxy/utils.js +0 -79
- package/test/unit/api/transfers/data/getTransfersCommittedResponse.json +0 -24
- package/test/unit/api/transfers/data/getTransfersErrorNotFound.json +0 -18
- package/test/unit/api/transfers/data/postQuotesBody.json +0 -52
- package/test/unit/api/transfers/data/postTransfersBadBody.json +0 -17
- package/test/unit/api/transfers/data/postTransfersBody.json +0 -24
- package/test/unit/api/transfers/data/postTransfersErrorMojaloopResponse.json +0 -62
- package/test/unit/api/transfers/data/postTransfersErrorTimeoutResponse.json +0 -48
- package/test/unit/api/transfers/data/postTransfersSimpleBody.json +0 -26
- package/test/unit/api/transfers/data/postTransfersSuccessResponse.json +0 -128
- package/test/unit/api/transfers/data/putPartiesBody.json +0 -20
- package/test/unit/api/transfers/data/putQuotesBody.json +0 -37
- package/test/unit/api/transfers/data/putTransfersBody.json +0 -17
- package/test/unit/api/transfers/transfers.test.js +0 -191
- package/test/unit/api/transfers/utils.js +0 -264
- package/test/unit/api/utils.js +0 -86
- package/test/unit/config.test.js +0 -119
- package/test/unit/data/commonHttpHeaders.json +0 -7
- package/test/unit/data/defaultConfig.json +0 -70
- package/test/unit/data/postQuotesBody.json +0 -52
- package/test/unit/data/putParticipantsBody.json +0 -12
- package/test/unit/data/putPartiesBody.json +0 -20
- package/test/unit/data/testFile.json +0 -29
- package/test/unit/data/testFile.yaml +0 -14
- package/test/unit/inboundApi/data/mockArguments.json +0 -117
- package/test/unit/inboundApi/data/mockTransactionRequest.json +0 -42
- package/test/unit/inboundApi/handlers.test.js +0 -786
- package/test/unit/index.test.js +0 -88
- package/test/unit/lib/cache.test.js +0 -145
- package/test/unit/lib/model/AccountsModel.test.js +0 -124
- package/test/unit/lib/model/InboundTransfersModel.test.js +0 -889
- package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +0 -253
- package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +0 -247
- package/test/unit/lib/model/OutboundRequestToPayModel.test.js +0 -166
- package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +0 -245
- package/test/unit/lib/model/OutboundTransfersModel.test.js +0 -1579
- package/test/unit/lib/model/PartiesModel.test.js +0 -478
- package/test/unit/lib/model/QuotesModel.test.js +0 -477
- package/test/unit/lib/model/TransfersModel.test.js +0 -481
- package/test/unit/lib/model/common/PersistentStateMachine.test.js +0 -178
- package/test/unit/lib/model/data/authorizationsResponse.json +0 -13
- package/test/unit/lib/model/data/bulkQuoteRequest.json +0 -27
- package/test/unit/lib/model/data/bulkQuoteResponse.json +0 -35
- package/test/unit/lib/model/data/bulkTransferFulfil.json +0 -13
- package/test/unit/lib/model/data/bulkTransferRequest.json +0 -29
- package/test/unit/lib/model/data/defaultConfig.json +0 -59
- package/test/unit/lib/model/data/getBulkTransfersBackendResponse.json +0 -42
- package/test/unit/lib/model/data/getBulkTransfersMojaloopResponse.json +0 -22
- package/test/unit/lib/model/data/getTransfersBackendResponse.json +0 -34
- package/test/unit/lib/model/data/getTransfersMojaloopResponse.json +0 -17
- package/test/unit/lib/model/data/mockArguments.json +0 -188
- package/test/unit/lib/model/data/mockTxnRequestsArguments.json +0 -63
- package/test/unit/lib/model/data/notificationAbortedToPayee.json +0 -10
- package/test/unit/lib/model/data/notificationReservedToPayee.json +0 -10
- package/test/unit/lib/model/data/notificationToPayee.json +0 -10
- package/test/unit/lib/model/data/payeeParty.json +0 -18
- package/test/unit/lib/model/data/putQuotesResponse.json +0 -33
- package/test/unit/lib/model/data/putTransfersResponse.json +0 -5
- package/test/unit/lib/model/data/quoteResponse.json +0 -42
- package/test/unit/lib/model/data/requestToPayRequest.json +0 -20
- package/test/unit/lib/model/data/requestToPayTransferRequest.json +0 -27
- package/test/unit/lib/model/data/transactionRequestResponse.json +0 -18
- package/test/unit/lib/model/data/transferFulfil.json +0 -10
- package/test/unit/lib/model/data/transferRequest.json +0 -26
- package/test/unit/lib/model/mockedLibRequests.js +0 -74
- package/test/unit/mockLogger.js +0 -39
- package/test/unit/outboundApi/data/bulkQuoteRequest.json +0 -28
- package/test/unit/outboundApi/data/bulkTransferRequest.json +0 -28
- package/test/unit/outboundApi/data/mockBulkQuoteError.json +0 -45
- package/test/unit/outboundApi/data/mockBulkTransferError.json +0 -48
- package/test/unit/outboundApi/data/mockError.json +0 -41
- package/test/unit/outboundApi/data/mockGetPartiesError.json +0 -4
- package/test/unit/outboundApi/data/mockRequestToPayError.json +0 -32
- package/test/unit/outboundApi/data/mockRequestToPayTransferError.json +0 -39
- package/test/unit/outboundApi/data/requestToPay.json +0 -21
- package/test/unit/outboundApi/data/requestToPayTransferRequest.json +0 -20
- package/test/unit/outboundApi/data/transferRequest.json +0 -21
- package/test/unit/outboundApi/handlers.test.js +0 -887
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"message": "Got an error response resolving party: {\n errorInformation: { errorCode: '3204', errorDescription: 'Party not found' }\n}",
|
|
3
|
-
"statusCode": "3204",
|
|
4
|
-
"transferState": {
|
|
5
|
-
"direction": "OUTBOUND",
|
|
6
|
-
"amount": "100",
|
|
7
|
-
"amountType": "SEND",
|
|
8
|
-
"currency": "USD",
|
|
9
|
-
"currentState": "ERROR_OCCURRED",
|
|
10
|
-
"from": {
|
|
11
|
-
"displayName": "John Doe",
|
|
12
|
-
"idType": "MSISDN",
|
|
13
|
-
"idValue": "123456789"
|
|
14
|
-
},
|
|
15
|
-
"getPartiesResponse": {
|
|
16
|
-
"body": {
|
|
17
|
-
"errorInformation": {
|
|
18
|
-
"errorCode": "3204",
|
|
19
|
-
"errorDescription": "Party not found"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"homeTransactionId": "123ABC",
|
|
24
|
-
"lastError": {
|
|
25
|
-
"httpStatusCode": 500,
|
|
26
|
-
"mojaloopError": {
|
|
27
|
-
"errorInformation": {
|
|
28
|
-
"errorCode": "3204",
|
|
29
|
-
"errorDescription": "Party not found"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"note": "test payment",
|
|
34
|
-
"quoteRequestExtensions": [
|
|
35
|
-
{
|
|
36
|
-
"key": "qreqkey1",
|
|
37
|
-
"value": "qreqvalue1"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"key": "qreqkey2",
|
|
41
|
-
"value": "qreqvalue2"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"to": {
|
|
45
|
-
"idSubValue": "PASSPORT",
|
|
46
|
-
"idType": "PERSONAL_ID",
|
|
47
|
-
"idValue": "987654321"
|
|
48
|
-
},
|
|
49
|
-
"transactionType": "TRANSFER",
|
|
50
|
-
"transferId": "00000000-0000-1000-8000-000000000001",
|
|
51
|
-
"transferRequestExtensions": [
|
|
52
|
-
{
|
|
53
|
-
"key": "treqkey1",
|
|
54
|
-
"value": "treqvalue1"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"key": "treqkey2",
|
|
58
|
-
"value": "treqvalue2"
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"message": "Timeout resolving payee for transfer 00000000-0000-1000-8000-000000000001",
|
|
3
|
-
"statusCode": "504",
|
|
4
|
-
"transferState": {
|
|
5
|
-
"amount": "100",
|
|
6
|
-
"amountType": "SEND",
|
|
7
|
-
"currency": "USD",
|
|
8
|
-
"direction": "OUTBOUND",
|
|
9
|
-
"currentState": "ERROR_OCCURRED",
|
|
10
|
-
"from": {
|
|
11
|
-
"displayName": "John Doe",
|
|
12
|
-
"idType": "MSISDN",
|
|
13
|
-
"idValue": "123456789"
|
|
14
|
-
},
|
|
15
|
-
"homeTransactionId": "123ABC",
|
|
16
|
-
"lastError": {
|
|
17
|
-
"httpStatusCode": 504
|
|
18
|
-
},
|
|
19
|
-
"note": "test payment",
|
|
20
|
-
"quoteRequestExtensions": [
|
|
21
|
-
{
|
|
22
|
-
"key": "qreqkey1",
|
|
23
|
-
"value": "qreqvalue1"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"key": "qreqkey2",
|
|
27
|
-
"value": "qreqvalue2"
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"to": {
|
|
31
|
-
"idSubValue": "PASSPORT",
|
|
32
|
-
"idType": "PERSONAL_ID",
|
|
33
|
-
"idValue": "987654321"
|
|
34
|
-
},
|
|
35
|
-
"transactionType": "TRANSFER",
|
|
36
|
-
"transferId": "00000000-0000-1000-8000-000000000001",
|
|
37
|
-
"transferRequestExtensions": [
|
|
38
|
-
{
|
|
39
|
-
"key": "treqkey1",
|
|
40
|
-
"value": "treqvalue1"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"key": "treqkey2",
|
|
44
|
-
"value": "treqvalue2"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"from": {
|
|
3
|
-
"displayName": "John Doe",
|
|
4
|
-
"idType": "MSISDN",
|
|
5
|
-
"idValue": "123456789"
|
|
6
|
-
},
|
|
7
|
-
"to": {
|
|
8
|
-
"idType": "PERSONAL_ID",
|
|
9
|
-
"idValue": "987654321",
|
|
10
|
-
"idSubValue": "PASSPORT"
|
|
11
|
-
},
|
|
12
|
-
"amountType": "SEND",
|
|
13
|
-
"currency": "USD",
|
|
14
|
-
"amount": "100",
|
|
15
|
-
"transactionType": "TRANSFER",
|
|
16
|
-
"note": "test payment",
|
|
17
|
-
"homeTransactionId": "123ABC",
|
|
18
|
-
"quoteRequestExtensions": [
|
|
19
|
-
{ "key": "qreqkey1", "value": "qreqvalue1" },
|
|
20
|
-
{ "key": "qreqkey2", "value": "qreqvalue2" }
|
|
21
|
-
],
|
|
22
|
-
"transferRequestExtensions": [
|
|
23
|
-
{ "key": "treqkey1", "value": "treqvalue1" },
|
|
24
|
-
{ "key": "treqkey2", "value": "treqvalue2" }
|
|
25
|
-
]
|
|
26
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"amount": "100",
|
|
3
|
-
"amountType": "SEND",
|
|
4
|
-
"currency": "USD",
|
|
5
|
-
"currentState": "COMPLETED",
|
|
6
|
-
"direction": "OUTBOUND",
|
|
7
|
-
"from": {
|
|
8
|
-
"displayName": "John Doe",
|
|
9
|
-
"idType": "MSISDN",
|
|
10
|
-
"idValue": "123456789"
|
|
11
|
-
},
|
|
12
|
-
"fulfil": {
|
|
13
|
-
"body": {
|
|
14
|
-
"completedTimestamp": "2017-11-15T14:16:09.663+01:00",
|
|
15
|
-
"extensionList": {
|
|
16
|
-
"extension": [
|
|
17
|
-
{
|
|
18
|
-
"key": "treskey1",
|
|
19
|
-
"value": "tresvalue1"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"key": "treskey2",
|
|
23
|
-
"value": "tresvalue2"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
"fulfilment": "87mm1reS3SAi8oIWXgBkLmgWc1MkZ_yLbFDX5XAdo5o",
|
|
28
|
-
"transferState": "COMMITTED"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"getPartiesResponse": {
|
|
32
|
-
"body": {
|
|
33
|
-
"party": {
|
|
34
|
-
"merchantClassificationCode": "1234",
|
|
35
|
-
"name": "John Doe",
|
|
36
|
-
"partyIdInfo": {
|
|
37
|
-
"fspId": "sim",
|
|
38
|
-
"partyIdType": "PERSONAL_ID",
|
|
39
|
-
"partyIdentifier": "987654321",
|
|
40
|
-
"partySubIdOrType": "PASSPORT"
|
|
41
|
-
},
|
|
42
|
-
"personalInfo": {
|
|
43
|
-
"complexName": {
|
|
44
|
-
"firstName": "John",
|
|
45
|
-
"lastName": "Doe",
|
|
46
|
-
"middleName": "Someone"
|
|
47
|
-
},
|
|
48
|
-
"dateOfBirth": "1980-01-01"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"homeTransactionId": "123ABC",
|
|
54
|
-
"note": "test payment",
|
|
55
|
-
"quoteId": "00000000-0000-1000-8000-000000000002",
|
|
56
|
-
"quoteRequestExtensions": [
|
|
57
|
-
{
|
|
58
|
-
"key": "qreqkey1",
|
|
59
|
-
"value": "qreqvalue1"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"key": "qreqkey2",
|
|
63
|
-
"value": "qreqvalue2"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
"quoteResponse": {
|
|
67
|
-
"body": {
|
|
68
|
-
"condition": "fH9pAYDQbmoZLPbvv3CSW2RfjU4jvM4ApG_fqGnR7Xs",
|
|
69
|
-
"expiration": "2017-11-15T14:17:09.663+01:00",
|
|
70
|
-
"extensionList": {
|
|
71
|
-
"extension": [
|
|
72
|
-
{
|
|
73
|
-
"key": "qreskey1",
|
|
74
|
-
"value": "qresvalue1"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"key": "qreskey2",
|
|
78
|
-
"value": "qresvalue2"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
"geoCode": {
|
|
83
|
-
"latitude": "53.295971",
|
|
84
|
-
"longitude": "-0.038500"
|
|
85
|
-
},
|
|
86
|
-
"ilpPacket": "AQAAAAAAACasIWcuc2UubW9iaWxlbW9uZXkubXNpc2RuLjEyMzQ1Njc4OYIEIXsNCiAgICAidHJhbnNhY3Rpb25JZCI6ICI4NWZlYWMyZi0zOWIyLTQ5MWItODE3ZS00YTAzMjAzZDRmMTQiLA0KICAgICJxdW90ZUlkIjogIjdjMjNlODBjLWQwNzgtNDA3Ny04MjYzLTJjMDQ3ODc2ZmNmNiIsDQogICAgInBheWVlIjogew0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiTVNJU0ROIiwNCiAgICAgICAgICAgICJwYXJ0eUlkZW50aWZpZXIiOiAiMTIzNDU2Nzg5IiwNCiAgICAgICAgICAgICJmc3BJZCI6ICJNb2JpbGVNb25leSINCiAgICAgICAgfSwNCiAgICAgICAgInBlcnNvbmFsSW5mbyI6IHsNCiAgICAgICAgICAgICJjb21wbGV4TmFtZSI6IHsNCiAgICAgICAgICAgICAgICAiZmlyc3ROYW1lIjogIkhlbnJpayIsDQogICAgICAgICAgICAgICAgImxhc3ROYW1lIjogIkthcmxzc29uIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfSwNCiAgICAicGF5ZXIiOiB7DQogICAgICAgICJwZXJzb25hbEluZm8iOiB7DQogICAgICAgICAgICAiY29tcGxleE5hbWUiOiB7DQogICAgICAgICAgICAgICAgImZpcnN0TmFtZSI6ICJNYXRzIiwNCiAgICAgICAgICAgICAgICAibGFzdE5hbWUiOiAiSGFnbWFuIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9LA0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiSUJBTiIsDQogICAgICAgICAgICAicGFydHlJZGVudGlmaWVyIjogIlNFNDU1MDAwMDAwMDA1ODM5ODI1NzQ2NiIsDQogICAgICAgICAgICAiZnNwSWQiOiAiQmFua05yT25lIg0KICAgICAgICB9DQogICAgfSwNCiAgICAiYW1vdW50Ijogew0KICAgICAgICAiYW1vdW50IjogIjEwMCIsDQogICAgICAgICJjdXJyZW5jeSI6ICJVU0QiDQogICAgfSwNCiAgICAidHJhbnNhY3Rpb25UeXBlIjogew0KICAgICAgICAic2NlbmFyaW8iOiAiVFJBTlNGRVIiLA0KICAgICAgICAiaW5pdGlhdG9yIjogIlBBWUVSIiwNCiAgICAgICAgImluaXRpYXRvclR5cGUiOiAiQ09OU1VNRVIiDQogICAgfSwNCiAgICAibm90ZSI6ICJGcm9tIE1hdHMiDQp9DQo==",
|
|
87
|
-
"payeeFspCommission": {
|
|
88
|
-
"amount": "5",
|
|
89
|
-
"currency": "USD"
|
|
90
|
-
},
|
|
91
|
-
"payeeFspFee": {
|
|
92
|
-
"amount": "5",
|
|
93
|
-
"currency": "USD"
|
|
94
|
-
},
|
|
95
|
-
"payeeReceiveAmount": {
|
|
96
|
-
"amount": "490",
|
|
97
|
-
"currency": "USD"
|
|
98
|
-
},
|
|
99
|
-
"transferAmount": {
|
|
100
|
-
"amount": "500",
|
|
101
|
-
"currency": "USD"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"quoteResponseSource": "mojaloop-sdk",
|
|
106
|
-
"to": {
|
|
107
|
-
"dateOfBirth": "1980-01-01",
|
|
108
|
-
"firstName": "John",
|
|
109
|
-
"fspId": "sim",
|
|
110
|
-
"idSubValue": "PASSPORT",
|
|
111
|
-
"idType": "PERSONAL_ID",
|
|
112
|
-
"idValue": "987654321",
|
|
113
|
-
"lastName": "Doe",
|
|
114
|
-
"middleName": "Someone"
|
|
115
|
-
},
|
|
116
|
-
"transactionType": "TRANSFER",
|
|
117
|
-
"transferId": "00000000-0000-1000-8000-000000000001",
|
|
118
|
-
"transferRequestExtensions": [
|
|
119
|
-
{
|
|
120
|
-
"key": "treqkey1",
|
|
121
|
-
"value": "treqvalue1"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"key": "treqkey2",
|
|
125
|
-
"value": "treqvalue2"
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"party": {
|
|
3
|
-
"partyIdInfo": {
|
|
4
|
-
"partyIdType": "PERSONAL_ID",
|
|
5
|
-
"partyIdentifier": "987654321",
|
|
6
|
-
"partySubIdOrType": "PASSPORT",
|
|
7
|
-
"fspId": "sim"
|
|
8
|
-
},
|
|
9
|
-
"personalInfo": {
|
|
10
|
-
"complexName": {
|
|
11
|
-
"firstName": "John",
|
|
12
|
-
"middleName": "Someone",
|
|
13
|
-
"lastName": "Doe"
|
|
14
|
-
},
|
|
15
|
-
"dateOfBirth": "1980-01-01"
|
|
16
|
-
},
|
|
17
|
-
"name": "John Doe",
|
|
18
|
-
"merchantClassificationCode": "1234"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"transferAmount": {
|
|
3
|
-
"amount": "500",
|
|
4
|
-
"currency": "USD"
|
|
5
|
-
},
|
|
6
|
-
"payeeReceiveAmount": {
|
|
7
|
-
"amount": "490",
|
|
8
|
-
"currency": "USD"
|
|
9
|
-
},
|
|
10
|
-
"payeeFspFee": {
|
|
11
|
-
"amount": "5",
|
|
12
|
-
"currency": "USD"
|
|
13
|
-
},
|
|
14
|
-
"payeeFspCommission": {
|
|
15
|
-
"amount": "5",
|
|
16
|
-
"currency": "USD"
|
|
17
|
-
},
|
|
18
|
-
"geoCode": {
|
|
19
|
-
"latitude": "53.295971",
|
|
20
|
-
"longitude": "-0.038500"
|
|
21
|
-
},
|
|
22
|
-
"expiration": "2017-11-15T14:17:09.663+01:00",
|
|
23
|
-
"ilpPacket": "AQAAAAAAACasIWcuc2UubW9iaWxlbW9uZXkubXNpc2RuLjEyMzQ1Njc4OYIEIXsNCiAgICAidHJhbnNhY3Rpb25JZCI6ICI4NWZlYWMyZi0zOWIyLTQ5MWItODE3ZS00YTAzMjAzZDRmMTQiLA0KICAgICJxdW90ZUlkIjogIjdjMjNlODBjLWQwNzgtNDA3Ny04MjYzLTJjMDQ3ODc2ZmNmNiIsDQogICAgInBheWVlIjogew0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiTVNJU0ROIiwNCiAgICAgICAgICAgICJwYXJ0eUlkZW50aWZpZXIiOiAiMTIzNDU2Nzg5IiwNCiAgICAgICAgICAgICJmc3BJZCI6ICJNb2JpbGVNb25leSINCiAgICAgICAgfSwNCiAgICAgICAgInBlcnNvbmFsSW5mbyI6IHsNCiAgICAgICAgICAgICJjb21wbGV4TmFtZSI6IHsNCiAgICAgICAgICAgICAgICAiZmlyc3ROYW1lIjogIkhlbnJpayIsDQogICAgICAgICAgICAgICAgImxhc3ROYW1lIjogIkthcmxzc29uIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfSwNCiAgICAicGF5ZXIiOiB7DQogICAgICAgICJwZXJzb25hbEluZm8iOiB7DQogICAgICAgICAgICAiY29tcGxleE5hbWUiOiB7DQogICAgICAgICAgICAgICAgImZpcnN0TmFtZSI6ICJNYXRzIiwNCiAgICAgICAgICAgICAgICAibGFzdE5hbWUiOiAiSGFnbWFuIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9LA0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiSUJBTiIsDQogICAgICAgICAgICAicGFydHlJZGVudGlmaWVyIjogIlNFNDU1MDAwMDAwMDA1ODM5ODI1NzQ2NiIsDQogICAgICAgICAgICAiZnNwSWQiOiAiQmFua05yT25lIg0KICAgICAgICB9DQogICAgfSwNCiAgICAiYW1vdW50Ijogew0KICAgICAgICAiYW1vdW50IjogIjEwMCIsDQogICAgICAgICJjdXJyZW5jeSI6ICJVU0QiDQogICAgfSwNCiAgICAidHJhbnNhY3Rpb25UeXBlIjogew0KICAgICAgICAic2NlbmFyaW8iOiAiVFJBTlNGRVIiLA0KICAgICAgICAiaW5pdGlhdG9yIjogIlBBWUVSIiwNCiAgICAgICAgImluaXRpYXRvclR5cGUiOiAiQ09OU1VNRVIiDQogICAgfSwNCiAgICAibm90ZSI6ICJGcm9tIE1hdHMiDQp9DQo\u003d\u003d",
|
|
24
|
-
"condition": "fH9pAYDQbmoZLPbvv3CSW2RfjU4jvM4ApG_fqGnR7Xs",
|
|
25
|
-
"extensionList": {
|
|
26
|
-
"extension": [
|
|
27
|
-
{
|
|
28
|
-
"key": "qreskey1",
|
|
29
|
-
"value": "qresvalue1"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"key": "qreskey2",
|
|
33
|
-
"value": "qresvalue2"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"fulfilment": "87mm1reS3SAi8oIWXgBkLmgWc1MkZ_yLbFDX5XAdo5o",
|
|
3
|
-
"completedTimestamp": "2017-11-15T14:16:09.663+01:00",
|
|
4
|
-
"transferState": "COMMITTED",
|
|
5
|
-
"extensionList": {
|
|
6
|
-
"extension": [
|
|
7
|
-
{
|
|
8
|
-
"key": "treskey1",
|
|
9
|
-
"value": "tresvalue1"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"key": "treskey2",
|
|
13
|
-
"value": "tresvalue2"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**************************************************************************
|
|
2
|
-
* (C) Copyright ModusBox Inc. 2019 - All rights reserved. *
|
|
3
|
-
* *
|
|
4
|
-
* This file is made available under the terms of the license agreement *
|
|
5
|
-
* specified in the corresponding source code repository. *
|
|
6
|
-
* *
|
|
7
|
-
* ORIGINAL AUTHOR: *
|
|
8
|
-
* Yevhen Kyriukha - yevhen.kyriukha@modusbox.com *
|
|
9
|
-
**************************************************************************/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
jest.unmock('@mojaloop/sdk-standard-components');
|
|
14
|
-
jest.mock('redis');
|
|
15
|
-
|
|
16
|
-
const redis = require('redis');
|
|
17
|
-
const uuidv4 = require('uuidv4');
|
|
18
|
-
const {createValidators, createTestServers, destroyTestServers} = require('../utils');
|
|
19
|
-
const {createPostTransfersTester, createGetTransfersTester} = require('./utils');
|
|
20
|
-
|
|
21
|
-
const defaultConfig = require('../../data/defaultConfig');
|
|
22
|
-
|
|
23
|
-
// Transfers
|
|
24
|
-
const postQuotesBody = require('./data/postQuotesBody');
|
|
25
|
-
const postTransfersBody = require('./data/postTransfersBody');
|
|
26
|
-
const putPartiesBody = require('./data/putPartiesBody');
|
|
27
|
-
const putQuotesBody = require('./data/putQuotesBody');
|
|
28
|
-
const putTransfersBody = require('./data/putTransfersBody');
|
|
29
|
-
const postTransfersBadBody = require('./data/postTransfersBadBody');
|
|
30
|
-
const postTransfersSuccessResponse = require('./data/postTransfersSuccessResponse');
|
|
31
|
-
const postTransfersErrorTimeoutResponse = require('./data/postTransfersErrorTimeoutResponse');
|
|
32
|
-
const postTransfersErrorMojaloopResponse = require('./data/postTransfersErrorMojaloopResponse');
|
|
33
|
-
const getTransfersCommittedResponse = require('./data/getTransfersCommittedResponse');
|
|
34
|
-
const getTransfersErrorNotFound = require('./data/getTransfersErrorNotFound');
|
|
35
|
-
|
|
36
|
-
describe('Outbound Transfers API', () => {
|
|
37
|
-
let testPostTransfers;
|
|
38
|
-
let testGetTransfers;
|
|
39
|
-
let validatorsInfo;
|
|
40
|
-
let serversInfo;
|
|
41
|
-
let redisClient;
|
|
42
|
-
|
|
43
|
-
beforeAll(async () => {
|
|
44
|
-
validatorsInfo = await createValidators();
|
|
45
|
-
redisClient = redis.createClient({ cacheUrl: 'redis://dummy:1234' });
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
beforeEach(async () => {
|
|
49
|
-
serversInfo = await createTestServers({
|
|
50
|
-
...defaultConfig,
|
|
51
|
-
alsEndpoint: null,
|
|
52
|
-
});
|
|
53
|
-
testPostTransfers = createPostTransfersTester({
|
|
54
|
-
reqInbound: serversInfo.reqInbound,
|
|
55
|
-
reqOutbound: serversInfo.reqOutbound,
|
|
56
|
-
requestValidatorInbound: validatorsInfo.requestValidatorInbound,
|
|
57
|
-
apiSpecsOutbound: validatorsInfo.apiSpecsOutbound,
|
|
58
|
-
});
|
|
59
|
-
testGetTransfers = createGetTransfersTester({
|
|
60
|
-
reqInbound: serversInfo.reqInbound,
|
|
61
|
-
reqOutbound: serversInfo.reqOutbound,
|
|
62
|
-
apiSpecsOutbound: validatorsInfo.apiSpecsOutbound,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
afterEach(async () => {
|
|
67
|
-
await destroyTestServers(serversInfo);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
afterAll(async () => {
|
|
71
|
-
redisClient.end();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe('POST /transfers', () => {
|
|
75
|
-
beforeEach(() => {
|
|
76
|
-
uuidv4.__reset();
|
|
77
|
-
redisClient.flushdb();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test(
|
|
81
|
-
'fails validation on invalid request and gives detailed error message indicating source of failure',
|
|
82
|
-
(done) => {
|
|
83
|
-
serversInfo.reqOutbound.post('/transfers').
|
|
84
|
-
send(postTransfersBadBody).
|
|
85
|
-
expect(400, {
|
|
86
|
-
message: 'must be equal to one of the allowed values',
|
|
87
|
-
statusCode: 400,
|
|
88
|
-
}).
|
|
89
|
-
end((err) => {
|
|
90
|
-
if (err) {
|
|
91
|
-
return done(err);
|
|
92
|
-
}
|
|
93
|
-
return done();
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test('should return success response', () => {
|
|
98
|
-
const bodyFn = {
|
|
99
|
-
parties: {
|
|
100
|
-
put: () => putPartiesBody,
|
|
101
|
-
},
|
|
102
|
-
quotes: {
|
|
103
|
-
post: (body) => ({
|
|
104
|
-
...postQuotesBody,
|
|
105
|
-
expiration: body.expiration,
|
|
106
|
-
}),
|
|
107
|
-
put: () => putQuotesBody,
|
|
108
|
-
},
|
|
109
|
-
transfers: {
|
|
110
|
-
post: (body) => ({
|
|
111
|
-
...postTransfersBody,
|
|
112
|
-
expiration: body.expiration,
|
|
113
|
-
}),
|
|
114
|
-
put: () => putTransfersBody,
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
return testPostTransfers(bodyFn, 200, postTransfersSuccessResponse);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test('should return timeout error response on party resolution', () => {
|
|
121
|
-
const putBodyFn = {
|
|
122
|
-
parties: {
|
|
123
|
-
put: () => new Promise(
|
|
124
|
-
resolve => setTimeout(() => resolve(putPartiesBody),
|
|
125
|
-
2000)),
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
return testPostTransfers(putBodyFn, 504,
|
|
129
|
-
postTransfersErrorTimeoutResponse);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test('should return mojaloop error response on party resolution', () => {
|
|
133
|
-
const putBodyFn = {
|
|
134
|
-
parties: {
|
|
135
|
-
put: () => ({
|
|
136
|
-
errorInformation: {
|
|
137
|
-
errorCode: '3204',
|
|
138
|
-
errorDescription: 'Party not found',
|
|
139
|
-
},
|
|
140
|
-
}),
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
return testPostTransfers(putBodyFn, 500,
|
|
144
|
-
postTransfersErrorMojaloopResponse);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
describe('GET /transfers', () => {
|
|
150
|
-
beforeEach(() => {
|
|
151
|
-
uuidv4.__reset();
|
|
152
|
-
redisClient.flushdb();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test('should return COMMITTED transaction state', async () => {
|
|
156
|
-
const bodyFn = {
|
|
157
|
-
parties: {
|
|
158
|
-
put: () => putPartiesBody,
|
|
159
|
-
},
|
|
160
|
-
quotes: {
|
|
161
|
-
post: (body) => ({
|
|
162
|
-
...postQuotesBody,
|
|
163
|
-
expiration: body.expiration,
|
|
164
|
-
}),
|
|
165
|
-
put: () => putQuotesBody,
|
|
166
|
-
},
|
|
167
|
-
transfers: {
|
|
168
|
-
post: (body) => ({
|
|
169
|
-
...postTransfersBody,
|
|
170
|
-
expiration: body.expiration,
|
|
171
|
-
}),
|
|
172
|
-
put: () => putTransfersBody,
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
await testPostTransfers(bodyFn, 200, postTransfersSuccessResponse);
|
|
176
|
-
|
|
177
|
-
const putBodyFn = () => putTransfersBody;
|
|
178
|
-
return testGetTransfers(putBodyFn, 200, getTransfersCommittedResponse);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
test('should return transfer not found error', () => {
|
|
182
|
-
const putBodyFn = () => ({
|
|
183
|
-
errorInformation: {
|
|
184
|
-
errorCode: '3208',
|
|
185
|
-
errorDescription: 'Transaction not found',
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
return testGetTransfers(putBodyFn, 500, getTransfersErrorNotFound);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
});
|