@mojaloop/sdk-scheme-adapter 18.0.0 → 18.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.
Files changed (119) hide show
  1. package/.dockerignore +18 -0
  2. package/.eslintignore +2 -0
  3. package/.ncurc.yaml +7 -0
  4. package/CHANGELOG.md +20 -0
  5. package/CODEOWNERS +31 -1
  6. package/README.md +1 -0
  7. package/audit-resolve.json +35 -0
  8. package/package.json +13 -13
  9. package/test/__mocks__/@mojaloop/sdk-standard-components.js +0 -151
  10. package/test/__mocks__/javascript-state-machine.js +0 -21
  11. package/test/__mocks__/redis.js +0 -78
  12. package/test/__mocks__/uuidv4.js +0 -16
  13. package/test/config/integration.env +0 -146
  14. package/test/integration/lib/Outbound/data/quotesPostRequest.json +0 -52
  15. package/test/integration/lib/Outbound/data/transfersPostRequest.json +0 -24
  16. package/test/integration/lib/Outbound/parties.test.js +0 -31
  17. package/test/integration/lib/Outbound/quotes.test.js +0 -62
  18. package/test/integration/lib/Outbound/simpleTransfers.test.js +0 -70
  19. package/test/integration/lib/cache.test.js +0 -79
  20. package/test/integration/testEnv.js +0 -4
  21. package/test/unit/ControlClient.test.js +0 -69
  22. package/test/unit/ControlServer/events.js +0 -41
  23. package/test/unit/ControlServer/index.js +0 -227
  24. package/test/unit/ControlServer.test.js +0 -66
  25. package/test/unit/InboundServer.test.js +0 -443
  26. package/test/unit/TestServer.test.js +0 -392
  27. package/test/unit/api/accounts/accounts.test.js +0 -128
  28. package/test/unit/api/accounts/data/postAccountsBody.json +0 -7
  29. package/test/unit/api/accounts/data/postAccountsErrorMojaloopResponse.json +0 -33
  30. package/test/unit/api/accounts/data/postAccountsErrorTimeoutResponse.json +0 -19
  31. package/test/unit/api/accounts/data/postAccountsSuccessResponse.json +0 -31
  32. package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError1.json +0 -34
  33. package/test/unit/api/accounts/data/postAccountsSuccessResponseWithError2.json +0 -39
  34. package/test/unit/api/accounts/utils.js +0 -79
  35. package/test/unit/api/proxy/data/proxyConfig.yaml +0 -82
  36. package/test/unit/api/proxy/data/requestBody.json +0 -22
  37. package/test/unit/api/proxy/data/requestHeaders.json +0 -5
  38. package/test/unit/api/proxy/data/requestQuery.json +0 -6
  39. package/test/unit/api/proxy/data/responseBody.json +0 -21
  40. package/test/unit/api/proxy/data/responseHeaders.json +0 -5
  41. package/test/unit/api/proxy/proxy.test.js +0 -220
  42. package/test/unit/api/proxy/utils.js +0 -79
  43. package/test/unit/api/transfers/data/getTransfersCommittedResponse.json +0 -24
  44. package/test/unit/api/transfers/data/getTransfersErrorNotFound.json +0 -18
  45. package/test/unit/api/transfers/data/postQuotesBody.json +0 -52
  46. package/test/unit/api/transfers/data/postTransfersBadBody.json +0 -17
  47. package/test/unit/api/transfers/data/postTransfersBody.json +0 -24
  48. package/test/unit/api/transfers/data/postTransfersErrorMojaloopResponse.json +0 -62
  49. package/test/unit/api/transfers/data/postTransfersErrorTimeoutResponse.json +0 -48
  50. package/test/unit/api/transfers/data/postTransfersSimpleBody.json +0 -26
  51. package/test/unit/api/transfers/data/postTransfersSuccessResponse.json +0 -128
  52. package/test/unit/api/transfers/data/putPartiesBody.json +0 -20
  53. package/test/unit/api/transfers/data/putQuotesBody.json +0 -37
  54. package/test/unit/api/transfers/data/putTransfersBody.json +0 -17
  55. package/test/unit/api/transfers/transfers.test.js +0 -191
  56. package/test/unit/api/transfers/utils.js +0 -264
  57. package/test/unit/api/utils.js +0 -86
  58. package/test/unit/config.test.js +0 -119
  59. package/test/unit/data/commonHttpHeaders.json +0 -7
  60. package/test/unit/data/defaultConfig.json +0 -70
  61. package/test/unit/data/postQuotesBody.json +0 -52
  62. package/test/unit/data/putParticipantsBody.json +0 -12
  63. package/test/unit/data/putPartiesBody.json +0 -20
  64. package/test/unit/data/testFile.json +0 -29
  65. package/test/unit/data/testFile.yaml +0 -14
  66. package/test/unit/inboundApi/data/mockArguments.json +0 -117
  67. package/test/unit/inboundApi/data/mockTransactionRequest.json +0 -42
  68. package/test/unit/inboundApi/handlers.test.js +0 -786
  69. package/test/unit/index.test.js +0 -88
  70. package/test/unit/lib/cache.test.js +0 -145
  71. package/test/unit/lib/model/AccountsModel.test.js +0 -124
  72. package/test/unit/lib/model/InboundTransfersModel.test.js +0 -889
  73. package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +0 -253
  74. package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +0 -247
  75. package/test/unit/lib/model/OutboundRequestToPayModel.test.js +0 -166
  76. package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +0 -245
  77. package/test/unit/lib/model/OutboundTransfersModel.test.js +0 -1579
  78. package/test/unit/lib/model/PartiesModel.test.js +0 -478
  79. package/test/unit/lib/model/QuotesModel.test.js +0 -477
  80. package/test/unit/lib/model/TransfersModel.test.js +0 -481
  81. package/test/unit/lib/model/common/PersistentStateMachine.test.js +0 -178
  82. package/test/unit/lib/model/data/authorizationsResponse.json +0 -13
  83. package/test/unit/lib/model/data/bulkQuoteRequest.json +0 -27
  84. package/test/unit/lib/model/data/bulkQuoteResponse.json +0 -35
  85. package/test/unit/lib/model/data/bulkTransferFulfil.json +0 -13
  86. package/test/unit/lib/model/data/bulkTransferRequest.json +0 -29
  87. package/test/unit/lib/model/data/defaultConfig.json +0 -59
  88. package/test/unit/lib/model/data/getBulkTransfersBackendResponse.json +0 -42
  89. package/test/unit/lib/model/data/getBulkTransfersMojaloopResponse.json +0 -22
  90. package/test/unit/lib/model/data/getTransfersBackendResponse.json +0 -34
  91. package/test/unit/lib/model/data/getTransfersMojaloopResponse.json +0 -17
  92. package/test/unit/lib/model/data/mockArguments.json +0 -188
  93. package/test/unit/lib/model/data/mockTxnRequestsArguments.json +0 -63
  94. package/test/unit/lib/model/data/notificationAbortedToPayee.json +0 -10
  95. package/test/unit/lib/model/data/notificationReservedToPayee.json +0 -10
  96. package/test/unit/lib/model/data/notificationToPayee.json +0 -10
  97. package/test/unit/lib/model/data/payeeParty.json +0 -18
  98. package/test/unit/lib/model/data/putQuotesResponse.json +0 -33
  99. package/test/unit/lib/model/data/putTransfersResponse.json +0 -5
  100. package/test/unit/lib/model/data/quoteResponse.json +0 -42
  101. package/test/unit/lib/model/data/requestToPayRequest.json +0 -20
  102. package/test/unit/lib/model/data/requestToPayTransferRequest.json +0 -27
  103. package/test/unit/lib/model/data/transactionRequestResponse.json +0 -18
  104. package/test/unit/lib/model/data/transferFulfil.json +0 -10
  105. package/test/unit/lib/model/data/transferRequest.json +0 -26
  106. package/test/unit/lib/model/mockedLibRequests.js +0 -74
  107. package/test/unit/mockLogger.js +0 -39
  108. package/test/unit/outboundApi/data/bulkQuoteRequest.json +0 -28
  109. package/test/unit/outboundApi/data/bulkTransferRequest.json +0 -28
  110. package/test/unit/outboundApi/data/mockBulkQuoteError.json +0 -45
  111. package/test/unit/outboundApi/data/mockBulkTransferError.json +0 -48
  112. package/test/unit/outboundApi/data/mockError.json +0 -41
  113. package/test/unit/outboundApi/data/mockGetPartiesError.json +0 -4
  114. package/test/unit/outboundApi/data/mockRequestToPayError.json +0 -32
  115. package/test/unit/outboundApi/data/mockRequestToPayTransferError.json +0 -39
  116. package/test/unit/outboundApi/data/requestToPay.json +0 -21
  117. package/test/unit/outboundApi/data/requestToPayTransferRequest.json +0 -20
  118. package/test/unit/outboundApi/data/transferRequest.json +0 -21
  119. package/test/unit/outboundApi/handlers.test.js +0 -887
