@RequestMapping(value = "/viewCart.htm", method = RequestMethod.GET)
  public String viewCart(ModelMap model, HttpServletRequest request) throws PricingException {
    Order cart = retrieveCartOrder(request, model);
    CartSummary cartSummary = new CartSummary();

    if (cart.getOrderItems() != null) {
      for (OrderItem orderItem : cart.getOrderItems()) {
        if (orderItem instanceof DiscreteOrderItem) {
          Sku sku = catalogService.findSkuById(((DiscreteOrderItem) orderItem).getSku().getId());
          if (!(sku.getSalePrice().equals(((DiscreteOrderItem) orderItem).getSalePrice()))) {
            orderItem.setSalePrice(sku.getSalePrice());
          }
          if (!(sku.getRetailPrice().equals(((DiscreteOrderItem) orderItem).getRetailPrice()))) {
            orderItem.setRetailPrice(sku.getRetailPrice());
          }

          if (orderItem.getSalePrice() != orderItem.getRetailPrice()) {
            orderItem.setPrice(orderItem.getSalePrice());
          } else {
            orderItem.setPrice(orderItem.getRetailPrice());
          }

          orderItem.getPrice();
        }
      }
    }

    if (cart.getOrderItems() != null) {
      for (OrderItem orderItem : cart.getOrderItems()) {
        CartOrderItem cartOrderItem = new CartOrderItem();
        cartOrderItem.setOrderItem(orderItem);
        cartOrderItem.setQuantity(orderItem.getQuantity());
        cartSummary.getRows().add(cartOrderItem);
      }
    }

    if ((cart.getFulfillmentGroups() != null) && (cart.getFulfillmentGroups().isEmpty() == false)) {
      String cartShippingMethod = cart.getFulfillmentGroups().get(0).getMethod();
      String cartShippingService = cart.getFulfillmentGroups().get(0).getService();

      if (cartShippingMethod != null) {
        if (cartShippingMethod.equals("standard")) {
          cartSummary = createFulfillmentGroup(cartSummary, "standard", cartShippingService, cart);
        } else if (cartShippingMethod.equals("expedited")) {
          cartSummary = createFulfillmentGroup(cartSummary, "expedited", cartShippingService, cart);
        }
      }
    }

    updateFulfillmentGroups(cartSummary, cart);
    cartSummary.setOrderDiscounts(cart.getTotalAdjustmentsValue().getAmount());
    model.addAttribute("cartSummary", cartSummary);
    return cartViewRedirect ? "redirect:" + cartView : cartView;
  }
 public List<PromotableFulfillmentGroup> getFulfillmentGroups() {
   if (fulfillmentGroups == null) {
     fulfillmentGroups = new ArrayList<PromotableFulfillmentGroup>();
     for (FulfillmentGroup fulfillmentGroup : delegate.getFulfillmentGroups()) {
       fulfillmentGroups.add(itemFactory.createPromotableFulfillmentGroup(fulfillmentGroup, this));
     }
   }
   return Collections.unmodifiableList(fulfillmentGroups);
 }
 public boolean containsNotStackableFulfillmentGroupOffer() {
   boolean isContainsNotStackableFulfillmentGroupOffer = false;
   for (FulfillmentGroup fg : delegate.getFulfillmentGroups()) {
     for (FulfillmentGroupAdjustment fgAdjustment : fg.getFulfillmentGroupAdjustments()) {
       if (!fgAdjustment.getOffer().isStackable()) {
         isContainsNotStackableFulfillmentGroupOffer = true;
         break;
       }
     }
   }
   return isContainsNotStackableFulfillmentGroupOffer;
 }
 public void resetTotalitarianOfferApplied() {
   totalitarianOfferApplied = false;
   notCombinableOfferAppliedAtAnyLevel = false;
   for (OrderAdjustment adjustment : delegate.getOrderAdjustments()) {
     if (adjustment.getOffer().isTotalitarianOffer() != null
         && adjustment.getOffer().isTotalitarianOffer()) {
       totalitarianOfferApplied = true;
       break;
     }
     if (!adjustment.getOffer().isCombinableWithOtherOffers()) {
       notCombinableOfferAppliedAtAnyLevel = true;
       break;
     }
   }
   if (!totalitarianOfferApplied || !notCombinableOfferAppliedAtAnyLevel) {
     check:
     {
       for (OrderItem orderItem : delegate.getOrderItems()) {
         for (OrderItemAdjustment adjustment : orderItem.getOrderItemAdjustments()) {
           if (adjustment.getOffer().isTotalitarianOffer() != null
               && adjustment.getOffer().isTotalitarianOffer()) {
             totalitarianOfferApplied = true;
             break check;
           }
           if (!adjustment.getOffer().isCombinableWithOtherOffers()) {
             notCombinableOfferAppliedAtAnyLevel = true;
             break check;
           }
         }
       }
     }
   }
   if (!totalitarianOfferApplied || !notCombinableOfferAppliedAtAnyLevel) {
     check:
     {
       for (FulfillmentGroup fg : delegate.getFulfillmentGroups()) {
         for (FulfillmentGroupAdjustment adjustment : fg.getFulfillmentGroupAdjustments()) {
           if (adjustment.getOffer().isTotalitarianOffer() != null
               && adjustment.getOffer().isTotalitarianOffer()) {
             totalitarianOfferApplied = true;
             break check;
           }
           if (!adjustment.getOffer().isCombinableWithOtherOffers()) {
             notCombinableOfferAppliedAtAnyLevel = true;
             break check;
           }
         }
       }
     }
   }
 }