Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/calvinlfer/wallet-api

An implementation of an API for wallet built using Akka (HTTP, Cluster Sharding, Event Sourcing) and ZIO
https://github.com/calvinlfer/wallet-api

akka scala zio

Last synced: 9 days ago
JSON representation

An implementation of an API for wallet built using Akka (HTTP, Cluster Sharding, Event Sourcing) and ZIO

Awesome Lists containing this project

README

        

## Wallet API

An implementation of a Wallet API built on Akka Typed making using of event sourcing (using the JDBC plugin) and
distributed by Akka Cluster Sharding.

Deposits and Withdrawals follow a fee structure (the more money in your account, the cheaper it becomes to transact).
The amount of money generated by fees is calculated via a Persistence Query but is not currently exposed but can be
accessed by querying the `processor` table.

### Running the application
1. Make sure to spin up Postgres via `docker-compose up -d`
2. Run the application using IntelliJ, Visual Studio Code + Metals or just `sbt run`

### Postman
A Postman collection is included for easy testing in the `postman` folder

### Operations

#### Create
`POST /wallets`
```json
{
"id": "abc"
}
```

#### Deposit
`POST /wallets//deposit`
```json
{
"amount": 2000
}
```

#### Withdraw
`POST /wallets//withdraw`
```json
{
"amount": 2000
}
```

#### Query Deposit Fee
`POST /wallets//depositFee`
```json
{
"amount": 2000
}
```

#### Query Withdraw Fee
`POST /wallets//withdrawFee`
```json
{
"amount": 2000
}
```

#### Immediate history
`GET /wallets/abc/history/immediate`

#### All history
`GET /wallets/abc/history/all`