Project | How to use | Technologies | API | License
- Simply API about money deposit, withdraw and transfer between accounts.
To clone and run this application, you need Elixir and Docker/docker-compose installed on your computer. On your command line:
# Enter the command below to clone the repository
$ git clone https://github.com/osergioneto/expay
# Install dependencies with
mix deps.get
# Run docker container with database
docker-compose up -d
# Create and migrate your database with
mix ecto.setup
# Start Phoenix endpoint with
mix phx.server
Now you can visit localhost:4000
from your browser.
All APIs requests are under /api
scope.
POST /users
// Body
{
"name": "José da Silva",
"email": "[email protected]",
"email_confirmation": "[email protected]",
"document_number": "66274705007",
"password": "Kb0ySi1C",
"password_confirmation": "Kb0ySi1C"
}
{
"message": "User created",
"user": {
"account": {
"agency": "1",
"balance": 100000,
"number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
},
"email": "[email protected]",
"id": "145678f6-672b-4994-8fb2-4d716144afb2",
"name": "José da Silva"
}
}
POST /accounts/:account_number/deposit/:value
{
"message": "Successful deposit",
"account": {
"agency": "1",
"balance": 117500,
"number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
}
}
POST /accounts/:account_number/withdraw/:value
{
"message": "Successful withdraw",
"account": {
"agency": "1",
"balance": 116250,
"number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
}
}
POST /accounts/transfer
// Body
{
"from": "8d332da8-7f28-42be-bd17-1c511712e1b7",
"to": "36adab94-b310-4070-b7e3-7f65e1f6bb73",
"value": "23000"
}
{
"message": "Successful transfer",
"transfer": {
"from": "8d332da8-7f28-42be-bd17-1c511712e1b7",
"to": "36adab94-b310-4070-b7e3-7f65e1f6bb73",
"value": "133"
}
}
GET /accounts/balance/:account_number
{
"account": {
"agency": "1",
"balance": 116250,
"number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
}
}
These are the technologies used in this project
💻
This project is under the APL 2.0 license. Check LICENSE for details.
Made by Sérgio Deusdedith 👋
🔗 Linkedin
✉ [email protected]