@mojaloop/sdk-scheme-adapter 12.0.1 → 12.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 (251) hide show
  1. package/.circleci/config.yml +619 -0
  2. package/CHANGELOG.md +7 -0
  3. package/CODEOWNERS +2 -0
  4. package/Dockerfile +35 -0
  5. package/LICENSE.md +10 -0
  6. package/PROXY.md +84 -0
  7. package/README.md +228 -0
  8. package/SECURITY.md +18 -0
  9. package/docker/ml-testing-toolkit/secrets/keygen.sh +5 -0
  10. package/docker/ml-testing-toolkit/secrets/privatekey.pem +27 -0
  11. package/docker/ml-testing-toolkit/secrets/publickey.cer +21 -0
  12. package/docker/ml-testing-toolkit/secrets/tls/createSecrets.sh +29 -0
  13. package/docker/ml-testing-toolkit/secrets/tls/hub_client.csr +28 -0
  14. package/docker/ml-testing-toolkit/secrets/tls/hub_client_cacert.pem +32 -0
  15. package/docker/ml-testing-toolkit/secrets/tls/hub_client_cakey.key +51 -0
  16. package/docker/ml-testing-toolkit/secrets/tls/hub_client_key.key +51 -0
  17. package/docker/ml-testing-toolkit/secrets/tls/hub_server.csr +28 -0
  18. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cacert.pem +32 -0
  19. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cacert.srl +1 -0
  20. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cakey.key +51 -0
  21. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cert.pem +33 -0
  22. package/docker/ml-testing-toolkit/secrets/tls/hub_server_key.key +51 -0
  23. package/docker/ml-testing-toolkit/secrets/tls/openssl.conf +17 -0
  24. package/docker/ml-testing-toolkit/spec_files/api_definitions/central_admin_9.3/api_spec.yaml +2450 -0
  25. package/docker/ml-testing-toolkit/spec_files/api_definitions/central_admin_9.3/response_map.json +96 -0
  26. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/api_spec.yaml +4187 -0
  27. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/callback_map.json +542 -0
  28. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/mockRef.json +83 -0
  29. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup.json +125 -0
  30. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/api_spec.yaml +3703 -0
  31. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/callback_map.json +568 -0
  32. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/mockRef.json +83 -0
  33. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/trigger_templates/transaction_request_followup.json +125 -0
  34. package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/api_spec.yaml +983 -0
  35. package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/mockRef.json +38 -0
  36. package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/response_map.json +34 -0
  37. package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/html_template.html +1074 -0
  38. package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/pdf_template.html +765 -0
  39. package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/script.js +98 -0
  40. package/docker/ml-testing-toolkit/spec_files/rules_callback/config.json +3 -0
  41. package/docker/ml-testing-toolkit/spec_files/rules_callback/default.json +426 -0
  42. package/docker/ml-testing-toolkit/spec_files/rules_response/config.json +3 -0
  43. package/docker/ml-testing-toolkit/spec_files/rules_response/default.json +1623 -0
  44. package/docker/ml-testing-toolkit/spec_files/rules_response/default_pisp_rules.json +161 -0
  45. package/docker/ml-testing-toolkit/spec_files/rules_validation/config.json +3 -0
  46. package/docker/ml-testing-toolkit/spec_files/rules_validation/default.json +672 -0
  47. package/docker/ml-testing-toolkit/spec_files/system_config.json +62 -0
  48. package/docker/ml-testing-toolkit/spec_files/user_config.json +45 -0
  49. package/docker/wait4/setup_hosts_file.sh +25 -0
  50. package/docker/wait4/wait4.config.js +71 -0
  51. package/docker/wait4/wait4.js +204 -0
  52. package/docker-compose.yml +67 -0
  53. package/docs/Mojaloop - Modusbox Onboarding functionality.pdf +0 -0
  54. package/docs/dfspInboundApi.yaml +1091 -0
  55. package/jest.config.js +4 -1
  56. package/junit.xml +515 -0
  57. package/package.json +9 -8
  58. package/secrets/jwsSigningKey.key +27 -0
  59. package/secrets/jwsVerificationKeys/mojaloop-sdk.pem +9 -0
  60. package/secrets/jwsVerificationKeys/switch.pem +9 -0
  61. package/sequences.puml +99 -0
  62. package/{InboundServer → src/InboundServer}/api.yaml +0 -0
  63. package/src/InboundServer/api_template.yaml +69 -0
  64. package/{InboundServer → src/InboundServer}/handlers.js +0 -0
  65. package/{InboundServer → src/InboundServer}/index.js +0 -0
  66. package/{InboundServer → src/InboundServer}/middlewares.js +0 -0
  67. package/{OAuthTestServer → src/OAuthTestServer}/index.js +0 -0
  68. package/{OAuthTestServer → src/OAuthTestServer}/model.js +0 -0
  69. package/{OutboundServer → src/OutboundServer}/api.yaml +0 -0
  70. package/{OutboundServer → src/OutboundServer}/api_interfaces/index.d.ts +0 -0
  71. package/{OutboundServer → src/OutboundServer}/api_interfaces/openapi.d.ts +0 -0
  72. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/bulkQuoteId.yaml +1 -1
  73. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/bulkTransferId.yaml +1 -1
  74. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/requestToPayTransactionId.yaml +1 -1
  75. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/transferId.yaml +1 -1
  76. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationCompleted.yaml +0 -0
  77. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationError.yaml +0 -0
  78. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationTimeout.yaml +0 -0
  79. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteBadRequest.yaml +0 -0
  80. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteServerError.yaml +0 -0
  81. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteSuccess.yaml +0 -0
  82. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteTimeout.yaml +0 -0
  83. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferBadRequest.yaml +0 -0
  84. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferServerError.yaml +0 -0
  85. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferSuccess.yaml +0 -0
  86. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferTimeout.yaml +0 -0
  87. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/partiesByIdError404.yaml +1 -1
  88. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/partiesByIdSuccess.yaml +0 -0
  89. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/quotesPostSuccess.yaml +0 -0
  90. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/quotesServerError.yaml +0 -0
  91. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPaySuccess.yaml +0 -0
  92. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPayTransferBadRequest.yaml +0 -0
  93. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPayTransferSuccess.yaml +0 -0
  94. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/simpleTransfersPostSuccess.yaml +0 -0
  95. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/simpleTransfersServerError.yaml +0 -0
  96. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferBadRequest.yaml +0 -0
  97. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferServerError.yaml +0 -0
  98. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferSuccess.yaml +0 -0
  99. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferTimeout.yaml +0 -0
  100. package/src/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +18 -0
  101. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/accountsCreationState.yaml +0 -0
  102. package/src/OutboundServer/api_template/components/schemas/accountsRequest.yaml +20 -0
  103. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/accountsResponse.yaml +1 -1
  104. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/async2SyncCurrentState.yaml +0 -0
  105. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteErrorResponse.yaml +0 -0
  106. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteRequest.yaml +2 -2
  107. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteResponse.yaml +1 -1
  108. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteStatus.yaml +0 -0
  109. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteStatusResponse.yaml +1 -1
  110. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferErrorResponse.yaml +0 -0
  111. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferRequest.yaml +2 -2
  112. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferResponse.yaml +1 -1
  113. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferStatus.yaml +0 -0
  114. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferStatusResponse.yaml +1 -1
  115. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorAccountsResponse.yaml +0 -0
  116. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorQuotesResponse.yaml +0 -0
  117. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorResponse.yaml +0 -0
  118. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorSimpleTransfersResponse.yaml +0 -0
  119. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorTransferResponse.yaml +0 -0
  120. package/src/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +6 -0
  121. package/src/OutboundServer/api_template/components/schemas/individualQuote.yaml +32 -0
  122. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualQuoteResult.yaml +5 -5
  123. package/src/OutboundServer/api_template/components/schemas/individualTransfer.yaml +32 -0
  124. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualTransferFulfilment.yaml +2 -2
  125. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualTransferResult.yaml +6 -6
  126. package/src/OutboundServer/api_template/components/schemas/mojaloopError.yaml +5 -0
  127. package/src/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +2 -0
  128. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/partiesByIdResponse.yaml +1 -1
  129. package/src/OutboundServer/api_template/components/schemas/quote.yaml +3 -0
  130. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/quoteError.yaml +0 -0
  131. package/src/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +13 -0
  132. package/src/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +48 -0
  133. package/src/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +39 -0
  134. package/src/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +41 -0
  135. package/src/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +42 -0
  136. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/requestToPayTransferResponse.yaml +6 -6
  137. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/simpleTransferServerError.yaml +0 -0
  138. package/src/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +12 -0
  139. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/simpleTransfersPostResponse.yaml +1 -1
  140. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transactionType.yaml +0 -0
  141. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptOTP.yaml +0 -0
  142. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptParty.yaml +0 -0
  143. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptQuote.yaml +0 -0
  144. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferError.yaml +0 -0
  145. package/src/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +3 -0
  146. package/src/OutboundServer/api_template/components/schemas/transferParty.yaml +40 -0
  147. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferRequest.yaml +4 -4
  148. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferResponse.yaml +6 -6
  149. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferStatus.yaml +0 -0
  150. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferStatusResponse.yaml +1 -1
  151. package/{OutboundServer → src/OutboundServer}/api_template/health.yaml +0 -0
  152. package/{OutboundServer → src/OutboundServer}/api_template/openapi.yaml +0 -0
  153. package/{OutboundServer → src/OutboundServer}/api_template/paths/accounts.yaml +0 -0
  154. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes.yaml +0 -0
  155. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes_bulkQuoteId.yaml +0 -0
  156. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers.yaml +0 -0
  157. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers_bulkTransferId.yaml +0 -0
  158. package/{OutboundServer → src/OutboundServer}/api_template/paths/parties_Type_ID.yaml +2 -2
  159. package/{OutboundServer → src/OutboundServer}/api_template/paths/parties_Type_ID_SubId.yaml +3 -3
  160. package/{OutboundServer → src/OutboundServer}/api_template/paths/quotes.yaml +0 -0
  161. package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPay.yaml +0 -0
  162. package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPayTransfer.yaml +0 -0
  163. package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPayTransfer_requestToPayTransactionId.yaml +0 -0
  164. package/{OutboundServer → src/OutboundServer}/api_template/paths/simpleTransfers.yaml +0 -0
  165. package/{OutboundServer → src/OutboundServer}/api_template/paths/transfers.yaml +0 -0
  166. package/{OutboundServer → src/OutboundServer}/api_template/paths/transfers_transferId.yaml +0 -0
  167. package/{OutboundServer → src/OutboundServer}/handlers.js +0 -0
  168. package/{OutboundServer → src/OutboundServer}/index.js +0 -0
  169. package/{OutboundServer → src/OutboundServer}/middlewares.js +0 -0
  170. package/{TestServer → src/TestServer}/api.yaml +0 -0
  171. package/{TestServer → src/TestServer}/handlers.js +0 -0
  172. package/{TestServer → src/TestServer}/index.js +0 -0
  173. package/{config.js → src/config.js} +0 -0
  174. package/{index.d.ts → src/index.d.ts} +0 -0
  175. package/{index.js → src/index.js} +0 -0
  176. package/{lib → src/lib}/api/index.js +0 -0
  177. package/{lib → src/lib}/cache.js +0 -0
  178. package/{lib → src/lib}/check.js +0 -0
  179. package/{lib → src/lib}/model/AccountsModel.js +0 -0
  180. package/{lib → src/lib}/model/Async2SyncModel.js +0 -0
  181. package/{lib → src/lib}/model/InboundTransfersModel.js +0 -0
  182. package/{lib → src/lib}/model/OutboundBulkQuotesModel.js +0 -0
  183. package/{lib → src/lib}/model/OutboundBulkTransfersModel.js +0 -0
  184. package/{lib → src/lib}/model/OutboundRequestToPayModel.js +0 -0
  185. package/{lib → src/lib}/model/OutboundRequestToPayTransferModel.js +0 -0
  186. package/{lib → src/lib}/model/OutboundTransfersModel.js +0 -0
  187. package/{lib → src/lib}/model/PartiesModel.js +0 -0
  188. package/{lib → src/lib}/model/ProxyModel/MatchRules/Expression.js +0 -0
  189. package/{lib → src/lib}/model/ProxyModel/MatchRules/Headers.js +0 -0
  190. package/{lib → src/lib}/model/ProxyModel/MatchRules/MatchRule.js +0 -0
  191. package/{lib → src/lib}/model/ProxyModel/MatchRules/Path.js +0 -0
  192. package/{lib → src/lib}/model/ProxyModel/MatchRules/Query.js +0 -0
  193. package/{lib → src/lib}/model/ProxyModel/MatchRules/index.js +0 -0
  194. package/{lib → src/lib}/model/ProxyModel/Route.js +0 -0
  195. package/{lib → src/lib}/model/ProxyModel/configSchema.json +0 -0
  196. package/{lib → src/lib}/model/ProxyModel/index.js +0 -0
  197. package/{lib → src/lib}/model/QuotesModel.js +0 -0
  198. package/{lib → src/lib}/model/TransfersModel.js +0 -0
  199. package/{lib → src/lib}/model/common/BackendError.js +0 -0
  200. package/{lib → src/lib}/model/common/PersistentStateMachine.js +0 -0
  201. package/{lib → src/lib}/model/common/index.js +0 -0
  202. package/{lib → src/lib}/model/index.js +0 -0
  203. package/{lib → src/lib}/model/lib/deferredJob.js +0 -0
  204. package/{lib → src/lib}/model/lib/index.js +0 -0
  205. package/{lib → src/lib}/model/lib/requests/backendRequests.js +0 -0
  206. package/{lib → src/lib}/model/lib/requests/common.js +0 -0
  207. package/{lib → src/lib}/model/lib/requests/index.js +0 -0
  208. package/{lib → src/lib}/model/lib/shared.js +0 -0
  209. package/{lib → src/lib}/randomphrase/index.js +0 -0
  210. package/{lib → src/lib}/randomphrase/words.json +0 -0
  211. package/{lib → src/lib}/router.js +0 -0
  212. package/{lib → src/lib}/validate.js +0 -0
  213. package/test/integration/lib/cache.test.js +3 -3
  214. package/test/unit/InboundServer.test.js +4 -4
  215. package/test/unit/TestServer.test.js +5 -5
  216. package/test/unit/api/utils.js +5 -5
  217. package/test/unit/config.test.js +9 -9
  218. package/test/unit/inboundApi/handlers.test.js +6 -6
  219. package/test/unit/index.test.js +1 -1
  220. package/test/unit/lib/cache.test.js +1 -1
  221. package/test/unit/lib/model/AccountsModel.test.js +2 -2
  222. package/test/unit/lib/model/InboundTransfersModel.test.js +5 -5
  223. package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +2 -2
  224. package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +2 -2
  225. package/test/unit/lib/model/OutboundRequestToPayModel.test.js +3 -3
  226. package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +2 -2
  227. package/test/unit/lib/model/OutboundTransfersModel.test.js +3 -3
  228. package/test/unit/lib/model/PartiesModel.test.js +28 -28
  229. package/test/unit/lib/model/QuotesModel.test.js +31 -31
  230. package/test/unit/lib/model/TransfersModel.test.js +3 -3
  231. package/test/unit/lib/model/common/PersistentStateMachine.test.js +13 -13
  232. package/test/unit/lib/model/mockedLibRequests.js +1 -1
  233. package/test/unit/outboundApi/handlers.test.js +3 -3
  234. package/.eslintignore +0 -2
  235. package/InboundServer/api_template.yaml +0 -69
  236. package/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +0 -18
  237. package/OutboundServer/api_template/components/schemas/accountsRequest.yaml +0 -20
  238. package/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +0 -6
  239. package/OutboundServer/api_template/components/schemas/individualQuote.yaml +0 -32
  240. package/OutboundServer/api_template/components/schemas/individualTransfer.yaml +0 -32
  241. package/OutboundServer/api_template/components/schemas/mojaloopError.yaml +0 -5
  242. package/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +0 -2
  243. package/OutboundServer/api_template/components/schemas/quote.yaml +0 -3
  244. package/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +0 -13
  245. package/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +0 -48
  246. package/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +0 -39
  247. package/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +0 -41
  248. package/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +0 -42
  249. package/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +0 -12
  250. package/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +0 -3
  251. package/OutboundServer/api_template/components/schemas/transferParty.yaml +0 -40
