/**
  * Calculates the cheapest price considering the variant min purchase
  * @param Struct\ListProduct $product
  * @param Struct\Product\PriceRule $priceRule
  * @param Struct\ProductContextInterface $context
  * @return Struct\Product\Price
  */
 private function calculateCheapestAvailablePrice(Struct\ListProduct $product, Struct\Product\PriceRule $priceRule, Struct\ProductContextInterface $context)
 {
     $priceRule->setPrice($priceRule->getUnit()->getMinPurchase() * $priceRule->getPrice());
     $priceRule->getUnit()->setPurchaseUnit($priceRule->getUnit()->getMinPurchase() * $priceRule->getUnit()->getPurchaseUnit());
     $priceRule->setPseudoPrice($priceRule->getUnit()->getMinPurchase() * $priceRule->getPseudoPrice());
     $tax = $context->getTaxRule($product->getTax()->getId());
     return $this->calculatePriceStruct($priceRule, $tax, $context);
 }
 /**
  * Reduces the passed price with a configured
  * price group discount for the min purchase of the
  * prices unit.
  *
  * @param Struct\ListProduct $product
  * @param Struct\Product\PriceRule $priceRule
  * @param Struct\ProductContextInterface $context
  * @return Struct\Product\Price
  */
 private function calculateCheapestPrice(Struct\ListProduct $product, Struct\Product\PriceRule $priceRule, Struct\ProductContextInterface $context)
 {
     $tax = $context->getTaxRule($product->getTax()->getId());
     //check for price group discounts.
     if (!$product->getPriceGroup() || !$product->isPriceGroupActive()) {
         return $this->calculatePriceStruct($priceRule, $tax, $context);
     }
     //selects the highest price group discount, for the passed quantity.
     $discount = $this->getHighestQuantityDiscount($product, $context, $priceRule->getUnit()->getMinPurchase());
     if ($discount) {
         $priceRule->setPrice($priceRule->getPrice() / 100 * (100 - $discount->getPercent()));
     }
     return $this->calculatePriceStruct($priceRule, $tax, $context);
 }