IBM Blue Academy | NullBank

IBM Blue Academy Java Spring

Topics

Curriculum

The curriculum will touch on the following subjects:

  • Java
  • Spring Boot
  • Microservices
  • Unit tests
  • Rest APIs
  • Among others

Go to topics

NullBank

NullBank was born as a project for Gama Academy's Java Web Development course sponsored by IBM.

The object is to highlight the theoretical knowledge acquired in classes turning it into something substantial and practical.

Along with this project, it will be necessary to accomplish some activities to attest the acquired knowledge. The activities must strictly follow the statement.

Go to topics

Mission

NullBank is the bank made by and for developers. It's possible to manage all your financial life with it.

It's possible to open current and saving accounts, do transfers, and much more!

Go to topics

Activities

The features required for approval are:

  • Registering clients
  • Listing clients
  • Cash transfer between accounts
  • Transaction history

Go to topics

Endpoints

Below are all the available endpoints.

Create Agency

Endpoint to create an agency

Endoint:

POST /agencies

Request:

{
    "agencyName": "Central Agency",
    "agencyNumber": "0001"
}

Response:

{
    "agencyName": "Central Agency",
    "agencyNumber": "0001"
}

Go to topics

New Client

Endoint for creating a client.

Endpoint:

POST /clients

Request:

{
    "name": "Client 01",
    "address": "Address 01",
    "cpf": "606.344.610-95",
    "salary": "500.0"
}

Response:

{
    "id": 2,
    "name": "Client 01"
}

Go to topics

Open Account

Endpoint for opening an account after creating a client.

Endpoint:

POST /accounts

Request:

{
    "cpf": "606.344.610-95",
    "agencyNumber": "0001",
    "accountType": "CURRENT_ACCOUNT"
}

Response:

{
    "agencyNumber": "0001",
    "agencyName": "Central Agency",
    "accountHolderName": "Client 01",
    "accountHolderId": 1,
    "accountNumber": "0000256938",
    "currentBalance": 0
}

Go to topics

Deposit

Endpoint for depositing to an account.

Endpoint:

POST /accounts/{ACCOUNT_NUMBER}/deposit

Request:

{
    "amount": 1000
}

Response:

{
    "agencyNumber": "0001",
    "agencyName": "Central Agency",
    "accountHolderName": "Client 01",
    "accountHolderId": 1,
    "accountNumber": "0000256938",
    "currentBalance": 1000.00
}

Go to topics

Cash Transfer

Endpoint for transfering cash between accounts.

Endpoints:

POST /accounts/{ORIGIN_ACCOUNT_NUMBER}/transfer-to/{DESTINATION_ACCOUNT_NUMBER}

Request:

{
    "amount": 1000
}

Response:

{
    "originAccountNumber": "0001664535",
    "destinationAccountNumber": "0001076192",
    "transferredAmount": 1000,
    "currentBalance": 0.00
}

Go to topics

Transaction History

Endpoint for getting the transaction history.

Endpoint:

GET /accounts/{{ACCOUNT_NUMBER}}/history

Response:

{
    "accountNumber": "0001664535",
    "history": [
        {
            "amount": 1000.00,
            "description": "Deposit to account 0001664535"
        },
        {
            "amount": 1000.00,
            "description": "Transfer to account 0001076192"
        }
    ]
}

Go to topics

List All Clients

Endpoint for listing clients.

Endpoint:

GET /clients

Response:

{
    "data": [
        {
            "id": 1,
            "name": "Client 01"
        }
    ]
}

Go to topics

Find Account

Endpoint for finding account by account number.

Endpoint:

GET /accounts/{ACCOUNT_NUMBER}

Response:

{
    "agencyNumber": "0001",
    "agencyName": "Central Agency",
    "accountHolderName": "Client 01",
    "accountHolderId": 1,
    "accountNumber": "0001664535",
    "currentBalance": 0.00
}

Go to topics

Withdrawal

Endpoint for withdrawal.

Endpoint:

POST /accounts/{ACCOUNT_NUMBER}/withdraw

Request:

{
    "amount": 1000
}

Response:

{
    "agencyNumber": "0001",
    "agencyName": "Central Agency",
    "accountHolderName": "Client 01",
    "accountHolderId": 1,
    "accountNumber": "0001664535",
    "currentBalance": -1000.00
}

Go to topics

List All Accounts

Endpoint for listing the available accounts.

Endpoint:

GET /accounts

Response:

{
    "data": [
        {
            "agencyNumber": "0001",
            "agencyName": "Central Agency",
            "accountHolderName": "Client 01",
            "accountHolderId": 1,
            "accountNumber": "0001076192",
            "currentBalance": 2000.00
        },
        {
            "agencyNumber": "0001",
            "agencyName": "Central Agency",
            "accountHolderName": "Client 01",
            "accountHolderId": 1,
            "accountNumber": "0001664535",
            "currentBalance": -1000.00
        }
    ]
}

Go to topics

SonarQube

SonarQube is a tool for Code Static Analysis. For configuration, it's necessary to create a file called settings.xml in ~/.m2 folder.

File: ~/.m2/settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
     </profiles>
</settings>
  1. For running this tool, you need to run the following Docker command:
docker run --name sonarqube -p 9000:9000 sonarqube:lts-community
  1. Open the web browser and go to http://localhost:9000. The following image will open:

Login

  1. Type in admin for user and password.

  2. In the top right side, click in the green button with an A.

Green Button

  1. Select My account and click on Security Tab.

Security Tab

  1. Then, generate a token.

Generate Token

  1. Type the following command:
mvn clean install sonar:sonar -D sonar.projectKey=nullbank  -D sonar.host.url=http://localhost:9000 -D sonar.login=<your token>
  1. In the top left side, go to Projects -> Your Project.

Your Projects

Our current coverage is:

Code Coverage

Go to topics