Skip to content

Commit

Permalink
Bugfix/some corrections to scheme adapter docs (#149)
Browse files Browse the repository at this point in the history
* Corrections to the scheme adapter documentation

* Changed the postman file location in scheme adapter docs

* Fixed typos
  • Loading branch information
vijayg10 authored Dec 11, 2019
1 parent b2e9b1e commit 6c2ca92
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,47 +33,51 @@ 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
```

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.
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
```

Expand All @@ -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": {
Expand Down

0 comments on commit 6c2ca92

Please sign in to comment.