@mojaloop/sdk-scheme-adapter 12.0.0 → 12.1.0

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 (263) hide show
  1. package/.circleci/config.yml +619 -0
  2. package/.env.example +13 -0
  3. package/.nvmrc +1 -1
  4. package/.versionrc +1 -0
  5. package/CHANGELOG.md +28 -2
  6. package/CODEOWNERS +2 -0
  7. package/Dockerfile +35 -0
  8. package/LICENSE.md +10 -0
  9. package/PROXY.md +84 -0
  10. package/README.md +228 -0
  11. package/SECURITY.md +18 -0
  12. package/audit-resolve.json +45 -0
  13. package/docker/ml-testing-toolkit/secrets/keygen.sh +5 -0
  14. package/docker/ml-testing-toolkit/secrets/privatekey.pem +27 -0
  15. package/docker/ml-testing-toolkit/secrets/publickey.cer +21 -0
  16. package/docker/ml-testing-toolkit/secrets/tls/createSecrets.sh +29 -0
  17. package/docker/ml-testing-toolkit/secrets/tls/hub_client.csr +28 -0
  18. package/docker/ml-testing-toolkit/secrets/tls/hub_client_cacert.pem +32 -0
  19. package/docker/ml-testing-toolkit/secrets/tls/hub_client_cakey.key +51 -0
  20. package/docker/ml-testing-toolkit/secrets/tls/hub_client_key.key +51 -0
  21. package/docker/ml-testing-toolkit/secrets/tls/hub_server.csr +28 -0
  22. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cacert.pem +32 -0
  23. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cacert.srl +1 -0
  24. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cakey.key +51 -0
  25. package/docker/ml-testing-toolkit/secrets/tls/hub_server_cert.pem +33 -0
  26. package/docker/ml-testing-toolkit/secrets/tls/hub_server_key.key +51 -0
  27. package/docker/ml-testing-toolkit/secrets/tls/openssl.conf +17 -0
  28. package/docker/ml-testing-toolkit/spec_files/api_definitions/central_admin_9.3/api_spec.yaml +2450 -0
  29. package/docker/ml-testing-toolkit/spec_files/api_definitions/central_admin_9.3/response_map.json +96 -0
  30. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/api_spec.yaml +4187 -0
  31. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/callback_map.json +542 -0
  32. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/mockRef.json +83 -0
  33. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup.json +125 -0
  34. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/api_spec.yaml +3703 -0
  35. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/callback_map.json +568 -0
  36. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/mockRef.json +83 -0
  37. package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/trigger_templates/transaction_request_followup.json +125 -0
  38. package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/api_spec.yaml +983 -0
  39. package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/mockRef.json +38 -0
  40. package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/response_map.json +34 -0
  41. package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/html_template.html +1074 -0
  42. package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/pdf_template.html +765 -0
  43. package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/script.js +98 -0
  44. package/docker/ml-testing-toolkit/spec_files/rules_callback/config.json +3 -0
  45. package/docker/ml-testing-toolkit/spec_files/rules_callback/default.json +426 -0
  46. package/docker/ml-testing-toolkit/spec_files/rules_response/config.json +3 -0
  47. package/docker/ml-testing-toolkit/spec_files/rules_response/default.json +1623 -0
  48. package/docker/ml-testing-toolkit/spec_files/rules_response/default_pisp_rules.json +161 -0
  49. package/docker/ml-testing-toolkit/spec_files/rules_validation/config.json +3 -0
  50. package/docker/ml-testing-toolkit/spec_files/rules_validation/default.json +672 -0
  51. package/docker/ml-testing-toolkit/spec_files/system_config.json +62 -0
  52. package/docker/ml-testing-toolkit/spec_files/user_config.json +45 -0
  53. package/docker/wait4/setup_hosts_file.sh +25 -0
  54. package/docker/wait4/wait4.config.js +71 -0
  55. package/docker/wait4/wait4.js +204 -0
  56. package/docker-compose.yml +67 -0
  57. package/docs/Mojaloop - Modusbox Onboarding functionality.pdf +0 -0
  58. package/docs/dfspInboundApi.yaml +1091 -0
  59. package/jest.config.js +4 -1
  60. package/package.json +17 -17
  61. package/secrets/jwsSigningKey.key +27 -0
  62. package/secrets/jwsVerificationKeys/mojaloop-sdk.pem +9 -0
  63. package/secrets/jwsVerificationKeys/switch.pem +9 -0
  64. package/sequences.puml +99 -0
  65. package/src/ControlAgent/index.js +221 -0
  66. package/{TestServer → src/ControlServer}/handlers.js +0 -0
  67. package/src/ControlServer/index.js +294 -0
  68. package/{InboundServer → src/InboundServer}/api.yaml +0 -0
  69. package/src/InboundServer/api_template.yaml +69 -0
  70. package/{InboundServer → src/InboundServer}/handlers.js +0 -0
  71. package/{InboundServer → src/InboundServer}/index.js +33 -1
  72. package/{InboundServer → src/InboundServer}/middlewares.js +0 -0
  73. package/src/OAuthTestServer/index.js +127 -0
  74. package/{OAuthTestServer → src/OAuthTestServer}/model.js +0 -0
  75. package/{OutboundServer → src/OutboundServer}/api.yaml +0 -0
  76. package/{OutboundServer → src/OutboundServer}/api_interfaces/index.d.ts +0 -0
  77. package/{OutboundServer → src/OutboundServer}/api_interfaces/openapi.d.ts +0 -0
  78. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/bulkQuoteId.yaml +1 -1
  79. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/bulkTransferId.yaml +1 -1
  80. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/requestToPayTransactionId.yaml +1 -1
  81. package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/transferId.yaml +1 -1
  82. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationCompleted.yaml +0 -0
  83. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationError.yaml +0 -0
  84. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationTimeout.yaml +0 -0
  85. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteBadRequest.yaml +0 -0
  86. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteServerError.yaml +0 -0
  87. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteSuccess.yaml +0 -0
  88. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteTimeout.yaml +0 -0
  89. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferBadRequest.yaml +0 -0
  90. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferServerError.yaml +0 -0
  91. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferSuccess.yaml +0 -0
  92. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferTimeout.yaml +0 -0
  93. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/partiesByIdError404.yaml +1 -1
  94. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/partiesByIdSuccess.yaml +0 -0
  95. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/quotesPostSuccess.yaml +0 -0
  96. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/quotesServerError.yaml +0 -0
  97. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPaySuccess.yaml +0 -0
  98. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPayTransferBadRequest.yaml +0 -0
  99. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPayTransferSuccess.yaml +0 -0
  100. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/simpleTransfersPostSuccess.yaml +0 -0
  101. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/simpleTransfersServerError.yaml +0 -0
  102. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferBadRequest.yaml +0 -0
  103. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferServerError.yaml +0 -0
  104. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferSuccess.yaml +0 -0
  105. package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferTimeout.yaml +0 -0
  106. package/src/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +18 -0
  107. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/accountsCreationState.yaml +0 -0
  108. package/src/OutboundServer/api_template/components/schemas/accountsRequest.yaml +20 -0
  109. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/accountsResponse.yaml +1 -1
  110. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/async2SyncCurrentState.yaml +0 -0
  111. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteErrorResponse.yaml +0 -0
  112. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteRequest.yaml +2 -2
  113. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteResponse.yaml +1 -1
  114. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteStatus.yaml +0 -0
  115. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteStatusResponse.yaml +1 -1
  116. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferErrorResponse.yaml +0 -0
  117. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferRequest.yaml +2 -2
  118. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferResponse.yaml +1 -1
  119. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferStatus.yaml +0 -0
  120. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferStatusResponse.yaml +1 -1
  121. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorAccountsResponse.yaml +0 -0
  122. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorQuotesResponse.yaml +0 -0
  123. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorResponse.yaml +0 -0
  124. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorSimpleTransfersResponse.yaml +0 -0
  125. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorTransferResponse.yaml +0 -0
  126. package/src/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +6 -0
  127. package/src/OutboundServer/api_template/components/schemas/individualQuote.yaml +32 -0
  128. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualQuoteResult.yaml +5 -5
  129. package/src/OutboundServer/api_template/components/schemas/individualTransfer.yaml +32 -0
  130. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualTransferFulfilment.yaml +2 -2
  131. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualTransferResult.yaml +6 -6
  132. package/src/OutboundServer/api_template/components/schemas/mojaloopError.yaml +5 -0
  133. package/src/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +2 -0
  134. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/partiesByIdResponse.yaml +1 -1
  135. package/src/OutboundServer/api_template/components/schemas/quote.yaml +3 -0
  136. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/quoteError.yaml +0 -0
  137. package/src/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +13 -0
  138. package/src/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +48 -0
  139. package/src/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +39 -0
  140. package/src/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +41 -0
  141. package/src/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +42 -0
  142. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/requestToPayTransferResponse.yaml +6 -6
  143. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/simpleTransferServerError.yaml +0 -0
  144. package/src/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +12 -0
  145. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/simpleTransfersPostResponse.yaml +1 -1
  146. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transactionType.yaml +0 -0
  147. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptOTP.yaml +0 -0
  148. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptParty.yaml +0 -0
  149. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptQuote.yaml +0 -0
  150. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferError.yaml +0 -0
  151. package/src/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +3 -0
  152. package/src/OutboundServer/api_template/components/schemas/transferParty.yaml +40 -0
  153. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferRequest.yaml +4 -4
  154. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferResponse.yaml +6 -6
  155. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferStatus.yaml +0 -0
  156. package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferStatusResponse.yaml +1 -1
  157. package/{OutboundServer → src/OutboundServer}/api_template/health.yaml +0 -0
  158. package/{OutboundServer → src/OutboundServer}/api_template/openapi.yaml +0 -0
  159. package/{OutboundServer → src/OutboundServer}/api_template/paths/accounts.yaml +0 -0
  160. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes.yaml +0 -0
  161. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes_bulkQuoteId.yaml +0 -0
  162. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers.yaml +0 -0
  163. package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers_bulkTransferId.yaml +0 -0
  164. package/{OutboundServer → src/OutboundServer}/api_template/paths/parties_Type_ID.yaml +2 -2
  165. package/{OutboundServer → src/OutboundServer}/api_template/paths/parties_Type_ID_SubId.yaml +3 -3
  166. package/{OutboundServer → src/OutboundServer}/api_template/paths/quotes.yaml +0 -0
  167. package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPay.yaml +0 -0
  168. package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPayTransfer.yaml +0 -0
  169. package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPayTransfer_requestToPayTransactionId.yaml +0 -0
  170. package/{OutboundServer → src/OutboundServer}/api_template/paths/simpleTransfers.yaml +0 -0
  171. package/{OutboundServer → src/OutboundServer}/api_template/paths/transfers.yaml +0 -0
  172. package/{OutboundServer → src/OutboundServer}/api_template/paths/transfers_transferId.yaml +0 -0
  173. package/{OutboundServer → src/OutboundServer}/handlers.js +0 -0
  174. package/{OutboundServer → src/OutboundServer}/index.js +15 -0
  175. package/{OutboundServer → src/OutboundServer}/middlewares.js +0 -0
  176. package/{TestServer → src/TestServer}/api.yaml +0 -0
  177. package/src/TestServer/handlers.js +63 -0
  178. package/{TestServer → src/TestServer}/index.js +31 -0
  179. package/{config.js → src/config.js} +6 -0
  180. package/{index.d.ts → src/index.d.ts} +0 -0
  181. package/{index.js → src/index.js} +0 -0
  182. package/{lib → src/lib}/api/index.js +0 -0
  183. package/{lib → src/lib}/cache.js +0 -0
  184. package/{lib → src/lib}/check.js +0 -0
  185. package/{lib → src/lib}/model/AccountsModel.js +0 -0
  186. package/{lib → src/lib}/model/Async2SyncModel.js +0 -0
  187. package/{lib → src/lib}/model/InboundTransfersModel.js +0 -0
  188. package/{lib → src/lib}/model/OutboundBulkQuotesModel.js +0 -0
  189. package/{lib → src/lib}/model/OutboundBulkTransfersModel.js +0 -0
  190. package/{lib → src/lib}/model/OutboundRequestToPayModel.js +0 -0
  191. package/{lib → src/lib}/model/OutboundRequestToPayTransferModel.js +0 -0
  192. package/{lib → src/lib}/model/OutboundTransfersModel.js +0 -0
  193. package/{lib → src/lib}/model/PartiesModel.js +0 -0
  194. package/{lib → src/lib}/model/ProxyModel/MatchRules/Expression.js +0 -0
  195. package/{lib → src/lib}/model/ProxyModel/MatchRules/Headers.js +0 -0
  196. package/{lib → src/lib}/model/ProxyModel/MatchRules/MatchRule.js +0 -0
  197. package/{lib → src/lib}/model/ProxyModel/MatchRules/Path.js +0 -0
  198. package/{lib → src/lib}/model/ProxyModel/MatchRules/Query.js +0 -0
  199. package/{lib → src/lib}/model/ProxyModel/MatchRules/index.js +0 -0
  200. package/{lib → src/lib}/model/ProxyModel/Route.js +0 -0
  201. package/{lib → src/lib}/model/ProxyModel/configSchema.json +0 -0
  202. package/{lib → src/lib}/model/ProxyModel/index.js +0 -0
  203. package/{lib → src/lib}/model/QuotesModel.js +0 -0
  204. package/{lib → src/lib}/model/TransfersModel.js +0 -0
  205. package/{lib → src/lib}/model/common/BackendError.js +0 -0
  206. package/{lib → src/lib}/model/common/PersistentStateMachine.js +0 -0
  207. package/{lib → src/lib}/model/common/index.js +0 -0
  208. package/{lib → src/lib}/model/index.js +0 -0
  209. package/{lib → src/lib}/model/lib/deferredJob.js +0 -0
  210. package/{lib → src/lib}/model/lib/index.js +0 -0
  211. package/{lib → src/lib}/model/lib/requests/backendRequests.js +0 -0
  212. package/{lib → src/lib}/model/lib/requests/common.js +0 -0
  213. package/{lib → src/lib}/model/lib/requests/index.js +0 -0
  214. package/{lib → src/lib}/model/lib/shared.js +0 -0
  215. package/{lib → src/lib}/randomphrase/index.js +0 -0
  216. package/{lib → src/lib}/randomphrase/words.json +0 -0
  217. package/{lib → src/lib}/router.js +0 -0
  218. package/{lib → src/lib}/validate.js +0 -0
  219. package/test/config/integration.env +9 -0
  220. package/test/integration/lib/cache.test.js +3 -3
  221. package/test/unit/ControlClient.test.js +113 -0
  222. package/test/unit/ControlServer/events.js +41 -0
  223. package/test/unit/ControlServer/index.js +231 -0
  224. package/test/unit/ControlServer.test.js +126 -0
  225. package/test/unit/InboundServer.test.js +5 -5
  226. package/test/unit/TestServer.test.js +5 -5
  227. package/test/unit/api/utils.js +5 -5
  228. package/test/unit/config.test.js +11 -10
  229. package/test/unit/inboundApi/handlers.test.js +6 -6
  230. package/test/unit/index.test.js +2 -1
  231. package/test/unit/lib/cache.test.js +1 -1
  232. package/test/unit/lib/model/AccountsModel.test.js +2 -2
  233. package/test/unit/lib/model/InboundTransfersModel.test.js +5 -5
  234. package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +2 -2
  235. package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +2 -2
  236. package/test/unit/lib/model/OutboundRequestToPayModel.test.js +3 -3
  237. package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +2 -2
  238. package/test/unit/lib/model/OutboundTransfersModel.test.js +3 -3
  239. package/test/unit/lib/model/PartiesModel.test.js +28 -28
  240. package/test/unit/lib/model/QuotesModel.test.js +31 -31
  241. package/test/unit/lib/model/TransfersModel.test.js +3 -3
  242. package/test/unit/lib/model/common/PersistentStateMachine.test.js +13 -13
  243. package/test/unit/lib/model/mockedLibRequests.js +1 -1
  244. package/test/unit/outboundApi/handlers.test.js +3 -3
  245. package/.eslintignore +0 -2
  246. package/InboundServer/api_template.yaml +0 -69
  247. package/OAuthTestServer/index.js +0 -66
  248. package/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +0 -18
  249. package/OutboundServer/api_template/components/schemas/accountsRequest.yaml +0 -20
  250. package/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +0 -6
  251. package/OutboundServer/api_template/components/schemas/individualQuote.yaml +0 -32
  252. package/OutboundServer/api_template/components/schemas/individualTransfer.yaml +0 -32
  253. package/OutboundServer/api_template/components/schemas/mojaloopError.yaml +0 -5
  254. package/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +0 -2
  255. package/OutboundServer/api_template/components/schemas/quote.yaml +0 -3
  256. package/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +0 -13
  257. package/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +0 -48
  258. package/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +0 -39
  259. package/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +0 -41
  260. package/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +0 -42
  261. package/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +0 -12
  262. package/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +0 -3
  263. package/OutboundServer/api_template/components/schemas/transferParty.yaml +0 -40
