From 6c2ca92c0e3571857fa602a6b28b2a91ce4cf000 Mon Sep 17 00:00:00 2001 From: vijayg10 <33152110+vijayg10@users.noreply.github.com> Date: Thu, 12 Dec 2019 00:45:01 +0530 Subject: [PATCH] Bugfix/some corrections to scheme adapter docs (#149) * Corrections to the scheme adapter documentation * Changed the postman file location in scheme adapter docs * Fixed typos --- .../scheme-adapter-and-local-k8s/README.md | 133 ++++++++++++----- ...op-Local.postman_environment_modified.json | 0 ...chemeAdapter-Setup.postman_collection.json | 0 .../README.md | 138 +++++++++--------- 4 files changed, 169 insertions(+), 102 deletions(-) rename mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/{ => assets}/postman_files/Mojaloop-Local.postman_environment_modified.json (100%) rename mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/{ => assets}/postman_files/OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json (100%) diff --git a/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/README.md b/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/README.md index f8de61c38..eaed3022b 100644 --- a/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/README.md +++ b/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/README.md @@ -15,7 +15,8 @@ A detailed documentation for dfsps who want to test the mojaloop cluster deploym ### Mojaloop Local K8S cluster deployment Please follow the below link to deploy your own cluster on local system. https://mojaloop.io/documentation/deployment-guide/ -MacOS is recommended and atleast 16GB Ram and 4 core processor is required. + +A Linux based operating system is recommended and at least 16GB Ram and 4 core processor is required. After installation please complete the New FSP Onboarding collection available at the below link. https://github.com/mojaloop/postman @@ -32,31 +33,32 @@ https://github.com/mojaloop/sdk-mock-dfsp-backend Edit the docker-compose.yml file and verify the following lines. ``` - version: '3' - services: - redis2: - image: "redis:5.0.4-alpine" - container_name: redis2 - backend: - image: "mojaloop/sdk-mock-dfsp-backend" - env_file: ./backend.env - container_name: dfsp_mock_backend2 - ports: - - "23000:3000" - depends_on: - - scheme-adapter2 - - scheme-adapter2: - image: "mojaloop/sdk-scheme-adapter:latest" - env_file: ./scheme-adapter.env - container_name: sa_sim2 - depends_on: - - redis2 +version: '3' +services: + redis2: + image: "redis:5.0.4-alpine" + container_name: redis2 + backend: + image: "mojaloop/sdk-mock-dfsp-backend" + env_file: ./backend.env + container_name: dfsp_mock_backend2 + ports: + - "23000:3000" + depends_on: + - scheme-adapter2 + + scheme-adapter2: + image: "mojaloop/sdk-scheme-adapter:latest" + env_file: ./scheme-adapter.env + container_name: sa_sim2 + ports: + - "4000:4000" + depends_on: + - redis2 ``` -Edit the sim-backend.env file and change the OUTBOUND_ENDPOINT and DFSP_ID as below +Edit the backend.env file and change the OUTBOUND_ENDPOINT value ``` -DFSP_ID=safsp OUTBOUND_ENDPOINT=http://sa_sim2:4001 ``` @@ -64,15 +66,18 @@ Edit scheme-adapter.env and change the following lines Please replace the endpoint values with the appropriate hostnames provided in /etc/hosts file. ``` - DFSP_ID=safsp - CACHE_HOST=redis2 - ALS_ENDPOINT=account-lookup-service.local - QUOTES_ENDPOINT=quoting-service.local - TRANSFERS_ENDPOINT=ml-api-adapter.local - BACKEND_ENDPOINT=dfsp_mock_backend2:3000 - AUTO_ACCEPT_PARTY=true - AUTO_ACCEPT_QUOTES=true - +DFSP_ID=safsp +CACHE_HOST=redis2 +ALS_ENDPOINT=account-lookup-service.local +QUOTES_ENDPOINT=quoting-service.local +TRANSFERS_ENDPOINT=ml-api-adapter.local +BACKEND_ENDPOINT=dfsp_mock_backend2:3000 +AUTO_ACCEPT_PARTY=true +AUTO_ACCEPT_QUOTES=true +VALIDATE_INBOUND_JWS=false +VALIDATE_INBOUND_PUT_PARTIES_JWS=false +JWS_SIGN=true +JWS_SIGN_PUT_PARTIES=true ``` Start the backend and scheme adapter using the following command. @@ -84,20 +89,74 @@ docker-compose up -d ## Testing -### Additinal postman collections -Use the files "Mojaloop-Local.postman_environment_modified.json" and "OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json" from postman repo. -https://github.com/mojaloop/postman +### Additional postman collections +Download the following files +* [Mojaloop-Local.postman_environment_modified.json](assets/postman_files/Mojaloop-Local.postman_environment_modified.json) +* [OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json](assets/postman_files/OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json) + +Point the following hostnames to your local machine IP by adding the below line in /etc/hosts file +``` +192.168.5.101 ml-api-adapter.local account-lookup-service.local central-ledger.local central-settlement.local account-lookup-service-admin.local quoting-service.local moja-simulator.local central-ledger central-settlement ml-api-adapter account-lookup-service account-lookup-service-admin quoting-service simulator host.docker.internal moja-account-lookup-mysql +``` -Change URLs in the environment file to your machine IP where applicable. By selecting the environment file please run the custom collection in the postman to provision a new FSP called "safsp". The endpoints for safsp will be set to the URL of the scheme adapter which is configured in environment file. +### Add the target MSISDN to payee simulator which is running inside the K8S. Run the following commands +``` +curl -X POST \ + http://moja-simulator.local/payeefsp/parties/MSISDN/27713803912 \ + -H 'Accept: */*' \ + -H 'Accept-Encoding: gzip, deflate' \ + -H 'Cache-Control: no-cache' \ + -H 'Connection: keep-alive' \ + -H 'Content-Length: 406' \ + -H 'Content-Type: application/json' \ + -H 'Host: moja-simulator.local' \ + -H 'User-Agent: PostmanRuntime/7.20.1' \ + -H 'cache-control: no-cache' \ + -d '{ + "party": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": "27713803912", + "fspId": "payeefsp" + }, + "name": "Siabelo Maroka", + "personalInfo": { + "complexName": { + "firstName": "Siabelo", + "lastName": "Maroka" + }, + "dateOfBirth": "1974-01-01" + } + } +}' + +curl -X POST \ + http://account-lookup-service.local/participants/MSISDN/27713803912 \ + -H 'Accept: application/vnd.interoperability.participants+json;version=1' \ + -H 'Connection: keep-alive' \ + -H 'Content-Length: 50' \ + -H 'Content-Type: application/vnd.interoperability.participants+json;version=1.0' \ + -H 'Date: Fri, 21 Dec 2018 12:17:01 GMT' \ + -H 'FSPIOP-Source: payeefsp' \ + -H 'Host: account-lookup-service.local' \ + -H 'User-Agent: PostmanRuntime/7.11.0' \ + -H 'accept-encoding: gzip, deflate' \ + -H 'cache-control: no-cache,no-cache' \ + -d '{ + "fspId": "payeefsp", + "currency": "USD" +}' +``` + ### Try to send money Try to send funds from "safsp" (Mock DFSP) to a MSISDN which is in "payeedfsp" (Simulator in K8S) through scheme adapter. Run the following curl command to issue command to Mock DFSP service. ``` curl -X POST \ - http://localhost:3000/send \ + http://localhost:23000/send \ -H 'Content-Type: application/json' \ -d '{ "from": { diff --git a/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/postman_files/Mojaloop-Local.postman_environment_modified.json b/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/assets/postman_files/Mojaloop-Local.postman_environment_modified.json similarity index 100% rename from mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/postman_files/Mojaloop-Local.postman_environment_modified.json rename to mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/assets/postman_files/Mojaloop-Local.postman_environment_modified.json diff --git a/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/postman_files/OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json b/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/assets/postman_files/OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json similarity index 100% rename from mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/postman_files/OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json rename to mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-and-local-k8s/assets/postman_files/OSS-Custom-FSP-Onboaring-SchemeAdapter-Setup.postman_collection.json diff --git a/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-to-scheme-adapter/README.md b/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-to-scheme-adapter/README.md index cbf5a2e0c..b34595858 100644 --- a/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-to-scheme-adapter/README.md +++ b/mojaloop-technical-overview/sdk-scheme-adapter/usage/scheme-adapter-to-scheme-adapter/README.md @@ -22,51 +22,55 @@ git clone https://github.com/mojaloop/mojaloop-simulator.git ``` * Edit the file src/docker-compose.yml and add the container names for all the containers. Please refer the following lines - ``` - version: '3' - services: - redis1: - image: "redis:5.0.4-alpine" - container_name: redis1 - sim: - image: "mojaloop-simulator-backend" - build: ../ - env_file: ./sim-backend.env - container_name: ml_sim1 - ports: - - "13000:3000" - - "3001:3001" - - "3003:3003" - depends_on: - - scheme-adapter - scheme-adapter: - image: "mojaloop/sdk-scheme-adapter:latest" - env_file: ./scheme-adapter.env - container_name: sa_sim1 - ports: - - "13500:3000" - - "14000:4000" - depends_on: - - redis1 - ``` +``` +version: '3' +services: + redis1: + image: "redis:5.0.4-alpine" + container_name: redis1 + sim: + image: "mojaloop-simulator-backend" + build: ../ + env_file: ./sim-backend.env + container_name: ml_sim1 + ports: + - "13000:3000" + - "3001:3001" + - "3003:3003" + depends_on: + - scheme-adapter + scheme-adapter: + image: "mojaloop/sdk-scheme-adapter:latest" + env_file: ./scheme-adapter.env + container_name: sa_sim1 + ports: + - "13500:3000" + - "14000:4000" + depends_on: + - redis1 +``` * Edit the file src/sim-backend.env file and change the container name of the scheme adapter in that. Please refer the following lines. - ``` - OUTBOUND_ENDPOINT=http://sa_sim1:4001 - ``` +``` +OUTBOUND_ENDPOINT=http://sa_sim1:4001 +``` * Edit the file src/scheme-adapter.env file and change the container names of the another scheme adapter and mojaloop simulator. Please refer the following lines - ``` - DFSP_ID=payeefsp - CACHE_HOST=redis1 - PEER_ENDPOINT=sa_sim2:4000 - BACKEND_ENDPOINT=ml_sim1:3000 - AUTO_ACCEPT_PARTY=true - AUTO_ACCEPT_QUOTES=true +``` +DFSP_ID=payeefsp +CACHE_HOST=redis1 +PEER_ENDPOINT=sa_sim2:4000 +BACKEND_ENDPOINT=ml_sim1:3000 +AUTO_ACCEPT_PARTY=true +AUTO_ACCEPT_QUOTES=true +VALIDATE_INBOUND_JWS=false +VALIDATE_INBOUND_PUT_PARTIES_JWS=false +JWS_SIGN=true +JWS_SIGN_PUT_PARTIES=true - ``` +``` Then try running the following command to run the services ``` @@ -100,35 +104,39 @@ git clone https://github.com/mojaloop/sdk-mock-dfsp-backend.git Edit the files src/docker-compose.yml, src/backend.env and src/scheme-adapter.env and add the container names for all the containers. Please refer the following files. docker-compose.yml ``` - version: '3' - services: - redis2: - image: "redis:5.0.4-alpine" - container_name: redis2 - backend: - image: "mojaloop/sdk-mock-dfsp-backend" - env_file: ./backend.env - container_name: dfsp_mock_backend2 - ports: - - "23000:3000" - depends_on: - - scheme-adapter2 - - scheme-adapter2: - image: "mojaloop/sdk-scheme-adapter:latest" - env_file: ./scheme-adapter.env - container_name: sa_sim2 - depends_on: - - redis2 +version: '3' +services: + redis2: + image: "redis:5.0.4-alpine" + container_name: redis2 + backend: + image: "mojaloop/sdk-mock-dfsp-backend" + env_file: ./backend.env + container_name: dfsp_mock_backend2 + ports: + - "23000:3000" + depends_on: + - scheme-adapter2 + + scheme-adapter2: + image: "mojaloop/sdk-scheme-adapter:latest" + env_file: ./scheme-adapter.env + container_name: sa_sim2 + depends_on: + - redis2 ``` scheme-adapter.env ``` - DFSP_ID=payerfsp - CACHE_HOST=redis2 - PEER_ENDPOINT=sa_sim1:4000 - BACKEND_ENDPOINT=dfsp_mock_backend2:3000 - AUTO_ACCEPT_PARTY=true - AUTO_ACCEPT_QUOTES=true +DFSP_ID=payerfsp +CACHE_HOST=redis2 +PEER_ENDPOINT=sa_sim1:4000 +BACKEND_ENDPOINT=dfsp_mock_backend2:3000 +AUTO_ACCEPT_PARTY=true +AUTO_ACCEPT_QUOTES=true +VALIDATE_INBOUND_JWS=false +VALIDATE_INBOUND_PUT_PARTIES_JWS=false +JWS_SIGN=true +JWS_SIGN_PUT_PARTIES=true ``` @@ -148,7 +156,7 @@ Try to send funds from "payerfsp" (Mock DFSP) to a MSISDN which is in "payeefsp" Run the following curl command to issue command to Mock DFSP service. ``` curl -X POST \ - http://localhost:3000/send \ + http://localhost:23000/send \ -H 'Content-Type: application/json' \ -d '{ "from": {