https://github.com/kovstas/money-transfer
Money Transfer API demo app
https://github.com/kovstas/money-transfer
akka-http h2 rest-api slick
Last synced: 8 months ago
JSON representation
Money Transfer API demo app
- Host: GitHub
- URL: https://github.com/kovstas/money-transfer
- Owner: kovstas
- Created: 2017-08-15T08:04:48.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T08:25:42.000Z (almost 9 years ago)
- Last Synced: 2025-06-09T07:56:13.098Z (about 1 year ago)
- Topics: akka-http, h2, rest-api, slick
- Language: Scala
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# About
Test project RESTful API for money transfers between internal users and accounts
[](https://travis-ci.org/PepRoll/money-transfer)
The application using:
* akka-http
* slick
* H2 in memory database
#### Run
`sbt run` - The app start server on localhost port 8080.
An H2 initialized with several exchange rates.
#### Test
`sbt test` - Start all tests.
# Available Services
API root URL: [http://localhost:8080/api/](http://localhost:8080/api/)
#### User resource ( [/api/users](http://localhost:8080/api/users) )
| HTTP METHOD | PATH | USAGE |
| ------------- |:-------------|:-----|
| GET | /users | get all users |
| GET | /users/{userId} | get user by id |
| POST | /users/ | create a new user |
| PUT | /users/{userId} | update user |
| DELETE | /users/{userId} | remove user |
| GET | /users/{userId}/accounts | get all accounts by user id |
| GET | /users/{userId}/accounts/{accountId} | get account by id with filter by user id |
| GET | /users/{userId}/accounts/{accountId}/transfers | get all transfers with filer by user and account ids |
| GET | /users/{userId}/accounts/{accountId}/transfers/{transferId} | get transfer by id with filter by user and account |
| GET | /users/{userId}/accounts/{accountId}/transfers/{transferId}/rate | get rate by transfer id with filter by user and account |
#### Account resource ( [/api/accounts](http://localhost:8080/api/accounts) )
| HTTP METHOD | PATH | USAGE |
| ------------- |:-------------|:-----|
| GET | /accounts | get all accounts |
| GET | /accounts/{accountId} | get account by id |
| POST | /accounts/ | create a new account |
| PUT | /accounts/ | update account |
| DELETE | /accounts/{accountId} | remove account |
| GET | /accounts/{accountId}/transfers | get all transfers by account id |
| GET | /accounts/{accountId}/transfers/{transferId} | get transfer by id with filter by account id |
| GET | /accounts/{accountId}/transfers/{transferId}/rate | get rate by transfer id with filter by account id |
#### Transfer resource ( [/api/transfers](http://localhost:8080/api/transfers) )
| HTTP METHOD | PATH | USAGE |
| ------------- |:-------------|:-----|
| GET | /transfers | get all transfers |
| GET | /transfers/{transferId} | get transfer by id |
| POST | /transfers/ | create a new transfer |
| GET | /transfers/{transferId}/rate | get rate by transfer id |
#### Rate resource ( [/api/rates](http://localhost:8080/api/rates) )
| HTTP METHOD | PATH | USAGE |
| ------------- |:-------------|:-----|
| GET | /rates | get all rates |
| GET | /rates/{rateId} | get rate by id |
| POST | /rates/ | create a new rate |
| PUT | /rates/ | update rate |
| DELETE | /rates/{rateId} | remove rate |
## Sample JSON
Currency values: `RUB | USD | EUR`
##### User
```json
{
"firstName": "Harrison",
"lastName": "Ford"
}
```
##### Account
```json
{
"currency": "USD",
"balance": 10000,
"userId": 1
}
```
##### Transfer
```json
{
"sourceAccount": 1,
"targetAccount": 2,
"amount": 200,
"exchangeRateId": 2
}
```
##### Rate
```json
{
"sourceCurrency": "RUB",
"targetCurrency": "USD",
"exchangeRate": 30
}
```