@@ -0,0 +1,40 @@
1
+ type: object
2
+ required:
3
+ - idType
4
+ - idValue
5
+ properties:
6
+ type:
7
+ $ref: >-
8
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/TransactionInitiatorType.yaml
9
+ idType:
10
+ $ref: >-
11
+ ../../../../../node_modules/@mojaloop/api-snippets/thirdparty/v1_0/openapi3/components/schemas/PartyIdType.yaml
12
+ idValue:
13
+ $ref: >-
14
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/PartyIdentifier.yaml
15
+ idSubValue:
16
+ $ref: >-
17
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/PartySubIdOrType.yaml
18
+ displayName:
19
+ $ref: >-
20
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Name.yaml
21
+ firstName:
22
+ $ref: >-
23
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/FirstName.yaml
24
+ middleName:
25
+ $ref: >-
26
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/MiddleName.yaml
27
+ lastName:
28
+ $ref: >-
29
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/LastName.yaml
30
+ dateOfBirth:
31
+ $ref: >-
32
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/DateOfBirth.yaml
33
+ merchantClassificationCode:
34
+ $ref: >-
35
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/MerchantClassificationCode.yaml
36
+ fspId:
37
+ $ref: >-
38
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/FspId.yaml
39
+ extensionList:
40
+ $ref: ./extensionListEmptiable.yaml
@@ -19,18 +19,18 @@ properties:
19
19
  $ref: ./transferParty.yaml
