8000 GitHub - nijatismayilzada/bank-transaction-manager: Bank Transaction Manager for event-based, non-spring bank transaction management microservice
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nijatismayilzada/bank-transaction-manager

Repository files navigation

BankTransactionManager

Setup

  • Run below to start the microservice:

For Linux:

./gradlew run

For Windows:

gradlew.bat run

Rest API

  • Create new user named "Nijat":

This returns created user id -> 1

curl --request POST --url http://localhost:8081/users/create --header 'Content-Type: application/json' --data '{"name":"Nijat"}'

 

  • Create new GBP account for user id 1 ("Nijat" user):

This returns created account id -> 1

curl --request POST --url http://localhost:8081/users/accounts/create --header 'Content-Type: application/json' --data '{"userId" : 1,"currency" : "GBP"}'

 

  • Create new simple payment transaction for account id 1 to increase balance by 10 pounds:

This returns created transaction id -> 1

curl --request POST --url http://localhost:8082/transactions/create --header 'Content-Type: application/json' --data '{"accountId":1,"reference" : "SomeBankPayment","transactionType":"SIMPLE_INCREASE","amount":10.00,"currency":"GBP"}'

 

  • Get the details of transaction 1 to learn its status:
curl --request GET --url http://localhost:8082/transactions/transaction-id/1

 

  • Get the details of user 1 with its account to learn the balance:
curl --request GET  --url http://localhost:8081/users/user-id/1 

 

  • You can create new simple payment transaction for account id 1 to decrease balance by 2 pounds:

This returns created transaction id -> 2

curl --request POST --url http://localhost:8082/transactions/create --header 'Content-Type: application/json' --data '{"accountId":1,"reference" : "SomeBankPayment","transactionType":"SIMPLE_DECREASE","amount":2.00,"currency":"GBP"}'

 

  • Create another GBP account for user id 1 ("Nijat" user):

This returns newly created account id -> 2

curl --request POST --url http://localhost:8081/users/accounts/create --header 'Content-Type: application/json' --data '{"userId" : 1,"currency" : "GBP"}'

 

  • Create new transfer transaction for moving 3 pounds from account 1 to account 2:

This returns created transaction id -> 3

curl --request POST --url http://localhost:8082/transactions/create --header 'Content-Type: application/json' --data '{"accountId":1,"reference" : "2","transactionType":"TRANSFER","amount":3.00,"currency":"GBP"}'

 

  • Get the details of all transactions for account 1 and 2 to view overall account:
curl --request GET --url http://localhost:8082/transactions/account-id/1
curl --request GET --url http://localhost:8082/transactions/account-id/2

 

  • Check the details of user 1 with all of its accounts to learn the balances:
curl --request
6BC1
 GET  --url http://localhost:8081/users/user-id/1 

 

Some underlying technologies

  • Gradle
  • Jersey REST Api
  • Embedded Jetty container
  • Hk2 Dependency management
  • H2 in-memory non-persistent database
  • Embedded ActiveMQ broker messaging
  • JUnit & Mockito for testing

How it works

Create user

Image of architecture

Create account

Image of architecture

Simple transaction

Image of architecture

Transfer transaction

Image of architecture

About

Bank Transaction Manager for event-based, non-spring bank transaction management microservice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0