Skip to content

Commit

Permalink
fix issue return one object
Browse files Browse the repository at this point in the history
  • Loading branch information
naruepracht-s committed Mar 24, 2024
1 parent 1e3edf6 commit a570aa2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public ApplyCodeResponse applyCode(String username, ApplyCodeRequest request) {
@Transactional
public CreateCartResponse createCart(String userName, CartRequest cartRequest) {
CreateCartResponse response = new CreateCartResponse();
response.setItems(new ArrayList<>());
Optional<Shopper> shopper = shopperRepository.findByUsername(userName);
Optional<Cart> checkShopperHaveCart = cartRepository.findByShopperId(shopper.get().getId());

Expand Down Expand Up @@ -115,7 +116,6 @@ public CreateCartResponse createCart(String userName, CartRequest cartRequest) {
item.getFinalPrice());
totalPriceForReturn = item.getFinalPrice().plus();
totalDiscountForReturn = item.getDiscount().plus();
response.setItems(new ArrayList<>());
response.getItems().add(cartItem);
}
if (enableShippingFee) {
Expand Down

0 comments on commit a570aa2

Please sign in to comment.