20
20
  amountType:
21
21
  $ref: >-
22
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/AmountType.yaml
22
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/AmountType.yaml
23
23
  currency:
24
24
  $ref: >-
25
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Currency.yaml
25
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Currency.yaml
26
26
  amount:
27
27
  $ref: >-
28
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Amount.yaml
28
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Amount.yaml
29
29
  transactionType:
30
30
  $ref: ./transactionType.yaml
31
31
  note:
32
32
  $ref: >-
33
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Note.yaml
33
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Note.yaml
34
34
  quoteRequestExtensions:
35
35
  $ref: ./extensionListEmptiable.yaml
36
36
  transferRequestExtensions:
@@ -10,7 +10,7 @@ required:
10
10
  properties:
11
11
  transferId:
12
12
  $ref: >-
13
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
13
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
14
14
  homeTransactionId:
15
15
  type: string
16
16
  description: >-
@@ -22,23 +22,23 @@ properties:
22
22
  $ref: ./transferParty.yaml
23
23
  amountType:
24
24
  $ref: >-
25
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/AmountType.yaml
25
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/AmountType.yaml
26
26
  currency:
27
27
  $ref: >-
28
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Currency.yaml
28
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Currency.yaml
29
29
  amount:
30
30
  $ref: >-
31
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Amount.yaml
31
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Amount.yaml
32
32
  transactionType:
