- Run below to start the microservice:
For Linux:
./gradlew run
For Windows:
gradlew.bat run
-
Application starts at 8082 port.
-
You also need to get BankAccountManager and start that too (that starts at 8081 port): https://github.com/nijatismayilzada/bank-account-manager
- 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
- Gradle
- Jersey REST Api
- Embedded Jetty container
- Hk2 Dependency management
- H2 in-memory non-persistent database
- Embedded ActiveMQ broker messaging
- JUnit & Mockito for testing