Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mfvanek/money-transfer-rest-api
Simple implementation of RESTful API for money transfers between accounts
https://github.com/mfvanek/money-transfer-rest-api
concurrency http-client java java-11 junit5 lombok maven money-transfer rest-api restful-api sparkjava
Last synced: about 2 months ago
JSON representation
Simple implementation of RESTful API for money transfers between accounts
- Host: GitHub
- URL: https://github.com/mfvanek/money-transfer-rest-api
- Owner: mfvanek
- License: mit
- Archived: true
- Created: 2018-12-23T14:04:36.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-29T08:09:12.000Z (3 months ago)
- Last Synced: 2024-09-26T01:40:19.228Z (about 2 months ago)
- Topics: concurrency, http-client, java, java-11, junit5, lombok, maven, money-transfer, rest-api, restful-api, sparkjava
- Language: Java
- Homepage:
- Size: 192 KB
- Stars: 19
- Watchers: 3
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple implementation of RESTful API for money transfers between accounts.
[![Java CI](https://github.com/mfvanek/money-transfer-rest-api/actions/workflows/tests.yml/badge.svg)](https://github.com/mfvanek/money-transfer-rest-api/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/mfvanek/money-transfer-rest-api/branch/master/graph/badge.svg?token=M07PR66QAP)](https://codecov.io/gh/mfvanek/money-transfer-rest-api)## Important
1. Should be rewritten for using of JAXRS
2. Replace **Hand-written in-memory data storage** with H2 or Embedded PostgreSQL
3. Add Swagger for API documentation## Task
Design and implement a RESTful API (including data model and the backing implementation) for money transfers between accounts.### Explicit requirements:
1. You can use Java, Scala or Kotlin.
2. Keep it simple and to the point (e.g. no need to implement any authentication).
3. Assume the API is invoked by multiple systems and services on behalf of end users.
4. You can use frameworks/libraries if you like (except Spring), but don't forget about requirement #2 – keep it simple and avoid heavy frameworks.
5. The datastore should run in-memory for the sake of this test.
6. The final result should be executable as a standalone program (should not require a pre-installed container/server).
7. Demonstrate with tests that the API works as expected.## Technology stack
- Java 11
- [Maven](https://maven.apache.org/)
- [Spark Framework](http://sparkjava.com) (with embedded Jetty)
- [Logback](https://logback.qos.ch)
- [Lombok](https://projectlombok.org)
- [google/gson](https://github.com/google/gson)
- **Hand-written in-memory data storage using concurrency utilities**
- [JUnit 5](https://junit.org/junit5/)
- [Apache HttpClient](https://hc.apache.org/index.html) (for unit testing)## How to run
```shell
java -jar "./rest-api-app/target/rest-api-app-1.3.0.jar"
```## Available services
- GET [http://localhost:9999/parties?limit=10](http://localhost:9999/parties?limit=10)
- GET [http://localhost:9999/parties/1](http://localhost:9999/parties/1)
- GET [http://localhost:9999/parties/1/accounts](http://localhost:9999/parties/1/accounts)
- GET [http://localhost:9999/accounts?limit=10](http://localhost:9999/accounts?limit=10)
- GET [http://localhost:9999/accounts/1](http://localhost:9999/accounts/1)
- GET [http://localhost:9999/accounts/1/transactions?limit=100](http://localhost:9999/accounts/1/transactions?limit=100)
- GET [http://localhost:9999/transactions?limit=100](http://localhost:9999/transactions?limit=100)
- GET [http://localhost:9999/transactions/1](http://localhost:9999/transactions/1)
- POST [http://localhost:9999/transactions](http://localhost:9999/transactions)### Pagination
- [http://localhost:9999/parties?limit=10](http://localhost:9999/parties?limit=10)
- [http://localhost:9999/parties?page=2&limit=20](http://localhost:9999/parties?page=2&limit=20)
- [http://localhost:9999/accounts/1/transactions?limit=100](http://localhost:9999/accounts/1/transactions?limit=100)## Http status
- 200 OK
- 400 Bad request
- 404 Not found## Notes
- Using Russian bank accounts
- Decided to ignore topics of **currency conversions** and **multi-currency operations**