33
33
  $ref: ./transactionType.yaml
34
34
  note:
35
35
  $ref: >-
36
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Note.yaml
36
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/Note.yaml
37
37
  currentState:
38
38
  $ref: ./transferStatus.yaml
39
39
  quoteId:
40
40
  $ref: >-
41
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
41
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
42
42
  quoteResponse:
43
43
  $ref: ./quote.yaml
44
44
  quoteResponseSource:
@@ -6,7 +6,7 @@ required:
6
6
  properties:
7
7
  transferId:
8
8
  $ref: >-
9
- ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
9
+ ../../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/schemas/CorrelationId.yaml
10
10
  currentState:
11
11
  $ref: ./transferStatus.yaml
12
12
  fulfil:
@@ -1,8 +1,8 @@
1
1
  parameters:
2
2
  - $ref: >-
3
- ../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Type.yaml
3
+ ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Type.yaml
4
4
  - $ref: >-
5
- ../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml
5
+ ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml
6
6
  get:
7
7
  description: >-
8
8
  The HTTP request GET /parties// (or GET /parties///) is used to lookup
@@ -1,10 +1,10 @@
1
1
  parameters:
2
2
  - $ref: >-
3
- ../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Type.yaml
3
+ ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Type.yaml
4
4
  - $ref: >-
