Skip to content

mojaloop/thirdparty-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mojaloop Thirdparty SDK

Git Commit Git Releases CircleCI

This package provides a Thirdparty (PISP) SDK that interfaces between a Mojaloop API compliant switch and a Thirdparty backend platform that does not natively implement the Mojaloop API.

The API between the SDK and the Thirdparty backend is synchronous HTTP while the interface between the SDK and the switch is native Mojaloop Third Party API.

This package exemplifies the use of the Mojaloop SDK Standard Components for TLS, JWS and ILP and is should be use together with mojaloop/sdk-scheme-adapter

Quick Start

The steps shown below illustrate setting up the Mojaloop Thirdparty SDK locally and how to run Inbound and Outbound API services listening on localhost

  1. Clone repo
    git clone git@github.com:mojaloop/thirdparty-sdk.git
  2. Install dependencies
    npm install
  3. Start servers
    npm run start
    then visit in your web browser for outbound API http://localhost:4006/health and inbound API http://localhost:4005/health

Inbound & Outbound API

This package delivers implementation Inbound and Outbound API services which will be used by Thirdparty to integrate with Mojaloop Switch or used by a DFSP that wants to enabled Thirdparty functionality

  • TODO: Separate and rename servers, handlers and models to be broken up Thirdparty ones and DFSP ones.
  • TODO: Move models to src/domain/stateMachine
  • TODO: Add a openapi file detailing what the DFSP backend needs to implement. In some scenarios implementers will create a connector between the SDK and a DFSP's backend.

When used by a Thirdparty

Thirdparty's needs both the Outbound and Inbound service running.

Inbound API

Inbound API service is called by Mojaloop Switch. Its responsibility is to forward calls to Thirdparty Backend or help to deliver synchronous response for calls initiated by Thirdparty backend on Outbound API

Deep Dive

Inbound handlers handle receiving of requests coming from the Switch. These typically publish responses into redis for state machines to continue a flow.

Inbound models handle the processing of Switch requests but they themselves can make requests to the accomplish a certain flow the initial inbound request initiates.

Outbound API

Outbound API service is used by Thirdparty backend to make a call to Mojaloop Switch Its responsibility is to transform asynchronous Mojaloop API native interface's set of calls to a synchronous call.

Deep Dive

Outbound handlers handle receiving of requests coming only from Thirdparty. These typically kick off a flow for example Thirdparty Linking or Thirdparty transaction.

Outbound models handle the processing of Thirdparty requests but the models themselves can make requests to the accomplish a certain flow the initial outbound request initiates.

mTLS

config.OUTBOUND.TLS and config.INBOUND.TLS when used by a Thirdparty will be certificates the Thirdparty registered and got signed with the Hub.

config.OUTBOUND.TLS represents the certs needed by the thirdparty-sdk when making any requests to the switch. So even "inbound" models will be loaded with config.OUTBOUND.TLS

The certs are loaded into MojaloopRequests and ThirdpartyRequests classes of sdk-standard-components and they handle the rest.

config.INBOUND.TLS represents the certs needed by the thirdparty-sdk Hapi Inbound server.

When used by a DFSP

DFSPs need to have Inbound service running, DFSPs will need to implement a Backend API to handle backend requests from the thirdparty-sdk and configure the thirdparty-sdk to point to the DFSP's sdk-scheme-adapter.

The thirdparty-sdk works in tandem with asdk-scheme-adapter to complete transactions.

Backend OpenAPI3 file coming soon.

Inbound API

Inbound API service is called by Mojaloop Switch. Its responsibility is to forward calls to DFSP Backend or initiate flows thats provide Thirdparty's with relevant responses to accomplish Thirdparty scenarios like Linking or Transactions.

Deep Dive

Inbound handlers handle receiving of requests coming from the Switch. These typically publish responses into redis for state machines to continue a flow.

Inbound models handle the processing of Switch requests but they themselves can make requests to the accomplish a certain flow the initial inbound request initiates.

mTLS

config.OUTBOUND.TLS and config.INBOUND.TLS when used by a DFSP will be certificates the DFSP registered and got signed with the Hub.

config.OUTBOUND.TLS represents the certs needed by the thirdparty-sdk when making any requests to the switch. So even "inbound" models will be loaded with config.OUTBOUND.TLS The certs are loaded into MojaloopRequests and ThirdpartyRequests classes of sdk-standard-components and they handle the rest.

config.INBOUND.TLS represents the certs needed by the thirdparty-sdk Hapi Inbound server.

PM4ML (Payment Manager for Mojaloop) (In progress)

This project has the option of being configured to work with PM4ML which connects to MCM.

Setting pm4mlEnabled to true and configuring control.mgmtAPIWsUrl and control.mgmtAPIWsPort to a Management API service instance will connect to and listen to the Management API service for management protocol messages e.g configuration changes, certificate updates etc and restart the server with updated configuration.

Integration Test

To run integration tests, first start docker-compose in root folder

docker-compose build && docker-compose up

Finally run the following command to execute tests

npm run test:integration

Contribution

Read the contributing.md doc