This assessments aims to provide a purchase and exchange transactions platform utilizing Treasury Reporting Rates of Exchange API. The application returns, after consuming Rates of Exchange API, the amount of Dollar in the transaction converted to a desired currency.
https://fiscaldata.treasury.gov/datasets/treasury-reporting-rates-exchange/treasury-reporting-rates-of-exchange
- Clone the repository
- Move into repository folder
- Build and start the application using Docker Compose
docker compose up
This will build and up two containers one containing Postgres and another containing the application artifact.
- The application will be exposed at the following address
http://localhost:8080/transaction
- Create a purchase:
http://localhost:8080/transaction/purchase - Body:
{"amount":100.00, "description":"desc up to 50 char","transactionDate": "2024-12-19"} - Retrieve a purchase:
http://localhost:8080/transaction/retrieve/{{purchase uuid}} - Retrieve a purchase in a desired currency
http://localhost:8080/transaction/retrieve?id={{purchase uuid}}¤cy={{desired currency (i.e. Real}}- You can check the currencies supported in this link.
The application contains integration and unit tests using H2 Database, MockMvc and Mockito. You can run all the tests using your favorite IDE (i.e. IntelliJ) or run
- Windows
.\gradlew.bat clean test --info
- Linux or Mac
./gradlew clean test --info