Simple wallet microservice. It exposes endpoints for reading the account balance, debit transaction, credit transaction and for transactions history.
- Players can only use one currency.
- Neither authorization nor authentication is provided.
- Simplify process by merging DTO with Entity.
To run tests simply run command: mvn test
mvn spring-boot:run
- exposes application on http://localhost:8080
- documentation on http://localhost:8080/swagger-ui.html
- Tests - Of course there could be more unit tests and e2e tests
- Refactor - maybe with hexagonal architecture. Then Business logic would be inside domain module, player and transactions would be two separate adapters, transactions could be stored in different db, and controllers would be in rest module for communicating and documenting API.
- Concurrency - application at this moment is not truly concurrent. There could be an issue with account balance lower than 0 when user provides two or more withdrawals at the same time. Probably lock on db per player transaction should be fine
- Scalability - application is scalable - just run new one on different port and setup load balancer
- Atomicity - application could be divided into more microservices: the one for creating player, one for handling transactions, one for transactions history (which could provide some stats etc.)
- Idempotency - there are few idempotent endpoints:
- getAllPlayerTransactions,
- getPlayer,
- getBalance
- Production - to be production ready we should take care about the points above and set up a build process which should check if every dependency is not vulnerable (dependency-check), code is well written (sonarQube), and deploy. Maybe there should be also some logs. To deploy application on Kubernetes we need to containerize it and provide actuator endpoints.
- Commands to run and more description and instruction