@@ -0,0 +1,62 @@
1
+ {
2
+ "API_PORT": 5000,
3
+ "HOSTING_ENABLED": false,
4
+ "CONFIG_VERSIONS": {
5
+ "response": 1,
6
+ "callback": 1,
7
+ "validation": 1,
8
+ "forward": 1,
9
+ "userSettings": 1
10
+ },
11
+ "DB": {
12
+ "URI": "mongodb://mongo:27018/dfsps"
13
+ },
14
+ "OAUTH": {
15
+ "AUTH_ENABLED": false,
16
+ "APP_OAUTH_CLIENT_KEY": "asdf",
17
+ "APP_OAUTH_CLIENT_SECRET": "asdf",
18
+ "MTA_ROLE": "Application/MTA",
19
+ "PTA_ROLE": "Application/PTA",
20
+ "EVERYONE_ROLE": "Internal/everyone",
21
+ "OAUTH2_ISSUER": "http://ml-testing-toolkit:5050/api/oauth2/token",
22
+ "JWT_COOKIE_NAME": "TTK-API_ACCESS_TOKEN",
23
+ "EMBEDDED_CERTIFICATE": "password"
24
+ },
25
+ "CONNECTION_MANAGER": {
26
+ "API_URL": "http://connection-manager-api:5061",
27
+ "AUTH_ENABLED": false,
28
+ "HUB_USERNAME": "hub",
29
+ "HUB_PASSWORD": "hub"
30
+ },
31
+ "KEYCLOAK": {
32
+ "ENABLED": false,
33
+ "API_URL": "http://172.17.0.1:9080",
34
+ "REALM": "testingtoolkit",
35
+ "USERNAME": "hub",
36
+ "PASSWORD": "hub"
37
+ },
38
+ "API_DEFINITIONS": [
39
+ {
40
+ "type": "fspiop",
41
+ "version": "1.0",
42
+ "folderPath": "fspiop_1.0",
43
+ "asynchronous": true
44
+ },
45
+ {
46
+ "type": "fspiop",
47
+ "version": "1.1",
48
+ "folderPath": "fspiop_1.1",
49
+ "asynchronous": true
50
+ },
51
+ {
52
+ "type": "settlements",
53
+ "version": "1.0",
54
+ "folderPath": "settlements_1.0"
55
+ },
56
+ {
57
+ "type": "central_admin",
58
+ "version": "9.3",
59
+ "folderPath": "central_admin_9.3"
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "VERSION": 1,
3
+ "CALLBACK_ENDPOINT": "http://scheme-adapter:4000",
4
+ "ALS_ENDPOINT": "http://account-lookup-service:4002",
5
+ "CALLBACK_RESOURCE_ENDPOINTS": {
6
+ "enabled": false,
7
+ "endpoints": [
8
+ {
9
+ "method": "put",
10
+ "path": "/parties/{Type}/{ID}",
11
+ "endpoint": "http://localhost:4001"
12
+ },
13
+ {
14
+ "method": "put",
15
+ "path": "/quotes/{ID}",
16
+ "endpoint": "http://localhost:3002"
17
+ },
18
+ {
19
+ "method": "put",
20
+ "path": "/transfers/{ID}",
21
+ "endpoint": "http://localhost:3000"
22
+ }
23
+ ]
24
+ },
25
+ "HUB_ONLY_MODE": false,
26
+ "ENDPOINTS_DFSP_WISE": {
27
+ "dfsps": {}
28
+ },
29
+ "SEND_CALLBACK_ENABLE": true,
30
+ "FSPID": "switch",
31
+ "DEFAULT_USER_FSPID": "userdfsp",
32
+ "TRANSFERS_VALIDATION_WITH_PREVIOUS_QUOTES": false,
33
+ "TRANSFERS_VALIDATION_ILP_PACKET": false,
34
+ "TRANSFERS_VALIDATION_CONDITION": false,
35
+ "ILP_SECRET": "secret",
36
+ "VERSIONING_SUPPORT_ENABLE": true,
37
+ "VALIDATE_INBOUND_JWS": false,
38
+ "VALIDATE_INBOUND_PUT_PARTIES_JWS": false,
39
+ "JWS_SIGN": false,
40
+ "JWS_SIGN_PUT_PARTIES": false,
41
+ "INBOUND_MUTUAL_TLS_ENABLED": false,
42
+ "OUTBOUND_MUTUAL_TLS_ENABLED": false,
43
+ "ADVANCED_FEATURES_ENABLED": true,
44
+ "CALLBACK_TIMEOUT": 20000
45
+ }
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env sh
2
+
3
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
+
5
+ set -u
6
+ set -e
7
+
8
+ HOSTS_FILE=/etc/hosts
9
+ touch ${HOSTS_FILE}
10
+
11
+ if [ `cat ${HOSTS_FILE} | grep 'scheme-adapter' | wc -l` -gt 0 ]; then
12
+ echo "[WARN] Already found scheme-adapter hosts in ${HOSTS_FILE}"
13
+ echo "[WARN] exiting with status: 0"
14
+ exit 0
15
+ fi
16
+
17
+ echo "
18
+ # Added by mojaloop
19
+ # to allow local access to mojaloop docker-compose environment
20
+ 127.0.0.1 host.docker.internal
21
+ 127.0.0.1 scheme-adapter, scheme-adapter-int, ml-testing-toolkit, mongo, redis
22
+ # end of section
23
+ " >> ${HOSTS_FILE}
24
+
25
+ cat ${HOSTS_FILE}
@@ -0,0 +1,71 @@
1
+ module.exports = {
2
+ // format version sem-ver
3
+ // `v{major}.${minor}.${patch}`
4
+ wait4: 'v0.1.0',
5
+
6
+ // How many times should we retry waiting for a service?
7
+ retries: 60,
8
+
9
+ // How many ms to wait before retrying a service connection?
10
+ waitMs: 2500,
11
+
12
+ // services definitions
13
+ services: [
14
+ {
15
+ name: 'sdk-scheme-adapter',
16
+
17
+ // list of services to wait for
18
+ wait4: [
19
+ {
20
+ description: 'Redis Cache',
21
+ uri: 'redis:6379',
22
+ method: 'ncat'
23
+ },
24
+ {
25
+ description: 'ml-testing-toolkit',
26
+ uri: 'ml-testing-toolkit:5000',
27
+ method: 'ncat'
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ name: 'cicd-integration-tests',
33
+ wait4: [
34
+ {
35
+ description: 'Inbound service',
36
+ uri: 'localhost:4000',
37
+ method: 'ncat'
38
+ },
39
+ {
40
+ description: 'Outbound service',
41
+ uri: 'localhost:4001',
42
+ method: 'ncat'
43
+ },
44
+ {
45
+ uri: 'localhost:5000',
46
+ method: 'ncat'
47
+ },
48
+ {
49
+ description: 'Redis Cache',
50
+ uri: 'localhost:6379',
51
+ method: 'ncat'
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ name: 'ml-testing-toolkit',
57
+ wait4: [
58
+ {
59
+ description: 'Inbound service',
60
+ uri: 'scheme-adapter:4000',
61
+ method: 'ncat'
62
+ },
63
+ {
64
+ description: 'MongoDB object store',
65
+ uri: 'mongodb://mongo:27018/dfsps',
66
+ method: 'mongo'
67
+ }
68
+ ]
69
+ }
70
+ ]
71
+ }
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use-strict'
4
+ const util = require('util')
5
+ /**
6
+ * @file wait4.js
7
+ * @description Waits for a given service's prerequisite services to be up and running.
8
+ *
9
+ * Observe the following Environment Variables:
10
+ * `WAIT4_SERVICE` - REQUIRED The name of the service. Must refer to any entry of `services.[*].name` in config.json
11
+ * `WAIT4_CONFIG` - OPTIONAL path to config.json file, by default `./wait4.config.json`
12
+ * `WAIT4_RETRIES` - OPTIONAL How many times should we retry waiting for a service? _optional_ Defaults to 10
13
+ * `WAIT4_WAIT_MS` - OPTIONAL How many ms to wait before retrying a service connection? _optional_ Defaults to 1000 (1 second)
14
+ *
15
+ * To keep the script code simple, we drop any validation, so the format of config file must be perfect!
16
+ *
17
+ *
18
+ */
19
+ async function main () {
20
+ console.log('args are', process.argv)
21
+
22
+ try {
23
+ const config = require(process.env.WAIT4_CONFIG || './wait4.config.js')
24
+ const service = getService(config)
25
+ console.info(`wait4 Service: ${service.name}`)
26
+
27
+ // merge config with environment or defaults
28
+ config.retries = parseInt(process.env.WAIT4_RETRIES || config.retries || 10)
29
+ config.waitMs = parseInt(process.env.WAIT4_WAIT_MS || config.waitMs || 1000)
30
+
31
+ // wait for services connections or paradox to be ready
32
+ const waitresses = getWaiters(service.wait4, config)
33
+ const report = await Promise.all(waitresses)
34
+
35
+ console.info(`wait4 Report:\n${util.inspect(report, false, 5, true)}`)
36
+ process.exit(0)
37
+ } catch (error) {
38
+ console.error(`wait4 Error: ${error}`)
39
+ process.exit(1)
40
+ }
41
+ }
42
+
43
+ main()
44
+
45
+ function getService (config) {
46
+ const serviceName = process.argv.slice(-1).pop() || process.env.WAIT4_SERVICE
47
+ if (!serviceName) {
48
+ console.error('wait4 Environment variable WAIT4_SERVICE or service name parameter are required')
49
+ process.exit(1)
50
+ }
51
+ return config.services.find(s => s.name === serviceName)
52
+ }
53
+ /**
54
+ * @function getWaiters
55
+ * @description - generates the list of promises of doing the wait job
56
+ * @param {array} wait4 - list of wait job descriptions
57
+ * @param {object} config - configuration
58
+ */
59
+ function getWaiters (wait4, config) {
60
+ const methods = {
61
+ mongo: methodMongoDB,
62
+ mysql: methodMySQL,
63
+ // creating a alternative wait method since consent oracle uses a different separated config
64
+ mysqlAlt: methodMySQLAlt,
65
+ ncat: methodNCat
66
+ }
67
+ console.log(`wait4 Dependencies to wait for:\n${util.inspect(wait4, false, 5, true)}`)
68
+ return wait4.map(waitJob => wrapWithRetries(
69
+ methods[waitJob.method],
70
+ waitJob,
71
+ waitJob.retries || config.retries,
72
+ waitJob.waitMs || config.waitMs
73
+ ))
74
+ }
75
+
76
+ /**
77
+ * @function wrapWithRetries
78
+ * @description - Call the given function with a number of retries.
79
+ * @param {fn} method - Async function to be called with retries
80
+ * @param {object} waitJob - waitJob's definition
81
+ * @param {number} retries - Number of times to retry before returning an error if the func fails
82
+ * @param {number} waitTimeMs - Ms time to wait before trying again
83
+ */
84
+ async function wrapWithRetries (method, waitJob, retries, waitTimeMs) {
85
+ try {
86
+ // generate method's RC config
87
+ const RC = getRC(waitJob)
88
+ // method do it's wait job
89
+ waitJob = await method(waitJob, RC)
90
+ waitJob.status = 'connected'
91
+ return Promise.resolve(waitJob)
92
+ } catch (err) {
93
+ console.info(`wait4 Retry(${waitJob.uri})`)
94
+ if (retries > 0) {
95
+ // let retry wait job again
96
+ return new Promise((resolve) => {
97
+ waitJob.retries = (waitJob.retries || 0) + 1
98
+ setTimeout(() => resolve(wrapWithRetries(method, waitJob, retries - 1, waitTimeMs)), waitTimeMs)
99
+ })
100
+ }
101
+ // no more retries left
102
+ console.error(`wait4 Out of retries for uri:${waitJob.uri}\n\t\tand method: ${waitJob.method}`)
103
+ waitJob.status = 'stalled'
104
+ return Promise.reject(err)
105
+ }
106
+ }
107
+
108
+ /**
109
+ * @function getRC
110
+ * @description - create RC config instance
111
+ * @param {object} waitJob
112
+ */
113
+ function getRC (waitJob) {
114
+ // acquire rc parameters
115
+ const namespace = (waitJob.rc && waitJob.rc.namespace) || 'CLEDG'
116
+ const configPath = (waitJob.rc && waitJob.rc.configPath) || '../config/default.json'
117
+
118
+ // require rc to deliver config
119
+ try {
120
+ return require('rc')(namespace, require(configPath))
121
+ } catch (err) {
122
+ return waitJob.rc || {}
123
+ }
124
+ }
125
+
126
+ /**
127
+ * @function methodMongoDB
128
+ * @description Waits for the MongoDB service to be up and running
129
+ * @param {object} waitJob
130
+ * @param {object} RC
131
+ */
132
+ async function methodMongoDB (waitJob, RC) {
133
+ const isDisabled = RC.MONGODB.DISABLED && RC.MONGODB.DISABLED.toString().trim().toLowerCase() === 'true'
134
+ if (isDisabled) {
135
+ return `MongoDB(${waitJob.uri}) Disabled`
136
+ }
137
+
138
+ // make connection to MongoDB using `Mongoose`
139
+ const mongoose = require('mongoose')
140
+ const model = mongoose.model('test', mongoose.Schema({ name: 'string' }))
141
+ await mongoose.connect(waitJob.uri, { useUnifiedTopology: true, promiseLibrary: global.Promise })
142
+ await model.findOne({ name: 'x' }).exec()
143
+ return waitJob
144
+ }
145
+
146
+ /**
147
+ * @function methodMySQL
148
+ * @description Waits for the MySQL service to be up and running
149
+ * @param {*} waitJob
150
+ * @param {*} RC
151
+ */
152
+ async function methodMySQL (waitJob, RC) {
153
+ // make connection to MySQL using `knex`
154
+ const knex = require('knex')({
155
+ client: RC.DATABASE.DIALECT,
156
+ connection: {
157
+ host: RC.DATABASE.HOST.replace(/\/$/, ''),
158
+ port: RC.DATABASE.PORT,
159
+ user: RC.DATABASE.USER,
160
+ password: RC.DATABASE.PASSWORD,
161
+ database: RC.DATABASE.SCHEMA
162
+ }
163
+ })
164
+ await knex.select(1)
165
+
166
+ return waitJob
167
+ }
168
+
169
+ /**
170
+ * @function methodMySQLAlt
171
+ * @description Waits for the MySQL service to be up and running
172
+ * @param {*} waitJob
173
+ * @param {*} RC
174
+ */
175
+ async function methodMySQLAlt (waitJob, RC) {
176
+ // make connection to MySQL using `knex`
177
+ const knex = require('knex')({
178
+ client: 'mysql',
179
+ connection: {
180
+ host: RC.connection.host.replace(/\/$/, ''),
181
+ port: RC.connection.port,
182
+ user: RC.connection.user,
183
+ password: RC.connection.password,
184
+ database: RC.connection.schema
185
+ }
186
+ })
187
+ await knex.select(1)
188
+
189
+ return waitJob
190
+ }
191
+
192
+ /**
193
+ * @function methodNCat
194
+ * @description checks is any TCP network stream up on given host:port
195
+ * @param {*} waitJob
196
+ * @param {*} RC
197
+ */
198
+ async function methodNCat (waitJob) {
199
+ const [host, port] = waitJob.uri.toString().split(':').map(x => x.trim())
200
+ const { execSync } = require('child_process')
201
+ const command = `nc -z ${host} ${port}`
202
+ execSync(command)
203
+ return waitJob
204
+ }
@@ -0,0 +1,67 @@
1
+ version: '3.7'
2
+ networks:
3
+ mojaloop-net:
4
+ name: mojaloop-net
5
+
6
+ services:
7
+ redis:
8
+ networks:
9
+ - mojaloop-net
10
+ image: "redis:5.0.4-alpine"
11
+ ports:
12
+ - "6379:6379"
13
+ scheme-adapter:
14
+ networks:
15
+ - mojaloop-net
16
+ build:
17
+ context: .
18
+ env_file: ./test/config/integration.env
19
+ ports:
20
+ - "4000:4000"
21
+ - "4001:4001"
22
+ - "4002:4002"
23
+ depends_on:
24
+ - redis
25
+ command: sh -c "/wait4/wait4.js sdk-scheme-adapter; node src/index.js"
26
+ volumes:
27
+ - ./docker/wait4:/wait4
28
+
29
+ ml-testing-toolkit:
30
+ networks:
31
+ - mojaloop-net
32
+ image: mojaloop/ml-testing-toolkit:v11.7.11
33
+ container_name: ml-testing-toolkit
34
+ volumes:
35
+ - "./docker/ml-testing-toolkit/spec_files:/opt/mojaloop-testing-toolkit/spec_files"
36
+ - "./docker/ml-testing-toolkit/secrets:/opt/mojaloop-testing-toolkit/secrets"
37
+
38
+ ports:
39
+ - "5000:5000"
40
+ - "5050:5050"
41
+ environment:
42
+ - AUTH_ENABLED=FALSE
43
+ command: npm start
44
+ depends_on:
45
+ - mongo
46
+
47
+ mongo:
48
+ networks:
49
+ - mojaloop-net
50
+ image: mongo
51
+ ports:
52
+ - "27018:27017"
53
+ #
54
+ # for local development we want to have ttk-ui
55
+ #
56
+ # mojaloop-testing-toolkit-ui:
57
+ # image: mojaloop/ml-testing-toolkit-ui:v11.8.4
58
+ # ports:
59
+ # - "6060:6060"
60
+ # networks:
61
+ # - mojaloop-net
62
+ # environment:
63
+ # - API_BASE_URL=http://localhost:5050
64
+ # - AUTH_ENABLED=FALSE
65
+ # command:
66
+ # - sh
67
+ # - /usr/share/nginx/start.sh