Backend of banking card management application.
The runtime environment contains packages:
- Java SE 21 development and runtime platform;
- Docker containerization platform;
- Apache Maven build tool.
All commands are run in the terminal from the project folder Bank_REST/.
No initial setup is required.
The project is built using the shell command:
mvn clean packageUpon successful build, the results will be located in the folder target/
To run the package, execute the following commands in the project folder:
docker compose --project-directory ./docker/ up --detachUpon successful package startup, docker will run 2 containers cards-microservice, postgres-container in the Up status.
The package functionality is accessed via the URL:
<METHOD> http://localhost:8081/api/<endpoint>
Where <endpoint> represents a specific API resource.
Depending on the chosen <METHOD>, the package will initiate corresponding command.
A detailed API description is available at:
GET http://localhost:8081/swagger-ui/index.html
The package uses JWT-based authentication. To obtain a token, send a request to:
POST http://localhost:8081/api/login
This authentication endpoint expects input data as a JSON object in the following format:
{
"email": "<email address>",
"password": "<password>"
}Upon successful authentication, the access_token will be returned in the response body.
Using this token, and based on the roles assigned during registration, the user will have access to the users, cards, and transfers resources.
- The command to register a new user is invoked using the HTTP
POSTmethod. The command expects input data as an object in the followingJSONnotation:
{
"email": "<email address>",
"password": "<password>",
"roles": ["role1","..."]
}Successful execution of this command results in the creation of a user account.
- The command to delete a user is invoked using the HTTP
DELETEmethod. The command expects input data as the following request parameters:
email = <email address>Successful execution of this command ensures that the user account no longer exists.
- The command to update a user record is invoked using the HTTP
PUTmethod. The command expects input data as an object in the followingJSONnotation:
{
"email": "<email address>",
"password": "<password>",
"roles": ["role1","..."]
}Successful execution of this command results in the update of the user account.
- The command to retrieve a list of users is invoked using the HTTP
GETmethod. The command expects input data as the following request parameters:
email = [email address]
offset = [search result offset]
limit = [search result page size]Successful execution of this command returns a list of users that matches the criteria specified in the request body.
- The command to create a bank card is invoked using the HTTP
POSTmethod. The command expects input data as an object in the followingJSONnotation:
{
"pan": "<#### #### ##### ####>",
"expire_date": "[yyyy-MM-dd]",
"email": "<email address>",
"status": "[card status]",
"balance": "[card balance]"
}Successful execution of this command results in the creation of a bank card record.
- The command to retrieve a list of bank cards is invoked using the HTTP
GETmethod. The command expects input data as the following request parameters:
offset = [search result offset]
limit = [search result page size]Successful execution of this command returns a list of session user banking cards.
- The command to update bank card details is invoked using the HTTP
PUTmethod. The command expects input data as an object in the followingJSONnotation:
{
"pan": "<#### #### ##### ####>",
"expire_date": "[yyyy-MM-dd]",
"status": "[card status]",
"balance": "[card balance]"
}Successful execution of this command results in the update of the bank card record based on the existing Primary Account Number.
- The command to block a bank card is invoked using the HTTP
PATCHmethod. The command expects input data as an object in the followingJSONnotation:
{
"pan": "<#### #### ##### ####>"
}Successful execution of this command results in a change to the bank card status based on the existing Primary Account Number.
- The command to delete a bank card is invoked using the HTTP
DELETEmethod. The command expects input data as the following request parameters:
pan = <#### #### ##### ####>Successful execution of this command results in the deletion of the bank card record based on the existing Primary Account Number.
- The command to transfer funds is invoked using the HTTP
POSTmethod. The command expects input data as the following request parameters:
origin = <#### #### #### ####>
destination = = <#### #### #### ####>
amount = <number>Successful execution of this command results in the creation of a transaction record and the adjustment of card balances for the current session user.
- The command of reissuing access token is invoked using the HTTP
POSTmethod. Prior of using this resource user has to have active session. Successful execution of this command results in refreshing the expiry date of user access_token.