public Shoppingcart run(Shoppingcart _cart) { Shoppingcart cart = _cart; BigDecimal total = new BigDecimal(0); logger.debug( new StringBuffer() .append("[DONATE_PERCENT|") .append(paramDonatePercent) .append("]") .append("[CATEGORY|") .append(paramCategory) .append("]") .toString()); for (ShoppingcartItem cartItem : _cart.getShoppingCartItemsForPromoInAction()) { if (PromoDependServicesUtil.getProductService() .isInCategoryBySku( cartItem.getProductSku().getProductSkuId(), new Integer(paramCategory))) { if (!isSkuExcluded(params, cartItem.getProductSku().getProductSkuId().toString()) && !isProductExcluded(params, cartItem.getProductSku().getProductId().toString()) && !isCategoryExcluded(params, cartItem.getProductSku().getProductSkuId().toString())) { // found it total = total.add( cartItem .getDiscountPrice() .multiply(new BigDecimal(cartItem.getDiscountQuantity()))); } } } cart.setGainedPointRAM( cart.getGainedPointRAM() + total.multiply(paramDonatePercent).intValue()); return cart; }
public boolean getResult(Shoppingcart _cart) { logger.debug( new StringBuffer() .append("[NUMITEMS_QUANTIFIER|") .append(paramNumItemsQuantifier) .append("]") .append("[NUMITEMS|") .append(paramNumItems) .append("]~~{") .append(_cart.getItemsCount()) .append("}") .toString()); switch (paramNumItemsQuantifier) { case CartAbstractCondition.NUMITEMS_QUANTIFIER_TYPE_OF_GT_OR_EQ: return (_cart.getBuyNowItemsCount() >= paramNumItems) ? true : false; case CartAbstractCondition.NUMITEMS_QUANTIFIER_TYPE_OF_EQ: return (_cart.getBuyNowItemsCount() == paramNumItems) ? true : false; case CartAbstractCondition.NUMITEMS_QUANTIFIER_TYPE_OF_LT_OR_EQ: return (_cart.getBuyNowItemsCount() <= paramNumItems) ? true : false; default: return false; } }
public Shoppingcart run(Shoppingcart _cart) { Shoppingcart cart = _cart; logger.debug( new StringBuffer() .append("[DISCOUNT_PERCENT|") .append(paramDiscountPercent) .append("]") .append("[PRODUCT|") .append(paramProduct) .append("]") .toString()); for (ShoppingcartItem cartItem : _cart.getShoppingCartItemsForPromoInAction()) { if (cartItem.getProductSku().getProductId().toString().equals(paramProduct)) { if (!isSkuExcluded(params, cartItem.getProductSku().getProductSkuId().toString())) { // found it cartItem.setDiscountPriceRAM( cartItem .getDiscountPriceRAM() .add(cartItem.getDiscountPrice().multiply(paramDiscountPercent))); } } } return cart; }