package/.dockerignore ADDED
@@ -0,0 +1,18 @@
1
+ deploy/
2
+ coverage/
3
+ node_modules/
4
+ .dockerignore
5
+ .editorconfig
6
+ .git/
7
+ .gitignore
8
+ .istanbul.yml
9
+ circle.yml
10
+ docker-compose.circle.yml
11
+ docker-compose.dev.yml
12
+ docker-compose.functional.yml
13
+ docker-compose.yml
14
+ Dockerfile
15
+ LICENSE
16
+ README.md
17
+ sonar-project.properties
18
+ .devspace/
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ coverage
2
+ templates
package/.ncurc.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ## Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
2
+ reject: [
3
+ ## TODO: Breaking changes to ws lib dependency will need to be addressed in a future story. ref https://github.com/websockets/ws/releases/tag/8.0.0.
4
+ "ws",
5
+ ## TODO: This will need to be removed, and upgraded once this PR https://github.com/mojaloop/sdk-scheme-adapter/pull/340 has been merged
6
+ "@mojaloop/api-snippets"
7
+ ]
package/CHANGELOG.md CHANGED
@@ -1,4 +1,24 @@
1
1
  # Changelog: [mojaloop/thirdparty-api-svc](https://github.com/mojaloop/thirdparty-api-svc)