5
- ../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml
5
+ ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml
6
6
  - $ref: >-
7
- ../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/SubId.yaml
7
+ ../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/SubId.yaml
8
8
  get:
9
9
  description: >-
10
10
  The HTTP request GET /parties// (or GET /parties///) is used to lookup
@@ -132,6 +132,21 @@ class OutboundServer extends EventEmitter {
132
132
  }
133
133
  this._logger.log('Shut down complete');
134
134
  }
135
+
136
+ async reconfigure(conf, logger, cache, metricsClient) {
137
+ const newApi = new OutboundApi(conf, logger, cache, this._validator, metricsClient);
138
+ await newApi.start();
139
+ return () => {
140
+ this._logger = logger;
141
+ this._cache = cache;
142
+ this._server.removeAllListeners('request');
143
+ this._server.on('request', newApi.callback());
144
+ this._api.stop();
145
+ this._api = newApi;
146
+ this._conf = conf;
147
+ this._logger.log('restarted');
148
+ };
149
+ }
135
150
  }
136
151
 
137
152
  module.exports = OutboundServer;
File without changes
@@ -0,0 +1,63 @@
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 healthCheck = async(ctx) => {
14
+ ctx.response.status = 204;
15
+ ctx.response.body = '';
16
+ };
17
+
18
+
19
+ /**
20
+ * Handles a GET /requests/{ID} request. This is a test support method that allows the caller
21
+ * to see the body of a previous incoming request.
22
+ */
23
+ const getRequestById = async(ctx) => {
24
+ try {
25
+ const req = await ctx.state.cache.get(`request_${ctx.state.path.params.ID}`);
26
+ ctx.response.status = 200;
27
+ ctx.response.body = req;
28
+ }
29
+ catch(err) {
30
+ ctx.status = 500;
31
+ ctx.response.body = err;
32
+ }
33
+ };
34
+
35
+
36
+ /**
37
+ * Handles a GET /callbacks/{ID} request. This is a test support method that allows the caller
38
+ * to see the body of a previous incoming callback.
39
+ */
40
+ const getCallbackById = async(ctx) => {
41
+ try {
42
+ const req = await ctx.state.cache.get(`callback_${ctx.state.path.params.ID}`);
43
+ ctx.response.status = 200;
44
+ ctx.response.body = req;
45
+ }
46
+ catch(err) {
47
+ ctx.status = 500;
48
+ ctx.response.body = err;
49
+ }
50
+ };
51
+
52
+
53
+ module.exports = {
54
+ '/': {
55
+ get: healthCheck
56
+ },
57
+ '/requests/{ID}': {
58
+ get: getRequestById
59
+ },
60
+ '/callbacks/{ID}': {
61
+ get: getCallbackById
62
+ },
63
+ };
@@ -11,6 +11,7 @@
11
11
  const Koa = require('koa');
