ml-testing-toolkit 18.13.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 (319) hide show
  1. package/.dockerignore +10 -0
  2. package/.grype.yaml +16 -0
  3. package/.ncurc.yaml +9 -0
  4. package/.nvmrc +1 -0
  5. package/.versionrc.js +16 -0
  6. package/CHANGELOG.md +504 -0
  7. package/CODEOWNERS +30 -0
  8. package/Dockerfile +42 -0
  9. package/Dockerfile-newman +13 -0
  10. package/LICENSE.md +9 -0
  11. package/README.md +119 -0
  12. package/assets/diagrams/architectural/architectural-diagram.svg +3 -0
  13. package/assets/diagrams/flow/flow-diagram.svg +3 -0
  14. package/assets/images/Sample-Response-Failure.png +0 -0
  15. package/assets/images/Screenshot 2020-04-16 at 22.58.04.png +0 -0
  16. package/assets/images/TLS-Enabled-on-Environment.png +0 -0
  17. package/assets/images/adapter-mutual-tls-enabled.png +0 -0
  18. package/assets/images/add-additional-input-values.png +0 -0
  19. package/assets/images/add-condition-button.png +0 -0
  20. package/assets/images/add-new-assertion.png +0 -0
  21. package/assets/images/add-new-input-value.png +0 -0
  22. package/assets/images/add-new-input-variable.png +0 -0
  23. package/assets/images/additional-transfers.png +0 -0
  24. package/assets/images/api-provisioning-add-new-api-confirmation.png +0 -0
  25. package/assets/images/api-provisioning-file-input-window.png +0 -0
  26. package/assets/images/api-provisioning-list-apis-view.png +0 -0
  27. package/assets/images/api-provisioning-menu-item.png +0 -0
  28. package/assets/images/apply_and_restart.jpg +0 -0
  29. package/assets/images/assess-request-or-response.png +0 -0
  30. package/assets/images/assess-response-equation-save.png +0 -0
  31. package/assets/images/assess-response-equation.png +0 -0
  32. package/assets/images/assess-response-status.png +0 -0
  33. package/assets/images/building-new-rules-file.png +0 -0
  34. package/assets/images/callback-rules-screen.png +0 -0
  35. package/assets/images/configurable-parameter-assertion.png +0 -0
  36. package/assets/images/configurable-parameter-currency.png +0 -0
  37. package/assets/images/configurable-parameter.png +0 -0
  38. package/assets/images/connection-manager-ui-opening.png +0 -0
  39. package/assets/images/create-inbound-user-simulator.png +0 -0
  40. package/assets/images/creating-new-rule-file.png +0 -0
  41. package/assets/images/dfsp-client-cacert.png +0 -0
  42. package/assets/images/dfsp-client-submit.png +0 -0
  43. package/assets/images/dfsp-client.png +0 -0
  44. package/assets/images/dfsp-p2p-happy-path.png +0 -0
  45. package/assets/images/dfsp-server-cacert.png +0 -0
  46. package/assets/images/dfsp-server-cert.png +0 -0
  47. package/assets/images/download-report.png +0 -0
  48. package/assets/images/drive_have_not_been_shared.jpg +0 -0
  49. package/assets/images/event-response-options.png +0 -0
  50. package/assets/images/expand-monitoring-messages.png +0 -0
  51. package/assets/images/fixed-response-sample.png +0 -0
  52. package/assets/images/header-selection.png +0 -0
  53. package/assets/images/heap_error_windows.jpg +0 -0
  54. package/assets/images/hosted-mode-docker-compose-intro.png +0 -0
  55. package/assets/images/hub-client-cert.png +0 -0
  56. package/assets/images/import-template.png +0 -0
  57. package/assets/images/inbound-requests-environment.png +0 -0
  58. package/assets/images/inbound-requests-scripts.png +0 -0
  59. package/assets/images/jws-certificate-submit.png +0 -0
  60. package/assets/images/jws-certificate.png +0 -0
  61. package/assets/images/jws-certs-keys.png +0 -0
  62. package/assets/images/jws-hub-certs-keys.png +0 -0
  63. package/assets/images/local-enable-jws-publickey.png +0 -0
  64. package/assets/images/local-mutual-tls-enabled.png +0 -0
  65. package/assets/images/local_drives_to_be_available.jpg +0 -0
  66. package/assets/images/mcm-environment-opening.png +0 -0
  67. package/assets/images/menu-items.png +0 -0
  68. package/assets/images/mock-response-sample.png +0 -0
  69. package/assets/images/monitoring-initial-state.png +0 -0
  70. package/assets/images/monitoring-messages.png +0 -0
  71. package/assets/images/new-empty-assertion.png +0 -0
  72. package/assets/images/opened-imported-template.png +0 -0
  73. package/assets/images/opening-default-settings.png +0 -0
  74. package/assets/images/opening-sync-response-rules.png +0 -0
  75. package/assets/images/opening-view.png +0 -0
  76. package/assets/images/outbound-display-opening-hub.png +0 -0
  77. package/assets/images/outbound-display-opening.png +0 -0
  78. package/assets/images/override-with-environment-variable.png +0 -0
  79. package/assets/images/populate-with-sample-body.png +0 -0
  80. package/assets/images/resource-selection.png +0 -0
  81. package/assets/images/rule-builder-select-api.png +0 -0
  82. package/assets/images/sample-condition-add-configurable-params.png +0 -0
  83. package/assets/images/sample-condition.png +0 -0
  84. package/assets/images/sample-editor.png +0 -0
  85. package/assets/images/sample-request.png +0 -0
  86. package/assets/images/sample-test-assertion.png +0 -0
  87. package/assets/images/send-transfer.png +0 -0
  88. package/assets/images/sending-single-test-case-1.png +0 -0
  89. package/assets/images/sending-single-test-case-2.png +0 -0
  90. package/assets/images/sending-test-cases.png +0 -0
  91. package/assets/images/server-certificates-submitted.png +0 -0
  92. package/assets/images/simulator-response.png +0 -0
  93. package/assets/images/simulator-scheme-adapter-endpoint.png +0 -0
  94. package/assets/images/summarized-view-of-rule.png +0 -0
  95. package/assets/images/template-window.png +0 -0
  96. package/assets/images/test-case-editor-console-log.png +0 -0
  97. package/assets/images/test-case-editor-environment-state.png +0 -0
  98. package/assets/images/test-case-editor-scripts.png +0 -0
  99. package/assets/images/test-case-editor.png +0 -0
  100. package/assets/images/testcase-definition-download.png +0 -0
  101. package/assets/images/testcase-definition-edit-meta-info.png +0 -0
  102. package/assets/images/testing-toolkit-mojaloop-testing-toolkit-endpoint.png +0 -0
  103. package/assets/images/tls-hub-certs-keys.png +0 -0
  104. package/assets/images/tls-jws-enabled-on-environment.png +0 -0
  105. package/assets/images/updated-sample-body-data.png +0 -0
  106. package/assets/images/using-configurable-parameter.png +0 -0
  107. package/assets/images/validation-rules-screen.png +0 -0
  108. package/assets/images/view-response.png +0 -0
  109. package/audit-ci.jsonc +7 -0
  110. package/connection-manager/docker-compose.yml +55 -0
  111. package/database/docker-compose.yml +16 -0
  112. package/docker/hosted-mode/docker-compose.yaml +107 -0
  113. package/docker/hosted-mode/keycloak/keycloak-realm.json +2298 -0
  114. package/docker/hosted-mode/mongo-init.sh +1 -0
  115. package/docker/hosted-mode-tls/docker-compose.yaml +171 -0
  116. package/docker/hosted-mode-tls/keycloak/keycloak-realm.json +2298 -0
  117. package/docker/hosted-mode-tls/mongo-init.sh +1 -0
  118. package/docker-compose.yml +62 -0
  119. package/documents/Mojaloop-Testing-Toolkit.md +296 -0
  120. package/documents/RULES_ENGINE.md +403 -0
  121. package/documents/User-Guide-API-Provisioning.md +121 -0
  122. package/documents/User-Guide-CLI.md +218 -0
  123. package/documents/User-Guide-Connection-Manager.md +282 -0
  124. package/documents/User-Guide-Frequently-Asked-Questions.md +39 -0
  125. package/documents/User-Guide-Hosted-Mode-Docker-Compose.md +110 -0
  126. package/documents/User-Guide-Installation.md +163 -0
  127. package/documents/User-Guide-Mojaloop-Testing-Toolkit.md +642 -0
  128. package/documents/User-Guide-OAuth-Server-Deployment.md +283 -0
  129. package/documents/User-Guide-Onboarding-DFSP.md +197 -0
  130. package/documents/User-Guide-Onboarding-HUB.md +191 -0
  131. package/documents/User-Guide.md +53 -0
  132. package/examples/collections/dfsp/p2p_failed_tests.json +7161 -0
  133. package/examples/collections/dfsp/p2p_fx_happy_path.json +502 -0
  134. package/examples/collections/dfsp/p2p_happy_path.json +350 -0
  135. package/examples/collections/dfsp/p2p_happy_path_extended.json +6106 -0
  136. package/examples/collections/dfsp/p2p_happy_path_jws.json +511 -0
  137. package/examples/collections/dfsp/p2p_payee_assertions_websocket.json +441 -0
  138. package/examples/collections/dfsp/sample.json +5029 -0
  139. package/examples/collections/dfsp/transaction_request_service.json +240 -0
  140. package/examples/collections/fxp/FXP.json +264 -0
  141. package/examples/collections/fxp/SDK_backend.json +98 -0
  142. package/examples/collections/fxp/SDK_outbound.json +163 -0
  143. package/examples/collections/hub/hub_01_p2p_happy_path/hub_p2p_receive_quote.json +400 -0
  144. package/examples/collections/hub/hub_01_p2p_happy_path/hub_p2p_send_quote.json +395 -0
  145. package/examples/collections/hub/hub_02_block_transfer/hub_block_transfer.json +393 -0
  146. package/examples/collections/hub/hub_03_funds_in_out/hub_funds_in.json +224 -0
  147. package/examples/collections/hub/hub_03_funds_in_out/hub_funds_out.json +780 -0
  148. package/examples/collections/hub/hub_04_settlements/hub_settlements.json +3138 -0
  149. package/examples/collections/hub/hub_05_transfer_negative_scenarios/hub_transfer_negative_payee_abort.json +475 -0
  150. package/examples/collections/hub/hub_05_transfer_negative_scenarios/hub_transfer_negative_payee_invalid_fulfillment.json +370 -0
  151. package/examples/collections/hub/hub_05_transfer_negative_scenarios/hub_transfer_negative_transfer_timeout.json +262 -0
  152. package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_authorizations.json +117 -0
  153. package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_error_framework.json +591 -0
  154. package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_received_state.json +379 -0
  155. package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_reject_state.json +361 -0
  156. package/examples/collections/hub/hub_07_quoting_service.json +525 -0
  157. package/examples/collections/hub/hub_08_participant_inactive_stop_transfers.json +706 -0
  158. package/examples/collections/hub/hub_09_duplicate_handling_transfers.json +1377 -0
  159. package/examples/collections/hub/hub_10_on_us_transfers.json +245 -0
  160. package/examples/collections/hub/hub_11_accented_and_spl_chars.json +629 -0
  161. package/examples/collections/hub/hub_12_fspiop_version_1.1.json +646 -0
  162. package/examples/collections/hub/hub_13_bulk_transfers.json +1857 -0
  163. package/examples/collections/iso20022/self_referencing_iso20022.json +926 -0
  164. package/examples/collections/provisioning/testingtoolkitdfsp.json +904 -0
  165. package/examples/environments/dfsp_local_environment.json +46 -0
  166. package/examples/environments/hub_local_environment.json +57 -0
  167. package/jest.config.js +17 -0
  168. package/package.json +199 -0
  169. package/sbom-v18.12.4.csv +1553 -0
  170. package/secrets/keygen.sh +5 -0
  171. package/secrets/privatekey.pem +27 -0
  172. package/secrets/publickey.cer +21 -0
  173. package/secrets/tls/01.pem +132 -0
  174. package/secrets/tls/createSecrets.sh +20 -0
  175. package/secrets/tls/hub_client.csr +32 -0
  176. package/secrets/tls/hub_client_cacert.pem +35 -0
  177. package/secrets/tls/hub_client_cakey.pem +52 -0
  178. package/secrets/tls/hub_client_key.key +52 -0
  179. package/secrets/tls/hub_server.csr +31 -0
  180. package/secrets/tls/hub_server_cacert.pem +35 -0
  181. package/secrets/tls/hub_server_cakey.pem +52 -0
  182. package/secrets/tls/hub_server_cert.pem +132 -0
  183. package/secrets/tls/hub_server_key.key +52 -0
  184. package/secrets/tls/index.txt +1 -0
  185. package/secrets/tls/index.txt.attr +1 -0
  186. package/secrets/tls/openssl-client.cnf +36 -0
  187. package/secrets/tls/openssl-clientca.cnf +71 -0
  188. package/secrets/tls/openssl-server.cnf +39 -0
  189. package/secrets/tls/openssl-serverca.cnf +71 -0
  190. package/secrets/tls/serial.txt +1 -0
  191. package/spec_files/api_definitions/als_admin_1.1/api_spec.yaml +804 -0
  192. package/spec_files/api_definitions/central_admin_1.0/api_spec.yaml +1850 -0
  193. package/spec_files/api_definitions/central_admin_1.0/response_map.json +96 -0
  194. package/spec_files/api_definitions/central_admin_old_9.3/api_spec.yaml +2467 -0
  195. package/spec_files/api_definitions/central_admin_old_9.3/response_map.json +96 -0
  196. package/spec_files/api_definitions/fspiop_1.0/api_spec.yaml +4187 -0
  197. package/spec_files/api_definitions/fspiop_1.0/callback_map.json +568 -0
  198. package/spec_files/api_definitions/fspiop_1.0/mockRef.json +79 -0
  199. package/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup.json +126 -0
  200. package/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup_quotes_only.json +97 -0
  201. package/spec_files/api_definitions/fspiop_1.1/api_spec.yaml +3778 -0
  202. package/spec_files/api_definitions/fspiop_1.1/callback_map.json +568 -0
  203. package/spec_files/api_definitions/fspiop_1.1/mockRef.json +79 -0
  204. package/spec_files/api_definitions/fspiop_1.1/trigger_templates/transaction_request_followup.json +125 -0
  205. package/spec_files/api_definitions/fspiop_2.0/api_spec.yaml +4839 -0
  206. package/spec_files/api_definitions/fspiop_2.0/callback_map.json +716 -0
  207. package/spec_files/api_definitions/fspiop_2.0/mockRef.json +79 -0
  208. package/spec_files/api_definitions/fspiop_2.0/trigger_templates/transaction_request_followup.json +125 -0
  209. package/spec_files/api_definitions/fspiop_2.0_iso20022/api_spec.yaml +8331 -0
  210. package/spec_files/api_definitions/fspiop_2.0_iso20022/callback_map.json +508 -0
  211. package/spec_files/api_definitions/fspiop_2.0_iso20022/mockRef.json +66 -0
  212. package/spec_files/api_definitions/fx-api_2.0/api_spec.yaml +1768 -0
  213. package/spec_files/api_definitions/fx-api_2.0/callback_map.json +188 -0
  214. package/spec_files/api_definitions/fx-api_2.0/mockRef.json +83 -0
  215. package/spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml +2612 -0
  216. package/spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json +22 -0
  217. package/spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json +35 -0
  218. package/spec_files/api_definitions/mojaloop_simulator_0.1/api_spec.yaml +225 -0
  219. package/spec_files/api_definitions/mojaloop_simulator_sim_1.4/api_spec.yaml +1087 -0
  220. package/spec_files/api_definitions/mojaloop_simulator_sim_1.4/mockRef.json +75 -0
  221. package/spec_files/api_definitions/mojaloop_simulator_sim_1.4/response_map.json +55 -0
  222. package/spec_files/api_definitions/payment_manager_1.4/api_spec.yaml +1389 -0
  223. package/spec_files/api_definitions/sdk-scheme-adapter-backend-v2_1_0-openapi3-snippets_2.1/api_spec.yaml +2834 -0
  224. package/spec_files/api_definitions/sdk-scheme-adapter-outbound-v2_1_0-openapi3-snippets_2.1/api_spec.yaml +3449 -0
  225. package/spec_files/api_definitions/settlements_1.0/api_spec.yaml +983 -0
  226. package/spec_files/api_definitions/settlements_1.0/mockRef.json +38 -0
  227. package/spec_files/api_definitions/settlements_1.0/response_map.json +34 -0
  228. package/spec_files/api_definitions/settlements_2.0/api_spec.yaml +1001 -0
  229. package/spec_files/api_definitions/settlements_2.0/mockRef.json +38 -0
  230. package/spec_files/api_definitions/settlements_2.0/response_map.json +34 -0
  231. package/spec_files/api_definitions/thirdparty_sdk_outbound_0.1/api_spec.yaml +2139 -0
  232. package/spec_files/reports/templates/newman/html_template.html +1202 -0
  233. package/spec_files/reports/templates/newman/pdf_template.html +790 -0
  234. package/spec_files/reports/templates/testcase_definition/table_view.html +1602 -0
  235. package/spec_files/rules_callback/config.json +3 -0
  236. package/spec_files/rules_callback/default.json +2698 -0
  237. package/spec_files/rules_callback/p2p-limit.json +129 -0
  238. package/spec_files/rules_forward/config.json +3 -0
  239. package/spec_files/rules_forward/default.json +482 -0
  240. package/spec_files/rules_response/config.json +3 -0
  241. package/spec_files/rules_response/default.json +295 -0
  242. package/spec_files/rules_validation/config.json +3 -0
  243. package/spec_files/rules_validation/default.json +1 -0
  244. package/spec_files/rules_validation/p2p-limit.json +55 -0
  245. package/spec_files/system_config.json +175 -0
  246. package/spec_files/user_config.json +109 -0
  247. package/src/index.js +67 -0
  248. package/src/lib/MyEventEmitter.js +54 -0
  249. package/src/lib/api-management.js +143 -0
  250. package/src/lib/api-routes/config.js +83 -0
  251. package/src/lib/api-routes/history.js +139 -0
  252. package/src/lib/api-routes/keycloak.js +54 -0
  253. package/src/lib/api-routes/longpolling.js +70 -0
  254. package/src/lib/api-routes/oauth2.js +149 -0
  255. package/src/lib/api-routes/objectstore.js +53 -0
  256. package/src/lib/api-routes/openapi.js +224 -0
  257. package/src/lib/api-routes/outbound.js +134 -0
  258. package/src/lib/api-routes/reports.js +72 -0
  259. package/src/lib/api-routes/rules.js +356 -0
  260. package/src/lib/api-routes/samples.js +92 -0
  261. package/src/lib/api-routes/server-logs.js +44 -0
  262. package/src/lib/api-routes/settings.js +71 -0
  263. package/src/lib/api-server.js +135 -0
  264. package/src/lib/arrayStore.js +101 -0
  265. package/src/lib/callbackHandler.js +201 -0
  266. package/src/lib/config.js +177 -0
  267. package/src/lib/configuration-providers/mb-connection-manager.js +625 -0
  268. package/src/lib/db/adapters/dbAdapter.js +184 -0
  269. package/src/lib/db/dfspMockUsers.js +64 -0
  270. package/src/lib/db/models/mongoDBWrapper.js +78 -0
  271. package/src/lib/eventListenerClient/inboundEventListener.js +176 -0
  272. package/src/lib/fileAdapter.js +57 -0
  273. package/src/lib/httpAgentStore.js +135 -0
  274. package/src/lib/importExport.js +186 -0
  275. package/src/lib/jws/JwsSigning.js +141 -0
  276. package/src/lib/loadSamples.js +128 -0
  277. package/src/lib/logger.js +20 -0
  278. package/src/lib/longpollingEmitter.js +56 -0
  279. package/src/lib/metrics.js +51 -0
  280. package/src/lib/mocking/custom-functions/generic.js +57 -0
  281. package/src/lib/mocking/middleware-functions/ilpModel.js +238 -0
  282. package/src/lib/mocking/middleware-functions/quotesAssociation.js +75 -0
  283. package/src/lib/mocking/middleware-functions/transactionRequestsService.js +78 -0
  284. package/src/lib/mocking/openApiDefinitionsModel.js +64 -0
  285. package/src/lib/mocking/openApiMockHandler.js +466 -0
  286. package/src/lib/mocking/openApiRulesEngine.js +492 -0
  287. package/src/lib/mocking/openApiVersionTools.js +136 -0
  288. package/src/lib/mocking/transformers/fspiopToISO20022.js +230 -0
  289. package/src/lib/mocking/transformers/index.js +41 -0
  290. package/src/lib/notificationEmitter.js +64 -0
  291. package/src/lib/oauth/KeycloakHelper.js +220 -0
  292. package/src/lib/oauth/LoginService.js +133 -0
  293. package/src/lib/oauth/OAuthHelper.js +181 -0
  294. package/src/lib/oauth/OAuthValidator.js +118 -0
  295. package/src/lib/oauth/Wso2Client.js +64 -0
  296. package/src/lib/objectStore/inMemoryImpl.js +50 -0
  297. package/src/lib/objectStore/objectStoreInterface.js +51 -0
  298. package/src/lib/objectStore.js +122 -0
  299. package/src/lib/report-generator/generator.js +126 -0
  300. package/src/lib/report-generator/helpers.js +154 -0
  301. package/src/lib/requestLogger.js +190 -0
  302. package/src/lib/resources/wso2carbon-publickey.cert +20 -0
  303. package/src/lib/rulesEngine.js +95 -0
  304. package/src/lib/rulesEngineModel.js +463 -0
  305. package/src/lib/scripting-engines/postman-sandbox.js +142 -0
  306. package/src/lib/scripting-engines/vm-javascript-sandbox.js +294 -0
  307. package/src/lib/server-logs/adapters/elastic-search.js +102 -0
  308. package/src/lib/server-logs/adapters/grafana.js +0 -0
  309. package/src/lib/server-logs/index.js +75 -0
  310. package/src/lib/socket-server.js +55 -0
  311. package/src/lib/storageAdapter.js +109 -0
  312. package/src/lib/test-outbound/TestCaseRunner.js +173 -0
  313. package/src/lib/test-outbound/getTracing.js +19 -0
  314. package/src/lib/test-outbound/outbound-initiator.js +1107 -0
  315. package/src/lib/uniqueIdGenerator.js +35 -0
  316. package/src/lib/utils.js +89 -0
  317. package/src/lib/utilsInternal.js +56 -0
  318. package/src/lib/webSocketClient/WebSocketClientManager.js +197 -0
  319. package/src/server.js +218 -0
