A SpringBoot REST server that receives trade requests, performs enrichment using SSI reference data, and returns market settlement messages.
Made by Neil 😄
This README.md
consists of the instructions to get the application up and running.
For more information on the below topics, please refer to the /docs
folder:
- Approaches and assumptions
- Design choices
- Testing approaches and coverage
- Others (Validations, Exception handling, Logging, Coding Practices)
For the purpose of the project, .env
and all required configuration files would have been included in the zip file.
Before you can set up and run the Settlements Enrichment Service application, make sure you have the following installed on your machine:
-
Docker
- Ensure that Docker is installed and running on your machine. You can download and install Docker from here.
-
Environment Variables
- Create an
.env
file in the root directory of the project, refer to.env.example
. This should be already included in the zip folder.
- Create an
-
Make
- Typically available on Unix-like operating systems, including macOS and Linux
- For windows you will need to run
choco install make
- This is optional if you want to run the project using manual commands, required if you want to run quick commands
using the
Makefile
provided
-
Make sure docker is running on your machine
-
You can either use make or docker-compose directly to build and run the application:
make run
or
docker-compose -f compose.dev.yaml up --build -d settlements-enrichment-service postgres
-
Once the containers are up and running, refer to
Using the service
section below.
- To run the application locally, you will need these additionally:
- IntelliJ IDEA (or any other Java IDE)
- Java Development Kit (JDK) 17
- Verify the installation by running the following command in your terminal:
java -version
- Open the SettlementsEnrichmentServiceApplication class.
- Right-click on the class and select Run 'SettlementsEnrichmentServiceApplication'
- The application should start, and you should see logs in the run window.
Once the containers have started, here are some references for you to explore:
- Access the API documentation at:
http://localhost:8080/swagger-ui/v1.html
- Use the postman collection to test endpoints and make
requests:
settlements_enrichment_service.postman_collection.json
- Run tests - 3 options
make test
docker-compose -f compose.dev.yaml run --rm tests
- Run it locally via the IDE (e.g. IntelliJ)
- Get test coverage report (It has good coverage!):
View coverage report in browser:
mvn clean test mvn jacoco:report
http://localhost:63342/settlements-enrichment-service/target/site/jacoco/index.html
Once the server starts, execute the below commands to test the application out
GET
curl -X GET "http://localhost:8080/api/v1/market-settlement-messages/16846548" -H "Content-Type: application/json"
CREATE
curl --location 'localhost:8080/api/v1/market-settlement-messages' \
--header 'Content-Type: application/json' \
--data '{
"TradeId": "16846548",
"SSI Code": "OCBC_DBS_1",
"Amount": 12894.65,
"Currency": "USD",
"Value Date": "20022020"
}'
./mvnw: not found
- This should not be a concern when running directly from the unzipped project file. This error occurs when using
windows, and cloning the repository. Make sure that the line ending of
the mvnw is LF, when you clone the repository, git for Windows may change the line
endings to CRLF. This can be resolved by running
git config --global core.autocrlf input
before cloning.
Docker commands are stuck during execution
- Restart docker