public function calculate($item, $currency = null, $useProductsPrice = true)
    {
        $currency = $this->getCurrency($currency);

        // validate item
        $this->validateItem($item);

        if ($useProductsPrice) {
            $priceValue = $this->getValidProductPriceForItem($item, $currency);
        } else {
            $priceValue = $item->getPrice();
        }
        $this->validateNotNull('price', $priceValue);

        if ($item->getPrice() && $item->getPrice() !== $priceValue) {
            $item->setPriceChange($item->getPrice(), $priceValue);
        }

        $itemPrice = $priceValue * $item->getCalcQuantity();

        // calculate items discount
        $discount = ($itemPrice / 100) * $item->getCalcDiscount();

        // calculate total item price
        $totalPrice = $itemPrice - $discount;

        return $totalPrice;
    }