dvdscripter / go-bank-transfer

Simple API for banking routines using a Clean Architecture in Golang. :credit_card: :moneybag: :money_with_wings:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to Go Bank Transfer 🏦

Version License: MIT Build

  • Go Bank Transfer is a simple API for some banking routines, such as creating accounts, listing accounts, listing balance for a specific account, transfers between accounts and listing transfers.

Architecture

Clean Architecture

Requirements/dependencies

  • Golang (not obligatory)
  • Docker
  • Docker-compose

Getting Started

  • Environment variables
make init
  • Starting API
make up
  • Run tests in container (it is necessary to have the application started)
make test-container
  • Run tests local (it is necessary to have golang installed)
make test
  • View logs
make logs
  • Enter in container
make enter-container

API Request

Endpoint HTTP Method Description
/api/accounts POST Create accounts
/api/accounts GET List accounts
/api/accounts/{{account_id}}/balance GET Find balance account
/api/transfers POST Create transfer
/api/transfers GET List transfers

Test endpoints API using Postman

Run in Postman

Test endpoints API using curl

  • Creating new account
curl -i --request POST 'http://localhost:3001/api/accounts' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Test",
    "cpf": "070.910.584-24",
    "balance": 1.00
}'
  • Listing accounts
curl -i --request GET 'http://localhost:3001/api/accounts'
  • Fetching account balance
curl -i --request GET 'http://localhost:3001/api/accounts/{{account_id}}/balance'
  • Creating new transfer
curl -i --request POST 'http://localhost:3001/api/transfers' \
--header 'Content-Type: application/json' \
--data-raw '{
	"account_destination_id": "{{account_id}}",
	"account_origin_id": "{{account_id}}",
	"amount": 1.00
}'
  • Listing transfers
curl -i --request GET 'http://localhost:3001/api/transfers'

Git workflow

  • Gitflow

Code status

  • Development

Author

License

Copyright © 2020 GSabadini.
This project is MIT licensed.

About

Simple API for banking routines using a Clean Architecture in Golang. :credit_card: :moneybag: :money_with_wings:

License:MIT License


Languages

Language:Go 98.4%Language:Makefile 0.9%Language:Dockerfile 0.4%Language:JavaScript 0.3%