@mojaloop/sdk-scheme-adapter 11.18.8
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 +140 -0
- package/.eslintignore +2 -0
- package/.eslintrc.json +30 -0
- package/.nvmrc +1 -0
- package/.versionrc +15 -0
- package/CHANGELOG.md +118 -0
- package/InboundServer/api.yaml +3594 -0
- package/InboundServer/api_template.yaml +69 -0
- package/InboundServer/handlers.js +940 -0
- package/InboundServer/index.js +205 -0
- package/InboundServer/middlewares.js +426 -0
- package/OAuthTestServer/index.js +66 -0
- package/OAuthTestServer/model.js +70 -0
- package/OutboundServer/api.yaml +2732 -0
- package/OutboundServer/api_interfaces/index.d.ts +117 -0
- package/OutboundServer/api_interfaces/openapi.d.ts +1475 -0
- package/OutboundServer/api_template/components/parameters/bulkQuoteId.yaml +9 -0
- package/OutboundServer/api_template/components/parameters/bulkTransferId.yaml +9 -0
- package/OutboundServer/api_template/components/parameters/requestToPayTransactionId.yaml +9 -0
- package/OutboundServer/api_template/components/parameters/transferId.yaml +9 -0
- package/OutboundServer/api_template/components/responses/accountsCreationCompleted.yaml +5 -0
- package/OutboundServer/api_template/components/responses/accountsCreationError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/accountsCreationTimeout.yaml +5 -0
- package/OutboundServer/api_template/components/responses/authorizationPostSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/authorizationsServerError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkQuoteBadRequest.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkQuoteServerError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkQuoteSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkQuoteTimeout.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkTransferBadRequest.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkTransferServerError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkTransferSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/bulkTransferTimeout.yaml +5 -0
- package/OutboundServer/api_template/components/responses/partiesByIdError404.yaml +9 -0
- package/OutboundServer/api_template/components/responses/partiesByIdSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/quotesPostSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/quotesServerError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/requestToPaySuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/requestToPayTransferBadRequest.yaml +5 -0
- package/OutboundServer/api_template/components/responses/requestToPayTransferSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/simpleTransfersPostSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/simpleTransfersServerError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/transferBadRequest.yaml +5 -0
- package/OutboundServer/api_template/components/responses/transferServerError.yaml +5 -0
- package/OutboundServer/api_template/components/responses/transferSuccess.yaml +5 -0
- package/OutboundServer/api_template/components/responses/transferTimeout.yaml +5 -0
- package/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +18 -0
- package/OutboundServer/api_template/components/schemas/accountsCreationState.yaml +4 -0
- package/OutboundServer/api_template/components/schemas/accountsRequest.yaml +20 -0
- package/OutboundServer/api_template/components/schemas/accountsResponse.yaml +15 -0
- package/OutboundServer/api_template/components/schemas/async2SyncCurrentState.yaml +5 -0
- package/OutboundServer/api_template/components/schemas/authorizationsPostRequest.yaml +15 -0
- package/OutboundServer/api_template/components/schemas/authorizationsPostResponse.yaml +19 -0
- package/OutboundServer/api_template/components/schemas/bulkQuoteErrorResponse.yaml +8 -0
- package/OutboundServer/api_template/components/schemas/bulkQuoteRequest.yaml +26 -0
- package/OutboundServer/api_template/components/schemas/bulkQuoteResponse.yaml +21 -0
- package/OutboundServer/api_template/components/schemas/bulkQuoteStatus.yaml +4 -0
- package/OutboundServer/api_template/components/schemas/bulkQuoteStatusResponse.yaml +17 -0
- package/OutboundServer/api_template/components/schemas/bulkTransferErrorResponse.yaml +8 -0
- package/OutboundServer/api_template/components/schemas/bulkTransferRequest.yaml +26 -0
- package/OutboundServer/api_template/components/schemas/bulkTransferResponse.yaml +16 -0
- package/OutboundServer/api_template/components/schemas/bulkTransferStatus.yaml +4 -0
- package/OutboundServer/api_template/components/schemas/bulkTransferStatusResponse.yaml +17 -0
- package/OutboundServer/api_template/components/schemas/errorAccountsResponse.yaml +8 -0
- package/OutboundServer/api_template/components/schemas/errorAuthorizationsResponse.yaml +3 -0
- package/OutboundServer/api_template/components/schemas/errorQuotesResponse.yaml +9 -0
- package/OutboundServer/api_template/components/schemas/errorResponse.yaml +8 -0
- package/OutboundServer/api_template/components/schemas/errorSimpleTransfersResponse.yaml +3 -0
- package/OutboundServer/api_template/components/schemas/errorTransferResponse.yaml +8 -0
- package/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +6 -0
- package/OutboundServer/api_template/components/schemas/individualQuote.yaml +32 -0
- package/OutboundServer/api_template/components/schemas/individualQuoteResult.yaml +28 -0
- package/OutboundServer/api_template/components/schemas/individualTransfer.yaml +32 -0
- package/OutboundServer/api_template/components/schemas/individualTransferFulfilment.yaml +13 -0
- package/OutboundServer/api_template/components/schemas/individualTransferResult.yaml +41 -0
- package/OutboundServer/api_template/components/schemas/mojaloopError.yaml +5 -0
- package/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +2 -0
- package/OutboundServer/api_template/components/schemas/partiesByIdResponse.yaml +13 -0
- package/OutboundServer/api_template/components/schemas/quote.yaml +3 -0
- package/OutboundServer/api_template/components/schemas/quoteError.yaml +16 -0
- package/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +13 -0
- package/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +48 -0
- package/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +39 -0
- package/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +41 -0
- package/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +42 -0
- package/OutboundServer/api_template/components/schemas/requestToPayTransferResponse.yaml +58 -0
- package/OutboundServer/api_template/components/schemas/simpleTransferServerError.yaml +5 -0
- package/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +12 -0
- package/OutboundServer/api_template/components/schemas/simpleTransfersPostResponse.yaml +11 -0
- package/OutboundServer/api_template/components/schemas/transactionType.yaml +4 -0
- package/OutboundServer/api_template/components/schemas/transferContinuationAcceptOTP.yaml +9 -0
- package/OutboundServer/api_template/components/schemas/transferContinuationAcceptParty.yaml +8 -0
- package/OutboundServer/api_template/components/schemas/transferContinuationAcceptQuote.yaml +9 -0
- package/OutboundServer/api_template/components/schemas/transferError.yaml +16 -0
- package/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +3 -0
- package/OutboundServer/api_template/components/schemas/transferParty.yaml +40 -0
- package/OutboundServer/api_template/components/schemas/transferRequest.yaml +37 -0
- package/OutboundServer/api_template/components/schemas/transferResponse.yaml +58 -0
- package/OutboundServer/api_template/components/schemas/transferStatus.yaml +6 -0
- package/OutboundServer/api_template/components/schemas/transferStatusResponse.yaml +13 -0
- package/OutboundServer/api_template/health.yaml +12 -0
- package/OutboundServer/api_template/openapi.yaml +55 -0
- package/OutboundServer/api_template/paths/accounts.yaml +26 -0
- package/OutboundServer/api_template/paths/authorizations.yaml +19 -0
- package/OutboundServer/api_template/paths/bulkQuotes.yaml +23 -0
- package/OutboundServer/api_template/paths/bulkQuotes_bulkQuoteId.yaml +24 -0
- package/OutboundServer/api_template/paths/bulkTransfers.yaml +23 -0
- package/OutboundServer/api_template/paths/bulkTransfers_bulkTransferId.yaml +24 -0
- package/OutboundServer/api_template/paths/parties_Type_ID.yaml +20 -0
- package/OutboundServer/api_template/paths/parties_Type_ID_SubId.yaml +22 -0
- package/OutboundServer/api_template/paths/quotes.yaml +20 -0
- package/OutboundServer/api_template/paths/requestToPay.yaml +22 -0
- package/OutboundServer/api_template/paths/requestToPayTransfer.yaml +57 -0
- package/OutboundServer/api_template/paths/requestToPayTransfer_requestToPayTransactionId.yaml +34 -0
- package/OutboundServer/api_template/paths/simpleTransfers.yaml +19 -0
- package/OutboundServer/api_template/paths/transfers.yaml +55 -0
- package/OutboundServer/api_template/paths/transfers_transferId.yaml +58 -0
- package/OutboundServer/handlers.js +622 -0
- package/OutboundServer/index.js +137 -0
- package/OutboundServer/middlewares.js +67 -0
- package/TestServer/api.yaml +62 -0
- package/TestServer/handlers.js +63 -0
- package/TestServer/index.js +215 -0
- package/audit-resolve.json +65 -0
- package/babel.config.js +3 -0
- package/config.js +158 -0
- package/index.d.ts +1 -0
- package/index.js +149 -0
- package/jest.config.js +15 -0
- package/lib/api/index.js +12 -0
- package/lib/cache.js +352 -0
- package/lib/check.js +25 -0
- package/lib/model/AccountsModel.js +396 -0
- package/lib/model/Async2SyncModel.js +283 -0
- package/lib/model/AuthorizationsModel.js +86 -0
- package/lib/model/InboundTransfersModel.js +730 -0
- package/lib/model/OutboundBulkQuotesModel.js +485 -0
- package/lib/model/OutboundBulkTransfersModel.js +479 -0
- package/lib/model/OutboundRequestToPayModel.js +517 -0
- package/lib/model/OutboundRequestToPayTransferModel.js +893 -0
- package/lib/model/OutboundTransfersModel.js +823 -0
- package/lib/model/PartiesModel.js +70 -0
- package/lib/model/ProxyModel/MatchRules/Expression.js +48 -0
- package/lib/model/ProxyModel/MatchRules/Headers.js +65 -0
- package/lib/model/ProxyModel/MatchRules/MatchRule.js +27 -0
- package/lib/model/ProxyModel/MatchRules/Path.js +36 -0
- package/lib/model/ProxyModel/MatchRules/Query.js +65 -0
- package/lib/model/ProxyModel/MatchRules/index.js +19 -0
- package/lib/model/ProxyModel/Route.js +82 -0
- package/lib/model/ProxyModel/configSchema.json +118 -0
- package/lib/model/ProxyModel/index.js +138 -0
- package/lib/model/QuotesModel.js +94 -0
- package/lib/model/TransfersModel.js +81 -0
- package/lib/model/common/BackendError.js +26 -0
- package/lib/model/common/PersistentStateMachine.js +93 -0
- package/lib/model/common/index.js +18 -0
- package/lib/model/index.js +43 -0
- package/lib/model/lib/deferredJob.js +113 -0
- package/lib/model/lib/index.js +9 -0
- package/lib/model/lib/requests/backendRequests.js +227 -0
- package/lib/model/lib/requests/common.js +76 -0
- package/lib/model/lib/requests/index.js +19 -0
- package/lib/model/lib/shared.js +468 -0
- package/lib/randomphrase/index.js +21 -0
- package/lib/randomphrase/words.json +3397 -0
- package/lib/router.js +28 -0
- package/lib/validate.js +205 -0
- package/package.json +102 -0
- package/test/__mocks__/@mojaloop/sdk-standard-components.js +152 -0
- package/test/__mocks__/javascript-state-machine.js +21 -0
- package/test/__mocks__/redis.js +49 -0
- package/test/__mocks__/uuidv4.js +16 -0
- package/test/config/integration.env +136 -0
- package/test/integration/lib/Outbound/authorizations.test.js +58 -0
- package/test/integration/lib/Outbound/data/authorizationsPostRequest.json +43 -0
- package/test/integration/lib/Outbound/data/quotesPostRequest.json +52 -0
- package/test/integration/lib/Outbound/data/transfersPostRequest.json +24 -0
- package/test/integration/lib/Outbound/parties.test.js +28 -0
- package/test/integration/lib/Outbound/quotes.test.js +58 -0
- package/test/integration/lib/Outbound/simpleTransfers.test.js +67 -0
- package/test/integration/lib/cache.test.js +80 -0
- package/test/integration/testEnv.js +7 -0
- package/test/unit/InboundServer.test.js +443 -0
- package/test/unit/TestServer.test.js +394 -0
- package/test/unit/api/accounts/accounts.test.js +128 -0
- package/test/unit/api/accounts/data/postAccountsBody.json +7 -0
- package/test/unit/api/accounts/data/postAccountsErrorMojaloopResponse.json +25 -0
- package/test/unit/api/accounts/data/postAccountsErrorTimeoutResponse.json +19 -0
- package/test/unit/api/accounts/data/postAccountsSuccessResponse.json +17 -0
- package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError1.json +21 -0
- package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError2.json +21 -0
- package/test/unit/api/accounts/utils.js +65 -0
- package/test/unit/api/proxy/data/proxyConfig.yaml +82 -0
- package/test/unit/api/proxy/data/requestBody.json +22 -0
- package/test/unit/api/proxy/data/requestHeaders.json +5 -0
- package/test/unit/api/proxy/data/requestQuery.json +6 -0
- package/test/unit/api/proxy/data/responseBody.json +21 -0
- package/test/unit/api/proxy/data/responseHeaders.json +5 -0
- package/test/unit/api/proxy/proxy.test.js +220 -0
- package/test/unit/api/proxy/utils.js +79 -0
- package/test/unit/api/transfers/data/getTransfersCommittedResponse.json +21 -0
- package/test/unit/api/transfers/data/getTransfersErrorNotFound.json +17 -0
- package/test/unit/api/transfers/data/postQuotesBody.json +52 -0
- package/test/unit/api/transfers/data/postTransfersBadBody.json +17 -0
- package/test/unit/api/transfers/data/postTransfersBody.json +24 -0
- package/test/unit/api/transfers/data/postTransfersErrorMojaloopResponse.json +53 -0
- package/test/unit/api/transfers/data/postTransfersErrorTimeoutResponse.json +47 -0
- package/test/unit/api/transfers/data/postTransfersSimpleBody.json +26 -0
- package/test/unit/api/transfers/data/postTransfersSuccessResponse.json +101 -0
- package/test/unit/api/transfers/data/putPartiesBody.json +20 -0
- package/test/unit/api/transfers/data/putQuotesBody.json +37 -0
- package/test/unit/api/transfers/data/putTransfersBody.json +17 -0
- package/test/unit/api/transfers/transfers.test.js +191 -0
- package/test/unit/api/transfers/utils.js +183 -0
- package/test/unit/api/utils.js +75 -0
- package/test/unit/config.test.js +119 -0
- package/test/unit/data/commonHttpHeaders.json +6 -0
- package/test/unit/data/defaultConfig.json +58 -0
- package/test/unit/data/postQuotesBody.json +52 -0
- package/test/unit/data/putParticipantsBody.json +12 -0
- package/test/unit/data/putPartiesBody.json +20 -0
- package/test/unit/data/testFile.json +29 -0
- package/test/unit/data/testFile.yaml +14 -0
- package/test/unit/inboundApi/data/mockArguments.json +117 -0
- package/test/unit/inboundApi/data/mockTransactionRequest.json +42 -0
- package/test/unit/inboundApi/handlers.test.js +799 -0
- package/test/unit/index.test.js +55 -0
- package/test/unit/lib/cache.test.js +146 -0
- package/test/unit/lib/model/AccountsModel.test.js +121 -0
- package/test/unit/lib/model/AuthorizationsModel.test.js +460 -0
- package/test/unit/lib/model/InboundTransfersModel.test.js +628 -0
- package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +249 -0
- package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +244 -0
- package/test/unit/lib/model/OutboundRequestToPayModel.test.js +166 -0
- package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +245 -0
- package/test/unit/lib/model/OutboundTransfersModel.test.js +836 -0
- package/test/unit/lib/model/PartiesModel.test.js +468 -0
- package/test/unit/lib/model/QuotesModel.test.js +470 -0
- package/test/unit/lib/model/TransfersModel.test.js +474 -0
- package/test/unit/lib/model/common/PersistentStateMachine.test.js +179 -0
- package/test/unit/lib/model/data/authorizationsResponse.json +13 -0
- package/test/unit/lib/model/data/bulkQuoteRequest.json +27 -0
- package/test/unit/lib/model/data/bulkQuoteResponse.json +35 -0
- package/test/unit/lib/model/data/bulkTransferFulfil.json +13 -0
- package/test/unit/lib/model/data/bulkTransferRequest.json +29 -0
- package/test/unit/lib/model/data/defaultConfig.json +47 -0
- package/test/unit/lib/model/data/getBulkTransfersBackendResponse.json +42 -0
- package/test/unit/lib/model/data/getBulkTransfersMojaloopResponse.json +22 -0
- package/test/unit/lib/model/data/getTransfersBackendResponse.json +34 -0
- package/test/unit/lib/model/data/getTransfersMojaloopResponse.json +17 -0
- package/test/unit/lib/model/data/mockArguments.json +131 -0
- package/test/unit/lib/model/data/mockTxnRequestsArguments.json +63 -0
- package/test/unit/lib/model/data/notificationToPayee.json +10 -0
- package/test/unit/lib/model/data/payeeParty.json +16 -0
- package/test/unit/lib/model/data/putAuthorizationsResponse.json +10 -0
- package/test/unit/lib/model/data/putQuotesResponse.json +33 -0
- package/test/unit/lib/model/data/putTransfersResponse.json +5 -0
- package/test/unit/lib/model/data/quoteResponse.json +31 -0
- package/test/unit/lib/model/data/requestToPayRequest.json +20 -0
- package/test/unit/lib/model/data/requestToPayTransferRequest.json +27 -0
- package/test/unit/lib/model/data/transactionRequestResponse.json +18 -0
- package/test/unit/lib/model/data/transferFulfil.json +8 -0
- package/test/unit/lib/model/data/transferRequest.json +26 -0
- package/test/unit/lib/model/mockedLibRequests.js +74 -0
- package/test/unit/mockLogger.js +39 -0
- package/test/unit/outboundApi/data/bulkQuoteRequest.json +28 -0
- package/test/unit/outboundApi/data/bulkTransferRequest.json +28 -0
- package/test/unit/outboundApi/data/mockBulkQuoteError.json +45 -0
- package/test/unit/outboundApi/data/mockBulkTransferError.json +48 -0
- package/test/unit/outboundApi/data/mockError.json +41 -0
- package/test/unit/outboundApi/data/mockGetPartiesError.json +4 -0
- package/test/unit/outboundApi/data/mockRequestToPayError.json +32 -0
- package/test/unit/outboundApi/data/mockRequestToPayTransferError.json +39 -0
- package/test/unit/outboundApi/data/requestToPay.json +21 -0
- package/test/unit/outboundApi/data/requestToPayTransferRequest.json +20 -0
- package/test/unit/outboundApi/data/transferRequest.json +21 -0
- package/test/unit/outboundApi/handlers.test.js +986 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const nock = require('nock');
|
|
2
|
+
const crypto = require('crypto');
|
|
3
|
+
|
|
4
|
+
const defaultConfig = require('../../data/defaultConfig');
|
|
5
|
+
const requestBody = require('./data/requestBody');
|
|
6
|
+
const requestHeaders = require('./data/requestHeaders');
|
|
7
|
+
const requestQuery = require('./data/requestQuery');
|
|
8
|
+
const responseBodyJSON = require('./data/responseBody');
|
|
9
|
+
const responseHeaders = require('./data/responseHeaders');
|
|
10
|
+
|
|
11
|
+
const responseBodyBinary = crypto.randomBytes(10000);
|
|
12
|
+
|
|
13
|
+
const convertToLowerCaseKeys = (obj) => Object.entries(obj).reduce(
|
|
14
|
+
(acc, [k, v]) => ({...acc, [k.toLowerCase()]: v}),
|
|
15
|
+
{},
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param reqOutbound
|
|
21
|
+
* @returns Function => Promise
|
|
22
|
+
*/
|
|
23
|
+
function createProxyTester({ reqOutbound }) {
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param sdkUrlPath {string}
|
|
27
|
+
* @param switchUrlPath {string}
|
|
28
|
+
* @param method {string} - one of POST, GET, PUT
|
|
29
|
+
* @param expectedStatusCode {number}
|
|
30
|
+
*
|
|
31
|
+
* @return {Promise<any>}
|
|
32
|
+
*/
|
|
33
|
+
return async ({sdkUrlPath, switchUrlPath, method, shouldForward, query, headers, binary}) => {
|
|
34
|
+
const endpoint = new URL(`http://${defaultConfig.peerEndpoint}`).host;
|
|
35
|
+
const switchEndpoint = `http://${endpoint}`;
|
|
36
|
+
const responseBody = binary ? responseBodyBinary : responseBodyJSON;
|
|
37
|
+
nock(switchEndpoint, {
|
|
38
|
+
reqheaders: {
|
|
39
|
+
...requestHeaders,
|
|
40
|
+
...headers,
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
.intercept(switchUrlPath, method.toUpperCase())
|
|
44
|
+
.query({
|
|
45
|
+
...requestQuery,
|
|
46
|
+
...query,
|
|
47
|
+
})
|
|
48
|
+
.reply(200, responseBody, responseHeaders);
|
|
49
|
+
|
|
50
|
+
const res = await reqOutbound[method.toLowerCase()](sdkUrlPath)
|
|
51
|
+
.query({
|
|
52
|
+
...requestQuery,
|
|
53
|
+
...query,
|
|
54
|
+
})
|
|
55
|
+
.send(requestBody)
|
|
56
|
+
.set({
|
|
57
|
+
...requestHeaders,
|
|
58
|
+
...headers,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (shouldForward) {
|
|
62
|
+
const expectedHeaders = convertToLowerCaseKeys(responseHeaders);
|
|
63
|
+
const receivedHeaders = convertToLowerCaseKeys(res.headers);
|
|
64
|
+
expect(res.body).toEqual(responseBody);
|
|
65
|
+
expect(receivedHeaders).toMatchObject(expectedHeaders);
|
|
66
|
+
expect(res.statusCode).toBe(200);
|
|
67
|
+
} else {
|
|
68
|
+
expect(res.body).toEqual({
|
|
69
|
+
'message': `Couldn't match path ${sdkUrlPath}`,
|
|
70
|
+
'statusCode': 400,
|
|
71
|
+
});
|
|
72
|
+
expect(res.statusCode).toBe(400);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
createProxyTester,
|
|
79
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"currentState": "COMPLETED",
|
|
3
|
+
"fulfil": {
|
|
4
|
+
"completedTimestamp": "2017-11-15T14:16:09.663+01:00",
|
|
5
|
+
"extensionList": {
|
|
6
|
+
"extension": [
|
|
7
|
+
{
|
|
8
|
+
"key": "treskey1",
|
|
9
|
+
"value": "tresvalue1"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"key": "treskey2",
|
|
13
|
+
"value": "tresvalue2"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"fulfilment": "87mm1reS3SAi8oIWXgBkLmgWc1MkZ_yLbFDX5XAdo5o",
|
|
18
|
+
"transferState": "COMMITTED"
|
|
19
|
+
},
|
|
20
|
+
"transferId": "00000000-0000-1000-8000-000000000001"
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"message": "Got an error response retrieving transfer: {\n errorInformation: { errorCode: '3208', errorDescription: 'Transaction not found' }\n}",
|
|
3
|
+
"statusCode": "3208",
|
|
4
|
+
"transferState": {
|
|
5
|
+
"currentState": "ERROR_OCCURRED",
|
|
6
|
+
"lastError": {
|
|
7
|
+
"httpStatusCode": 500,
|
|
8
|
+
"mojaloopError": {
|
|
9
|
+
"errorInformation": {
|
|
10
|
+
"errorCode": "3208",
|
|
11
|
+
"errorDescription": "Transaction not found"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"transferId": "00000000-0000-1000-8000-000000000001"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"amount": {
|
|
3
|
+
"amount": "100",
|
|
4
|
+
"currency": "USD"
|
|
5
|
+
},
|
|
6
|
+
"amountType": "SEND",
|
|
7
|
+
"expiration": "2020-01-20T11:31:49.325Z",
|
|
8
|
+
"extensionList": {
|
|
9
|
+
"extension": [
|
|
10
|
+
{
|
|
11
|
+
"key": "qreqkey1",
|
|
12
|
+
"value": "qreqvalue1"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"key": "qreqkey2",
|
|
16
|
+
"value": "qreqvalue2"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"note": "test payment",
|
|
21
|
+
"payee": {
|
|
22
|
+
"partyIdInfo": {
|
|
23
|
+
"fspId": "sim",
|
|
24
|
+
"partyIdType": "PERSONAL_ID",
|
|
25
|
+
"partyIdentifier": "987654321",
|
|
26
|
+
"partySubIdOrType": "PASSPORT"
|
|
27
|
+
},
|
|
28
|
+
"personalInfo": {
|
|
29
|
+
"complexName": {
|
|
30
|
+
"firstName": "John",
|
|
31
|
+
"lastName": "Doe",
|
|
32
|
+
"middleName": "Someone"
|
|
33
|
+
},
|
|
34
|
+
"dateOfBirth": "1980-01-01"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"payer": {
|
|
38
|
+
"name": "John Doe",
|
|
39
|
+
"partyIdInfo": {
|
|
40
|
+
"fspId": "mojaloop-sdk",
|
|
41
|
+
"partyIdType": "MSISDN",
|
|
42
|
+
"partyIdentifier": "123456789"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"quoteId": "00000000-0000-1000-8000-000000000002",
|
|
46
|
+
"transactionId": "00000000-0000-1000-8000-000000000001",
|
|
47
|
+
"transactionType": {
|
|
48
|
+
"initiator": "PAYER",
|
|
49
|
+
"initiatorType": "CONSUMER",
|
|
50
|
+
"scenario": "TRANSFER"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"from": {
|
|
3
|
+
"displayName": "James Bush",
|
|
4
|
+
"idType": "MSISDN",
|
|
5
|
+
"idValue": "987654321"
|
|
6
|
+
},
|
|
7
|
+
"to": {
|
|
8
|
+
"idType": "",
|
|
9
|
+
"idValue": "123456789"
|
|
10
|
+
},
|
|
11
|
+
"amountType": "SEND",
|
|
12
|
+
"currency": "USD",
|
|
13
|
+
"amount": "100",
|
|
14
|
+
"transactionType": "TRANSFER",
|
|
15
|
+
"note": "test payment",
|
|
16
|
+
"homeTransactionId": "123ABC"
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"amount": {
|
|
3
|
+
"amount": "500",
|
|
4
|
+
"currency": "USD"
|
|
5
|
+
},
|
|
6
|
+
"condition": "fH9pAYDQbmoZLPbvv3CSW2RfjU4jvM4ApG_fqGnR7Xs",
|
|
7
|
+
"expiration": "2020-01-20T11:32:52.167Z",
|
|
8
|
+
"extensionList": {
|
|
9
|
+
"extension": [
|
|
10
|
+
{
|
|
11
|
+
"key": "treqkey1",
|
|
12
|
+
"value": "treqvalue1"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"key": "treqkey2",
|
|
16
|
+
"value": "treqvalue2"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"ilpPacket": "AQAAAAAAACasIWcuc2UubW9iaWxlbW9uZXkubXNpc2RuLjEyMzQ1Njc4OYIEIXsNCiAgICAidHJhbnNhY3Rpb25JZCI6ICI4NWZlYWMyZi0zOWIyLTQ5MWItODE3ZS00YTAzMjAzZDRmMTQiLA0KICAgICJxdW90ZUlkIjogIjdjMjNlODBjLWQwNzgtNDA3Ny04MjYzLTJjMDQ3ODc2ZmNmNiIsDQogICAgInBheWVlIjogew0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiTVNJU0ROIiwNCiAgICAgICAgICAgICJwYXJ0eUlkZW50aWZpZXIiOiAiMTIzNDU2Nzg5IiwNCiAgICAgICAgICAgICJmc3BJZCI6ICJNb2JpbGVNb25leSINCiAgICAgICAgfSwNCiAgICAgICAgInBlcnNvbmFsSW5mbyI6IHsNCiAgICAgICAgICAgICJjb21wbGV4TmFtZSI6IHsNCiAgICAgICAgICAgICAgICAiZmlyc3ROYW1lIjogIkhlbnJpayIsDQogICAgICAgICAgICAgICAgImxhc3ROYW1lIjogIkthcmxzc29uIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfSwNCiAgICAicGF5ZXIiOiB7DQogICAgICAgICJwZXJzb25hbEluZm8iOiB7DQogICAgICAgICAgICAiY29tcGxleE5hbWUiOiB7DQogICAgICAgICAgICAgICAgImZpcnN0TmFtZSI6ICJNYXRzIiwNCiAgICAgICAgICAgICAgICAibGFzdE5hbWUiOiAiSGFnbWFuIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9LA0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiSUJBTiIsDQogICAgICAgICAgICAicGFydHlJZGVudGlmaWVyIjogIlNFNDU1MDAwMDAwMDA1ODM5ODI1NzQ2NiIsDQogICAgICAgICAgICAiZnNwSWQiOiAiQmFua05yT25lIg0KICAgICAgICB9DQogICAgfSwNCiAgICAiYW1vdW50Ijogew0KICAgICAgICAiYW1vdW50IjogIjEwMCIsDQogICAgICAgICJjdXJyZW5jeSI6ICJVU0QiDQogICAgfSwNCiAgICAidHJhbnNhY3Rpb25UeXBlIjogew0KICAgICAgICAic2NlbmFyaW8iOiAiVFJBTlNGRVIiLA0KICAgICAgICAiaW5pdGlhdG9yIjogIlBBWUVSIiwNCiAgICAgICAgImluaXRpYXRvclR5cGUiOiAiQ09OU1VNRVIiDQogICAgfSwNCiAgICAibm90ZSI6ICJGcm9tIE1hdHMiDQp9DQo==",
|
|
21
|
+
"payeeFsp": "sim",
|
|
22
|
+
"payerFsp": "mojaloop-sdk",
|
|
23
|
+
"transferId": "00000000-0000-1000-8000-000000000001"
|
|
24
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"message": "Got an error response resolving party: {\n errorInformation: { errorCode: '3204', errorDescription: 'Party not found' }\n}",
|
|
3
|
+
"statusCode": "3204",
|
|
4
|
+
"transferState": {
|
|
5
|
+
"amount": "100",
|
|
6
|
+
"amountType": "SEND",
|
|
7
|
+
"currency": "USD",
|
|
8
|
+
"currentState": "ERROR_OCCURRED",
|
|
9
|
+
"from": {
|
|
10
|
+
"displayName": "John Doe",
|
|
11
|
+
"idType": "MSISDN",
|
|
12
|
+
"idValue": "123456789"
|
|
13
|
+
},
|
|
14
|
+
"homeTransactionId": "123ABC",
|
|
15
|
+
"lastError": {
|
|
16
|
+
"httpStatusCode": 500,
|
|
17
|
+
"mojaloopError": {
|
|
18
|
+
"errorInformation": {
|
|
19
|
+
"errorCode": "3204",
|
|
20
|
+
"errorDescription": "Party not found"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"note": "test payment",
|
|
25
|
+
"quoteRequestExtensions": [
|
|
26
|
+
{
|
|
27
|
+
"key": "qreqkey1",
|
|
28
|
+
"value": "qreqvalue1"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"key": "qreqkey2",
|
|
32
|
+
"value": "qreqvalue2"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"to": {
|
|
36
|
+
"idSubValue": "PASSPORT",
|
|
37
|
+
"idType": "PERSONAL_ID",
|
|
38
|
+
"idValue": "987654321"
|
|
39
|
+
},
|
|
40
|
+
"transactionType": "TRANSFER",
|
|
41
|
+
"transferId": "00000000-0000-1000-8000-000000000001",
|
|
42
|
+
"transferRequestExtensions": [
|
|
43
|
+
{
|
|
44
|
+
"key": "treqkey1",
|
|
45
|
+
"value": "treqvalue1"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"key": "treqkey2",
|
|
49
|
+
"value": "treqvalue2"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
"currentState": "ERROR_OCCURRED",
|
|
9
|
+
"from": {
|
|
10
|
+
"displayName": "John Doe",
|
|
11
|
+
"idType": "MSISDN",
|
|
12
|
+
"idValue": "123456789"
|
|
13
|
+
},
|
|
14
|
+
"homeTransactionId": "123ABC",
|
|
15
|
+
"lastError": {
|
|
16
|
+
"httpStatusCode": 504
|
|
17
|
+
},
|
|
18
|
+
"note": "test payment",
|
|
19
|
+
"quoteRequestExtensions": [
|
|
20
|
+
{
|
|
21
|
+
"key": "qreqkey1",
|
|
22
|
+
"value": "qreqvalue1"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"key": "qreqkey2",
|
|
26
|
+
"value": "qreqvalue2"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"to": {
|
|
30
|
+
"idSubValue": "PASSPORT",
|
|
31
|
+
"idType": "PERSONAL_ID",
|
|
32
|
+
"idValue": "987654321"
|
|
33
|
+
},
|
|
34
|
+
"transactionType": "TRANSFER",
|
|
35
|
+
"transferId": "00000000-0000-1000-8000-000000000001",
|
|
36
|
+
"transferRequestExtensions": [
|
|
37
|
+
{
|
|
38
|
+
"key": "treqkey1",
|
|
39
|
+
"value": "treqvalue1"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"key": "treqkey2",
|
|
43
|
+
"value": "treqvalue2"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"amount": "100",
|
|
3
|
+
"amountType": "SEND",
|
|
4
|
+
"currency": "USD",
|
|
5
|
+
"currentState": "COMPLETED",
|
|
6
|
+
"from": {
|
|
7
|
+
"displayName": "John Doe",
|
|
8
|
+
"idType": "MSISDN",
|
|
9
|
+
"idValue": "123456789"
|
|
10
|
+
},
|
|
11
|
+
"fulfil": {
|
|
12
|
+
"completedTimestamp": "2017-11-15T14:16:09.663+01:00",
|
|
13
|
+
"extensionList": {
|
|
14
|
+
"extension": [
|
|
15
|
+
{
|
|
16
|
+
"key": "treskey1",
|
|
17
|
+
"value": "tresvalue1"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"key": "treskey2",
|
|
21
|
+
"value": "tresvalue2"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"fulfilment": "87mm1reS3SAi8oIWXgBkLmgWc1MkZ_yLbFDX5XAdo5o",
|
|
26
|
+
"transferState": "COMMITTED"
|
|
27
|
+
},
|
|
28
|
+
"homeTransactionId": "123ABC",
|
|
29
|
+
"note": "test payment",
|
|
30
|
+
"quoteId": "00000000-0000-1000-8000-000000000002",
|
|
31
|
+
"quoteRequestExtensions": [
|
|
32
|
+
{
|
|
33
|
+
"key": "qreqkey1",
|
|
34
|
+
"value": "qreqvalue1"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"key": "qreqkey2",
|
|
38
|
+
"value": "qreqvalue2"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"quoteResponse": {
|
|
42
|
+
"condition": "fH9pAYDQbmoZLPbvv3CSW2RfjU4jvM4ApG_fqGnR7Xs",
|
|
43
|
+
"expiration": "2017-11-15T14:17:09.663+01:00",
|
|
44
|
+
"extensionList": {
|
|
45
|
+
"extension": [
|
|
46
|
+
{
|
|
47
|
+
"key": "qreskey1",
|
|
48
|
+
"value": "qresvalue1"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"key": "qreskey2",
|
|
52
|
+
"value": "qresvalue2"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"geoCode": {
|
|
57
|
+
"latitude": "53.295971",
|
|
58
|
+
"longitude": "-0.038500"
|
|
59
|
+
},
|
|
60
|
+
"ilpPacket": "AQAAAAAAACasIWcuc2UubW9iaWxlbW9uZXkubXNpc2RuLjEyMzQ1Njc4OYIEIXsNCiAgICAidHJhbnNhY3Rpb25JZCI6ICI4NWZlYWMyZi0zOWIyLTQ5MWItODE3ZS00YTAzMjAzZDRmMTQiLA0KICAgICJxdW90ZUlkIjogIjdjMjNlODBjLWQwNzgtNDA3Ny04MjYzLTJjMDQ3ODc2ZmNmNiIsDQogICAgInBheWVlIjogew0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiTVNJU0ROIiwNCiAgICAgICAgICAgICJwYXJ0eUlkZW50aWZpZXIiOiAiMTIzNDU2Nzg5IiwNCiAgICAgICAgICAgICJmc3BJZCI6ICJNb2JpbGVNb25leSINCiAgICAgICAgfSwNCiAgICAgICAgInBlcnNvbmFsSW5mbyI6IHsNCiAgICAgICAgICAgICJjb21wbGV4TmFtZSI6IHsNCiAgICAgICAgICAgICAgICAiZmlyc3ROYW1lIjogIkhlbnJpayIsDQogICAgICAgICAgICAgICAgImxhc3ROYW1lIjogIkthcmxzc29uIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfSwNCiAgICAicGF5ZXIiOiB7DQogICAgICAgICJwZXJzb25hbEluZm8iOiB7DQogICAgICAgICAgICAiY29tcGxleE5hbWUiOiB7DQogICAgICAgICAgICAgICAgImZpcnN0TmFtZSI6ICJNYXRzIiwNCiAgICAgICAgICAgICAgICAibGFzdE5hbWUiOiAiSGFnbWFuIg0KICAgICAgICAgICAgfQ0KICAgICAgICB9LA0KICAgICAgICAicGFydHlJZEluZm8iOiB7DQogICAgICAgICAgICAicGFydHlJZFR5cGUiOiAiSUJBTiIsDQogICAgICAgICAgICAicGFydHlJZGVudGlmaWVyIjogIlNFNDU1MDAwMDAwMDA1ODM5ODI1NzQ2NiIsDQogICAgICAgICAgICAiZnNwSWQiOiAiQmFua05yT25lIg0KICAgICAgICB9DQogICAgfSwNCiAgICAiYW1vdW50Ijogew0KICAgICAgICAiYW1vdW50IjogIjEwMCIsDQogICAgICAgICJjdXJyZW5jeSI6ICJVU0QiDQogICAgfSwNCiAgICAidHJhbnNhY3Rpb25UeXBlIjogew0KICAgICAgICAic2NlbmFyaW8iOiAiVFJBTlNGRVIiLA0KICAgICAgICAiaW5pdGlhdG9yIjogIlBBWUVSIiwNCiAgICAgICAgImluaXRpYXRvclR5cGUiOiAiQ09OU1VNRVIiDQogICAgfSwNCiAgICAibm90ZSI6ICJGcm9tIE1hdHMiDQp9DQo==",
|
|
61
|
+
"payeeFspCommission": {
|
|
62
|
+
"amount": "5",
|
|
63
|
+
"currency": "USD"
|
|
64
|
+
},
|
|
65
|
+
"payeeFspFee": {
|
|
66
|
+
"amount": "5",
|
|
67
|
+
"currency": "USD"
|
|
68
|
+
},
|
|
69
|
+
"payeeReceiveAmount": {
|
|
70
|
+
"amount": "490",
|
|
71
|
+
"currency": "USD"
|
|
72
|
+
},
|
|
73
|
+
"transferAmount": {
|
|
74
|
+
"amount": "500",
|
|
75
|
+
"currency": "USD"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"quoteResponseSource": "mojaloop-sdk",
|
|
79
|
+
"to": {
|
|
80
|
+
"dateOfBirth": "1980-01-01",
|
|
81
|
+
"firstName": "John",
|
|
82
|
+
"fspId": "sim",
|
|
83
|
+
"idSubValue": "PASSPORT",
|
|
84
|
+
"idType": "PERSONAL_ID",
|
|
85
|
+
"idValue": "987654321",
|
|
86
|
+
"lastName": "Doe",
|
|
87
|
+
"middleName": "Someone"
|
|
88
|
+
},
|
|
89
|
+
"transactionType": "TRANSFER",
|
|
90
|
+
"transferId": "00000000-0000-1000-8000-000000000001",
|
|
91
|
+
"transferRequestExtensions": [
|
|
92
|
+
{
|
|
93
|
+
"key": "treqkey1",
|
|
94
|
+
"value": "treqvalue1"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"key": "treqkey2",
|
|
98
|
+
"value": "treqvalue2"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|