Skip to content

osergioneto/expay

Repository files navigation

Expay

💰 Expay 💸

language version GitHub language count License

Project   |    How to use   |    Technologies   |    API   |    License

📋 Project

  • Simply API about money deposit, withdraw and transfer between accounts.

💻 How to use

To clone and run this application, you need Elixir and Docker/docker-compose installed on your computer. On your command line:

Clone this repository

# Enter the command below to clone the repository
$ git clone https://github.com/osergioneto/expay

Running the project

# 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.

API

All APIs requests are under /api scope.

Create user

Request

POST /users

// Body
{
	"name": "José da Silva",
	"email": "[email protected]",
	"email_confirmation": "[email protected]",
	"document_number": "66274705007",
	"password": "Kb0ySi1C",
	"password_confirmation": "Kb0ySi1C"
}

Response

{
  "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"
  }
}

Deposit

Request

POST /accounts/:account_number/deposit/:value

Response

{
  "message": "Successful deposit",
  "account": {
    "agency": "1",
    "balance": 117500,
    "number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
  }
}

Withdraw

Request

POST /accounts/:account_number/withdraw/:value

Response

{
  "message": "Successful withdraw",
  "account": {
    "agency": "1",
    "balance": 116250,
    "number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
  }
}

Transfer

Request

POST /accounts/transfer

// Body
{
	"from": "8d332da8-7f28-42be-bd17-1c511712e1b7",
	"to": "36adab94-b310-4070-b7e3-7f65e1f6bb73",
	"value": "23000"
}

Response

{
  "message": "Successful transfer",
  "transfer": {
    "from": "8d332da8-7f28-42be-bd17-1c511712e1b7",
    "to": "36adab94-b310-4070-b7e3-7f65e1f6bb73",
    "value": "133"
  }
}

Get balance

Request

GET /accounts/balance/:account_number

Response

{
  "account": {
    "agency": "1",
    "balance": 116250,
    "number": "8d332da8-7f28-42be-bd17-1c511712e1b7"
  }
}

👨‍💻 Technologies

These are the technologies used in this project

💻

📝 License

This project is under the APL 2.0 license. Check LICENSE for details.


Made by Sérgio Deusdedith 👋
🔗 Linkedin
[email protected]  

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages