@@ -37,6 +37,9 @@ public Bid placeBid(User user, String itemId, double amount) {
3737 Map <String , Object > body = new LinkedHashMap <>();
3838 body .put ("itemId" , itemId );
3939 body .put ("bidAmount" , amount );
40+ if (user .isBanned ()) {
41+ throw new InvalidBidException ("Your account is banned. You cannot place bids." );
42+ }
4043 try {
4144 String response = http .post ("/bids" , http .getGson ().toJson (body ));
4245 Map <String , Object > map = http .getGson ().fromJson (response , MAP );
@@ -68,6 +71,9 @@ public AutoBid setAutoBid(User user, String itemId, double maxBid, double increm
6871 body .put ("itemId" , itemId );
6972 body .put ("maxBid" , maxBid );
7073 body .put ("increment" , increment );
74+ if (user .isBanned ()) {
75+ throw new InvalidBidException ("Your account is banned. You cannot set auto-bids." );
76+ }
7177 try {
7278 String response = http .post ("/auto-bids" , http .getGson ().toJson (body ));
7379 Map <String , Object > map = http .getGson ().fromJson (response , MAP );
@@ -92,6 +98,9 @@ public Optional<AutoBid> getAutoBid(User user, String itemId) {
9298
9399 @ Override
94100 public void cancelAutoBid (User user , String itemId ) {
101+ if (user .isBanned ()) {
102+ throw new InvalidBidException ("Your account is banned. You cannot cancel auto-bids." );
103+ }
95104 try {
96105 String encodedItemId =
97106 java .net .URLEncoder .encode (itemId , java .nio .charset .StandardCharsets .UTF_8 );
0 commit comments