From 6b4bb84aeef4599b7ce4c793b72244c511fd7196 Mon Sep 17 00:00:00 2001 From: Nour Eldien Ayman Date: Sun, 18 May 2025 21:43:09 +0300 Subject: [PATCH 1/2] Fix cart endpoints --- .../java/com/podzilla/cart/controller/CartController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/podzilla/cart/controller/CartController.java b/src/main/java/com/podzilla/cart/controller/CartController.java index 53b69e9..10019d3 100644 --- a/src/main/java/com/podzilla/cart/controller/CartController.java +++ b/src/main/java/com/podzilla/cart/controller/CartController.java @@ -109,7 +109,7 @@ public ResponseEntity deleteCart( @ApiResponse(responseCode = "404", description = "Cart not found for this customer") }) - @PostMapping("/{customerId}/items") + @PostMapping("/items") public ResponseEntity addItemToCart( @RequestHeader("X-User-Id") final String customerId, @RequestBody final CartItem cartItem) { @@ -131,7 +131,7 @@ public ResponseEntity addItemToCart( @ApiResponse(responseCode = "404", description = "Cart or item not found") }) - @PatchMapping("/{customerId}/items/{productId}") + @PatchMapping("/items/{productId}") public ResponseEntity updateItemQuantity( @RequestHeader("X-User-Id") final String customerId, @PathVariable("productId") final String productId, @@ -154,7 +154,7 @@ public ResponseEntity updateItemQuantity( @ApiResponse(responseCode = "404", description = "Cart or item not found") }) - @DeleteMapping("/{customerId}/items/{productId}") + @DeleteMapping("/items/{productId}") public ResponseEntity removeItemFromCart( @RequestHeader("X-User-Id") final String customerId, @PathVariable("productId") final String productId) { From 99f87c0aada4a2d2356d45a2252a30435c57b377 Mon Sep 17 00:00:00 2001 From: Nour Eldien Ayman Date: Sun, 18 May 2025 22:00:18 +0300 Subject: [PATCH 2/2] Fix cart endpoints --- src/main/java/com/podzilla/cart/controller/CartController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/podzilla/cart/controller/CartController.java b/src/main/java/com/podzilla/cart/controller/CartController.java index 10019d3..1f5c93d 100644 --- a/src/main/java/com/podzilla/cart/controller/CartController.java +++ b/src/main/java/com/podzilla/cart/controller/CartController.java @@ -239,7 +239,7 @@ public ResponseEntity checkoutCart( @RequestParam(required = false) final String signature, @RequestParam(required = true) final Double longitude, @RequestParam(required = true) final Double latitude, - @RequestParam(required = true) final DeliveryAddress address + @RequestBody(required = true) final DeliveryAddress address ) { log.debug("Entering checkoutCart endpoint with customerId: {}," + " confirmationType: {}, signature: {}",