Skip to content

Latest commit

 

History

History
144 lines (137 loc) · 4.52 KB

TestAccountTransaction.md

File metadata and controls

144 lines (137 loc) · 4.52 KB

Code Challenge - TEST Account Transaction API

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

TEST Account Transaction API

Account Transaction API is used for inserting and validating transactions.
As mentioned Account Transaction Table holds transaction information as Date,
Reference, IBAN, Amount, Fee and Status.
It is the entity to validate transactions.
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.

ASUMPTIONS

FEES are not well defined, if they are positive or negative.
Payload process is for registering Deducting and Addition transactions.
I am asumming:
- FEES: 
FEES are Allways, positive values and amount is deducted from balance.
- Payload logic: 
Transaction is recorded and Amount plus and fee value considered.
Amount is positive: (Positive Amount value) - (fee) is added.
Amount is negative: (Positive Amount value) + (fee) value is deducted.

READ All Account Transactions

If Iyou previously execute the java program with the transactions in the Transaccion.json file, the validated transactions can be read.

Actions:
POSTMAN REQUEST: GET
POSTMAN URL: http://localhost:8080/OrangeBookApp/transaction/get/
JSON Data: (Not required)
Results:
Result message: 
[
    {
        "id": 17,
        "account_iban": "ES9820385778983000760236",
        "treference": "12345A",
        "trfecha": "2019-07-16T16:55:42.000Z",
        "tramount": -493.37,
        "trfee": 1.00,
        "trdescription": "Restaurant payment",
        "trstatus": "OK",
        "trchannel": "CLIENT"
    },
    {
        "id": 18,
        "account_iban": "ES9820385778983000760236",
        "treference": "12345B",
        "trfecha": "2019-07-16T18:55:42.000Z",
        "tramount": -893.37,
        "trfee": 1.14,
        "trdescription": "Dept Store payment",
        "trstatus": "OK",
        "trchannel": "CLIENT"
    },
    {
        "id": 19,
        "account_iban": "ES9820385778983000760236",
        "treference": "12346A",
        "trfecha": "2019-07-16T19:55:42.000Z",
        "tramount": -1193.38,
        "trfee": 2.00,
        "trdescription": "Restaurant payment",
        "trstatus": "OK",
        "trchannel": "CLIENT"
    }
]

Create Account Transaction

Using Postman. 
In Sample Data base init only few account transaction were created. 
So additional transactions can be tested.
Actions:
POSTMAN REQUEST: POST
POSTMAN URL: http://localhost:8080/OrangeBookApp/transaction/add
SETTINGS: Body - Raw - JSON (application/json)
JSON Data:
 {
	"reference":"912345678910",
	"account_iban": "ES9820385778983000760234",
	"fecha":"2019-07-16T19:58:42.000Z",
	"amount":-500.38,
	"fee":2.00,
	"description":"Dept Store payment"
}
Results:
Result message:
 New Account Transaction has been saved with ID:1 Status:OK
Result message with Same reference:
 ** ERROR Account Transaction not SAVED *** Status:** TRANSACTION ERROR REFERENCE EXISTS ** REF:912345678910
Result message with Wrong Account:
 ** ERROR Account Transaction not SAVED *** Status:** TRANSACTION ERROR ACOUNT INVALID** REF:912345678910 IBAN:ES9820385778983000760234-9
Result message from Account:
    {
        "id": 2,
        "name": "Maria Auxiliadora Amesty",
        "account_iban": "ES9820385778983000760234",
        "balance": 11497.62,
        "initbalance": 12000.00
    },
The new balance is 11497.62 = 12,000.00 - 500.38 - 2.00

Read ONE Account Transaction(ID=176)

Retrieves one register giving the ID key.

Actions:
POSTMAN REQUEST: GET
POSTMAN URL: http://localhost:8080/OrangeBookApp/transaction/get/1
JSON Data: (Not required)
Result:
Result message: 
{
    "id": 1,
    "account_iban": "ES9820385778983000760234",
    "treference": "912345678910",
    "trfecha": null,
    "tramount": -500.38,
    "trfee": 2.00,
    "trdescription": "Dept Store payment",
    "trstatus": "OK",
    "trchannel": null
}

Return to Main: README.md