Skip to content

Commit

Permalink
feat:(mojaloop/#3670): add sdk (#49)
Browse files Browse the repository at this point in the history
* add scheme adapter to compose

* add env variables

* k6 test get party inbound

* fix: fix harness running tests without sim running (#46)

* fix: increase fundsin check delay (#47)

* add outbout server k6 tests

* add outbout server k6 tests

* fix k6 tests

* add outboud server k6 transfer flow

* finish outbound server k6 tests, debug inbound ws

* finish tests

* update tests

* fix(monitoring): parametrize dashboard-quoting-service.json for prometheus (#48)

* setup new headers for sdk

* add small doc

* commit suggestions

* change sdk image version

---------

Co-authored-by: Kevin Leyow <[email protected]>
Co-authored-by: Muzammil <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2024
1 parent 8e3a87e commit 69b5189
Show file tree
Hide file tree
Showing 28 changed files with 1,291 additions and 58 deletions.
183 changes: 181 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CENTRAL_LEDGER_VERSION=v17.2.1
# CENTRAL_LEDGER_VERSION=v17.0.4-snapshot.0
## Central Ledger version with batch processing capability
CENTRAL_LEDGER_BATCH_VERSION=v17.3.0-snapshot.5

SDK_SCHEME_ADAPTER_VERSION=v23.3.0
## Testing & Sims
TEST_SIMULATOR_VERSION=v11.1.3
TEST_TTK_SVC_VERSION=v16.1.1
Expand All @@ -41,7 +41,7 @@ KAFKA_EXPORTER_VERSION=latest
CADVISER_VERSION=latest

## Load Docker Image Versions
K6_VERSION=0.45.0
K6_VERSION=0.47.0

## Performance Testing Replicas
QS_REPLICAS=1
Expand All @@ -51,3 +51,182 @@ CENTRAL_LEDGER_POSITION_REPLICAS=1
CENTRAL_LEDGER_POSITION_BATCH_REPLICAS=0
ML_API_ADAPTER_REPLICAS=1
ML_NOTIFICATION_REPLICAS=1

## ----------------------------------------------



# Port number that the inbound (Mojaloop API) HTTP server will listen on
INBOUND_LISTEN_PORT=4000

# Port number that the outbound (simplified DFSP outbound API) HTTP server will listen on
OUTBOUND_LISTEN_PORT=4001

# Enable mutual TLS authentication. Useful when not running in a secure
# environment, i.e. when you're running it locally against your own implementation.
INBOUND_MUTUAL_TLS_ENABLED=false
OUTBOUND_MUTUAL_TLS_ENABLED=false

# Enable verification or incoming JWS signatures
# Note that signatures will be required on incoming messages
# and will be validated against a public key.
VALIDATE_INBOUND_JWS=false

# applicable only if VALIDATE_INBOUND_JWS is "true"
# allows disabling of validation on incoming PUT /parties/{idType}/{idValue} requests
VALIDATE_INBOUND_PUT_PARTIES_JWS=false

# Enable signing of outgoing requests
JWS_SIGN=false
VALIDATE_JWS_SIGN=false

# applicable only if JWS_SIGN is "true"
# allows disabling of signing on outgoing PUT /parties/{idType}/{idValue} requests
JWS_SIGN_PUT_PARTIES=false

# Path to JWS signing key (private key of THIS DFSP)
JWS_SIGNING_KEY_PATH=secrets/jwsSigningKey.key
JWS_VERIFICATION_KEYS_DIRECTORY=secrets/jwsVerificationKeys

# Location of certs and key required for TLS
# IN_CA_CERT_PATH=./secrets/cacert.pem
# IN_SERVER_CERT_PATH=./secrets/servercert.pem
# IN_SERVER_KEY_PATH=./secrets/serverkey.pem

# OUT_CA_CERT_PATH=./secrets/cacert.pem
# OUT_CLIENT_CERT_PATH=./secrets/servercert.pem
# OUT_CLIENT_KEY_PATH=./secrets/serverkey.pem

# The number of space characters by which to indent pretty-printed logs. If set to zero, log events
# will each be printed on a single line.
LOG_INDENT=0

# REDIS CACHE CONNECTION
CACHE_URL=redis://redis:6379

# expiry period in seconds for quote and transfers issued by the SDK
EXPIRY_SECONDS=60

# if set to false the SDK will not automatically accept all returned quotes
# but will halt the transfer after a quote response is received. A further
# confirmation call will be required to complete the final transfer stage.
AUTO_ACCEPT_QUOTES=false

# if set to false the SDK will not automatically accept a resolved party
# but will halt the transer after a party lookup response is received. A further
# cnofirmation call will be required to progress the transfer to quotes state.
AUTO_ACCEPT_PARTY=false

# if set to false the SDK will not automatically accept a resolved party on a requestToPay operation
# but will halt the operation after a party lookup response is received. A further
# confirmation call will be required to progress the requestToPay to transactionRequest state.
AUTO_ACCEPT_R2P_PARTY=true

# This parameter is only for the requestToPay transfers when the initiator is of type BUSINESS.
# if set to false the SDK will not automatically accept quote on a requestToPayTransfer.
# but will halt the operation after a quote response is received. A further
# confirmation call will be required to progress the requestToPayTransfer to authorization step.
AUTO_ACCEPT_R2P_BUSINESS_QUOTES=false

# if set to false the SDK will not automatically accept OTP on a requestToPay operation
# but will halt the operation after receiving entered OTP from payee. A further
# confirmation call will be required to progress the requestToPayTransfer to transfer step.
AUTO_ACCEPT_R2P_DEVICE_OTP=false

# this flag is for testing purpose only. sdk-scheme-adapter is not supposed to receive PUT /participants/{Type}/{ID},
# but for testing we can enable it by setting this flag to true
AUTO_ACCEPT_PARTICIPANTS_PUT=false

# when set to true, when sending money via the outbound API, the SDK will use the value
# of FSPIOP-Source header from the received quote response as the payeeFsp value in the
# transfer prepare request body instead of the value received in the payee party lookup.
# This behaviour should be enabled when the SDK user DFSP is in a forex enabled switch
# ecosystem and expects quotes and transfers to be rerouted by the switch to forex
# entities i.e. forex providing DFSPs. Please see the SDK documentation and switch
# operator documentation for more information on forex use cases.
USE_QUOTE_SOURCE_FSP_AS_TRANSFER_PAYEE_FSP=false

# set to true to validate ILP, otherwise false to ignore ILP
CHECK_ILP=false

# set to true to enable test features such as request cacheing and retrieval endpoints
ENABLE_TEST_FEATURES=false

# set to true to mock WSO2 oauth2 token endpoint
ENABLE_OAUTH_TOKEN_ENDPOINT=false
OAUTH_TOKEN_ENDPOINT_CLIENT_KEY=test-client-key
OAUTH_TOKEN_ENDPOINT_CLIENT_SECRET=test-client-secret
OAUTH_TOKEN_ENDPOINT_LISTEN_PORT=6000

# WSO2 Bearer Token specific to golden-fsp instance and environment
WSO2_BEARER_TOKEN=7718fa9b-be13-3fe7-87f0-a12cf1628168

# OAuth2 data used to obtain WSO2 bearer token
OAUTH_TOKEN_ENDPOINT=
OAUTH_CLIENT_KEY=
OAUTH_CLIENT_SECRET=
OAUTH_REFRESH_SECONDS=3600

# Set to true to respect expirity timestamps
REJECT_EXPIRED_QUOTE_RESPONSES=false
REJECT_TRANSFERS_ON_EXPIRED_QUOTES=false
REJECT_EXPIRED_TRANSFER_FULFILS=false

# Timeout for GET/POST/DELETE - PUT flow processing
REQUEST_PROCESSING_TIMEOUT_SECONDS=4

# Common Account Lookup System (ALS)
# ALS_ENDPOINT=ttkhubsim:4040

# # QUOTES_ENDPOINT
# QUOTES_ENDPOINT=ttkhubsim:4040

# # TRANSFERS_ENDPOINT
# TRANSFERS_ENDPOINT=ttkhubsim:4040

# To allow transfer without a previous quote request, set this value to true.
# The incoming transfer request should consists of an ILP packet and a matching condition in this case.
# The fulfilment will be generated from the provided ILP packet, and must hash to the provided condition.
ALLOW_TRANSFER_WITHOUT_QUOTE=false

# To enable request for notification on fulfiled transfer
RESERVE_NOTIFICATION=true
# resources API versions should be string in format: "resourceOneName=1.0,resourceTwoName=1.1"
RESOURCE_VERSIONS="transfers=1.1,participants=1.1"

# Management API websocket connection settings.
# The Management API uses this for exchanging connector management messages.
MGMT_API_WS_URL=mock-management-svc
MGMT_API_WS_PORT=4005

# Set to true to enable the use of PM4ML-related services e.g MCM, Management API service
# when running the scheme-adapter as a mojaloop connector component within Payment Manager for Mojaloop.
PM4ML_ENABLED=false

BACKEND_EVENT_CONSUMER_BROKER_LIST=kafka:29092
BACKEND_EVENT_PRODUCER_BROKER_LIST=kafka:29092
FSPIOP_EVENT_CONSUMER_BROKER_LIST=kafka:29092
FSPIOP_EVENT_PRODUCER_BROKER_LIST=kafka:29092

# Maximum payload limits
FSPIOP_API_SERVER_MAX_REQUEST_BYTES=209715200
BACKEND_API_SERVER_MAX_REQUEST_BYTES=209715200

ENABLE_FSPIOP_EVENT_HANDLER=false
ENABLE_BACKEND_EVENT_HANDLER=false

# Port number that the inbound (Mojaloop API) HTTP server will listen on
INBOUND_LISTEN_PORT=4000

# Port number that the outbound (simplified DFSP outbound API) HTTP server will listen on
OUTBOUND_LISTEN_PORT=4001

# ---- SDK Config ----
# The option 'PEER_ENDPOINT' has no effect if the remaining options 'ALS_ENDPOINT', 'QUOTES_ENDPOINT',
# 'BULK_QUOTES_ENDPOINT', 'TRANSFERS_ENDPOINT', 'BULK_TRANSFERS_ENDPOINT', 'TRANSACTION_REQUESTS_ENDPOINT' are specified.
# ALS_ENDPOINT=callback-handler-svc-cl-sim:3001/backend
# QUOTES_ENDPOINT=callback-handler-svc-cl-sim:3001/backend
# BULK_QUOTES_ENDPOINT=callback-handler-svc-cl-sim:3001/backend
# TRANSFERS_ENDPOINT=callback-handler-svc-cl-sim:3001/backend
# BULK_TRANSFERS_ENDPOINT=callback-handler-svc-cl-sim:3001/backend
# TRANSACTION_REQUESTS_ENDPOINT=callback-handler-svc-cl-sim:3001/backend
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,27 @@ docker compose --project-name ml-core -f docker-compose-perf.yml --profile all-s

> NOTE: `-v` argument is optional, and it will delete any volume data created by the monitoring docker compose
### Running Services for SDK characterization

```bash
docker compose --project-name ml-core -f docker-compose-perf.yml --profile sdk-scheme-adapter up -d
```

Stop Services

```bash
docker compose --project-name ml-core -f docker-compose-perf.yml --profile sdk-scheme-adapter down -v
```

#### Setting up the Inbound/Outbound Server variables
- Go to `perf.env` and comment out the inboundSDK variables. You'll need to do the same and restart the `docker-compose` in order to change test suite.

### Configuration for Transfers with batch support
- Set CENTRAL_LEDGER_POSITION_BATCH_REPLICAS to desired count in `.env` file
- Enable line `CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__PREPARE=topic-transfer-position-batch` in `perf.env` file
- Set `CENTRAL_LEDGER_VERSION` to `v17.2.0` or higher


### Monitoring

Start Monitoring Services stack which uses:
Expand Down Expand Up @@ -339,6 +355,12 @@ env K6_SCRIPT_CONFIG_FILE_NAME=fspiopDiscovery.json docker compose --project-nam
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopQuotes.json docker compose --project-name load -f docker-compose-load.yml up
( or )
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopE2E.json docker compose --project-name load -f docker-compose-load.yml up
( or )
env K6_SCRIPT_CONFIG_FILE_NAME=inboundSDKDiscovery.json docker compose --project-name load -f docker-compose-load.yml up
( or )
env K6_SCRIPT_CONFIG_FILE_NAME=inboundSDKQuotes.json docker compose --project-name load -f docker-compose-load.yml up
( or )
env K6_SCRIPT_CONFIG_FILE_NAME=inboundSDKTransfer.json docker compose --project-name load -f docker-compose-load.yml up
```

Cleanup tests
Expand Down
Loading

0 comments on commit 69b5189

Please sign in to comment.