REST API for calculating commission for transactions made by a given bank customer. Includes a sample data set
- Kotlin
- Gradle
- Spring Boot
- MongoDB
- Java 17
- Docker
-
Create
.env
file with environment variables (they can contain any string value):REST_API_USERNAME
REST_API_PASSWORD
MONGO_USERNAME
MONGO_PASSWORD
-
Make sure
JAVA_HOME
environment variable points to Java 17
- Run docker compose file:
docker compose up
- Build application:
.\gradlew build
- Run application:
java -jar build/libs/restApi-0.0.1-SNAPSHOT.jar
- App is available at:
http://localhost:8080
Run:
.\gradlew test
Endpoint api
provided with a key customer_id
allows you to search for a commission data of users in a few ways:
- by entering an identification number ranging from 1 to 5 (e.g. "2"),
- by entering several identification numbers separated by a comma (e.g. "1, 5"),
- by entering the string "ALL" or an empty string to search for commission data of all users.
GET request:
http://localhost:8080/api?customer_id=3
Response body:
{
"First name": "Adam",
"Last name": "Adamowski",
"Customer ID": 3,
"Number of transactions": 4,
"Total value of transactions": "134.47",
"Transactions fee value": "6.82",
"Last transaction date": "29.12.2020 21:00:03"
}
- App uses stateless basic authentication
- Each request is logged to local MongoDB database and each log contains the client's ID, the amount of the commission and the date of commission calculation.