GithubHelp home page GithubHelp logo

bank_laravel's Introduction

Bank API Documentation

Overview

This API provides functionalities for basic banking operations, such as depositing and withdrawing funds, managing bank accounts, and generating transaction reports. The API is built using Laravel and adheres to RESTful principles.

Authentication

The API uses Laravel Sanctum for authentication. To access protected routes, users must be authenticated by providing a valid token.

Authentication Routes

  • POST /v1/login
    Logs in a user and returns an authentication token.

  • POST /v1/register
    Registers a new user.

  • GET /v1/authenticated
    Confirms if the user is authenticated.

Routes

1. Companies

  • POST /v1/companies
    Creates a new company.
    Requires Authentication: Yes

2. Bank Accounts

  • POST /v1/bank_accounts
    Creates a new bank account for a client or company.
    Requires Authentication: Yes

  • GET /v1/bank_accounts/{bank_account}
    Retrieves the balance of the specified bank account.
    Requires Authentication: Yes

3. Transactions

  • POST /v1/transactions/{bank_account}
    Creates a new transaction (deposit or withdrawal) for the specified bank account. It requires to send the amount, and the type ('ADD' or 'SUBTRACT')

    Requires Authentication: Yes

  • GET /v1/transactions/recent/{bank_account}
    Lists the most recent transactions for the specified bank account.
    Requires Authentication: Yes

4. Reports

  • GET /v1/reports/clients-filtered-transactions-by-month
    Retrieves a report of client transactions filtered by month.
    Requires Authentication: Yes

  • GET /v1/reports/transactions-filtered-by-10k-and-city
    Retrieves a report of transactions filtered by amounts greater than 10k and city.
    Requires Authentication: Yes

  • GET /v1/reports/bank_accounts.balance.annual/{bank_account}
    Retrieves the annual balance report for the specified bank account.
    Requires Authentication: Yes

Error Handling

The API returns standard HTTP status codes to indicate the success or failure of an API request. For example:

  • 200 OK: The request was successful.
  • 401 Unauthorized: The request requires user authentication.
  • 404 Not Found: The requested resource could not be found.
  • 500 Internal Server Error: An error occurred on the server.

Example Requests

Register a New User

curl -X POST 'https://your-api-url/api/v1/register' \
-H 'Content-Type: application/json' \
-d '{
  "name": "John Doe",
  "email": "[email protected]",
  "password": "password"
}'

Authenticate a User

curl -X POST 'https://your-api-url/api/v1/login' \
-H 'Content-Type: application/json' \
-d '{
  "email": "[email protected]",
  "password": "password"
}'

Create a New Bank Account

For a Client Bank Account

curl -X POST 'https://your-api-url/api/v1/bank_accounts' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json' \
-d '{
  "account_name": "Main Account",
  "owner_id"": 1,
  "initial_balance": 1000,
  "city": "New York"
}'

For a Company Bank Account

curl -X POST 'https://your-api-url/api/v1/bank_accounts' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json' \
-d '{
  "company_id": 1,
  "account_name": "Main Account",
  "initial_balance": 1000,
  "city": "New York"
}'

Get Account Balance

curl -X GET 'https://your-api-url/api/v1/bank_accounts/{bank_account}' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json'

Create a New Transaction (Deposit/Withdrawal) (types: ADD, SUBTRACT)

curl -X POST 'https://your-api-url/api/v1/transactions/{bank_account}' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json' \
-d '{
"type": "ADD",
"amount": 500,
"city": "London"
}'

List Recent Transactions

curl -X GET 'https://your-api-url/api/v1/transactions/recent/{bank_account}' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json'

Get Clients Filtered Transactions by Month Report

curl -X GET 'https://your-api-url/api/v1/reports/clients-filtered-transactions-by-month' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json'

Get Transactions Filtered by 10k and City Report

curl -X GET 'https://your-api-url/api/v1/reports/transactions-filtered-by-10k-and-city' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json'

Get Annual Balance Report for Bank Account

curl -X GET 'https://your-api-url/api/v1/reports/bank_accounts.balance.annual/{bank_account}' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json'

Conclusion

This API provides a set of endpoints to manage bank accounts, perform transactions, and generate reports. Ensure that all requests are properly authenticated where required. For further assistance, please refer to the full API documentation or contact support.

bank_laravel's People

Contributors

hreluz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.