Skip to content

This project simulates a fake bank with an in memory database which the end user can use to interact with the system. It is a complete standalone project which can be a micro service in a bigger project. A Swagger API documentation is also available. It also uses github actions.

Notifications You must be signed in to change notification settings

syedumerahmedcode/simple-fake-bank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-fake-bank

Table of content

Introduction

This project contains an application which can be used to:

  • Create a new bank account with an initial deposit for a customer.
    • A single customer may have multiple accounts.
  • Transfer amounts between two accounts, including those owned by different customers.
  • Retrieve balance for a given account.
  • Retrieve transaction history for a given account.

Technologies Used

  • Java 11
  • SpringBoot: Used to create easy stand-alone, production-grade Spring based Applications.
  • H2 database engine: Embedded relational database
  • Maven: Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
  • Swagger: Swagger is an Interface Description Language for describing RESTful APIs expressed using JSON. Swagger is used together with a set of open-source software tools to design, build, document, and use RESTful web services. Swagger includes automated documentation, code generation, and test-case generation.
  • Git Actions: GitHub Actions helps automate tasks within the software development life cycle. GitHub Actions are event-driven, meaning that you can run a series of commands after a specified event has occurred. They happen directly on the Github repo itself.

Swagger

Following are the available endpoints

  1. POST http://localhost:8080/v1/accounts Creates a new account

Input:

{
"initial_amount": 0,
"user_id": 0
}

Output:

{
  "body": {},
  "statusCode": "ACCEPTED",
  "statusCodeValue": 0
}
  1. GET http://localhost:8080/v1/accounts/{id} Retrieves the account balance

Output:

{
  "account_id": 0,
  "balance": 0,
  "created_at": "2021-04-01T17:26:40.264Z"
}
  1. POST http://localhost:8080/v1/operations Creates a transfer between accounts

Input:

{
  "receiver_account_id": 0,
  "sender_account_id": 0,
  "value": 0
}

Output:

{
  "body": {},
  "statusCode": "ACCEPTED",
  "statusCodeValue": 0
}
  1. GET http://localhost:8080/v1/operations/fromAccount/{accountId} Get the history of operations for the provided account Id.

Output:

{
  "account_id": 0,
  "created_at": "2021-04-01T17:29:13.493Z",
  "operations": [
    {
      "created_at": "2021-04-01T17:29:13.493Z",
      "operation_id": 0,
      "receiver_account_id": 0,
      "sender_account_id": 0,
      "value": 0
    }
  ]
}

Commands

To compile and test, please execute

mvn clean install

To run the application, please execute

mvn spring-boot:run

API Documentation

In order to read the API documentation in Swagger, please first start the application and the visit API Documentation in Swagger

Github Actions

To ensure the correctness of the code committed, github action for 'building the java project using Maven' is used. This ensures that all tests are green and the projects runs correctly on Windows, MacOS and Linux systems.

Contribution

Feature requests, issues, pull requests and questions are welcome.

Contact Information

How to reach me? At github specific gmail account. Original idea for this project came from Joao Carlos Sousa do Vale

About

This project simulates a fake bank with an in memory database which the end user can use to interact with the system. It is a complete standalone project which can be a micro service in a bigger project. A Swagger API documentation is also available. It also uses github actions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages