/** * @param \Generated\Shared\Transfer\ItemTransfer $itemTransfer * * @return int */ protected function setItemGrossAmounts(ItemTransfer $itemTransfer) { $this->setCalculatedDiscountsSumGrossAmount($itemTransfer->getCalculatedDiscounts()); $totalDiscountUnitGrossAmount = $this->getCalculatedDiscountsUnitGrossAmount($itemTransfer->getCalculatedDiscounts()); if ($totalDiscountUnitGrossAmount > $itemTransfer->getUnitGrossPrice()) { $totalDiscountUnitGrossAmount = $itemTransfer->getUnitGrossPrice(); } $totalDiscountSumGrossAmount = $this->getCalculatedDiscountsSumGrossAmount($itemTransfer->getCalculatedDiscounts()); if ($totalDiscountSumGrossAmount > $itemTransfer->getSumGrossPrice()) { $totalDiscountSumGrossAmount = $itemTransfer->getSumGrossPrice(); } $itemTransfer->setUnitTotalDiscountAmount($totalDiscountUnitGrossAmount); $itemTransfer->setSumTotalDiscountAmount($totalDiscountSumGrossAmount); $itemTransfer->setUnitGrossPriceWithDiscounts($itemTransfer->getUnitGrossPrice() - $totalDiscountUnitGrossAmount); $itemTransfer->setSumGrossPriceWithDiscounts($itemTransfer->getSumGrossPrice() - $totalDiscountSumGrossAmount); }