From 4614992887b67c33a002c62732e103b6b53e38ef Mon Sep 17 00:00:00 2001 From: mirzaeimahdi409 Date: Sat, 3 Aug 2024 04:14:22 +0330 Subject: [PATCH] some change --- .../service/CustomerShoppingCartService.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/order/src/main/java/com/dish_dash/order/application/service/CustomerShoppingCartService.java b/order/src/main/java/com/dish_dash/order/application/service/CustomerShoppingCartService.java index 6a92546..7af4550 100644 --- a/order/src/main/java/com/dish_dash/order/application/service/CustomerShoppingCartService.java +++ b/order/src/main/java/com/dish_dash/order/application/service/CustomerShoppingCartService.java @@ -4,6 +4,7 @@ import com.dishDash.common.dto.FoodViewDto; import com.dishDash.common.dto.ShoppingCartDto; import com.dishDash.common.dto.ShoppingCartItemCreateDto; +import com.dishDash.common.enums.CurrencyUnit; import com.dishDash.common.enums.ErrorCode; import com.dishDash.common.exception.CustomException; import com.dishDash.common.feign.Product.FoodApi; @@ -75,14 +76,11 @@ public ShoppingCartDto modifyShoppingCart( return orderItem; }) - .collect(Collectors.toList()); - - shoppingCart.setShoppingCartItems(orderItems); + .toList(); + shoppingCart.getShoppingCartItems().clear(); + shoppingCart.getShoppingCartItems().addAll(orderItems); shoppingCart.setTotalPrice( - Price.builder() - .amount(totalPrice.get()) - .unit(orderItems.get(0).getPrice().getUnit()) - .build()); + Price.builder().amount(totalPrice.get()).unit(CurrencyUnit.TOMAN).build()); return ShoppingCartMapper.INSTANCE.shoppingCartToDto( shoppingCartRepository.save(shoppingCart)); }