Skip to content

Commit 7d0bf17

Browse files
Merge pull request pauldragoslav#1 from Nayananga/main
Add support for new APIs
2 parents bc89362 + 450b270 commit 7d0bf17

23 files changed

+490
-34
lines changed

Banking.postman_collection.json

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"info": {
3-
"_postman_id": "527d1a6d-ae07-4484-947b-e7f5501c1c6b",
3+
"_postman_id": "485cda16-0d43-4aa6-ac55-116fb41d8f17",
44
"name": "Banking",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
77
"item": [
88
{
9-
"name": "Account Balance",
9+
"name": "Create Account",
1010
"request": {
11-
"method": "POST",
11+
"method": "PUT",
1212
"header": [
1313
{
1414
"key": "Content-Type",
@@ -19,7 +19,7 @@
1919
],
2020
"body": {
2121
"mode": "raw",
22-
"raw": "{\n\t\"sortCode\": \"53-68-92\",\n\t\"accountNumber\": \"73084635\"\n}\n\n"
22+
"raw": "{\n\t\"bankName\": \"Bank of Ceyloan\",\n\t\"ownerName\": \"Nayananga Muhandiram\"\n}\n"
2323
},
2424
"url": {
2525
"raw": "localhost:8080/api/v1/accounts",
@@ -66,6 +66,99 @@
6666
}
6767
},
6868
"response": []
69+
},
70+
{
71+
"name": "Check Balance",
72+
"request": {
73+
"method": "POST",
74+
"header": [
75+
{
76+
"key": "Content-Type",
77+
"name": "Content-Type",
78+
"value": "application/json",
79+
"type": "text"
80+
}
81+
],
82+
"body": {
83+
"mode": "raw",
84+
"raw": "{\n\t\"sortCode\": \"35-16-67\",\n\t\"accountNumber\": \"95753174\"\n}\n"
85+
},
86+
"url": {
87+
"raw": "localhost:8080/api/v1/accounts",
88+
"host": [
89+
"localhost"
90+
],
91+
"port": "8080",
92+
"path": [
93+
"api",
94+
"v1",
95+
"accounts"
96+
]
97+
}
98+
},
99+
"response": []
100+
},
101+
{
102+
"name": "Withdraw",
103+
"request": {
104+
"method": "POST",
105+
"header": [
106+
{
107+
"key": "Content-Type",
108+
"name": "Content-Type",
109+
"type": "text",
110+
"value": "application/json"
111+
}
112+
],
113+
"body": {
114+
"mode": "raw",
115+
"raw": "{\n\t\"sortCode\": \"35-16-67\",\n\t\"accountNumber\": \"95753174\",\n \"amount\": 100.00\n}\n"
116+
},
117+
"url": {
118+
"raw": "localhost:8080/api/v1/withdraw",
119+
"host": [
120+
"localhost"
121+
],
122+
"port": "8080",
123+
"path": [
124+
"api",
125+
"v1",
126+
"withdraw"
127+
]
128+
}
129+
},
130+
"response": []
131+
},
132+
{
133+
"name": "Deposit",
134+
"request": {
135+
"method": "POST",
136+
"header": [
137+
{
138+
"key": "Content-Type",
139+
"name": "Content-Type",
140+
"type": "text",
141+
"value": "application/json"
142+
}
143+
],
144+
"body": {
145+
"mode": "raw",
146+
"raw": "{\n\t\"targetAccountNo\": \"95753174\",\n \"amount\": 1000.00\n}\n"
147+
},
148+
"url": {
149+
"raw": "localhost:8080/api/v1/deposit",
150+
"host": [
151+
"localhost"
152+
],
153+
"port": "8080",
154+
"path": [
155+
"api",
156+
"v1",
157+
"deposit"
158+
]
159+
}
160+
},
161+
"response": []
69162
}
70163
]
71164
}

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,53 @@ Example project demonstrating the use of Java and Spring-boot to build a microse
33

44
## Running locally
55
```
6-
./mvnw clean package
6+
./mvnw clean install -DskipTests=true
7+
```
8+
9+
```
710
java -jar target/Banking-0.0.1.jar
811
```
912

1013
## Running on Docker
1114
```
1215
docker build -t "spring-boot:banking" .
16+
```
17+
18+
```
1319
docker run -p 8080:8080 spring-boot:banking
1420
```
1521

1622
## Testing
17-
1. Import the Postman collection file into the application or copy the request body from there
23+
Import the Postman collection file into the application or copy the request body from there
24+
25+
### How to test
26+
1. Create account
27+
> Use create account API to create an account by providing a `bankName` and `ownerName`
28+
>
29+
![Create Account](screenshots/create_account.png)
30+
31+
> Make sure to write down the `sortCode` and the `accountNumber` to proceed with other APIs
32+
33+
2. Deposit Cash
34+
>Use noted `accountNumber` as `targetAccountNo` and provide amount greater than zero to deposit cash into an account
35+
36+
![Deposit cash](screenshots/deposit.png)
37+
38+
3. Check Balance
39+
>Use noted `accountNumber` and `sortCode` to check account balance
40+
41+
![Check Balance](screenshots/check_balance.png)
42+
43+
4. Withdraw Cash
44+
>Use noted `accountNumber` and `sortCode` and `amount` grater than zero to withdraw cash from an account
45+
46+
![Withdraw cash](screenshots/withdraw.png)
47+
48+
5. Check Balance again to verify withdrawal
49+
50+
![Check Balance](screenshots/check_balance_2.png)
51+
52+
1853

1954
### Extensions
2055
1. Use of persisted database

mvnw

100644100755
File mode changed.

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
<artifactId>spring-boot-starter-web</artifactId>
3333
</dependency>
3434

35+
<dependency>
36+
<groupId>com.github.mifmif</groupId>
37+
<artifactId>generex</artifactId>
38+
<version>1.0.2</version>
39+
</dependency>
3540
<dependency>
3641
<groupId>com.h2database</groupId>
3742
<artifactId>h2</artifactId>

screenshots/check_balance.png

118 KB
Loading

screenshots/check_balance_2.png

118 KB
Loading

screenshots/create_account.png

117 KB
Loading

screenshots/deposit.png

102 KB
Loading

screenshots/withdraw.png

104 KB
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.example.paul.constants;
2+
3+
public enum ACTION {
4+
DEPOSIT,
5+
WITHDRAW
6+
}

0 commit comments

Comments
 (0)