12
12
  const ws = require('ws');
13
13
 
14
+ const assert = require('assert').strict;
14
15
  const http = require('http');
15
16
  const yaml = require('js-yaml');
16
17
  const fs = require('fs').promises;
@@ -210,6 +211,36 @@ class TestServer {
210
211
  }
211
212
  this._logger.log('Test server shutdown complete');
212
213
  }
214
+
215
+ async reconfigure({ port, logger, cache }) {
216
+ assert(port === this._port, 'Cannot reconfigure running port');
217
+ const newApi = new TestApi(logger, cache, this._validator);
218
+ const newWsApi = new WsServer(logger.push({ component: 'websocket-server' }), cache);
219
+ await newWsApi.start();
220
+
221
+ return () => {
222
+ const oldWsApi = this._wsapi;
223
+ this._logger = logger;
224
+ this._cache = cache;
225
+ this._wsapi = newWsApi;
226
+ this._api = newApi;
227
+ this._server.removeAllListeners('upgrade');
228
+ this._server.on('upgrade', (req, socket, head) => {
229
+ this._wsapi.handleUpgrade(req, socket, head, (ws) =>
230
+ this._wsapi.emit('connection', ws, req));
231
+ });
232
+ this._server.removeAllListeners('request');
233
+ this._server.on('request', newApi.callback());
234
+ // TODO: we can't guarantee client implementations. Therefore we can't guarantee
235
+ // reconnect logic/behaviour. Therefore instead of closing all websocket client
236
+ // connections as we do below, we should replace handlers.
237
+ oldWsApi.stop().catch((err) => {
238
+ this._logger.push({ err }).log('Error stopping websocket server during reconfigure');
239
+ });
240
+
241
+ this._logger.log('restarted');
242
+ };
243
+ }
213
244
  }
214
245
 
215
246
  module.exports = TestServer;