2
+ ### [18.0.2](https://github.com/mojaloop/sdk-scheme-adapter/compare/v18.0.1...v18.0.2) (2022-07-27)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * ws-connection-issue ([#339](https://github.com/mojaloop/sdk-scheme-adapter/issues/339)) ([e29e158](https://github.com/mojaloop/sdk-scheme-adapter/commit/e29e158807d1c758e18418752339b8b10d42377b))
8
+
9
+
10
+ ### Chore
11
+
12
+ * updates to readme for header badges [skip ci] ([#334](https://github.com/mojaloop/sdk-scheme-adapter/issues/334)) ([415bb33](https://github.com/mojaloop/sdk-scheme-adapter/commit/415bb3380a17cfd35841095bb9b2f399e969f5c6))
13
+
14
+ ### [18.0.1](https://github.com/mojaloop/sdk-scheme-adapter/compare/v18.0.0...v18.0.1) (2022-07-12)
15
+
16
+
17
+ ### Chore
18
+
19
+ * added .npmignore so that the test folder is not included when publishing packages ([#332](https://github.com/mojaloop/sdk-scheme-adapter/issues/332)) ([602b3ab](https://github.com/mojaloop/sdk-scheme-adapter/commit/602b3abfe861123623768e2a1c3497063ce4b909))
20
+ * uodated deps ([#333](https://github.com/mojaloop/sdk-scheme-adapter/issues/333)) ([7f9e027](https://github.com/mojaloop/sdk-scheme-adapter/commit/7f9e0277ff760ad22ab29dc3abee20322030d7dc))
21
+
2
22
  ## [18.0.0](https://github.com/mojaloop/sdk-scheme-adapter/compare/v17.0.1...v18.0.0) (2022-07-11)
3
23
 
4
24
 
package/CODEOWNERS CHANGED
@@ -1,2 +1,32 @@
1
- * james.bush@modusbox.com
1
+ # This is a comment.
2
+ # Each line is a file pattern followed by one or more owners.
3
+ ## These owners will be the default owners for everything in
4
+ ## the repo. Unless a later match takes precedence,
5
+ ## @global-owner1 and @global-owner2 will be requested for
6
+ ## review when someone opens a pull request.
7
+ #* @global-owner1 @global-owner2
2
8
  * yevhen.kyriukha@modusbox.com
9
+ * @mdebarros @elnyry-sam-k @vijayg10 @kleyow
10
+ ## Order is important; the last matching pattern takes the most
11
+ ## precedence. When someone opens a pull request that only
12
+ ## modifies JS files, only @js-owner and not the global
13
+ ## owner(s) will be requested for a review.
14
+ # *.js @js-owner
15
+ ## You can also use email addresses if you prefer. They'll be
16
+ ## used to look up users just like we do for commit author
17
+ ## emails.
18
+ #*.go docs@example.com
19
+ # In this example, @doctocat owns any files in the build/logs
20
+ # directory at the root of the repository and any of its
21
+ # subdirectories.
22
+ # /build/logs/ @doctocat
23
+ ## The `docs/*` pattern will match files like
24
+ ## `docs/getting-started.md` but not further nested files like
25
+ ## `docs/build-app/troubleshooting.md`.
26
+ # docs/* docs@example.com
27
+ ## In this example, @octocat owns any file in an apps directory
28
+ ## anywhere in your repository.
29
+ #apps/ @octocat
30
+ ## In this example, @doctocat owns any file in the `/docs`
31
+ ## directory in the root of your repository.
32
+ #/docs/ @doctocat
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Git Commit](https://img.shields.io/github/last-commit/mojaloop/sdk-scheme-adapter.svg?style=flat)](https://github.com/mojaloop/sdk-scheme-adapter/commits/master)
2
2
  [![Git Releases](https://img.shields.io/github/release/mojaloop/sdk-scheme-adapter.svg?style=flat)](https://github.com/mojaloop/sdk-scheme-adapter/releases)
3
+ [![Docker pulls](https://img.shields.io/docker/pulls/mojaloop/sdk-scheme-adapter.svg?style=flat)](https://hub.docker.com/r/mojaloop/sdk-scheme-adapter)
3
4
  [![Npm Version](https://img.shields.io/npm/v/@mojaloop/sdk-scheme-adapter.svg?style=flat)](https://www.npmjs.com/package/@mojaloop/sdk-scheme-adapter)
4
5
  [![NPM Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/@mojaloop/sdk-scheme-adapter.svg?style=flat)](https://www.npmjs.com/package/@mojaloop/sdk-scheme-adapter)
5
6
  [![CircleCI](https://circleci.com/gh/mojaloop/sdk-scheme-adapter.svg?style=svg)](https://circleci.com/gh/mojaloop/sdk-scheme-adapter)
@@ -59,6 +59,41 @@
59
59
  "decision": "ignore",
60
60
  "madeAt": 1657217280998,
61
61
  "expiresAt": 1659809259103
62
+ },
63
+ "1081008|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment": {
64
+ "decision": "ignore",
65
+ "madeAt": 1657621042651,
66
+ "expiresAt": 1660213039412
67
+ },
68
+ "1081761|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment": {
69
+ "decision": "ignore",
70
+ "madeAt": 1658860721215,
71
+ "expiresAt": 1661452716888
72
+ },
73
+ "1070030|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it": {
74
+ "decision": "ignore",
75
+ "madeAt": 1658860722876,
76
+ "expiresAt": 1661452716888
77
+ },
78
+ "1070030|shins>markdown-it": {
79
+ "decision": "ignore",
80
+ "madeAt": 1658860722876,
81
+ "expiresAt": 1661452716888
82
+ },
83
+ "1068310|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser": {
84
+ "decision": "ignore",
85
+ "madeAt": 1658860723959,
86
+ "expiresAt": 1661452716888
87
+ },
88
+ "1068155|shins>markdown-it>sanitize-html": {
89
+ "decision": "ignore",
90
+ "madeAt": 1658860724884,
91
+ "expiresAt": 1661452716888
92
+ },
93
+ "1070260|shins>markdown-it>sanitize-html": {
94
+ "decision": "ignore",
95
+ "madeAt": 1658860725792,
96
+ "expiresAt": 1661452716888
62
97
  }
63
98
  },
64
99
  "rules": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "18.0.0",
3
+ "version": "18.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",
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "@koa/cors": "^3.3.0",
61
61
  "@mojaloop/central-services-shared": "17.0.2",
62
- "@mojaloop/sdk-standard-components": "^17.1.0",
62
+ "@mojaloop/sdk-standard-components": "^17.1.1",
63
63
  "ajv": "8.11.0",
64
64
  "axios": "^0.27.2",
65
65
  "co-body": "^6.1.0",
@@ -81,24 +81,24 @@
81
81
  "random-word-slugs": "^0.1.6",
82
82
  "redis": "^4.2.0",
83
83
  "uuidv4": "^6.2.13",
84
- "ws": "^8.8.0"
84
+ "ws": "^7.5.5"
85
85
  },
86
86
  "devDependencies": {
87
- "@babel/core": "^7.18.6",
88
- "@babel/preset-env": "^7.18.6",
89
- "@mojaloop/api-snippets": "^14.0.0",
87
+ "@babel/core": "^7.18.9",
88
+ "@babel/preset-env": "^7.18.9",
89
+ "@mojaloop/api-snippets": "^14.2.0",
90
90
  "@redocly/openapi-cli": "^1.0.0-beta.94",
91
- "@types/jest": "^28.1.4",
92
- "babel-jest": "^28.1.2",
93
- "eslint": "^8.19.0",
91
+ "@types/jest": "^28.1.6",
92
+ "babel-jest": "^28.1.3",
93
+ "eslint": "^8.20.0",
94
94
  "eslint-config-airbnb-base": "^15.0.0",
95
95
  "eslint-plugin-import": "^2.26.0",
96
- "eslint-plugin-jest": "^26.5.3",
97
- "jest": "^28.1.2",
96
+ "eslint-plugin-jest": "^26.6.0",
97
+ "jest": "^28.1.3",
98
98
  "jest-junit": "^14.0.0",
99
- "nock": "^13.2.8",
99
+ "nock": "^13.2.9",
100
100
  "npm-audit-resolver": "^3.0.0-7",
101
- "npm-check-updates": "^15.2.6",
101
+ "npm-check-updates": "^16.0.1",
102
102
  "openapi-response-validator": "^12.0.0",
103
103
  "openapi-typescript": "^5.4.1",
104
104
  "redis-mock": "^0.56.3",
@@ -1,151 +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
- * James Bush - james.bush@modusbox.com *
9
- **************************************************************************/
10
-
11
- 'use strict';
12
-
13
- const assert = require('assert').strict;
14
- const util = require('util');
15
- const { MojaloopRequests, Errors, WSO2Auth, Jws, Logger } = jest.requireActual('@mojaloop/sdk-standard-components');
16
-
17
-
18
- class MockMojaloopRequests extends MojaloopRequests {
19
- constructor(...args) {
20
- super(...args);
21
- MockMojaloopRequests.__instance = this;
22
- this.postParticipants = MockMojaloopRequests.__postParticipants;
23
- this.getParties = MockMojaloopRequests.__getParties;
24
- this.postTransactionRequests = MockMojaloopRequests.__postTransactionRequests;
25
- this.postQuotes = MockMojaloopRequests.__postQuotes;
26
- this.putQuotes = MockMojaloopRequests.__putQuotes;
27
- this.putQuotesError = MockMojaloopRequests.__putQuotesError;
28
- this.getAuthorizations = MockMojaloopRequests.__getAuthorizations;
29
- this.putAuthorizations = MockMojaloopRequests.__putAuthorizations;
30
- this.getTransfers = MockMojaloopRequests.__getTransfers;
31
- this.putTransactionRequests = MockMojaloopRequests.__putTransactionRequests;
32
- this.postTransfers = MockMojaloopRequests.__postTransfers;
33
- this.putTransfers = MockMojaloopRequests.__putTransfers;
34
- this.putTransfersError = MockMojaloopRequests.__putTransfersError;
35
- this.getBulkQuotes = MockMojaloopRequests.__getBulkQuotes;
36
- this.postBulkQuotes = MockMojaloopRequests.__postBulkQuotes;
37
- this.putBulkQuotes = MockMojaloopRequests.__putBulkQuotes;
38
- this.putBulkQuotesError = MockMojaloopRequests.__putBulkQuotesError;
39
- this.getBulkTransfers = MockMojaloopRequests.__getBulkTransfers;
40
- this.postBulkTransfers = MockMojaloopRequests.__postBulkTransfers;
41
- this.putBulkTransfers = MockMojaloopRequests.__putBulkTransfers;
42
- this.putBulkTransfersError = MockMojaloopRequests.__putBulkTransfersError;
43
- this.patchTransfers = MockMojaloopRequests.__patchTransfers;
44
- }
45
- }
46
- MockMojaloopRequests.__postParticipants = jest.fn(() => Promise.resolve());
47
- MockMojaloopRequests.__getParties = jest.fn(() => Promise.resolve());
48
- MockMojaloopRequests.__postTransactionRequests = jest.fn(() => Promise.resolve());
49
- MockMojaloopRequests.__postQuotes = jest.fn(() => Promise.resolve());
50
- MockMojaloopRequests.__putQuotes = jest.fn(() => Promise.resolve());
51
- MockMojaloopRequests.__putQuotesError = jest.fn(() => Promise.resolve());
52
- MockMojaloopRequests.__getAuthorizations = jest.fn(() => Promise.resolve());
53
- MockMojaloopRequests.__putAuthorizations = jest.fn(() => Promise.resolve());
54
- MockMojaloopRequests.__getTransfers = jest.fn(() => Promise.resolve());
55
- MockMojaloopRequests.__putTransactionRequests = jest.fn(() => Promise.resolve());
56
- MockMojaloopRequests.__postTransfers = jest.fn(() => Promise.resolve());
57
- MockMojaloopRequests.__putTransfers = jest.fn(() => Promise.resolve());
58
- MockMojaloopRequests.__putTransfersError = jest.fn(() => Promise.resolve());
59
- MockMojaloopRequests.__getBulkQuotes = jest.fn(() => Promise.resolve());
60
- MockMojaloopRequests.__postBulkQuotes = jest.fn(() => Promise.resolve());
61
- MockMojaloopRequests.__putBulkQuotes = jest.fn(() => Promise.resolve());
62
- MockMojaloopRequests.__putBulkQuotesError = jest.fn(() => Promise.resolve());
63
- MockMojaloopRequests.__getBulkTransfers = jest.fn(() => Promise.resolve());
64
- MockMojaloopRequests.__postBulkTransfers = jest.fn(() => Promise.resolve());
65
- MockMojaloopRequests.__putBulkTransfers = jest.fn(() => Promise.resolve());
66
- MockMojaloopRequests.__putBulkTransfersError = jest.fn(() => Promise.resolve());
67
- MockMojaloopRequests.__patchTransfers = jest.fn(() => Promise.resolve());
68
-
69
- class MockIlp {
70
- constructor(config) {
71
- assert(config.logger, 'Must supply a logger to Ilp constructor');
72
- this.logger = config.logger;
73
- this.logger.log('MockIlp constructed');
74
- this.config = config;
75
- }
76
-
77
- calculateFulfil(ilpPacket) {
78
- this.logger.log(`Mock ILP not calculating fulfil from ilp packet ${ilpPacket}`);
79
- return 'mockGeneratedFulfilment';
80
- }
81
-
82
- calculateConditionFromFulfil(fulfil) {
83
- this.logger.log(`Mock ILP not calculating condition from fulfil ${fulfil}`);
84
- return 'mockGeneratedCondition';
85
- }
86
-
87
- validateFulfil(fulfil, condition) {
88
- this.logger.log(`Mock ILP not checking fulfil ${fulfil} against condition ${condition}`);
89
- return true;
90
- }
91
-
92
- getResponseIlp(...args) {
93
- this.logger.log(`MockIlp.getResponseIlp called with args: ${util.inspect(args)}`);
94
-
95
- return MockIlp.__response;
96
- }
97
-
98
- getQuoteResponseIlp(...args) {
99
- this.logger.log(`MockIlp.getQuoteResponseIlp called with args: ${util.inspect(args)}`);
100
-
101
- return this.getResponseIlp(...args);
102
- }
103
-
104
-
105
- getTransactionObject(...args) {
106
- this.logger.log(`MockIlp.getTrasnactionObject called with args: ${util.inspect(args)}`);
107
-
108
- return MockIlp.__transactionObject;
109
- }
110
- }
111
- MockIlp.__response = {
112
- fulfilment: 'mockGeneratedFulfilment',
113
- ilpPacket: 'mockBase64encodedIlpPacket',
114
- condition: 'mockGeneratedCondition'
115
- };
116
-
117
- MockIlp.__transactionObject = {
118
- transactionId: 'mockTransactionId'
119
- };
120
-
121
-
122
- class MockJwsValidator extends Jws.validator {
123
- constructor(config) {
124
- super(config);
125
- MockJwsValidator.__validationKeys = config.validationKeys;
126
- this.validate = MockJwsValidator.__validate;
127
- }
128
- }
129
- MockJwsValidator.__validate = jest.fn(() => true);
130
-
131
-
132
- class MockJwsSigner {
133
- constructor(config) {
134
- assert(config.logger, 'Must supply a logger to JWS signer constructor');
135
- this.config = config;
136
- config.logger.log(`MockJwsSigner constructed with config: ${util.inspect(config)}`);
137
- }
138
- }
139
-
140
-
141
- module.exports = {
142
- MojaloopRequests: MockMojaloopRequests,
143
- Ilp: MockIlp,
144
- Jws: {
145
- validator: MockJwsValidator,
146
- signer: MockJwsSigner
147
- },
148
- Errors,
149
- WSO2Auth,
150
- Logger,
151
- };
@@ -1,21 +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
- const StateMachine = jest.requireActual('javascript-state-machine');
12
-
13
-
14
- class MockStateMachine extends StateMachine {
15
- constructor(...args) {
16
- super(...args);
17
- MockStateMachine.__instance = this;
18
- }
19
- }
20
-
21
- module.exports = MockStateMachine;
@@ -1,78 +0,0 @@
1
- /**************************************************************************
2
- * (C) Copyright ModusBox Inc. 2020 - 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
- const redisMock = require('redis-mock');
12
- const { promisify } = require('util');
13
-
14
- const { EventEmitter } = require('events');
15
-
16
- const events = {};
17
-
18
- // redis-mock currently ignores callback arguments, the following class fixes that
19
- class RedisClient extends redisMock.RedisClient {
20
- constructor(opts) {
21
- super(opts);
22
- events[opts.cacheUrl] = events[opts.cacheUrl] || new EventEmitter();
23
- this.events = events[opts.cacheUrl];
24
- }
25
-
26
- async subscribe(...args) {
27
- this.events.on(...args);
28
- // return promisify(super.subscribe.bind(this))(...args);
29
- }
30
-
31
- async unsubscribe(channel) {
32
- this.events.removeAllListeners(channel);
33
- }
34
-
35
- async publish(...args) {
36
- process.nextTick(() => this.events.emit(...args));
37
- }
38
-
39
- set(...args) {
40
- return promisify(super.set.bind(this))(...args);
41
- }
42
-
43
- get(...args) {
44
- return promisify(super.get.bind(this))(...args);
45
- }
46
-
47
- keys(...args) {
48
- return promisify(super.keys.bind(this))(...args);
49
- }
50
-
51
- end() {
52
- this.events.removeAllListeners();
53
- }
54
-
55
- connect() {}
56
-
57
- async disconnect() {
58
- return this.end();
59
- }
60
-
61
- async quit() {
62
- return this.end();
63
- }
64
-
65
- sAdd(...args) {
66
- return promisify(super.sadd.bind(this))(...args);
67
- }
68
-
69
- sMembers(...args) {
70
- return promisify(super.smembers.bind(this))(...args);
71
- }
72
-
73
- configSet() {}
74
- }
75
-
76
- module.exports = {
77
- createClient: (opts) => new RedisClient(opts),
78
- };
@@ -1,16 +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
- let id = 0;
12
-
13
- module.exports = {
14
- __reset: () => { id = 0; },
15
- uuid: () => `00000000-0000-1000-8000-${(++id).toString().padStart(12, '0')}`,
16
- };
@@ -1,146 +0,0 @@
1
- # Port number that the inbound (Mojaloop API) HTTP server will listen on
2
- INBOUND_LISTEN_PORT=4000
3
-
4
- # Port number that the outbound (simplified DFSP outbound API) HTTP server will listen on
5
- OUTBOUND_LISTEN_PORT=4001
6
-
7
- # Enable mutual TLS authentication. Useful when not running in a secure
8
- # environment, i.e. when you're running it locally against your own implementation.
9
- INBOUND_MUTUAL_TLS_ENABLED=false
10
- OUTBOUND_MUTUAL_TLS_ENABLED=false
11
-
12
- # Enable verification or incoming JWS signatures
13
- # Note that signatures will be required on incoming messages
14
- # and will be validated against a public key.
15
- VALIDATE_INBOUND_JWS=false
16
-
17
- # applicable only if VALIDATE_INBOUND_JWS is "true"
18
- # allows disabling of validation on incoming PUT /parties/{idType}/{idValue} requests
19
- VALIDATE_INBOUND_PUT_PARTIES_JWS=false
20
-
21
- # Enable signing of outgoing requests
22
- JWS_SIGN=false
23
-
24
- # applicable only if JWS_SIGN is "true"
25
- # allows disabling of signing on outgoing PUT /parties/{idType}/{idValue} requests
26
- JWS_SIGN_PUT_PARTIES=false
27
-
28
- # Path to JWS signing key (private key of THIS DFSP)
29
- JWS_SIGNING_KEY_PATH=secrets/jwsSigningKey.key
30
- JWS_VERIFICATION_KEYS_DIRECTORY=secrets/jwsVerificationKeys
31
-
32
- # Location of certs and key required for TLS
33
- # IN_CA_CERT_PATH=./secrets/cacert.pem
34
- # IN_SERVER_CERT_PATH=./secrets/servercert.pem
35
- # IN_SERVER_KEY_PATH=./secrets/serverkey.pem
36
-
37
- # OUT_CA_CERT_PATH=./secrets/cacert.pem
38
- # OUT_CLIENT_CERT_PATH=./secrets/servercert.pem
39
- # OUT_CLIENT_KEY_PATH=./secrets/serverkey.pem
40
-
41
- # The number of space characters by which to indent pretty-printed logs. If set to zero, log events
42
- # will each be printed on a single line.
43
- LOG_INDENT=0
44
-
45
- # REDIS CACHE CONNECTION
46
- CACHE_URL=redis://redis:6379
47
- CACHE_SHOULD_EXPIRE=false
48
- CACHE_EXPIRY_SECONDS=3600
49
-
50
- # SWITCH ENDPOINT
51
- # The option 'PEER_ENDPOINT' has no effect if the remaining options 'ALS_ENDPOINT', 'QUOTES_ENDPOINT',
52
- # 'BULK_QUOTES_ENDPOINT', 'TRANSFERS_ENDPOINT', 'BULK_TRANSFERS_ENDPOINT', 'TRANSACTION_REQUESTS_ENDPOINT' are specified.
53
- PEER_ENDPOINT=172.17.0.3:4000
54
- #ALS_ENDPOINT=account-lookup-service.local
55
- #QUOTES_ENDPOINT=quoting-service.local
56
- #TRANSFERS_ENDPOINT=ml-api-adapter.local
57
- #BULK_TRANSFERS_ENDPOINT=bulk-api-adapter.local
58
- #TRANSACTION_REQUESTS_ENDPOINT=transaction-requests-service.local
59
-
60
- # BACKEND ENDPOINT
61
- BACKEND_ENDPOINT=172.17.0.5:4000
62
-
63
- # FSPID of this DFSP
64
- DFSP_ID=mojaloop-sdk
65
-
66
- # Secret used for generation and verification of secure ILP
67
- ILP_SECRET=Quaixohyaesahju3thivuiChai5cahng
68
-
69
- # expiry period in seconds for quote and transfers issued by the SDK
70
- EXPIRY_SECONDS=60
71
-
72
- # if set to false the SDK will not automatically accept all returned quotes
73
- # but will halt the transfer after a quote response is received. A further
74
- # confirmation call will be required to complete the final transfer stage.
75
- AUTO_ACCEPT_QUOTES=false
76
-
77
- # if set to false the SDK will not automatically accept a resolved party
78
- # but will halt the transer after a party lookup response is received. A further
79
- # cnofirmation call will be required to progress the transfer to quotes state.
80
- AUTO_ACCEPT_PARTY=false
81
-
82
- # when set to true, when sending money via the outbound API, the SDK will use the value
83
- # of FSPIOP-Source header from the received quote response as the payeeFsp value in the
84
- # transfer prepare request body instead of the value received in the payee party lookup.
85
- # This behaviour should be enabled when the SDK user DFSP is in a forex enabled switch
86
- # ecosystem and expects quotes and transfers to be rerouted by the switch to forex
87
- # entities i.e. forex providing DFSPs. Please see the SDK documentation and switch
88
- # operator documentation for more information on forex use cases.
89
- USE_QUOTE_SOURCE_FSP_AS_TRANSFER_PAYEE_FSP=false
90
-
91
- # set to true to validate ILP, otherwise false to ignore ILP
92
- CHECK_ILP=true
93
-
94
- # set to true to enable test features such as request cacheing and retrieval endpoints
95
- ENABLE_TEST_FEATURES=false
96
-
97
- # set to true to mock WSO2 oauth2 token endpoint
98
- ENABLE_OAUTH_TOKEN_ENDPOINT=false
99
- OAUTH_TOKEN_ENDPOINT_CLIENT_KEY=test-client-key
100
- OAUTH_TOKEN_ENDPOINT_CLIENT_SECRET=test-client-secret
101
- OAUTH_TOKEN_ENDPOINT_LISTEN_PORT=6000
102
-
103
- # WSO2 Bearer Token specific to golden-fsp instance and environment
104
- WSO2_BEARER_TOKEN=7718fa9b-be13-3fe7-87f0-a12cf1628168
105
-
106
- # OAuth2 data used to obtain WSO2 bearer token
107
- OAUTH_TOKEN_ENDPOINT=
108
- OAUTH_CLIENT_KEY=
109
- OAUTH_CLIENT_SECRET=
110
- OAUTH_REFRESH_SECONDS=3600
111
-
112
- # Set to true to respect expirity timestamps
113
- REJECT_EXPIRED_QUOTE_RESPONSES=false
114
- REJECT_TRANSFERS_ON_EXPIRED_QUOTES=false
115
- REJECT_EXPIRED_TRANSFER_FULFILS=false
116
-
117
- # Timeout for GET/POST/DELETE - PUT flow processing
118
- REQUEST_PROCESSING_TIMEOUT_SECONDS=4
119
-
120
- # Common Account Lookup System (ALS)
121
- ALS_ENDPOINT=ml-testing-toolkit:5000
122
-
123
- # QUOTES_ENDPOINT
124
- QUOTES_ENDPOINT=ml-testing-toolkit:5000
125
-
126
- # TRANSFERS_ENDPOINT
127
- TRANSFERS_ENDPOINT=ml-testing-toolkit:5000
128
-
129
- # To allow transfer without a previous quote request, set this value to true.
130
- # The incoming transfer request should consists of an ILP packet and a matching condition in this case.
131
- # The fulfilment will be generated from the provided ILP packet, and must hash to the provided condition.
132
- ALLOW_TRANSFER_WITHOUT_QUOTE=false
133
-
134
- # To enable request for notification on fulfiled transfer
135
- RESERVE_NOTIFICATION=true
136
- # resources API versions should be string in format: "resourceOneName=1.0,resourceTwoName=1.1"
137
- RESOURCE_VERSIONS="transfers=1.1,participants=1.1"
138
-
139
- # Management API websocket connection settings.
140
- # The Management API uses this for exchanging connector management messages.
141
- MGMT_API_WS_URL=127.0.0.1
142
- MGMT_API_WS_PORT=4005
143
-
144
- # Set to true to enable the use of PM4ML-related services e.g MCM, Management API service
145
- # when running the scheme-adapter as a mojaloop connector component within Payment Manager for Mojaloop.
146
- PM4ML_ENABLED=false
@@ -1,52 +0,0 @@
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
- "scenario": "TRANSFER",
49
- "initiator": "PAYEE",
50
- "initiatorType": "CONSUMER"
51
- }
52
- }