Skip to content

Latest commit

 

History

History
190 lines (180 loc) · 5.59 KB

TestAccount.md

File metadata and controls

190 lines (180 loc) · 5.59 KB

Code Challenge - TEST Account API

Return to Main: [README.md] (https://github.com/luisamesty/orangebanktest/blob/master/README.md)

TEST Account API

This test has to be run on OrangeBookApp.war APP.
Account API is used for CRUD accounts.
As mentioned Account Table holds account information as Name, IBAN, initial balance and current balance.
It is the entity to validate transactions on iban code and balance.
These tests haven't been requested on the Code Challenge, but i think it was neccesary for transaction
 validation and also for me, to begin with building the APP in order to be familiarized with Test Challenge 
 Requirements. 
Test can be executed locally on Eclipse environment. 
In order to be allset, OrangeBookApp.war must be running
on Local Apache TOMCAT, and ready to accept request on:
http://localhost:8080. 
If running as a microservice on a container, IP address must be changed.

READ All Accounts

If Database is created and also the accounts initiated as mentioned before on PostgreSQL chapter, then you can read all stored accounts coming from Account.json File using InitDBTables.java program.
Actions:
POSTMAN REQUEST: GET
POSTMAN URL: http://localhost:8080/OrangeBookApp/account/
JSON Data: (Not required)
Results:
Result message: (all accounts included) 
[
    {
        "id": 1,
        "name": "Luis Amesty Linares",
        "account_iban": "ES9820385778983000760236",
        "balance": 1000.00,
        "initbalance": 1000.00
    },
    {
        "id": 2,
        "name": "Maria Auxiliadora Amesty",
        "account_iban": "ES9820385778983000760234",
        "balance": 12000.00,
        "initbalance": 12000.00
    },
    {
        "id": 3,
        "name": "Maria Alejandra Amesty",
        "account_iban": "ES9820385778983000760230",
        "balance": 10000.00,
        "initbalance": 10000.00
    },
    {
        "id": 4,
        "name": "Luis Amesty Morello",
        "account_iban": "ES9820385778983000760240",
        "balance": 8000.00,
        "initbalance": 8000.00
    },
    {
        "id": 5,
        "name": "Maria Virginia Amesty",
        "account_iban": "ES9820385778983000760238",
        "balance": 7000.00,
        "initbalance": 7000.00
    },
]

Read ONE Account (ID=4)

Read only one Account. Record number must be indicated on URL.
Actions:
POSTMAN REQUEST: GET
POSTMAN URL: http://localhost:8080/OrangeBookApp/account/4
JSON Data: (Not required)
Results:
Result message: (only Account ID = 4) 
{
    "id": 4,
    "name": "Luis Amesty Morello",
    "account_iban": "ES9820385778983000760240",
    "balance": 8000.00,
    "initbalance": 8000.00
}

INSERT ONE Account

Insert one Account TEST in this case a new account can be added to Account table. Next sequence ID is taken.
Actions:
POSTMAN REQUEST: POST
POSTMAN URL: http://localhost:8080/OrangeBookApp/account/
JSON Data: 
    {
        "name": " Haydee Amesty",
        "account_iban": "ES9820385778983000760239",
        "balance": 15500.00,
        "initbalance": 15500.00
    }
Results:
Result message: 
New Account has been saved with ID:9
Error message when IBAN is equal to an existent one:
** ERROR ** EXIST Account IBAN:ES9820385778983000760239. NO Account has been saved with ID:0

Update Account (ID=3)

Update values from a previosly created account. In this case we show account id 3 (Previos Values):
        "name": "Maria Alejandra Amesty",
        "account_iban": "ES9820385778983000760230",
        "balance": 10000.00,
        "initbalance": 10000.00
        
And will be changed to (New Values):
        "name": "Maria Alejandra Amesty",
        "account_iban": "ES9820385778983000760239",
        "balance": 12500.00,
        "initbalance": 112500.00
Actions #1:
POSTMAN REQUEST: PUT
POSTMAN URL: http://localhost:8080/OrangeBookApp/account/3
JSON Data:
{
        "id": 3,
        "name": "Maria Alejandra Amesty",
        "account_iban": "ES9820385778983000760239",
        "balance": 12500.00,
        "initbalance": 12500.00
}
Result #1:
Result messages: 
Account has been updated successfully.
Action #2:
POSTMAN REQUEST: GET
POSTMAN URL: http://localhost:8080/OrangeBookApp/account/3
JSON Data: (Not required)
Result #2:
Result messages (Observe New Updated Values): 
{
    "id": 3,
    "name": "Maria Alejandra Amesty",
    "account_iban": "ES9820385778983000760239",
    "balance": 12500.00,
    "initbalance": 12500.00
}

Delete Account (5)

Delete Account can be used to erase an account from Database.
Account has to be unused on any transaction, in order to leave data consistency.
Action #1:
POSTMAN REQUEST: DELETE
POSTMAN URL: http://localhost:8080/OrangeBookApp/account/5
JSON Data: (Not required)
Result #1:
Result messages: 
Account has been deleted successfully.
Error message when Accoount ID is not found:
** ERROR ** Account DO NOT EXIST. NO Account has been deleted with ID:8

Return to Main: README.md