@@ -0,0 +1,3138 @@
1
+ {
2
+ "name": "hub-central-settlements-tests",
3
+ "test_cases": [
4
+ {
5
+ "id": 1,
6
+ "name": "Store Settlement&Position Account Balances Before Transfers",
7
+ "requests": [
8
+ {
9
+ "id": 1,
10
+ "description": "testfsp1 balances",
11
+ "apiVersion": {
12
+ "minorVersion": 3,
13
+ "majorVersion": 9,
14
+ "type": "central_admin"
15
+ },
16
+ "operationPath": "/participants/{name}/accounts",
17
+ "path": "/participants/testfsp1/accounts",
18
+ "method": "get",
19
+ "params": {
20
+ "name": "testfsp1"
21
+ },
22
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
23
+ "tests": {
24
+ "assertions": [
25
+ {
26
+ "id": 1,
27
+ "description": "Status code is 200",
28
+ "exec": [
29
+ "expect(response.status).to.equal(200)"
30
+ ]
31
+ }
32
+ ]
33
+ },
34
+ "scripts": {
35
+ "postRequest": {
36
+ "exec": [
37
+ "var jsonData = pm.response.body;\r",
38
+ "for (var i in jsonData) {\r",
39
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
40
+ " console.log(jsonData[i].value)\r",
41
+ " pm.environment.set(\"testfsp1SettleAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
42
+ " }\r",
43
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
44
+ " console.log(jsonData[i].value)\r",
45
+ " pm.environment.set(\"testfsp1PositionAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
46
+ " }\r",
47
+ "}"
48
+ ]
49
+ }
50
+ }
51
+ },
52
+ {
53
+ "id": 2,
54
+ "description": "testfsp2 balances",
55
+ "apiVersion": {
56
+ "minorVersion": 3,
57
+ "majorVersion": 9,
58
+ "type": "central_admin"
59
+ },
60
+ "operationPath": "/participants/{name}/accounts",
61
+ "path": "/participants/testfsp2/accounts",
62
+ "method": "get",
63
+ "params": {
64
+ "name": "testfsp2"
65
+ },
66
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
67
+ "tests": {
68
+ "assertions": [
69
+ {
70
+ "id": 1,
71
+ "description": "Status code is 200",
72
+ "exec": [
73
+ "expect(response.status).to.equal(200)"
74
+ ]
75
+ }
76
+ ]
77
+ },
78
+ "scripts": {
79
+ "postRequest": {
80
+ "exec": [
81
+ "var jsonData = pm.response.body;\r",
82
+ "for (var i in jsonData) {\r",
83
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
84
+ " console.log(jsonData[i].value)\r",
85
+ " pm.environment.set(\"testfsp2SettleAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
86
+ " }\r",
87
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
88
+ " console.log(jsonData[i].value)\r",
89
+ " pm.environment.set(\"testfsp2PositionAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
90
+ " }\r",
91
+ "}\r",
92
+ ""
93
+ ]
94
+ }
95
+ }
96
+ },
97
+ {
98
+ "id": 3,
99
+ "description": "testfsp3 balances",
100
+ "apiVersion": {
101
+ "minorVersion": 3,
102
+ "majorVersion": 9,
103
+ "type": "central_admin"
104
+ },
105
+ "operationPath": "/participants/{name}/accounts",
106
+ "path": "/participants/testfsp3/accounts",
107
+ "method": "get",
108
+ "params": {
109
+ "name": "testfsp3"
110
+ },
111
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
112
+ "tests": {
113
+ "assertions": [
114
+ {
115
+ "id": 1,
116
+ "description": "Status code is 200",
117
+ "exec": [
118
+ "expect(response.status).to.equal(200)"
119
+ ]
120
+ }
121
+ ]
122
+ },
123
+ "scripts": {
124
+ "preRequest": {
125
+ "exec": [
126
+ ""
127
+ ]
128
+ },
129
+ "postRequest": {
130
+ "exec": [
131
+ "var jsonData = pm.response.body;\r",
132
+ "for (var i in jsonData) {\r",
133
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
134
+ " console.log(jsonData[i].value)\r",
135
+ " pm.environment.set(\"testfsp3SettleAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
136
+ " }\r",
137
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
138
+ " console.log(jsonData[i].value)\r",
139
+ " pm.environment.set(\"testfsp3PositionAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
140
+ " }\r",
141
+ "}\r",
142
+ ""
143
+ ]
144
+ }
145
+ }
146
+ },
147
+ {
148
+ "id": 4,
149
+ "description": "testfsp4 balances",
150
+ "apiVersion": {
151
+ "minorVersion": 3,
152
+ "majorVersion": 9,
153
+ "type": "central_admin"
154
+ },
155
+ "operationPath": "/participants/{name}/accounts",
156
+ "path": "/participants/testfsp4/accounts",
157
+ "method": "get",
158
+ "params": {
159
+ "name": "testfsp4"
160
+ },
161
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
162
+ "tests": {
163
+ "assertions": [
164
+ {
165
+ "id": 1,
166
+ "description": "Status code is 200",
167
+ "exec": [
168
+ "expect(response.status).to.equal(200)"
169
+ ]
170
+ }
171
+ ]
172
+ },
173
+ "scripts": {
174
+ "postRequest": {
175
+ "exec": [
176
+ "var jsonData = pm.response.body;\r",
177
+ "for (var i in jsonData) {\r",
178
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
179
+ " console.log(jsonData[i].value)\r",
180
+ " pm.environment.set(\"testfsp4SettleAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
181
+ " }\r",
182
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
183
+ " console.log(jsonData[i].value)\r",
184
+ " pm.environment.set(\"testfsp4PositionAccountBalanceBeforeTransfer\", jsonData[i].value);\r",
185
+ " }\r",
186
+ "}"
187
+ ]
188
+ }
189
+ }
190
+ }
191
+ ]
192
+ },
193
+ {
194
+ "id": 2,
195
+ "name": "Run Quote & Transfers",
196
+ "requests": [
197
+ {
198
+ "id": 1,
199
+ "description": "Close Existing Window(quotes and transfers)",
200
+ "apiVersion": {
201
+ "minorVersion": 0,
202
+ "majorVersion": 1,
203
+ "type": "settlements"
204
+ },
205
+ "operationPath": "/settlementWindows/{id}",
206
+ "path": "/settlementWindows/{$environment.openWindowID}",
207
+ "method": "post",
208
+ "params": {
209
+ "id": "{$environment.openWindowID}"
210
+ },
211
+ "headers": {
212
+ "Content-Type": "application/json"
213
+ },
214
+ "body": {
215
+ "state": "CLOSED",
216
+ "reason": "string"
217
+ },
218
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
219
+ "tests": {
220
+ "assertions": [
221
+ {
222
+ "id": 1,
223
+ "description": "Status to be 200 or error code 3001",
224
+ "exec": [
225
+ "if (response.body.errorInformation) {",
226
+ " expect(response.body.errorInformation.errorCode).to.equal(\"3100\")",
227
+ "} else {",
228
+ " expect(response.status).to.equal(200) ",
229
+ "}",
230
+ ""
231
+ ]
232
+ },
233
+ {
234
+ "id": 2,
235
+ "description": "State to be OPEN or Window is empty",
236
+ "exec": [
237
+ "if (response.body.errorInformation) {",
238
+ " expect(response.body.errorInformation.errorDescription).to.equal(`Generic validation error - Window ${environment.openWindowID} is empty`)",
239
+ "} else {",
240
+ " expect(response.body.state).to.equal('OPEN') ",
241
+ "}"
242
+ ]
243
+ }
244
+ ]
245
+ },
246
+ "scripts": {
247
+ "postRequest": {
248
+ "exec": [
249
+ "pm.environment.set(\"closedWindowID\", pm.environment.get(\"openWindowID\"));\r",
250
+ "pm.environment.set(\"openWindowID\", pm.response.body.settlementWindowId);\r",
251
+ "console.log('openWindowID', pm.environment.get(\"openWindowID\"));\r",
252
+ "console.log('closedWindowID', pm.environment.get(\"closedWindowID\"));"
253
+ ]
254
+ },
255
+ "preRequest": {
256
+ "exec": [
257
+ "",
258
+ "setTimeout(function () {",
259
+ " pm.sendRequest(pm.environment.get(\"HOST_CENTRAL_SETTLEMENT\")+\"/settlementWindows?state=OPEN\", function (err, response) {",
260
+ " pm.environment.set(\"openWindowID\", response.json()[0].settlementWindowId)",
261
+ " });",
262
+ "}, 500)"
263
+ ]
264
+ }
265
+ }
266
+ },
267
+ {
268
+ "id": 2,
269
+ "description": "Send Quote 1 (testfsp1 to testfsp2)",
270
+ "apiVersion": {
271
+ "minorVersion": 0,
272
+ "majorVersion": 1,
273
+ "type": "fspiop",
274
+ "asynchronous": true
275
+ },
276
+ "operationPath": "/quotes",
277
+ "path": "/quotes",
278
+ "method": "post",
279
+ "url": "{$inputs.HOST_QUOTING_SERVICE}",
280
+ "headers": {
281
+ "Accept": "{$inputs.acceptQuotes}",
282
+ "Content-Type": "{$inputs.contentTypeQuotes}",
283
+ "Date": "{$function.generic.curDate}",
284
+ "FSPIOP-Source": "testfsp1",
285
+ "FSPIOP-Destination": "testfsp2"
286
+ },
287
+ "body": {
288
+ "quoteId": "{$function.generic.generateID}",
289
+ "transactionId": "{$function.generic.generateID}",
290
+ "payer": {
291
+ "partyIdInfo": {
292
+ "partyIdType": "MSISDN",
293
+ "partyIdentifier": "22507008181",
294
+ "fspId": "testfsp1"
295
+ },
296
+ "personalInfo": {
297
+ "complexName": {
298
+ "firstName": "Mats",
299
+ "lastName": "Hagman"
300
+ },
301
+ "dateOfBirth": "1983-10-25"
302
+ }
303
+ },
304
+ "payee": {
305
+ "partyIdInfo": {
306
+ "partyIdType": "MSISDN",
307
+ "partyIdentifier": "22556999125",
308
+ "fspId": "testfsp2"
309
+ }
310
+ },
311
+ "amountType": "SEND",
312
+ "amount": {
313
+ "amount": "{$environment.transferAmount}",
314
+ "currency": "{$environment.currency}"
315
+ },
316
+ "transactionType": {
317
+ "scenario": "TRANSFER",
318
+ "initiator": "PAYER",
319
+ "initiatorType": "CONSUMER"
320
+ },
321
+ "note": "hej"
322
+ },
323
+ "tests": {
324
+ "assertions": [
325
+ {
326
+ "id": 1,
327
+ "description": "Status to be 202",
328
+ "exec": [
329
+ "expect(response.status).to.equal(202)"
330
+ ]
331
+ }
332
+ ]
333
+ },
334
+ "ignoreCallbacks": true,
335
+ "scripts": {
336
+ "preRequest": {
337
+ "exec": [
338
+ "pm.environment.set('transferAmount', 60);"
339
+ ]
340
+ }
341
+ }
342
+ },
343
+ {
344
+ "id": 3,
345
+ "description": "Send Transfer 1 ( testfsp1 to testfsp2 )",
346
+ "apiVersion": {
347
+ "minorVersion": 0,
348
+ "majorVersion": 1,
349
+ "type": "fspiop",
350
+ "asynchronous": true
351
+ },
352
+ "ignoreCallbacks": true,
353
+ "operationPath": "/transfers",
354
+ "path": "/transfers",
355
+ "method": "post",
356
+ "headers": {
357
+ "Accept": "{$inputs.acceptTransfers}",
358
+ "Content-Type": "{$inputs.contentTransfers}",
359
+ "Date": "{$function.generic.curDate}",
360
+ "FSPIOP-Source": "testfsp1",
361
+ "FSPIOP-Destination": "testfsp2"
362
+ },
363
+ "body": {
364
+ "transferId": "{$environment.transfer_ID}",
365
+ "payerFsp": "testfsp1",
366
+ "payeeFsp": "testfsp2",
367
+ "amount": {
368
+ "amount": "{$environment.transferAmount}",
369
+ "currency": "{$environment.currency}"
370
+ },
371
+ "expiration": "{$environment.transferExpiration}",
372
+ "ilpPacket": "{$environment.ilpPacket}",
373
+ "condition": "{$environment.condition}"
374
+ },
375
+ "tests": {
376
+ "assertions": [
377
+ {
378
+ "id": 1,
379
+ "description": "callback does not have transferId",
380
+ "exec": [
381
+ "expect(environment.sendTransferResponse1).to.not.have.property('transferId')"
382
+ ]
383
+ },
384
+ {
385
+ "id": 2,
386
+ "description": "Callback status is COMMITTED",
387
+ "exec": [
388
+ "expect(environment.sendTransferResponse1.transferState).to.equal('COMMITTED')"
389
+ ]
390
+ },
391
+ {
392
+ "id": 3,
393
+ "description": "Status code is 202",
394
+ "exec": [
395
+ "expect(response.status).to.equal(202)"
396
+ ]
397
+ }
398
+ ]
399
+ },
400
+ "url": "{$inputs.HOST_ML_API_ADAPTER}",
401
+ "scripts": {
402
+ "preRequest": {
403
+ "exec": [
404
+ "var uuid = require('uuid');\r",
405
+ "pm.environment.set('transfer_ID', uuid.v4());\r",
406
+ "pm.environment.set('transferExpiration', new Date(new Date().getTime() + 120000))\r",
407
+ "pm.environment.set('transferAmount', 60);"
408
+ ]
409
+ },
410
+ "postRequest": {
411
+ "exec": [
412
+ "",
413
+ "setTimeout(function () {",
414
+ " pm.sendRequest(pm.environment.get(\"HOST_SIMULATOR\")+\"/testfsp1/correlationid/\"+pm.environment.get(\"transfer_ID\"), function (err, response) {",
415
+ " pm.environment.set(\"sendTransferResponse1\", response.json())",
416
+ " });",
417
+ "}, 500)"
418
+ ]
419
+ }
420
+ }
421
+ },
422
+ {
423
+ "id": 4,
424
+ "description": "Send Quote 2 (testfsp1 to testfsp4)",
425
+ "apiVersion": {
426
+ "minorVersion": 0,
427
+ "majorVersion": 1,
428
+ "type": "fspiop",
429
+ "asynchronous": true
430
+ },
431
+ "operationPath": "/quotes",
432
+ "path": "/quotes",
433
+ "method": "post",
434
+ "url": "{$inputs.HOST_QUOTING_SERVICE}",
435
+ "headers": {
436
+ "Accept": "{$inputs.acceptQuotes}",
437
+ "Content-Type": "{$inputs.contentTypeQuotes}",
438
+ "Date": "{$function.generic.curDate}",
439
+ "FSPIOP-Source": "testfsp1",
440
+ "FSPIOP-Destination": "testfsp4"
441
+ },
442
+ "body": {
443
+ "quoteId": "{$function.generic.generateID}",
444
+ "transactionId": "{$function.generic.generateID}",
445
+ "payer": {
446
+ "partyIdInfo": {
447
+ "partyIdType": "MSISDN",
448
+ "partyIdentifier": "22507008181",
449
+ "fspId": "testfsp1"
450
+ },
451
+ "personalInfo": {
452
+ "complexName": {
453
+ "firstName": "Mats",
454
+ "lastName": "Hagman"
455
+ },
456
+ "dateOfBirth": "1983-10-25"
457
+ }
458
+ },
459
+ "payee": {
460
+ "partyIdInfo": {
461
+ "partyIdType": "MSISDN",
462
+ "partyIdentifier": "22556999125",
463
+ "fspId": "testfsp4"
464
+ }
465
+ },
466
+ "amountType": "SEND",
467
+ "amount": {
468
+ "amount": "{$environment.transferAmount}",
469
+ "currency": "{$environment.currency}"
470
+ },
471
+ "transactionType": {
472
+ "scenario": "TRANSFER",
473
+ "initiator": "PAYER",
474
+ "initiatorType": "CONSUMER"
475
+ },
476
+ "note": "hej"
477
+ },
478
+ "tests": {
479
+ "assertions": [
480
+ {
481
+ "id": 1,
482
+ "description": "Status to be 202",
483
+ "exec": [
484
+ "expect(response.status).to.equal(202)"
485
+ ]
486
+ }
487
+ ]
488
+ },
489
+ "ignoreCallbacks": true,
490
+ "scripts": {
491
+ "preRequest": {
492
+ "exec": [
493
+ "pm.environment.set('transferAmount', 55.12);"
494
+ ]
495
+ }
496
+ }
497
+ },
498
+ {
499
+ "id": 5,
500
+ "description": "Send Transfer 2 (testfsp1 to testfsp4)",
501
+ "apiVersion": {
502
+ "minorVersion": 0,
503
+ "majorVersion": 1,
504
+ "type": "fspiop",
505
+ "asynchronous": true
506
+ },
507
+ "ignoreCallbacks": true,
508
+ "operationPath": "/transfers",
509
+ "path": "/transfers",
510
+ "method": "post",
511
+ "headers": {
512
+ "Accept": "{$inputs.acceptTransfers}",
513
+ "Content-Type": "{$inputs.contentTransfers}",
514
+ "Date": "{$function.generic.curDate}",
515
+ "FSPIOP-Source": "testfsp1",
516
+ "FSPIOP-Destination": "testfsp4"
517
+ },
518
+ "body": {
519
+ "transferId": "{$environment.transfer_ID}",
520
+ "payerFsp": "testfsp1",
521
+ "payeeFsp": "testfsp4",
522
+ "amount": {
523
+ "amount": "{$environment.transferAmount}",
524
+ "currency": "{$environment.currency}"
525
+ },
526
+ "expiration": "{$environment.transferExpiration}",
527
+ "ilpPacket": "{$environment.ilpPacket}",
528
+ "condition": "{$environment.condition}"
529
+ },
530
+ "tests": {
531
+ "assertions": [
532
+ {
533
+ "id": 1,
534
+ "description": "Callback does not have transferId",
535
+ "exec": [
536
+ "expect(environment.sendTransferResponse2).to.not.have.property('transferId')"
537
+ ]
538
+ },
539
+ {
540
+ "id": 2,
541
+ "description": "Callback status is COMMITTED",
542
+ "exec": [
543
+ "expect(environment.sendTransferResponse2.transferState).to.equal('COMMITTED')"
544
+ ]
545
+ },
546
+ {
547
+ "id": 3,
548
+ "description": "Status code is 202",
549
+ "exec": [
550
+ "expect(response.status).to.equal(202)"
551
+ ]
552
+ }
553
+ ]
554
+ },
555
+ "url": "{$inputs.HOST_ML_API_ADAPTER}",
556
+ "scripts": {
557
+ "preRequest": {
558
+ "exec": [
559
+ "var uuid = require('uuid');\r",
560
+ "\r",
561
+ "pm.environment.set('transfer_ID', uuid.v4());\r",
562
+ "pm.environment.set('transferDate', (new Date()).toUTCString());\r",
563
+ "pm.environment.set('transferExpiration', new Date(new Date().getTime() + 120000));\r",
564
+ "pm.environment.set('transferAmount', 55.99);"
565
+ ]
566
+ },
567
+ "postRequest": {
568
+ "exec": [
569
+ "setTimeout(function () {",
570
+ " pm.sendRequest(pm.environment.get(\"HOST_SIMULATOR\")+\"/testfsp1/correlationid/\"+pm.environment.get(\"transfer_ID\"), function (err, response) {",
571
+ " pm.environment.set(\"sendTransferResponse2\", response.json())",
572
+ " });",
573
+ "}, 500)"
574
+ ]
575
+ }
576
+ }
577
+ },
578
+ {
579
+ "id": 6,
580
+ "description": "Send Quote 3 (testfsp3 to testfsp1)",
581
+ "apiVersion": {
582
+ "minorVersion": 0,
583
+ "majorVersion": 1,
584
+ "type": "fspiop",
585
+ "asynchronous": true
586
+ },
587
+ "operationPath": "/quotes",
588
+ "path": "/quotes",
589
+ "method": "post",
590
+ "url": "{$inputs.HOST_QUOTING_SERVICE}",
591
+ "headers": {
592
+ "Accept": "{$inputs.acceptQuotes}",
593
+ "Content-Type": "{$inputs.contentTypeQuotes}",
594
+ "Date": "{$function.generic.curDate}",
595
+ "FSPIOP-Source": "testfsp3",
596
+ "FSPIOP-Destination": "testfsp1"
597
+ },
598
+ "body": {
599
+ "quoteId": "{$function.generic.generateID}",
600
+ "transactionId": "{$function.generic.generateID}",
601
+ "payer": {
602
+ "partyIdInfo": {
603
+ "partyIdType": "MSISDN",
604
+ "partyIdentifier": "22507008181",
605
+ "fspId": "testfsp3"
606
+ },
607
+ "personalInfo": {
608
+ "complexName": {
609
+ "firstName": "Mats",
610
+ "lastName": "Hagman"
611
+ },
612
+ "dateOfBirth": "1983-10-25"
613
+ }
614
+ },
615
+ "payee": {
616
+ "partyIdInfo": {
617
+ "partyIdType": "MSISDN",
618
+ "partyIdentifier": "22556999125",
619
+ "fspId": "testfsp1"
620
+ }
621
+ },
622
+ "amountType": "SEND",
623
+ "amount": {
624
+ "amount": "{$environment.transferAmount}",
625
+ "currency": "{$environment.currency}"
626
+ },
627
+ "transactionType": {
628
+ "scenario": "TRANSFER",
629
+ "initiator": "PAYER",
630
+ "initiatorType": "CONSUMER"
631
+ },
632
+ "note": "hej"
633
+ },
634
+ "tests": {
635
+ "assertions": [
636
+ {
637
+ "id": 1,
638
+ "description": "Status to be 202",
639
+ "exec": [
640
+ "expect(response.status).to.equal(202)"
641
+ ]
642
+ }
643
+ ]
644
+ },
645
+ "ignoreCallbacks": true,
646
+ "scripts": {
647
+ "preRequest": {
648
+ "exec": [
649
+ "pm.environment.set('transferAmount', 35.1);"
650
+ ]
651
+ }
652
+ }
653
+ },
654
+ {
655
+ "id": 7,
656
+ "description": "Send Transfer 3 (testfsp3 to testfsp1)",
657
+ "apiVersion": {
658
+ "minorVersion": 0,
659
+ "majorVersion": 1,
660
+ "type": "fspiop",
661
+ "asynchronous": true
662
+ },
663
+ "ignoreCallbacks": true,
664
+ "operationPath": "/transfers",
665
+ "path": "/transfers",
666
+ "method": "post",
667
+ "headers": {
668
+ "Accept": "{$inputs.acceptTransfers}",
669
+ "Content-Type": "{$inputs.contentTransfers}",
670
+ "Date": "{$function.generic.curDate}",
671
+ "FSPIOP-Source": "testfsp3",
672
+ "FSPIOP-Destination": "testfsp1"
673
+ },
674
+ "body": {
675
+ "transferId": "{$environment.transfer_ID}",
676
+ "payerFsp": "testfsp3",
677
+ "payeeFsp": "testfsp1",
678
+ "amount": {
679
+ "amount": "{$environment.transferAmount}",
680
+ "currency": "{$environment.currency}"
681
+ },
682
+ "expiration": "{$environment.transferExpiration}",
683
+ "ilpPacket": "{$environment.ilpPacket}",
684
+ "condition": "{$environment.condition}"
685
+ },
686
+ "tests": {
687
+ "assertions": [
688
+ {
689
+ "id": 1,
690
+ "description": "Callback does not have transferId",
691
+ "exec": [
692
+ "expect(environment.sendTransferResponse3).to.not.have.property('transferId')"
693
+ ]
694
+ },
695
+ {
696
+ "id": 2,
697
+ "description": "Callback status is COMMITTED",
698
+ "exec": [
699
+ "expect(environment.sendTransferResponse3.transferState).to.equal('COMMITTED')"
700
+ ]
701
+ },
702
+ {
703
+ "id": 3,
704
+ "description": "Status code is 202",
705
+ "exec": [
706
+ "expect(response.status).to.equal(202)"
707
+ ]
708
+ }
709
+ ]
710
+ },
711
+ "url": "{$inputs.HOST_ML_API_ADAPTER}",
712
+ "scripts": {
713
+ "preRequest": {
714
+ "exec": [
715
+ "var uuid = require('uuid');\r",
716
+ "\r",
717
+ "pm.environment.set('transfer_ID', uuid.v4());\r",
718
+ "pm.environment.set('transferDate', (new Date()).toUTCString());\r",
719
+ "pm.environment.set(\"transferExpiration\", new Date(new Date().getTime() + 60000))\r",
720
+ "pm.environment.set('transferAmount', 35.9);"
721
+ ]
722
+ },
723
+ "postRequest": {
724
+ "exec": [
725
+ "setTimeout(function () {",
726
+ " pm.sendRequest(pm.environment.get(\"HOST_SIMULATOR\")+\"/testfsp3/correlationid/\"+pm.environment.get(\"transfer_ID\"), function (err, response) {",
727
+ " pm.environment.set(\"sendTransferResponse3\", response.json())",
728
+ " });",
729
+ "}, 500)"
730
+ ]
731
+ }
732
+ }
733
+ },
734
+ {
735
+ "id": 8,
736
+ "description": "Send Quote 4 (testfsp2 to testfsp3)",
737
+ "apiVersion": {
738
+ "minorVersion": 0,
739
+ "majorVersion": 1,
740
+ "type": "fspiop",
741
+ "asynchronous": true
742
+ },
743
+ "operationPath": "/quotes",
744
+ "path": "/quotes",
745
+ "method": "post",
746
+ "url": "{$inputs.HOST_QUOTING_SERVICE}",
747
+ "headers": {
748
+ "Accept": "{$inputs.acceptQuotes}",
749
+ "Content-Type": "{$inputs.contentTypeQuotes}",
750
+ "Date": "{$function.generic.curDate}",
751
+ "FSPIOP-Source": "testfsp2",
752
+ "FSPIOP-Destination": "testfsp3"
753
+ },
754
+ "body": {
755
+ "quoteId": "{$function.generic.generateID}",
756
+ "transactionId": "{$function.generic.generateID}",
757
+ "payer": {
758
+ "partyIdInfo": {
759
+ "partyIdType": "MSISDN",
760
+ "partyIdentifier": "22507008181",
761
+ "fspId": "testfsp2"
762
+ },
763
+ "personalInfo": {
764
+ "complexName": {
765
+ "firstName": "Mats",
766
+ "lastName": "Hagman"
767
+ },
768
+ "dateOfBirth": "1983-10-25"
769
+ }
770
+ },
771
+ "payee": {
772
+ "partyIdInfo": {
773
+ "partyIdType": "MSISDN",
774
+ "partyIdentifier": "22556999125",
775
+ "fspId": "testfsp3"
776
+ }
777
+ },
778
+ "amountType": "SEND",
779
+ "amount": {
780
+ "amount": "{$environment.transferAmount}",
781
+ "currency": "{$environment.currency}"
782
+ },
783
+ "transactionType": {
784
+ "scenario": "TRANSFER",
785
+ "initiator": "PAYER",
786
+ "initiatorType": "CONSUMER"
787
+ },
788
+ "note": "hej"
789
+ },
790
+ "tests": {
791
+ "assertions": [
792
+ {
793
+ "id": 1,
794
+ "description": "Status to be 202",
795
+ "exec": [
796
+ "expect(response.status).to.equal(202)"
797
+ ]
798
+ }
799
+ ]
800
+ },
801
+ "ignoreCallbacks": true,
802
+ "scripts": {
803
+ "preRequest": {
804
+ "exec": [
805
+ "pm.environment.set('transferAmount', 20.11);"
806
+ ]
807
+ }
808
+ }
809
+ },
810
+ {
811
+ "id": 9,
812
+ "description": "Send Transfer 4 (testfsp2 to testfsp3)",
813
+ "apiVersion": {
814
+ "minorVersion": 0,
815
+ "majorVersion": 1,
816
+ "type": "fspiop",
817
+ "asynchronous": true
818
+ },
819
+ "ignoreCallbacks": true,
820
+ "operationPath": "/transfers",
821
+ "path": "/transfers",
822
+ "method": "post",
823
+ "headers": {
824
+ "Accept": "{$inputs.acceptTransfers}",
825
+ "Content-Type": "{$inputs.contentTransfers}",
826
+ "Date": "{$function.generic.curDate}",
827
+ "FSPIOP-Source": "testfsp2",
828
+ "FSPIOP-Destination": "testfsp3"
829
+ },
830
+ "body": {
831
+ "transferId": "{$environment.transfer_ID}",
832
+ "payerFsp": "testfsp2",
833
+ "payeeFsp": "testfsp3",
834
+ "amount": {
835
+ "amount": "{$environment.transferAmount}",
836
+ "currency": "{$environment.currency}"
837
+ },
838
+ "expiration": "{$environment.transferExpiration}",
839
+ "ilpPacket": "{$environment.ilpPacket}",
840
+ "condition": "{$environment.condition}"
841
+ },
842
+ "tests": {
843
+ "assertions": [
844
+ {
845
+ "id": 1,
846
+ "description": "Callback does not have transferId",
847
+ "exec": [
848
+ "expect(environment.sendTransferResponse4).to.not.have.property('transferId')"
849
+ ]
850
+ },
851
+ {
852
+ "id": 2,
853
+ "description": "Callback status is COMMITTED",
854
+ "exec": [
855
+ "expect(environment.sendTransferResponse4.transferState).to.equal('COMMITTED')"
856
+ ]
857
+ },
858
+ {
859
+ "id": 3,
860
+ "description": "Status code is 202",
861
+ "exec": [
862
+ "expect(response.status).to.equal(202)"
863
+ ]
864
+ }
865
+ ]
866
+ },
867
+ "url": "{$inputs.HOST_ML_API_ADAPTER}",
868
+ "scripts": {
869
+ "preRequest": {
870
+ "exec": [
871
+ "var uuid = require('uuid');\r",
872
+ "\r",
873
+ "pm.environment.set('transfer_ID', uuid.v4());\r",
874
+ "pm.environment.set('transferDate', (new Date()).toUTCString());\r",
875
+ "pm.environment.set(\"transferExpiration\", new Date(new Date().getTime() + 120000))\r",
876
+ "pm.environment.set(\"transferAmount\", 20.32);"
877
+ ]
878
+ },
879
+ "postRequest": {
880
+ "exec": [
881
+ "setTimeout(function () {",
882
+ " pm.sendRequest(pm.environment.get(\"HOST_SIMULATOR\")+\"/testfsp2/correlationid/\"+pm.environment.get(\"transfer_ID\"), function (err, response) {",
883
+ " pm.environment.set(\"sendTransferResponse4\", response.json())",
884
+ " });",
885
+ "}, 500)"
886
+ ]
887
+ }
888
+ }
889
+ },
890
+ {
891
+ "id": 10,
892
+ "description": "Send Quote 5 (testfsp4 to testfsp2)",
893
+ "apiVersion": {
894
+ "minorVersion": 0,
895
+ "majorVersion": 1,
896
+ "type": "fspiop",
897
+ "asynchronous": true
898
+ },
899
+ "operationPath": "/quotes",
900
+ "path": "/quotes",
901
+ "method": "post",
902
+ "url": "{$inputs.HOST_QUOTING_SERVICE}",
903
+ "headers": {
904
+ "Accept": "{$inputs.acceptQuotes}",
905
+ "Content-Type": "{$inputs.contentTypeQuotes}",
906
+ "Date": "{$function.generic.curDate}",
907
+ "FSPIOP-Source": "testfsp4",
908
+ "FSPIOP-Destination": "testfsp2"
909
+ },
910
+ "body": {
911
+ "quoteId": "{$function.generic.generateID}",
912
+ "transactionId": "{$function.generic.generateID}",
913
+ "payer": {
914
+ "partyIdInfo": {
915
+ "partyIdType": "MSISDN",
916
+ "partyIdentifier": "22507008181",
917
+ "fspId": "testfsp4"
918
+ },
919
+ "personalInfo": {
920
+ "complexName": {
921
+ "firstName": "Mats",
922
+ "lastName": "Hagman"
923
+ },
924
+ "dateOfBirth": "1983-10-25"
925
+ }
926
+ },
927
+ "payee": {
928
+ "partyIdInfo": {
929
+ "partyIdType": "MSISDN",
930
+ "partyIdentifier": "22556999125",
931
+ "fspId": "testfsp2"
932
+ }
933
+ },
934
+ "amountType": "SEND",
935
+ "amount": {
936
+ "amount": "{$environment.transferAmount}",
937
+ "currency": "{$environment.currency}"
938
+ },
939
+ "transactionType": {
940
+ "scenario": "TRANSFER",
941
+ "initiator": "PAYER",
942
+ "initiatorType": "CONSUMER"
943
+ },
944
+ "note": "hej"
945
+ },
946
+ "tests": {
947
+ "assertions": [
948
+ {
949
+ "id": 1,
950
+ "description": "Status to be 202",
951
+ "exec": [
952
+ "expect(response.status).to.equal(202)"
953
+ ]
954
+ }
955
+ ]
956
+ },
957
+ "ignoreCallbacks": true,
958
+ "scripts": {
959
+ "preRequest": {
960
+ "exec": [
961
+ "pm.environment.set('transferAmount', 35.124);"
962
+ ]
963
+ }
964
+ }
965
+ },
966
+ {
967
+ "id": 11,
968
+ "description": "Send Transfer 5 (testfsp4 to testfsp2)",
969
+ "apiVersion": {
970
+ "minorVersion": 0,
971
+ "majorVersion": 1,
972
+ "type": "fspiop",
973
+ "asynchronous": true
974
+ },
975
+ "ignoreCallbacks": true,
976
+ "operationPath": "/transfers",
977
+ "path": "/transfers",
978
+ "method": "post",
979
+ "headers": {
980
+ "Accept": "{$inputs.acceptTransfers}",
981
+ "Content-Type": "{$inputs.contentTransfers}",
982
+ "Date": "{$function.generic.curDate}",
983
+ "FSPIOP-Source": "testfsp4",
984
+ "FSPIOP-Destination": "testfsp2"
985
+ },
986
+ "body": {
987
+ "transferId": "{$environment.transfer_ID}",
988
+ "payerFsp": "testfsp4",
989
+ "payeeFsp": "testfsp2",
990
+ "amount": {
991
+ "amount": "{$environment.transferAmount}",
992
+ "currency": "{$environment.currency}"
993
+ },
994
+ "expiration": "{$environment.transferExpiration}",
995
+ "ilpPacket": "{$environment.ilpPacket}",
996
+ "condition": "{$environment.condition}"
997
+ },
998
+ "tests": {
999
+ "assertions": [
1000
+ {
1001
+ "id": 1,
1002
+ "description": "Callback does not have transferId",
1003
+ "exec": [
1004
+ "expect(environment.sendTransferResponse5).to.not.have.property('transferId')"
1005
+ ]
1006
+ },
1007
+ {
1008
+ "id": 2,
1009
+ "description": "Callback status is COMMITTED",
1010
+ "exec": [
1011
+ "expect(environment.sendTransferResponse5.transferState).to.equal('COMMITTED')"
1012
+ ]
1013
+ },
1014
+ {
1015
+ "id": 3,
1016
+ "description": "Status code is 202",
1017
+ "exec": [
1018
+ "expect(response.status).to.equal(202)"
1019
+ ]
1020
+ }
1021
+ ]
1022
+ },
1023
+ "url": "{$inputs.HOST_ML_API_ADAPTER}",
1024
+ "scripts": {
1025
+ "preRequest": {
1026
+ "exec": [
1027
+ "var uuid = require('uuid');\r",
1028
+ "pm.environment.set('transfer_ID', uuid.v4());\r",
1029
+ "pm.environment.set('transferExpiration', new Date(new Date().getTime() + 120000));\r",
1030
+ "pm.environment.set('transferAmount', 35.987);"
1031
+ ]
1032
+ },
1033
+ "postRequest": {
1034
+ "exec": [
1035
+ "setTimeout(function () {",
1036
+ " pm.sendRequest(pm.environment.get(\"HOST_SIMULATOR\")+\"/testfsp4/correlationid/\"+pm.environment.get(\"transfer_ID\"), function (err, response) {",
1037
+ " pm.environment.set(\"sendTransferResponse5\", response.json())",
1038
+ " });",
1039
+ "}, 500)"
1040
+ ]
1041
+ }
1042
+ }
1043
+ },
1044
+ {
1045
+ "id": 12,
1046
+ "description": "Send Quote 6 (testfsp4 to testfsp3)",
1047
+ "apiVersion": {
1048
+ "minorVersion": 0,
1049
+ "majorVersion": 1,
1050
+ "type": "fspiop",
1051
+ "asynchronous": true
1052
+ },
1053
+ "operationPath": "/quotes",
1054
+ "path": "/quotes",
1055
+ "method": "post",
1056
+ "url": "{$inputs.HOST_QUOTING_SERVICE}",
1057
+ "headers": {
1058
+ "Accept": "{$inputs.acceptQuotes}",
1059
+ "Content-Type": "{$inputs.contentTypeQuotes}",
1060
+ "Date": "{$function.generic.curDate}",
1061
+ "FSPIOP-Source": "testfsp4",
1062
+ "FSPIOP-Destination": "testfsp3"
1063
+ },
1064
+ "body": {
1065
+ "quoteId": "{$function.generic.generateID}",
1066
+ "transactionId": "{$function.generic.generateID}",
1067
+ "payer": {
1068
+ "partyIdInfo": {
1069
+ "partyIdType": "MSISDN",
1070
+ "partyIdentifier": "22507008181",
1071
+ "fspId": "testfsp4"
1072
+ },
1073
+ "personalInfo": {
1074
+ "complexName": {
1075
+ "firstName": "Mats",
1076
+ "lastName": "Hagman"
1077
+ },
1078
+ "dateOfBirth": "1983-10-25"
1079
+ }
1080
+ },
1081
+ "payee": {
1082
+ "partyIdInfo": {
1083
+ "partyIdType": "MSISDN",
1084
+ "partyIdentifier": "22556999125",
1085
+ "fspId": "testfsp3"
1086
+ }
1087
+ },
1088
+ "amountType": "SEND",
1089
+ "amount": {
1090
+ "amount": "{$environment.transferAmount}",
1091
+ "currency": "{$environment.currency}"
1092
+ },
1093
+ "transactionType": {
1094
+ "scenario": "TRANSFER",
1095
+ "initiator": "PAYER",
1096
+ "initiatorType": "CONSUMER"
1097
+ },
1098
+ "note": "hej"
1099
+ },
1100
+ "tests": {
1101
+ "assertions": [
1102
+ {
1103
+ "id": 1,
1104
+ "description": "Status to be 202",
1105
+ "exec": [
1106
+ "expect(response.status).to.equal(202)"
1107
+ ]
1108
+ }
1109
+ ]
1110
+ },
1111
+ "ignoreCallbacks": true,
1112
+ "scripts": {
1113
+ "preRequest": {
1114
+ "exec": [
1115
+ "pm.environment.set('transferAmount', 25.1234);"
1116
+ ]
1117
+ }
1118
+ }
1119
+ },
1120
+ {
1121
+ "id": 13,
1122
+ "description": "Send Transfer 6 (testfsp4 to testfsp3)",
1123
+ "apiVersion": {
1124
+ "minorVersion": 0,
1125
+ "majorVersion": 1,
1126
+ "type": "fspiop",
1127
+ "asynchronous": true
1128
+ },
1129
+ "ignoreCallbacks": true,
1130
+ "operationPath": "/transfers",
1131
+ "path": "/transfers",
1132
+ "method": "post",
1133
+ "headers": {
1134
+ "Accept": "{$inputs.acceptTransfers}",
1135
+ "Content-Type": "{$inputs.contentTransfers}",
1136
+ "Date": "{$function.generic.curDate}",
1137
+ "FSPIOP-Source": "testfsp4",
1138
+ "FSPIOP-Destination": "testfsp3"
1139
+ },
1140
+ "body": {
1141
+ "transferId": "{$environment.transfer_ID}",
1142
+ "payerFsp": "testfsp4",
1143
+ "payeeFsp": "testfsp3",
1144
+ "amount": {
1145
+ "amount": "{$environment.transferAmount}",
1146
+ "currency": "{$environment.currency}"
1147
+ },
1148
+ "expiration": "{$environment.transferExpiration}",
1149
+ "ilpPacket": "{$environment.ilpPacket}",
1150
+ "condition": "{$environment.condition}"
1151
+ },
1152
+ "tests": {
1153
+ "assertions": [
1154
+ {
1155
+ "id": 1,
1156
+ "description": "Callback does not have transferId",
1157
+ "exec": [
1158
+ "expect(environment.sendTransferResponse6).to.not.have.property('transferId')"
1159
+ ]
1160
+ },
1161
+ {
1162
+ "id": 2,
1163
+ "description": "Callback status is COMMITTED",
1164
+ "exec": [
1165
+ "expect(environment.sendTransferResponse6.transferState).to.equal('COMMITTED')"
1166
+ ]
1167
+ },
1168
+ {
1169
+ "id": 3,
1170
+ "description": "Status code is 202",
1171
+ "exec": [
1172
+ "expect(response.status).to.equal(202)"
1173
+ ]
1174
+ }
1175
+ ]
1176
+ },
1177
+ "url": "{$inputs.HOST_ML_API_ADAPTER}",
1178
+ "scripts": {
1179
+ "preRequest": {
1180
+ "exec": [
1181
+ "var uuid = require('uuid');\r",
1182
+ "\r",
1183
+ "pm.environment.set('transfer_ID', uuid.v4());\r",
1184
+ "pm.environment.set(\"transferExpiration\", new Date(new Date().getTime() + 120000));\r",
1185
+ "pm.environment.set('transferAmount', 25.7657);"
1186
+ ]
1187
+ },
1188
+ "postRequest": {
1189
+ "exec": [
1190
+ "setTimeout(function () {",
1191
+ " pm.sendRequest(pm.environment.get(\"HOST_SIMULATOR\")+\"/testfsp4/correlationid/\"+pm.environment.get(\"transfer_ID\"), function (err, response) {",
1192
+ " pm.environment.set(\"sendTransferResponse6\", response.json())",
1193
+ " });",
1194
+ "}, 500)"
1195
+ ]
1196
+ }
1197
+ }
1198
+ }
1199
+ ]
1200
+ },
1201
+ {
1202
+ "id": 3,
1203
+ "name": "Create Settlement DEFERREDNET",
1204
+ "requests": [
1205
+ {
1206
+ "id": 2,
1207
+ "description": "Close Existing Window",
1208
+ "apiVersion": {
1209
+ "minorVersion": 0,
1210
+ "majorVersion": 1,
1211
+ "type": "settlements"
1212
+ },
1213
+ "operationPath": "/settlementWindows/{id}",
1214
+ "path": "/settlementWindows/{$environment.openWindowID}",
1215
+ "method": "post",
1216
+ "params": {
1217
+ "id": "{$environment.openWindowID}"
1218
+ },
1219
+ "body": {
1220
+ "state": "CLOSED",
1221
+ "reason": "string"
1222
+ },
1223
+ "headers": {
1224
+ "Content-Type": "application/json"
1225
+ },
1226
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
1227
+ "tests": {
1228
+ "assertions": [
1229
+ {
1230
+ "id": 1,
1231
+ "description": "Status to be 200",
1232
+ "exec": [
1233
+ "expect(response.status).to.equal(200)"
1234
+ ]
1235
+ },
1236
+ {
1237
+ "id": 2,
1238
+ "description": "State should be OPEN",
1239
+ "exec": [
1240
+ "expect(response.body.state).to.equal('OPEN')"
1241
+ ]
1242
+ }
1243
+ ]
1244
+ },
1245
+ "scripts": {
1246
+ "preRequest": {
1247
+ "exec": [
1248
+ "setTimeout(function () {",
1249
+ " pm.sendRequest(pm.environment.get(\"HOST_CENTRAL_SETTLEMENT\")+\"/settlementWindows?state=OPEN\", function (err, response) {",
1250
+ " pm.environment.set(\"openWindowID\", response.json()[0].settlementWindowId)",
1251
+ " });",
1252
+ "}, 500)"
1253
+ ]
1254
+ },
1255
+ "postRequest": {
1256
+ "exec": [
1257
+ "pm.environment.set(\"closedWindowID\", pm.environment.get(\"openWindowID\"));\r",
1258
+ "pm.environment.set(\"openWindowID\", pm.response.body.settlementWindowId);\r",
1259
+ "console.log('openWindowID', pm.environment.get(\"openWindowID\"));\r",
1260
+ "console.log('closedWindowID', pm.environment.get(\"closedWindowID\"));"
1261
+ ]
1262
+ }
1263
+ }
1264
+ },
1265
+ {
1266
+ "id": 3,
1267
+ "description": "Create Settlement for Closed Window",
1268
+ "apiVersion": {
1269
+ "minorVersion": 0,
1270
+ "majorVersion": 1,
1271
+ "type": "settlements"
1272
+ },
1273
+ "operationPath": "/settlements",
1274
+ "path": "/settlements",
1275
+ "method": "post",
1276
+ "body": {
1277
+ "settlementModel": "DEFERREDNET",
1278
+ "reason": "TESTING",
1279
+ "settlementWindows": [
1280
+ {
1281
+ "id": "{$environment.closedWindowID}"
1282
+ }
1283
+ ]
1284
+ },
1285
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
1286
+ "headers": {
1287
+ "Content-Type": "application/json"
1288
+ },
1289
+ "tests": {
1290
+ "assertions": [
1291
+ {
1292
+ "id": 1,
1293
+ "description": "Status to be 200",
1294
+ "exec": [
1295
+ "expect(response.status).to.equal(200)"
1296
+ ]
1297
+ },
1298
+ {
1299
+ "id": 2,
1300
+ "description": "Settlement State should be PENDING_SETTLEMENT",
1301
+ "exec": [
1302
+ "expect(response.body.state).to.equal('PENDING_SETTLEMENT')"
1303
+ ]
1304
+ },
1305
+ {
1306
+ "id": 3,
1307
+ "description": "Number of associated windows should be 1",
1308
+ "exec": [
1309
+ "expect(response.body.settlementWindows.length).to.equal(1)"
1310
+ ]
1311
+ },
1312
+ {
1313
+ "id": 4,
1314
+ "description": "Associated Settlement Window ID should be as closedWindowId",
1315
+ "exec": [
1316
+ "expect(response.body.settlementWindows[0].id).to.eql(environment.closedWindowID)"
1317
+ ]
1318
+ },
1319
+ {
1320
+ "id": 5,
1321
+ "description": "Associated Settlement Window state should be PENDING_SETTLEMENT ",
1322
+ "exec": [
1323
+ "expect(response.body.state).to.equal('PENDING_SETTLEMENT')"
1324
+ ]
1325
+ },
1326
+ {
1327
+ "id": 6,
1328
+ "description": "Associated number of participants should be 4",
1329
+ "exec": [
1330
+ "expect(response.body.participants.length).to.equal(4)"
1331
+ ]
1332
+ },
1333
+ {
1334
+ "id": 7,
1335
+ "description": "DEFERREDNET calculation for testfsp1 should be 80.09",
1336
+ "exec": [
1337
+ "expect(response.body.participants[0].accounts[0].netSettlementAmount.amount).to.equal(80.09)"
1338
+ ]
1339
+ },
1340
+ {
1341
+ "id": 8,
1342
+ "description": "DEFERREDNET calculation for testfsp2 should be -75.667",
1343
+ "exec": [
1344
+ "expect(response.body.participants[1].accounts[0].netSettlementAmount.amount).to.equal(-75.667)"
1345
+ ]
1346
+ },
1347
+ {
1348
+ "id": 9,
1349
+ "description": "DEFERREDNET calculation for testfsp3 should be -10.1857",
1350
+ "exec": [
1351
+ "expect(response.body.participants[2].accounts[0].netSettlementAmount.amount).to.equal(-10.1857)"
1352
+ ]
1353
+ },
1354
+ {
1355
+ "id": 10,
1356
+ "description": "DEFERREDNET calculation for testfsp4 should be 5.7627",
1357
+ "exec": [
1358
+ "expect(response.body.participants[3].accounts[0].netSettlementAmount.amount).to.equal(5.7627)"
1359
+ ]
1360
+ }
1361
+ ]
1362
+ },
1363
+ "scripts": {
1364
+ "postRequest": {
1365
+ "exec": [
1366
+ "pm.environment.set(\"settlementId\", pm.response.body.id);",
1367
+ "",
1368
+ "",
1369
+ "pm.response.body.participants.forEach(participant => {",
1370
+ " participant.accounts.forEach(account => {",
1371
+ " console.log(account.id)",
1372
+ " if (account.id === Number(pm.environment.get(\"payerFspAccountId\"))) {",
1373
+ " console.log('payerfspNetSettlementAmount:', pm.environment.get(\"payerFspAccountId\"))",
1374
+ " pm.environment.set(\"payerfspNetSettlementAmount\",account.netSettlementAmount.amount);",
1375
+ " } else if (account.id === Number(pm.environment.get(\"payeeFspAccountId\"))) {",
1376
+ " console.log('payeefspNetSettlementAmount:',account.netSettlementAmount.amount)",
1377
+ " pm.environment.set(\"payeefspNetSettlementAmount\",account.netSettlementAmount.amount);",
1378
+ " ",
1379
+ " }",
1380
+ " })",
1381
+ "})"
1382
+ ]
1383
+ }
1384
+ }
1385
+ }
1386
+ ]
1387
+ },
1388
+ {
1389
+ "id": 4,
1390
+ "name": "Store Settlement&Position Account Balances After Transfers",
1391
+ "requests": [
1392
+ {
1393
+ "id": 1,
1394
+ "description": "testfsp1 balances",
1395
+ "apiVersion": {
1396
+ "minorVersion": 3,
1397
+ "majorVersion": 9,
1398
+ "type": "central_admin"
1399
+ },
1400
+ "operationPath": "/participants/{name}/accounts",
1401
+ "path": "/participants/testfsp1/accounts",
1402
+ "method": "get",
1403
+ "params": {
1404
+ "name": "testfsp1"
1405
+ },
1406
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1407
+ "tests": {
1408
+ "assertions": [
1409
+ {
1410
+ "id": 1,
1411
+ "description": "Status code is 200",
1412
+ "exec": [
1413
+ "expect(response.status).to.equal(200)"
1414
+ ]
1415
+ }
1416
+ ]
1417
+ },
1418
+ "scripts": {
1419
+ "postRequest": {
1420
+ "exec": [
1421
+ "var jsonData = pm.response.body;\r",
1422
+ "for (var i in jsonData) {\r",
1423
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
1424
+ " console.log(jsonData[i].value)\r",
1425
+ " pm.environment.set(\"testfsp1SettleAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1426
+ " }\r",
1427
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
1428
+ " console.log(jsonData[i].value)\r",
1429
+ " pm.environment.set(\"testfsp1PositionAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1430
+ " }\r",
1431
+ "}"
1432
+ ]
1433
+ }
1434
+ }
1435
+ },
1436
+ {
1437
+ "id": 2,
1438
+ "description": "testfsp2 balances",
1439
+ "apiVersion": {
1440
+ "minorVersion": 3,
1441
+ "majorVersion": 9,
1442
+ "type": "central_admin"
1443
+ },
1444
+ "operationPath": "/participants/{name}/accounts",
1445
+ "path": "/participants/testfsp2/accounts",
1446
+ "method": "get",
1447
+ "params": {
1448
+ "name": "testfsp2"
1449
+ },
1450
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1451
+ "tests": {
1452
+ "assertions": [
1453
+ {
1454
+ "id": 1,
1455
+ "description": "Status code is 200",
1456
+ "exec": [
1457
+ "expect(response.status).to.equal(200)"
1458
+ ]
1459
+ }
1460
+ ]
1461
+ },
1462
+ "scripts": {
1463
+ "postRequest": {
1464
+ "exec": [
1465
+ "var jsonData = pm.response.body;\r",
1466
+ "for (var i in jsonData) {\r",
1467
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
1468
+ " console.log(jsonData[i].value)\r",
1469
+ " pm.environment.set(\"testfsp2SettleAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1470
+ " }\r",
1471
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
1472
+ " console.log(jsonData[i].value)\r",
1473
+ " pm.environment.set(\"testfsp2PositionAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1474
+ " }\r",
1475
+ "}\r",
1476
+ ""
1477
+ ]
1478
+ }
1479
+ }
1480
+ },
1481
+ {
1482
+ "id": 3,
1483
+ "description": "testfsp3 balances",
1484
+ "apiVersion": {
1485
+ "minorVersion": 3,
1486
+ "majorVersion": 9,
1487
+ "type": "central_admin"
1488
+ },
1489
+ "operationPath": "/participants/{name}/accounts",
1490
+ "path": "/participants/testfsp3/accounts",
1491
+ "method": "get",
1492
+ "params": {
1493
+ "name": "testfsp3"
1494
+ },
1495
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1496
+ "tests": {
1497
+ "assertions": [
1498
+ {
1499
+ "id": 1,
1500
+ "description": "Status code is 200",
1501
+ "exec": [
1502
+ "expect(response.status).to.equal(200)"
1503
+ ]
1504
+ }
1505
+ ]
1506
+ },
1507
+ "scripts": {
1508
+ "preRequest": {
1509
+ "exec": [
1510
+ ""
1511
+ ]
1512
+ },
1513
+ "postRequest": {
1514
+ "exec": [
1515
+ "var jsonData = pm.response.body;\r",
1516
+ "for (var i in jsonData) {\r",
1517
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
1518
+ " console.log(jsonData[i].value)\r",
1519
+ " pm.environment.set(\"testfsp3SettleAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1520
+ " }\r",
1521
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
1522
+ " console.log(jsonData[i].value)\r",
1523
+ " pm.environment.set(\"testfsp3PositionAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1524
+ " }\r",
1525
+ "}\r",
1526
+ ""
1527
+ ]
1528
+ }
1529
+ }
1530
+ },
1531
+ {
1532
+ "id": 4,
1533
+ "description": "testfsp4 balances",
1534
+ "apiVersion": {
1535
+ "minorVersion": 3,
1536
+ "majorVersion": 9,
1537
+ "type": "central_admin"
1538
+ },
1539
+ "operationPath": "/participants/{name}/accounts",
1540
+ "path": "/participants/testfsp4/accounts",
1541
+ "method": "get",
1542
+ "params": {
1543
+ "name": "testfsp4"
1544
+ },
1545
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1546
+ "tests": {
1547
+ "assertions": [
1548
+ {
1549
+ "id": 1,
1550
+ "description": "Status code is 200",
1551
+ "exec": [
1552
+ "expect(response.status).to.equal(200)"
1553
+ ]
1554
+ }
1555
+ ]
1556
+ },
1557
+ "scripts": {
1558
+ "postRequest": {
1559
+ "exec": [
1560
+ "var jsonData = pm.response.body;\r",
1561
+ "for (var i in jsonData) {\r",
1562
+ " if (jsonData[i].ledgerAccountType === \"SETTLEMENT\") {\r",
1563
+ " console.log(jsonData[i].value)\r",
1564
+ " pm.environment.set(\"testfsp4SettleAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1565
+ " }\r",
1566
+ " if (jsonData[i].ledgerAccountType === \"POSITION\") {\r",
1567
+ " console.log(jsonData[i].value)\r",
1568
+ " pm.environment.set(\"testfsp4PositionAccountBalanceAfterTransfer\", jsonData[i].value);\r",
1569
+ " }\r",
1570
+ "}"
1571
+ ]
1572
+ }
1573
+ }
1574
+ }
1575
+ ]
1576
+ },
1577
+ {
1578
+ "id": 5,
1579
+ "name": "Prepare Settlement",
1580
+ "requests": [
1581
+ {
1582
+ "id": 1,
1583
+ "description": "Prepare Settlement",
1584
+ "apiVersion": {
1585
+ "minorVersion": 0,
1586
+ "majorVersion": 1,
1587
+ "type": "settlements"
1588
+ },
1589
+ "operationPath": "/settlements/{id}",
1590
+ "path": "/settlements/{$environment.settlementId}",
1591
+ "method": "get",
1592
+ "params": {
1593
+ "id": "{$environment.settlementId}"
1594
+ },
1595
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
1596
+ "tests": {
1597
+ "assertions": [
1598
+ {
1599
+ "id": 1,
1600
+ "description": "Status to be 200",
1601
+ "exec": [
1602
+ "expect(response.status).to.equal(200)"
1603
+ ]
1604
+ }
1605
+ ]
1606
+ },
1607
+ "scripts": {
1608
+ "postRequest": {
1609
+ "exec": [
1610
+ "var jsonData = pm.response.body;",
1611
+ "for(var j in jsonData.participants) {",
1612
+ " for(var k in jsonData.participants[j].accounts) {",
1613
+ " console.log(jsonData.participants[j].accounts[k].id)",
1614
+ " const participantPutRequest = {",
1615
+ " url: pm.environment.get(\"HOST_CENTRAL_SETTLEMENT\")+'/settlements/'+pm.environment.get(\"settlementId\"),",
1616
+ " method: 'PUT',",
1617
+ " header: {",
1618
+ " \"Authorization\":\"Bearer \"+pm.environment.get(\"HUB_OPERATOR_BEARER_TOKEN\"),",
1619
+ " \"FSPIOP-Source\": pm.environment.get(\"hub_operator\"),",
1620
+ " \"Content-Type\": \"application/json\"",
1621
+ " },",
1622
+ " body: {",
1623
+ " mode: 'raw',",
1624
+ " raw: JSON.stringify(",
1625
+ " {",
1626
+ " \"participants\": [",
1627
+ " {",
1628
+ " \"id\": jsonData.participants[j].id,",
1629
+ " \"accounts\": [",
1630
+ " {",
1631
+ " \"id\": jsonData.participants[j].accounts[k].id,",
1632
+ " \"reason\": \"Transfers recorded for payer\",",
1633
+ " \"state\": \"PS_TRANSFERS_RECORDED\"",
1634
+ " }",
1635
+ " ]",
1636
+ " }",
1637
+ " ]",
1638
+ " }",
1639
+ " )",
1640
+ " }",
1641
+ " };",
1642
+ " pm.sendRequest(participantPutRequest, function (err, response) {",
1643
+ " console.log(response.json());",
1644
+ " });",
1645
+ " ",
1646
+ " }",
1647
+ "}"
1648
+ ]
1649
+ },
1650
+ "preRequest": {
1651
+ "exec": [
1652
+ ""
1653
+ ]
1654
+ }
1655
+ }
1656
+ },
1657
+ {
1658
+ "id": 2,
1659
+ "description": "check state for participants after prepare",
1660
+ "apiVersion": {
1661
+ "minorVersion": 0,
1662
+ "majorVersion": 1,
1663
+ "type": "settlements"
1664
+ },
1665
+ "operationPath": "/settlements/{id}",
1666
+ "path": "/settlements/{$environment.settlementId}",
1667
+ "method": "get",
1668
+ "params": {
1669
+ "id": "{$environment.settlementId}"
1670
+ },
1671
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
1672
+ "tests": {
1673
+ "assertions": [
1674
+ {
1675
+ "id": 1,
1676
+ "description": "Status to be 200",
1677
+ "exec": [
1678
+ "expect(response.status).to.equal(200)"
1679
+ ]
1680
+ },
1681
+ {
1682
+ "id": 2,
1683
+ "description": "Settlement Id should be as expected",
1684
+ "exec": [
1685
+ "expect(response.body.id).to.equal(environment.settlementId)"
1686
+ ]
1687
+ },
1688
+ {
1689
+ "id": 3,
1690
+ "description": "Settlement state should be PS_TRANSFERS_RECORDED",
1691
+ "exec": [
1692
+ "expect(response.body.state).to.equal(\"PS_TRANSFERS_RECORDED\")"
1693
+ ]
1694
+ },
1695
+ {
1696
+ "id": 4,
1697
+ "description": "Settlement Window ID should be closed",
1698
+ "exec": [
1699
+ "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)"
1700
+ ]
1701
+ },
1702
+ {
1703
+ "id": 5,
1704
+ "description": "Settlement Window State should be PENDING_SETTLEMENT",
1705
+ "exec": [
1706
+ "expect(response.body.settlementWindows[0].state).to.equal(\"PENDING_SETTLEMENT\")"
1707
+ ]
1708
+ },
1709
+ {
1710
+ "id": 6,
1711
+ "description": "Participant Accounts state is PS_TRANSFERS_RECORDED",
1712
+ "exec": [
1713
+ "response.body.participants.forEach(participant => {",
1714
+ "\tparticipant.accounts.forEach(account => {",
1715
+ " expect(account.state).to.equal(\"PS_TRANSFERS_RECORDED\")",
1716
+ " })",
1717
+ "})"
1718
+ ]
1719
+ }
1720
+ ]
1721
+ },
1722
+ "scripts": {
1723
+ "postRequest": {
1724
+ "exec": [
1725
+ "console.log(pm.response)"
1726
+ ]
1727
+ }
1728
+ }
1729
+ },
1730
+ {
1731
+ "id": 3,
1732
+ "description": "testfsp1 settlement&position accont balance after prepare",
1733
+ "apiVersion": {
1734
+ "minorVersion": 3,
1735
+ "majorVersion": 9,
1736
+ "type": "central_admin"
1737
+ },
1738
+ "operationPath": "/participants/{name}/accounts",
1739
+ "path": "/participants/testfsp1/accounts",
1740
+ "method": "get",
1741
+ "params": {
1742
+ "name": "testfsp1"
1743
+ },
1744
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1745
+ "tests": {
1746
+ "assertions": [
1747
+ {
1748
+ "id": 1,
1749
+ "description": "Status to be 200",
1750
+ "exec": [
1751
+ "expect(response.status).to.equal(200)"
1752
+ ]
1753
+ },
1754
+ {
1755
+ "id": 2,
1756
+ "description": "Testfsp1 settlement account balance before and after prepare should be the same.",
1757
+ "exec": [
1758
+ "expect(environment.testfsp1SettleAccountBalanceAfterPrepare).to.equal(environment.testfsp1SettleAccountBalanceAfterTransfer)"
1759
+ ]
1760
+ },
1761
+ {
1762
+ "id": 3,
1763
+ "description": "Testfsp1 position account balance before and after prepare should be the same.",
1764
+ "exec": [
1765
+ "expect(environment.testfsp1PositionAccountBalanceAfterPrepare).to.equal(environment.testfsp1PositionAccountBalanceAfterTransfer)"
1766
+ ]
1767
+ }
1768
+ ]
1769
+ },
1770
+ "scripts": {
1771
+ "postRequest": {
1772
+ "exec": [
1773
+ "var jsonData = pm.response.body;",
1774
+ "var testfsp1SettleAccountBalanceAfterPrepare;",
1775
+ "var testfsp1PositionAccountBalanceAfterPrepare;",
1776
+ "for (var i in jsonData){",
1777
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
1778
+ " pm.environment.set(\"testfsp1SettleAccountBalanceAfterPrepare\", jsonData[i].value)",
1779
+ " }",
1780
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
1781
+ " pm.environment.set(\"testfsp1PositionAccountBalanceAfterPrepare\", jsonData[i].value)",
1782
+ " }",
1783
+ "}"
1784
+ ]
1785
+ }
1786
+ }
1787
+ },
1788
+ {
1789
+ "id": 4,
1790
+ "description": "testfsp2 settlement&position accont balance after prepare",
1791
+ "apiVersion": {
1792
+ "minorVersion": 3,
1793
+ "majorVersion": 9,
1794
+ "type": "central_admin"
1795
+ },
1796
+ "operationPath": "/participants/{name}/accounts",
1797
+ "path": "/participants/testfsp2/accounts",
1798
+ "method": "get",
1799
+ "params": {
1800
+ "name": "testfsp2"
1801
+ },
1802
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1803
+ "tests": {
1804
+ "assertions": [
1805
+ {
1806
+ "id": 1,
1807
+ "description": "Status to be 200",
1808
+ "exec": [
1809
+ "expect(response.status).to.equal(200)"
1810
+ ]
1811
+ },
1812
+ {
1813
+ "id": 2,
1814
+ "description": "Testfsp2 settlement account balance before and after prepare should be the same.",
1815
+ "exec": [
1816
+ "expect(environment.testfsp2SettleAccountBalanceAfterPrepare).to.equal(environment.testfsp2SettleAccountBalanceAfterTransfer)"
1817
+ ]
1818
+ },
1819
+ {
1820
+ "id": 3,
1821
+ "description": "Testfsp2 position account balance before and after prepare should be the same.",
1822
+ "exec": [
1823
+ "expect(environment.testfsp2PositionAccountBalanceAfterPrepare).to.equal(environment.testfsp2PositionAccountBalanceAfterTransfer)"
1824
+ ]
1825
+ }
1826
+ ]
1827
+ },
1828
+ "scripts": {
1829
+ "postRequest": {
1830
+ "exec": [
1831
+ "var jsonData = pm.response.body;",
1832
+ "var testfsp1SettleAccountBalanceAfterPrepare;",
1833
+ "var testfsp1PositionAccountBalanceAfterPrepare;",
1834
+ "for (var i in jsonData){",
1835
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
1836
+ " pm.environment.set(\"testfsp2SettleAccountBalanceAfterPrepare\", jsonData[i].value)",
1837
+ " }",
1838
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
1839
+ " pm.environment.set(\"testfsp2PositionAccountBalanceAfterPrepare\", jsonData[i].value)",
1840
+ " }",
1841
+ "}"
1842
+ ]
1843
+ }
1844
+ }
1845
+ },
1846
+ {
1847
+ "id": 5,
1848
+ "description": "testfsp3 settlement&position accont balance after prepare",
1849
+ "apiVersion": {
1850
+ "minorVersion": 3,
1851
+ "majorVersion": 9,
1852
+ "type": "central_admin"
1853
+ },
1854
+ "operationPath": "/participants/{name}/accounts",
1855
+ "path": "/participants/testfsp3/accounts",
1856
+ "method": "get",
1857
+ "params": {
1858
+ "name": "testfsp3"
1859
+ },
1860
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1861
+ "tests": {
1862
+ "assertions": [
1863
+ {
1864
+ "id": 1,
1865
+ "description": "Status to be 200",
1866
+ "exec": [
1867
+ "expect(response.status).to.equal(200)"
1868
+ ]
1869
+ },
1870
+ {
1871
+ "id": 2,
1872
+ "description": "Testfsp3 settlement account balance before and after prepare should be the same.",
1873
+ "exec": [
1874
+ "expect(environment.testfsp3SettleAccountBalanceAfterPrepare).to.equal(environment.testfsp3SettleAccountBalanceAfterTransfer)"
1875
+ ]
1876
+ },
1877
+ {
1878
+ "id": 3,
1879
+ "description": "Testfsp3 position account balance before and after prepare should be the same.",
1880
+ "exec": [
1881
+ "expect(environment.testfsp3PositionAccountBalanceAfterPrepare).to.equal(environment.testfsp3PositionAccountBalanceAfterTransfer)"
1882
+ ]
1883
+ }
1884
+ ]
1885
+ },
1886
+ "scripts": {
1887
+ "postRequest": {
1888
+ "exec": [
1889
+ "var jsonData = pm.response.body;",
1890
+ "var testfsp1SettleAccountBalanceAfterPrepare;",
1891
+ "var testfsp1PositionAccountBalanceAfterPrepare;",
1892
+ "for (var i in jsonData){",
1893
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
1894
+ " pm.environment.set(\"testfsp3SettleAccountBalanceAfterPrepare\", jsonData[i].value)",
1895
+ " }",
1896
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
1897
+ " pm.environment.set(\"testfsp3PositionAccountBalanceAfterPrepare\", jsonData[i].value)",
1898
+ " }",
1899
+ "}"
1900
+ ]
1901
+ }
1902
+ }
1903
+ },
1904
+ {
1905
+ "id": 6,
1906
+ "description": "testfsp4 settlement&position accont balance after prepare",
1907
+ "apiVersion": {
1908
+ "minorVersion": 3,
1909
+ "majorVersion": 9,
1910
+ "type": "central_admin"
1911
+ },
1912
+ "operationPath": "/participants/{name}/accounts",
1913
+ "path": "/participants/testfsp4/accounts",
1914
+ "method": "get",
1915
+ "params": {
1916
+ "name": "testfsp4"
1917
+ },
1918
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
1919
+ "tests": {
1920
+ "assertions": [
1921
+ {
1922
+ "id": 1,
1923
+ "description": "Status to be 200",
1924
+ "exec": [
1925
+ "expect(response.status).to.equal(200)"
1926
+ ]
1927
+ },
1928
+ {
1929
+ "id": 2,
1930
+ "description": "Testfsp4 settlement account balance before and after prepare should be the same.",
1931
+ "exec": [
1932
+ "expect(environment.testfsp4SettleAccountBalanceAfterPrepare).to.equal(environment.testfsp4SettleAccountBalanceAfterTransfer)"
1933
+ ]
1934
+ },
1935
+ {
1936
+ "id": 3,
1937
+ "description": "Testfsp4 position account balance before and after prepare should be the same.",
1938
+ "exec": [
1939
+ "expect(environment.testfsp4PositionAccountBalanceAfterPrepare).to.equal(environment.testfsp4PositionAccountBalanceAfterTransfer)"
1940
+ ]
1941
+ }
1942
+ ]
1943
+ },
1944
+ "scripts": {
1945
+ "postRequest": {
1946
+ "exec": [
1947
+ "var jsonData = pm.response.body;",
1948
+ "var testfsp1SettleAccountBalanceAfterPrepare;",
1949
+ "var testfsp1PositionAccountBalanceAfterPrepare;",
1950
+ "for (var i in jsonData){",
1951
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
1952
+ " pm.environment.set(\"testfsp4SettleAccountBalanceAfterPrepare\", jsonData[i].value)",
1953
+ " }",
1954
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
1955
+ " pm.environment.set(\"testfsp4PositionAccountBalanceAfterPrepare\", jsonData[i].value)",
1956
+ " }",
1957
+ "}"
1958
+ ]
1959
+ }
1960
+ }
1961
+ }
1962
+ ]
1963
+ },
1964
+ {
1965
+ "id": 6,
1966
+ "name": "Reserve Settlement",
1967
+ "requests": [
1968
+ {
1969
+ "id": 1,
1970
+ "description": "Reserve Settlement",
1971
+ "apiVersion": {
1972
+ "minorVersion": 0,
1973
+ "majorVersion": 1,
1974
+ "type": "settlements"
1975
+ },
1976
+ "operationPath": "/settlements/{id}",
1977
+ "path": "/settlements/{$environment.settlementId}",
1978
+ "method": "get",
1979
+ "params": {
1980
+ "id": "{$environment.settlementId}"
1981
+ },
1982
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
1983
+ "tests": {
1984
+ "assertions": [
1985
+ {
1986
+ "id": 1,
1987
+ "description": "Status to be 200",
1988
+ "exec": [
1989
+ "expect(response.status).to.equal(200)"
1990
+ ]
1991
+ }
1992
+ ]
1993
+ },
1994
+ "scripts": {
1995
+ "postRequest": {
1996
+ "exec": [
1997
+ "var jsonData = pm.response.body;",
1998
+ "for(var j in jsonData.participants) {",
1999
+ " for(var k in jsonData.participants[j].accounts) {",
2000
+ " console.log(jsonData.participants[j].accounts[k].id)",
2001
+ " const participantPutRequest = {",
2002
+ " url: pm.environment.get(\"HOST_CENTRAL_SETTLEMENT\")+'/settlements/'+pm.environment.get(\"settlementId\"),",
2003
+ " method: 'PUT',",
2004
+ " header: {",
2005
+ " \"Authorization\":\"Bearer \"+pm.environment.get(\"HUB_OPERATOR_BEARER_TOKEN\"),",
2006
+ " \"FSPIOP-Source\": pm.environment.get(\"hub_operator\"),",
2007
+ " \"Content-Type\": \"application/json\"",
2008
+ " },",
2009
+ " body: {",
2010
+ " mode: 'raw',",
2011
+ " raw: JSON.stringify(",
2012
+ " {",
2013
+ " \"participants\": [",
2014
+ " {",
2015
+ " \"id\": jsonData.participants[j].id,",
2016
+ " \"accounts\": [",
2017
+ " {",
2018
+ " \"id\": jsonData.participants[j].accounts[k].id,",
2019
+ " \"reason\": \"Transfers reserved\",",
2020
+ " \"state\": \"PS_TRANSFERS_RESERVED\"",
2021
+ " }",
2022
+ " ]",
2023
+ " }",
2024
+ " ]",
2025
+ " }",
2026
+ " )",
2027
+ " }",
2028
+ " };",
2029
+ " pm.sendRequest(participantPutRequest, function (err, response) {",
2030
+ " console.log(response.json());",
2031
+ " });",
2032
+ " ",
2033
+ " }",
2034
+ "}"
2035
+ ]
2036
+ },
2037
+ "preRequest": {
2038
+ "exec": [
2039
+ ""
2040
+ ]
2041
+ }
2042
+ }
2043
+ },
2044
+ {
2045
+ "id": 2,
2046
+ "description": "check state for participants after reserve",
2047
+ "apiVersion": {
2048
+ "minorVersion": 0,
2049
+ "majorVersion": 1,
2050
+ "type": "settlements"
2051
+ },
2052
+ "operationPath": "/settlements/{id}",
2053
+ "path": "/settlements/{$environment.settlementId}",
2054
+ "method": "get",
2055
+ "params": {
2056
+ "id": "{$environment.settlementId}"
2057
+ },
2058
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
2059
+ "tests": {
2060
+ "assertions": [
2061
+ {
2062
+ "id": 1,
2063
+ "description": "Status to be 200",
2064
+ "exec": [
2065
+ "expect(response.status).to.equal(200)"
2066
+ ]
2067
+ },
2068
+ {
2069
+ "id": 2,
2070
+ "description": "Settlement Id should be as expected",
2071
+ "exec": [
2072
+ "expect(response.body.id).to.equal(environment.settlementId)"
2073
+ ]
2074
+ },
2075
+ {
2076
+ "id": 3,
2077
+ "description": "Settlement state should be PS_TRANSFERS_RESERVED",
2078
+ "exec": [
2079
+ "expect(response.body.state).to.equal(\"PS_TRANSFERS_RESERVED\")"
2080
+ ]
2081
+ },
2082
+ {
2083
+ "id": 4,
2084
+ "description": "Settlement Window ID should be closed",
2085
+ "exec": [
2086
+ "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)"
2087
+ ]
2088
+ },
2089
+ {
2090
+ "id": 5,
2091
+ "description": "Settlement Window State should be PENDING_SETTLEMENT",
2092
+ "exec": [
2093
+ "expect(response.body.settlementWindows[0].state).to.equal(\"PENDING_SETTLEMENT\")"
2094
+ ]
2095
+ },
2096
+ {
2097
+ "id": 6,
2098
+ "description": "Participant Accounts state is PS_TRANSFERS_RESERVED",
2099
+ "exec": [
2100
+ "response.body.participants.forEach(participant => {",
2101
+ "\tparticipant.accounts.forEach(account => {",
2102
+ " expect(account.state).to.equal(\"PS_TRANSFERS_RESERVED\")",
2103
+ " })",
2104
+ "})"
2105
+ ]
2106
+ }
2107
+ ]
2108
+ },
2109
+ "scripts": {
2110
+ "postRequest": {
2111
+ "exec": [
2112
+ ""
2113
+ ]
2114
+ }
2115
+ }
2116
+ },
2117
+ {
2118
+ "id": 3,
2119
+ "description": "testfsp1 settlement&position accont balance after prepare",
2120
+ "apiVersion": {
2121
+ "minorVersion": 3,
2122
+ "majorVersion": 9,
2123
+ "type": "central_admin"
2124
+ },
2125
+ "operationPath": "/participants/{name}/accounts",
2126
+ "path": "/participants/testfsp1/accounts",
2127
+ "method": "get",
2128
+ "params": {
2129
+ "name": "testfsp1"
2130
+ },
2131
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2132
+ "tests": {
2133
+ "assertions": [
2134
+ {
2135
+ "id": 1,
2136
+ "description": "Status to be 200",
2137
+ "exec": [
2138
+ "expect(response.status).to.equal(200)"
2139
+ ]
2140
+ },
2141
+ {
2142
+ "id": 2,
2143
+ "description": "Testfsp1 settlement account balance before and after reserve should be the same.",
2144
+ "exec": [
2145
+ "expect(environment.testfsp1SettleAccountBalanceAfterReserve).to.equal(environment.testfsp1SettleAccountBalanceAfterTransfer)"
2146
+ ]
2147
+ },
2148
+ {
2149
+ "id": 3,
2150
+ "description": "Testfsp1 position account balance before and after reserve should be the same.",
2151
+ "exec": [
2152
+ "expect(environment.testfsp1PositionAccountBalanceAfterPrepare).to.equal(environment.testfsp1PositionAccountBalanceAfterTransfer)"
2153
+ ]
2154
+ }
2155
+ ]
2156
+ },
2157
+ "scripts": {
2158
+ "postRequest": {
2159
+ "exec": [
2160
+ "var jsonData = pm.response.body;",
2161
+ "for (var i in jsonData){",
2162
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2163
+ " pm.environment.set(\"testfsp1SettleAccountBalanceAfterReserve\", jsonData[i].value)",
2164
+ " }",
2165
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2166
+ " pm.environment.set(\"testfsp1PositionAccountBalanceAfterReserve\", jsonData[i].value)",
2167
+ " }",
2168
+ "}"
2169
+ ]
2170
+ }
2171
+ }
2172
+ },
2173
+ {
2174
+ "id": 4,
2175
+ "description": "testfsp2 settlement&position accont balance after reserve",
2176
+ "apiVersion": {
2177
+ "minorVersion": 3,
2178
+ "majorVersion": 9,
2179
+ "type": "central_admin"
2180
+ },
2181
+ "operationPath": "/participants/{name}/accounts",
2182
+ "path": "/participants/testfsp2/accounts",
2183
+ "method": "get",
2184
+ "params": {
2185
+ "name": "testfsp2"
2186
+ },
2187
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2188
+ "tests": {
2189
+ "assertions": [
2190
+ {
2191
+ "id": 1,
2192
+ "description": "Status to be 200",
2193
+ "exec": [
2194
+ "expect(response.status).to.equal(200)"
2195
+ ]
2196
+ },
2197
+ {
2198
+ "id": 2,
2199
+ "description": "Testfsp2 settlement account balance before and after reserve should be the same.",
2200
+ "exec": [
2201
+ "expect(environment.testfsp2SettleAccountBalanceAfterReserve).to.equal(environment.testfsp2SettleAccountBalanceAfterTransfer)"
2202
+ ]
2203
+ },
2204
+ {
2205
+ "id": 3,
2206
+ "description": "Testfsp2 position account balance after reserve gets increased by its net settlement amount.",
2207
+ "exec": [
2208
+ "expect(environment.testfsp2PositionAccountBalanceAfterReserve).to.equal(environment.testfsp2PositionAccountBalanceBeforeTransfer)"
2209
+ ]
2210
+ }
2211
+ ]
2212
+ },
2213
+ "scripts": {
2214
+ "postRequest": {
2215
+ "exec": [
2216
+ "var jsonData = pm.response.body;",
2217
+ "var testfsp1SettleAccountBalanceAfterPrepare;",
2218
+ "var testfsp1PositionAccountBalanceAfterPrepare;",
2219
+ "for (var i in jsonData){",
2220
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2221
+ " pm.environment.set(\"testfsp2SettleAccountBalanceAfterReserve\", jsonData[i].value)",
2222
+ " }",
2223
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2224
+ " pm.environment.set(\"testfsp2PositionAccountBalanceAfterReserve\", jsonData[i].value)",
2225
+ " }",
2226
+ "}"
2227
+ ]
2228
+ }
2229
+ }
2230
+ },
2231
+ {
2232
+ "id": 5,
2233
+ "description": "testfsp3 settlement&position accont balance after reserve",
2234
+ "apiVersion": {
2235
+ "minorVersion": 3,
2236
+ "majorVersion": 9,
2237
+ "type": "central_admin"
2238
+ },
2239
+ "operationPath": "/participants/{name}/accounts",
2240
+ "path": "/participants/testfsp3/accounts",
2241
+ "method": "get",
2242
+ "params": {
2243
+ "name": "testfsp3"
2244
+ },
2245
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2246
+ "tests": {
2247
+ "assertions": [
2248
+ {
2249
+ "id": 1,
2250
+ "description": "Status to be 200",
2251
+ "exec": [
2252
+ "expect(response.status).to.equal(200)"
2253
+ ]
2254
+ },
2255
+ {
2256
+ "id": 2,
2257
+ "description": "Testfsp3 settlement account balance before and after reserve should be the same.",
2258
+ "exec": [
2259
+ "expect(environment.testfsp3SettleAccountBalanceAfterReserve).to.equal(environment.testfsp3SettleAccountBalanceAfterTransfer)"
2260
+ ]
2261
+ },
2262
+ {
2263
+ "id": 3,
2264
+ "description": "Testfsp3 position account balance after reserve gets increased by its net settlement amount.",
2265
+ "exec": [
2266
+ "expect(environment.testfsp3PositionAccountBalanceAfterReserve).to.equal(environment.testfsp3PositionAccountBalanceBeforeTransfer)"
2267
+ ]
2268
+ }
2269
+ ]
2270
+ },
2271
+ "scripts": {
2272
+ "postRequest": {
2273
+ "exec": [
2274
+ "var jsonData = pm.response.body;",
2275
+ "for (var i in jsonData){",
2276
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2277
+ " pm.environment.set(\"testfsp3SettleAccountBalanceAfterReserve\", jsonData[i].value)",
2278
+ " }",
2279
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2280
+ " pm.environment.set(\"testfsp3PositionAccountBalanceAfterReserve\", jsonData[i].value)",
2281
+ " }",
2282
+ "}"
2283
+ ]
2284
+ }
2285
+ }
2286
+ },
2287
+ {
2288
+ "id": 6,
2289
+ "description": "testfsp4 settlement&position accont balance after reserve",
2290
+ "apiVersion": {
2291
+ "minorVersion": 3,
2292
+ "majorVersion": 9,
2293
+ "type": "central_admin"
2294
+ },
2295
+ "operationPath": "/participants/{name}/accounts",
2296
+ "path": "/participants/testfsp4/accounts",
2297
+ "method": "get",
2298
+ "params": {
2299
+ "name": "testfsp4"
2300
+ },
2301
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2302
+ "tests": {
2303
+ "assertions": [
2304
+ {
2305
+ "id": 1,
2306
+ "description": "Status to be 200",
2307
+ "exec": [
2308
+ "expect(response.status).to.equal(200)"
2309
+ ]
2310
+ },
2311
+ {
2312
+ "id": 2,
2313
+ "description": "Testfsp4 settlement account balance before and after reserve should be the same.",
2314
+ "exec": [
2315
+ "expect(environment.testfsp4SettleAccountBalanceAfterReserve).to.equal(environment.testfsp4SettleAccountBalanceAfterTransfer)"
2316
+ ]
2317
+ },
2318
+ {
2319
+ "id": 3,
2320
+ "description": "Testfsp4 position account balance before and after reserve should be the same.",
2321
+ "exec": [
2322
+ "expect(environment.testfsp4PositionAccountBalanceAfterReserve).to.equal(environment.testfsp4PositionAccountBalanceAfterTransfer)"
2323
+ ]
2324
+ }
2325
+ ]
2326
+ },
2327
+ "scripts": {
2328
+ "postRequest": {
2329
+ "exec": [
2330
+ "var jsonData = pm.response.body;",
2331
+ "for (var i in jsonData){",
2332
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2333
+ " pm.environment.set(\"testfsp4SettleAccountBalanceAfterReserve\", jsonData[i].value)",
2334
+ " }",
2335
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2336
+ " pm.environment.set(\"testfsp4PositionAccountBalanceAfterReserve\", jsonData[i].value)",
2337
+ " }",
2338
+ "}"
2339
+ ]
2340
+ }
2341
+ }
2342
+ }
2343
+ ]
2344
+ },
2345
+ {
2346
+ "id": 7,
2347
+ "name": "Commit Settlement",
2348
+ "requests": [
2349
+ {
2350
+ "id": 1,
2351
+ "description": "Commit Settlement",
2352
+ "apiVersion": {
2353
+ "minorVersion": 0,
2354
+ "majorVersion": 1,
2355
+ "type": "settlements"
2356
+ },
2357
+ "operationPath": "/settlements/{id}",
2358
+ "path": "/settlements/{$environment.settlementId}",
2359
+ "method": "get",
2360
+ "params": {
2361
+ "id": "{$environment.settlementId}"
2362
+ },
2363
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
2364
+ "tests": {
2365
+ "assertions": [
2366
+ {
2367
+ "id": 1,
2368
+ "description": "Status to be 200",
2369
+ "exec": [
2370
+ "expect(response.status).to.equal(200)"
2371
+ ]
2372
+ }
2373
+ ]
2374
+ },
2375
+ "scripts": {
2376
+ "postRequest": {
2377
+ "exec": [
2378
+ "var jsonData = pm.response.body;",
2379
+ "for(var j in jsonData.participants) {",
2380
+ " for(var k in jsonData.participants[j].accounts) {",
2381
+ " console.log(jsonData.participants[j].accounts[k].id)",
2382
+ " const participantPutRequest = {",
2383
+ " url: pm.environment.get(\"HOST_CENTRAL_SETTLEMENT\")+'/settlements/'+pm.environment.get(\"settlementId\"),",
2384
+ " method: 'PUT',",
2385
+ " header: {",
2386
+ " \"Authorization\":\"Bearer \"+pm.environment.get(\"HUB_OPERATOR_BEARER_TOKEN\"),",
2387
+ " \"FSPIOP-Source\": pm.environment.get(\"hub_operator\"),",
2388
+ " \"Content-Type\": \"application/json\"",
2389
+ " },",
2390
+ " body: {",
2391
+ " mode: 'raw',",
2392
+ " raw: JSON.stringify(",
2393
+ " {",
2394
+ " \"participants\": [",
2395
+ " {",
2396
+ " \"id\": jsonData.participants[j].id,",
2397
+ " \"accounts\": [",
2398
+ " {",
2399
+ " \"id\": jsonData.participants[j].accounts[k].id,",
2400
+ " \"reason\": \"Transfers committed\",",
2401
+ " \"state\": \"PS_TRANSFERS_COMMITTED\"",
2402
+ " }",
2403
+ " ]",
2404
+ " }",
2405
+ " ]",
2406
+ " }",
2407
+ " )",
2408
+ " }",
2409
+ " };",
2410
+ " pm.sendRequest(participantPutRequest, function (err, response) {",
2411
+ " console.log(response.json());",
2412
+ " });",
2413
+ " ",
2414
+ " }",
2415
+ "}"
2416
+ ]
2417
+ },
2418
+ "preRequest": {
2419
+ "exec": [
2420
+ ""
2421
+ ]
2422
+ }
2423
+ }
2424
+ },
2425
+ {
2426
+ "id": 2,
2427
+ "description": "check state for participants after prepare",
2428
+ "apiVersion": {
2429
+ "minorVersion": 0,
2430
+ "majorVersion": 1,
2431
+ "type": "settlements"
2432
+ },
2433
+ "operationPath": "/settlements/{id}",
2434
+ "path": "/settlements/{$environment.settlementId}",
2435
+ "method": "get",
2436
+ "params": {
2437
+ "id": "{$environment.settlementId}"
2438
+ },
2439
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
2440
+ "tests": {
2441
+ "assertions": [
2442
+ {
2443
+ "id": 1,
2444
+ "description": "Status to be 200",
2445
+ "exec": [
2446
+ "expect(response.status).to.equal(200)"
2447
+ ]
2448
+ },
2449
+ {
2450
+ "id": 2,
2451
+ "description": "Settlement Id should be as expected",
2452
+ "exec": [
2453
+ "expect(response.body.id).to.equal(environment.settlementId)"
2454
+ ]
2455
+ },
2456
+ {
2457
+ "id": 3,
2458
+ "description": "Settlement state should be PS_TRANSFERS_COMMITTED",
2459
+ "exec": [
2460
+ "expect(response.body.state).to.equal(\"PS_TRANSFERS_COMMITTED\")"
2461
+ ]
2462
+ },
2463
+ {
2464
+ "id": 4,
2465
+ "description": "Settlement Window ID should be closed",
2466
+ "exec": [
2467
+ "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)"
2468
+ ]
2469
+ },
2470
+ {
2471
+ "id": 5,
2472
+ "description": "Settlement Window State should be PENDING_SETTLEMENT",
2473
+ "exec": [
2474
+ "expect(response.body.settlementWindows[0].state).to.equal(\"PENDING_SETTLEMENT\")"
2475
+ ]
2476
+ },
2477
+ {
2478
+ "id": 6,
2479
+ "description": "Participant Accounts state is PS_TRANSFERS_COMMITTED",
2480
+ "exec": [
2481
+ "response.body.participants.forEach(participant => {",
2482
+ "\tparticipant.accounts.forEach(account => {",
2483
+ " expect(account.state).to.equal(\"PS_TRANSFERS_COMMITTED\")",
2484
+ " })",
2485
+ "})"
2486
+ ]
2487
+ }
2488
+ ]
2489
+ },
2490
+ "scripts": {
2491
+ "postRequest": {
2492
+ "exec": [
2493
+ ""
2494
+ ]
2495
+ }
2496
+ }
2497
+ },
2498
+ {
2499
+ "id": 3,
2500
+ "description": "testfsp1 settlement&position accont balance after prepare",
2501
+ "apiVersion": {
2502
+ "minorVersion": 3,
2503
+ "majorVersion": 9,
2504
+ "type": "central_admin"
2505
+ },
2506
+ "operationPath": "/participants/{name}/accounts",
2507
+ "path": "/participants/testfsp1/accounts",
2508
+ "method": "get",
2509
+ "params": {
2510
+ "name": "testfsp1"
2511
+ },
2512
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2513
+ "tests": {
2514
+ "assertions": [
2515
+ {
2516
+ "id": 1,
2517
+ "description": "Status to be 200",
2518
+ "exec": [
2519
+ "expect(response.status).to.equal(200)"
2520
+ ]
2521
+ },
2522
+ {
2523
+ "id": 2,
2524
+ "description": "Testfsp1 settlement account balance before and after commit should be the same.",
2525
+ "exec": [
2526
+ "expect(environment.testfsp1SettleAccountBalanceAfterCommit).to.equal(environment.testfsp1SettleAccountBalanceAfterTransfer)"
2527
+ ]
2528
+ },
2529
+ {
2530
+ "id": 3,
2531
+ "description": "Testfsp1 position account balance after commit should be reduced by its net settlement amount.",
2532
+ "exec": [
2533
+ "expect(environment.testfsp1PositionAccountBalanceAfterCommit).to.equal(environment.testfsp1PositionAccountBalanceBeforeTransfer)"
2534
+ ]
2535
+ }
2536
+ ]
2537
+ },
2538
+ "scripts": {
2539
+ "postRequest": {
2540
+ "exec": [
2541
+ "var jsonData = pm.response.body;",
2542
+ "for (var i in jsonData){",
2543
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2544
+ " pm.environment.set(\"testfsp1SettleAccountBalanceAfterCommit\", jsonData[i].value)",
2545
+ " }",
2546
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2547
+ " pm.environment.set(\"testfsp1PositionAccountBalanceAfterCommit\", jsonData[i].value)",
2548
+ " }",
2549
+ "}"
2550
+ ]
2551
+ }
2552
+ }
2553
+ },
2554
+ {
2555
+ "id": 4,
2556
+ "description": "testfsp2 settlement&position accont balance after commit",
2557
+ "apiVersion": {
2558
+ "minorVersion": 3,
2559
+ "majorVersion": 9,
2560
+ "type": "central_admin"
2561
+ },
2562
+ "operationPath": "/participants/{name}/accounts",
2563
+ "path": "/participants/testfsp2/accounts",
2564
+ "method": "get",
2565
+ "params": {
2566
+ "name": "testfsp2"
2567
+ },
2568
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2569
+ "tests": {
2570
+ "assertions": [
2571
+ {
2572
+ "id": 1,
2573
+ "description": "Status to be 200",
2574
+ "exec": [
2575
+ "expect(response.status).to.equal(200)"
2576
+ ]
2577
+ },
2578
+ {
2579
+ "id": 2,
2580
+ "description": "Testfsp2 settlement account balance before and after commit should be the same.",
2581
+ "exec": [
2582
+ "expect(environment.testfsp2SettleAccountBalanceAfterCommit).to.equal(environment.testfsp2SettleAccountBalanceAfterTransfer)"
2583
+ ]
2584
+ },
2585
+ {
2586
+ "id": 3,
2587
+ "description": "Testfsp2 position account balance after reserve gets increased by its net settlement amount.",
2588
+ "exec": [
2589
+ "expect(environment.testfsp2PositionAccountBalanceAfterCommit).to.equal(environment.testfsp2PositionAccountBalanceBeforeTransfer)"
2590
+ ]
2591
+ }
2592
+ ]
2593
+ },
2594
+ "scripts": {
2595
+ "postRequest": {
2596
+ "exec": [
2597
+ "var jsonData = pm.response.body;",
2598
+ "for (var i in jsonData){",
2599
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2600
+ " pm.environment.set(\"testfsp2SettleAccountBalanceAfterCommit\", jsonData[i].value)",
2601
+ " }",
2602
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2603
+ " pm.environment.set(\"testfsp2PositionAccountBalanceAfterCommit\", jsonData[i].value)",
2604
+ " }",
2605
+ "}"
2606
+ ]
2607
+ }
2608
+ }
2609
+ },
2610
+ {
2611
+ "id": 5,
2612
+ "description": "testfsp3 settlement&position accont balance after commit",
2613
+ "apiVersion": {
2614
+ "minorVersion": 3,
2615
+ "majorVersion": 9,
2616
+ "type": "central_admin"
2617
+ },
2618
+ "operationPath": "/participants/{name}/accounts",
2619
+ "path": "/participants/testfsp3/accounts",
2620
+ "method": "get",
2621
+ "params": {
2622
+ "name": "testfsp3"
2623
+ },
2624
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2625
+ "tests": {
2626
+ "assertions": [
2627
+ {
2628
+ "id": 1,
2629
+ "description": "Status to be 200",
2630
+ "exec": [
2631
+ "expect(response.status).to.equal(200)"
2632
+ ]
2633
+ },
2634
+ {
2635
+ "id": 2,
2636
+ "description": "Testfsp3 settlement account balance before and after commit should be the same.",
2637
+ "exec": [
2638
+ "expect(environment.testfsp3SettleAccountBalanceAfterCommit).to.equal(environment.testfsp3SettleAccountBalanceAfterTransfer)"
2639
+ ]
2640
+ },
2641
+ {
2642
+ "id": 3,
2643
+ "description": "Testfsp3 position account balance before and after commit should be the same.",
2644
+ "exec": [
2645
+ "expect(environment.testfsp3PositionAccountBalanceAfterCommit).to.equal(environment.testfsp3PositionAccountBalanceBeforeTransfer)"
2646
+ ]
2647
+ }
2648
+ ]
2649
+ },
2650
+ "scripts": {
2651
+ "postRequest": {
2652
+ "exec": [
2653
+ "var jsonData = pm.response.body;",
2654
+ "for (var i in jsonData){",
2655
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2656
+ " pm.environment.set(\"testfsp3SettleAccountBalanceAfterCommit\", jsonData[i].value)",
2657
+ " }",
2658
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2659
+ " pm.environment.set(\"testfsp3PositionAccountBalanceAfterCommit\", jsonData[i].value)",
2660
+ " }",
2661
+ "}"
2662
+ ]
2663
+ }
2664
+ }
2665
+ },
2666
+ {
2667
+ "id": 6,
2668
+ "description": "testfsp4 settlement&position accont balance after commit",
2669
+ "apiVersion": {
2670
+ "minorVersion": 3,
2671
+ "majorVersion": 9,
2672
+ "type": "central_admin"
2673
+ },
2674
+ "operationPath": "/participants/{name}/accounts",
2675
+ "path": "/participants/testfsp4/accounts",
2676
+ "method": "get",
2677
+ "params": {
2678
+ "name": "testfsp4"
2679
+ },
2680
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2681
+ "tests": {
2682
+ "assertions": [
2683
+ {
2684
+ "id": 1,
2685
+ "description": "Status to be 200",
2686
+ "exec": [
2687
+ "expect(response.status).to.equal(200)"
2688
+ ]
2689
+ },
2690
+ {
2691
+ "id": 2,
2692
+ "description": "Testfsp4 settlement account balance before and after commit should be the same.",
2693
+ "exec": [
2694
+ "expect(environment.testfsp4SettleAccountBalanceAfterCommit).to.equal(environment.testfsp4SettleAccountBalanceAfterTransfer)"
2695
+ ]
2696
+ },
2697
+ {
2698
+ "id": 3,
2699
+ "description": "Testfsp4 position account balance before and after commit should be the same.",
2700
+ "exec": [
2701
+ "expect(environment.testfsp4PositionAccountBalanceAfterCommit).to.equal(environment.testfsp4PositionAccountBalanceBeforeTransfer)"
2702
+ ]
2703
+ }
2704
+ ]
2705
+ },
2706
+ "scripts": {
2707
+ "postRequest": {
2708
+ "exec": [
2709
+ "var jsonData = pm.response.body;",
2710
+ "for (var i in jsonData){",
2711
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2712
+ " pm.environment.set(\"testfsp4SettleAccountBalanceAfterCommit\", jsonData[i].value)",
2713
+ " }",
2714
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2715
+ " pm.environment.set(\"testfsp4PositionAccountBalanceAfterCommit\", jsonData[i].value)",
2716
+ " }",
2717
+ "}"
2718
+ ]
2719
+ }
2720
+ }
2721
+ }
2722
+ ]
2723
+ },
2724
+ {
2725
+ "id": 8,
2726
+ "name": "Settle Settlement",
2727
+ "requests": [
2728
+ {
2729
+ "id": 1,
2730
+ "description": "Settle Settlement",
2731
+ "apiVersion": {
2732
+ "minorVersion": 0,
2733
+ "majorVersion": 1,
2734
+ "type": "settlements"
2735
+ },
2736
+ "operationPath": "/settlements/{id}",
2737
+ "path": "/settlements/{$environment.settlementId}",
2738
+ "method": "get",
2739
+ "params": {
2740
+ "id": "{$environment.settlementId}"
2741
+ },
2742
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
2743
+ "tests": {
2744
+ "assertions": [
2745
+ {
2746
+ "id": 1,
2747
+ "description": "Status to be 200",
2748
+ "exec": [
2749
+ "expect(response.status).to.equal(200)"
2750
+ ]
2751
+ }
2752
+ ]
2753
+ },
2754
+ "scripts": {
2755
+ "postRequest": {
2756
+ "exec": [
2757
+ "var jsonData = pm.response.body;",
2758
+ "for(var j in jsonData.participants) {",
2759
+ " for(var k in jsonData.participants[j].accounts) {",
2760
+ " console.log(jsonData.participants[j].accounts[k].id)",
2761
+ " const participantPutRequest = {",
2762
+ " url: pm.environment.get(\"HOST_CENTRAL_SETTLEMENT\")+'/settlements/'+pm.environment.get(\"settlementId\"),",
2763
+ " method: 'PUT',",
2764
+ " header: {",
2765
+ " \"Authorization\":\"Bearer \"+pm.environment.get(\"HUB_OPERATOR_BEARER_TOKEN\"),",
2766
+ " \"FSPIOP-Source\": pm.environment.get(\"hub_operator\"),",
2767
+ " \"Content-Type\": \"application/json\"",
2768
+ " },",
2769
+ " body: {",
2770
+ " mode: 'raw',",
2771
+ " raw: JSON.stringify(",
2772
+ " {",
2773
+ " \"participants\": [",
2774
+ " {",
2775
+ " \"id\": jsonData.participants[j].id,",
2776
+ " \"accounts\": [",
2777
+ " {",
2778
+ " \"id\": jsonData.participants[j].accounts[k].id,",
2779
+ " \"reason\": \"Transfers settled for payer\",",
2780
+ " \"state\": \"SETTLED\"",
2781
+ " }",
2782
+ " ]",
2783
+ " }",
2784
+ " ]",
2785
+ " }",
2786
+ " )",
2787
+ " }",
2788
+ " };",
2789
+ " pm.sendRequest(participantPutRequest, function (err, response) {",
2790
+ " console.log(response.json());",
2791
+ " });",
2792
+ " ",
2793
+ " }",
2794
+ "}"
2795
+ ]
2796
+ },
2797
+ "preRequest": {
2798
+ "exec": [
2799
+ ""
2800
+ ]
2801
+ }
2802
+ }
2803
+ },
2804
+ {
2805
+ "id": 2,
2806
+ "description": "check state for participants after settle",
2807
+ "apiVersion": {
2808
+ "minorVersion": 0,
2809
+ "majorVersion": 1,
2810
+ "type": "settlements"
2811
+ },
2812
+ "operationPath": "/settlements/{id}",
2813
+ "path": "/settlements/{$environment.settlementId}",
2814
+ "method": "get",
2815
+ "params": {
2816
+ "id": "{$environment.settlementId}"
2817
+ },
2818
+ "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}",
2819
+ "tests": {
2820
+ "assertions": [
2821
+ {
2822
+ "id": 1,
2823
+ "description": "Status to be 200",
2824
+ "exec": [
2825
+ "expect(response.status).to.equal(200)"
2826
+ ]
2827
+ },
2828
+ {
2829
+ "id": 2,
2830
+ "description": "Settlement Id should be as expected",
2831
+ "exec": [
2832
+ "expect(response.body.id).to.equal(environment.settlementId)"
2833
+ ]
2834
+ },
2835
+ {
2836
+ "id": 3,
2837
+ "description": "Settlement state should be SETTLED",
2838
+ "exec": [
2839
+ "expect(response.body.state).to.equal(\"SETTLED\")"
2840
+ ]
2841
+ },
2842
+ {
2843
+ "id": 4,
2844
+ "description": "Settlement Window ID should be closed",
2845
+ "exec": [
2846
+ "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)"
2847
+ ]
2848
+ },
2849
+ {
2850
+ "id": 5,
2851
+ "description": "Settlement Window State should be SETTLED",
2852
+ "exec": [
2853
+ "expect(response.body.settlementWindows[0].state).to.equal(\"SETTLED\")"
2854
+ ]
2855
+ },
2856
+ {
2857
+ "id": 6,
2858
+ "description": "Participant Accounts state is SETTLED",
2859
+ "exec": [
2860
+ "response.body.participants.forEach(participant => {",
2861
+ "\tparticipant.accounts.forEach(account => {",
2862
+ " expect(account.state).to.equal(\"SETTLED\")",
2863
+ " })",
2864
+ "})"
2865
+ ]
2866
+ }
2867
+ ]
2868
+ },
2869
+ "scripts": {
2870
+ "postRequest": {
2871
+ "exec": [
2872
+ ""
2873
+ ]
2874
+ }
2875
+ }
2876
+ },
2877
+ {
2878
+ "id": 3,
2879
+ "description": "testfsp1 settlement&position accont balance after prepare",
2880
+ "apiVersion": {
2881
+ "minorVersion": 3,
2882
+ "majorVersion": 9,
2883
+ "type": "central_admin"
2884
+ },
2885
+ "operationPath": "/participants/{name}/accounts",
2886
+ "path": "/participants/testfsp1/accounts",
2887
+ "method": "get",
2888
+ "params": {
2889
+ "name": "testfsp1"
2890
+ },
2891
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2892
+ "tests": {
2893
+ "assertions": [
2894
+ {
2895
+ "id": 1,
2896
+ "description": "Status to be 200",
2897
+ "exec": [
2898
+ "expect(response.status).to.equal(200)"
2899
+ ]
2900
+ },
2901
+ {
2902
+ "id": 2,
2903
+ "description": "Testfsp1 settlement account balance before and after settle should be the same.",
2904
+ "exec": [
2905
+ "expect(environment.testfsp1SettleAccountBalanceAfterSettle).to.equal(environment.testfsp1SettleAccountBalanceAfterTransfer)"
2906
+ ]
2907
+ },
2908
+ {
2909
+ "id": 3,
2910
+ "description": "Testfsp1 position account balance before and after settle should be the same.",
2911
+ "exec": [
2912
+ "expect(environment.testfsp1PositionAccountBalanceAfterSettle).to.equal(environment.testfsp1PositionAccountBalanceBeforeTransfer)"
2913
+ ]
2914
+ }
2915
+ ]
2916
+ },
2917
+ "scripts": {
2918
+ "postRequest": {
2919
+ "exec": [
2920
+ "var jsonData = pm.response.body;",
2921
+ "for (var i in jsonData){",
2922
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2923
+ " pm.environment.set(\"testfsp1SettleAccountBalanceAfterSettle\", jsonData[i].value)",
2924
+ " }",
2925
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2926
+ " pm.environment.set(\"testfsp1PositionAccountBalanceAfterSettle\", jsonData[i].value)",
2927
+ " }",
2928
+ "}"
2929
+ ]
2930
+ }
2931
+ }
2932
+ },
2933
+ {
2934
+ "id": 4,
2935
+ "description": "testfsp2 settlement&position accont balance after settle",
2936
+ "apiVersion": {
2937
+ "minorVersion": 3,
2938
+ "majorVersion": 9,
2939
+ "type": "central_admin"
2940
+ },
2941
+ "operationPath": "/participants/{name}/accounts",
2942
+ "path": "/participants/testfsp2/accounts",
2943
+ "method": "get",
2944
+ "params": {
2945
+ "name": "testfsp2"
2946
+ },
2947
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
2948
+ "tests": {
2949
+ "assertions": [
2950
+ {
2951
+ "id": 1,
2952
+ "description": "Status to be 200",
2953
+ "exec": [
2954
+ "expect(response.status).to.equal(200)"
2955
+ ]
2956
+ },
2957
+ {
2958
+ "id": 2,
2959
+ "description": "Testfsp2 settlement account balance before and after commit should be the same.",
2960
+ "exec": [
2961
+ "expect(environment.testfsp2SettleAccountBalanceAfterSettle).to.equal(environment.testfsp2SettleAccountBalanceAfterTransfer)"
2962
+ ]
2963
+ },
2964
+ {
2965
+ "id": 3,
2966
+ "description": "Testfsp2 position account balance before and after commit should be the same.",
2967
+ "exec": [
2968
+ "expect(environment.testfsp2PositionAccountBalanceAfterSettle).to.equal(environment.testfsp2PositionAccountBalanceBeforeTransfer)"
2969
+ ]
2970
+ }
2971
+ ]
2972
+ },
2973
+ "scripts": {
2974
+ "postRequest": {
2975
+ "exec": [
2976
+ "var jsonData = pm.response.body;",
2977
+ "for (var i in jsonData){",
2978
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
2979
+ " pm.environment.set(\"testfsp2SettleAccountBalanceAfterSettle\", jsonData[i].value)",
2980
+ " }",
2981
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
2982
+ " pm.environment.set(\"testfsp2PositionAccountBalanceAfterSettle\", jsonData[i].value)",
2983
+ " }",
2984
+ "}"
2985
+ ]
2986
+ }
2987
+ }
2988
+ },
2989
+ {
2990
+ "id": 5,
2991
+ "description": "testfsp3 settlement&position accont balance after settle",
2992
+ "apiVersion": {
2993
+ "minorVersion": 3,
2994
+ "majorVersion": 9,
2995
+ "type": "central_admin"
2996
+ },
2997
+ "operationPath": "/participants/{name}/accounts",
2998
+ "path": "/participants/testfsp3/accounts",
2999
+ "method": "get",
3000
+ "params": {
3001
+ "name": "testfsp3"
3002
+ },
3003
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
3004
+ "tests": {
3005
+ "assertions": [
3006
+ {
3007
+ "id": 1,
3008
+ "description": "Status to be 200",
3009
+ "exec": [
3010
+ "expect(response.status).to.equal(200)"
3011
+ ]
3012
+ },
3013
+ {
3014
+ "id": 2,
3015
+ "description": "Testfsp3 settlement account balance before and after commit should be the same.",
3016
+ "exec": [
3017
+ "expect(environment.testfsp3SettleAccountBalanceAfterSettle).to.equal(environment.testfsp3SettleAccountBalanceAfterTransfer)"
3018
+ ]
3019
+ },
3020
+ {
3021
+ "id": 3,
3022
+ "description": "Testfsp3 position account balance before and after commit should be the same.",
3023
+ "exec": [
3024
+ "expect(environment.testfsp3PositionAccountBalanceAfterSettle).to.equal(environment.testfsp3PositionAccountBalanceBeforeTransfer)"
3025
+ ]
3026
+ }
3027
+ ]
3028
+ },
3029
+ "scripts": {
3030
+ "postRequest": {
3031
+ "exec": [
3032
+ "var jsonData = pm.response.body;",
3033
+ "for (var i in jsonData){",
3034
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
3035
+ " pm.environment.set(\"testfsp3SettleAccountBalanceAfterSettle\", jsonData[i].value)",
3036
+ " }",
3037
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
3038
+ " pm.environment.set(\"testfsp3PositionAccountBalanceAfterSettle\", jsonData[i].value)",
3039
+ " }",
3040
+ "}"
3041
+ ]
3042
+ }
3043
+ }
3044
+ },
3045
+ {
3046
+ "id": 6,
3047
+ "description": "testfsp4 settlement&position accont balance after settle",
3048
+ "apiVersion": {
3049
+ "minorVersion": 3,
3050
+ "majorVersion": 9,
3051
+ "type": "central_admin"
3052
+ },
3053
+ "operationPath": "/participants/{name}/accounts",
3054
+ "path": "/participants/testfsp4/accounts",
3055
+ "method": "get",
3056
+ "params": {
3057
+ "name": "testfsp4"
3058
+ },
3059
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
3060
+ "tests": {
3061
+ "assertions": [
3062
+ {
3063
+ "id": 1,
3064
+ "description": "Status to be 200",
3065
+ "exec": [
3066
+ "expect(response.status).to.equal(200)"
3067
+ ]
3068
+ },
3069
+ {
3070
+ "id": 2,
3071
+ "description": "Testfsp4 settlement account balance before and after commit should be the same.",
3072
+ "exec": [
3073
+ "expect(environment.testfsp4SettleAccountBalanceAfterSettle).to.equal(environment.testfsp4SettleAccountBalanceAfterTransfer)"
3074
+ ]
3075
+ },
3076
+ {
3077
+ "id": 3,
3078
+ "description": "Testfsp4 position account balance before and after commit should be the same.",
3079
+ "exec": [
3080
+ "expect(environment.testfsp4PositionAccountBalanceAfterSettle).to.equal(environment.testfsp4PositionAccountBalanceBeforeTransfer)"
3081
+ ]
3082
+ }
3083
+ ]
3084
+ },
3085
+ "scripts": {
3086
+ "postRequest": {
3087
+ "exec": [
3088
+ "var jsonData = pm.response.body;",
3089
+ "for (var i in jsonData){",
3090
+ " if(jsonData[i].ledgerAccountType === \"SETTLEMENT\") {",
3091
+ " pm.environment.set(\"testfsp4SettleAccountBalanceAfterSettle\", jsonData[i].value)",
3092
+ " }",
3093
+ " if(jsonData[i].ledgerAccountType === \"POSITION\") {",
3094
+ " pm.environment.set(\"testfsp4PositionAccountBalanceAfterSettle\", jsonData[i].value)",
3095
+ " }",
3096
+ "}"
3097
+ ]
3098
+ }
3099
+ }
3100
+ },
3101
+ {
3102
+ "id": 7,
3103
+ "description": "Hub account balance check",
3104
+ "apiVersion": {
3105
+ "minorVersion": 3,
3106
+ "majorVersion": 9,
3107
+ "type": "central_admin"
3108
+ },
3109
+ "operationPath": "/participants/{name}/accounts",
3110
+ "path": "/participants/Hub/accounts",
3111
+ "method": "get",
3112
+ "params": {
3113
+ "name": "Hub"
3114
+ },
3115
+ "url": "{$inputs.HOST_CENTRAL_LEDGER}",
3116
+ "tests": {
3117
+ "assertions": [
3118
+ {
3119
+ "id": 1,
3120
+ "description": "Status to be 200",
3121
+ "exec": [
3122
+ "expect(response.status).to.equal(200)"
3123
+ ]
3124
+ }
3125
+ ]
3126
+ },
3127
+ "scripts": {
3128
+ "postRequest": {
3129
+ "exec": [
3130
+ "console.log(pm.response.body)"
3131
+ ]
3132
+ }
3133
+ }
3134
+ }
3135
+ ]
3136
+ }
3137
+ ]
3138
+ }