@@ -58,6 +58,10 @@ const env = from(process.env, {
58
58
 
59
59
  module.exports = {
60
60
  __parseResourceVersion: parseResourceVersions,
61
+ control: {
62
+ mgmtAPIWsUrl: env.get('MGMT_API_WS_URL').required().asString(),
63
+ mgmtAPIWsPort: env.get('MGMT_API_WS_PORT').default('4005').asPortNumber()
64
+ },
61
65
  mutualTLS: {
62
66
  inboundRequests: {
63
67
  enabled: env.get('INBOUND_MUTUAL_TLS_ENABLED').default('false').asBool(),
@@ -160,4 +164,6 @@ module.exports = {
160
164
  // a transactionRequestId. this option decodes the ilp packet for
161
165
  // the `transactionId` to retrieve the quote from cache
162
166
  allowDifferentTransferTransactionId: env.get('ALLOW_DIFFERENT_TRANSFER_TRANSACTION_ID').default('false').asBool(),
167
+
168
+ pm4mlEnabled: env.get('PM4ML_ENABLED').default('false').asBool(),
163
169
  };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -131,3 +131,12 @@ TRANSFERS_ENDPOINT=ml-testing-toolkit:5000
131
131
  # The incoming transfer request should consists of an ILP packet and a matching condition in this case.
132
132
  # The fulfilment will be generated from the provided ILP packet, and must hash to the provided condition.
133
133
  ALLOW_TRANSFER_WITHOUT_QUOTE=false
134
+
135
+ # Management API websocket connection settings.
136
+ # The Management API uses this for exchanging connector management messages.
137
+ MGMT_API_WS_URL=127.0.0.1
138
+ MGMT_API_WS_PORT=4005
139
+
140
+ # Set to true to enable the use of PM4ML-related services e.g MCM, Management API service
141
+ # when running the scheme-adapter as a mojaloop connector component within Payment Manager for Mojaloop.
142
+ PM4ML_ENABLED=false
@@ -32,7 +32,7 @@
32
32
 
33
33
  jest.dontMock('redis');
34
34
 
35
- const Cache = require('../../../lib/cache');
35
+ const Cache = require('~/lib/cache');
36
36
  const { Logger } = require('@mojaloop/sdk-standard-components');
37
37
  const env = require('../testEnv');
38
38
 
@@ -58,14 +58,14 @@ const createCache = async (config) => {
58
58
  describe('Cache', () => {
59
59
  let cache;
60
60
 
61
- beforeEach(async () => {
61
+ beforeEach(async () => {
62
62
  cache = await createCache(defaultCacheConfig);
63
63
  });
64
64
 
65
65
  afterEach(async () => {
66
66
  await cache.disconnect();
67
67
  });
68
-
68
+
69
69
  test('Sets and retrieves an object in the cache', async () => {
70
70
  // Arrange
71
71
  const value = {test: true};
@@ -0,0 +1,113 @@
1
+
2
+ const ControlAgent = require('~/ControlAgent');
3
+ const TestControlServer = require('./ControlServer');
4
+ const InboundServer = require('~/InboundServer');
5
+ const OutboundServer = require('~/OutboundServer');
6
+ const TestServer = require('~/TestServer');
7
+ const defaultConfig = require('./data/defaultConfig.json');
8
+ const { Logger } = require('@mojaloop/sdk-standard-components');
9
+
10
+ jest.mock('~/lib/cache');
11
+ const Cache = require('~/lib/cache');
12
+
13
+ // TODO:
14
+ // - diff against master to determine what else needs testing
15
+ // - especially look for assertions in the code
16
+ // - err.. grep the code for TODO
17
+
18
+ describe('ControlAgent', () => {
19
+ it('exposes a valid message API', () => {
20
+ expect(Object.keys(ControlAgent.build).sort()).toEqual(
21
+ Object.keys(ControlAgent.MESSAGE).sort(),
22
+ 'The API exposed by the builder object must contain as top-level keys all of the message types exposed in the MESSAGE constant. Check that ControlAgent.MESSAGE has the same keys as ControlAgent.build.'
23
+ );
24
+ Object.entries(ControlAgent.build).forEach(([messageType, builders]) => {
25
+ expect(Object.keys(ControlAgent.VERB)).toEqual(
26
+ expect.arrayContaining(Object.keys(builders)),
27
+ `For message type '${messageType}' every builder must correspond to a verb. Check that ControlAgent.build.${messageType} has the same keys as ControlAgent.VERB.`
28
+ );
29
+ });
30
+ expect(Object.keys(ControlAgent.build.ERROR.NOTIFY).sort()).toEqual(
31
+ Object.keys(ControlAgent.ERROR).sort(),
32
+ 'ControlAgent.ERROR.NOTIFY should contain the same keys as ControlAgent.ERROR'
33
+ );
34
+ });
35
+
36
+ describe('API', () => {
37
+ let server, logger, client;
38
+ const appConfig = { control: { port: 4005 }, what: 'ever' };
39
+ const changedConfig = { ...appConfig, some: 'thing' };
40
+
41
+ beforeEach(async () => {
42
+ logger = new Logger.Logger({ stringify: () => '' });
43
+ server = new TestControlServer.Server({ logger, appConfig });
44
+ client = await ControlAgent.Client.Create({
45
+ address: 'localhost',
46
+ port: server.address().port,
47
+ logger,
48
+ appConfig
49
+ });
50
+ });
51
+
52
+ afterEach(async () => {
53
+ await client.stop();
54
+ await server.stop();
55
+ });
56
+
57
+ it('receives config when requested', async () => {
58
+ await client.send(ControlAgent.build.CONFIGURATION.READ());
59
+ const response = await client.receive();
60
+ expect(response).toEqual({
61
+ ...JSON.parse(ControlAgent.build.CONFIGURATION.NOTIFY(appConfig, response.id)),
62
+ });
63
+ });
64
+
65
+ it('emits new config when received', async () => {
66
+ const newConfigEvent = new Promise(
67
+ (resolve) => client.on(ControlAgent.EVENT.RECONFIGURE, resolve)
68
+ );
69
+ await server.broadcastConfigChange(changedConfig);
70
+ const newConfEventData = await newConfigEvent;
71
+ expect(newConfEventData).toEqual(changedConfig);
72
+ });
73
+ });
74
+ });
75
+
76
+ describe('Server reconfigure methods', () => {
77
+ let conf, logger, cache;
78
+
79
+ const isPromise = (o) => Promise.resolve(o) === o;
80
+
81
+ beforeEach(() => {
82
+ conf = JSON.parse(JSON.stringify(defaultConfig));
83
+ logger = new Logger.Logger({ stringify: () => '' });
84
+ cache = new Cache({ ...conf.cacheConfig, logger: logger.push({ component: 'cache' }) });
85
+ });
86
+
87
+ test('InboundServer reconfigure method returns sync function', async () => {
88
+ const server = new InboundServer(conf, logger, cache);
89
+ const res = await server.reconfigure(conf, logger, cache);
90
+ expect(isPromise(res)).toEqual(false);
91
+ });
92
+
93
+ test('OutboundServer reconfigure method returns sync function', async () => {
94
+ const server = new OutboundServer(conf, logger, cache);
95
+ const res = await server.reconfigure(conf, logger, cache);
96
+ expect(isPromise(res)).toEqual(false);
97
+ });
98
+
99
+ test('TestServer reconfigure method returns sync function', async () => {
100
+ const server = new TestServer({ logger, cache });
101
+ const res = await server.reconfigure({ logger, cache });
102
+ expect(isPromise(res)).toEqual(false);
103
+ });
104
+
105
+ test('ControlClient reconfigure method returns sync function', async () => {
106
+ const server = new TestControlServer.Server({ logger, appConfig: { ...conf, control: { port: 4005 }}});
107
+ const client = await ControlAgent.Client.Create({ port: 4005, logger, appConfig: {} });
108
+ const res = await client.reconfigure({ logger, port: 4005, appConfig: {} });
109
+ expect(isPromise(res)).toEqual(false);
110
+ await client.close();
111
+ await server.close();
112
+ });
113
+ });
@@ -0,0 +1,41 @@
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
+ * Steven Oderayi - steven.oderayi@modusbox.com *
9
+ **************************************************************************/
10
+
11
+ const { EventEmitter } = require('events');
12
+
13
+ /**************************************************************************
14
+ * Internal events received by the control server via the exposed internal
15
+ * event emitter.
16
+ *************************************************************************/
17
+ const INTERNAL_EVENTS = {
18
+ SERVER: {
19
+ BROADCAST_CONFIG_CHANGE: 'BROADCAST_CONFIG_CHANGE',
20
+ }
21
+ };
22
+ const internalEventEmitter = new EventEmitter();
23
+
24
+ /**************************************************************************
25
+ * getInternalEventEmitter
26
+ *
27
+ * Returns an EventEmmitter that can be used to exchange internal events with
28
+ * either the control server or the client from other modules within this service.
29
+ * This prevents the need to pass down references to either the server or the client
30
+ * from one module to another in order to use their interfaces.
31
+ *
32
+ * @returns {events.EventEmitter}
33
+ *************************************************************************/
34
+ const getInternalEventEmitter = () => {
35
+ return internalEventEmitter;
36
+ };
37
+
38
+ module.exports = {
39
+ getInternalEventEmitter,
40
+ INTERNAL_EVENTS
41
+ };