/**
  * @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);
 }
 /**
  * @param \Generated\Shared\Transfer\ItemTransfer $orderItem
  *
  * @return \Generated\Shared\Transfer\RefundItemTransfer
  */
 protected function createRefundItem(ItemTransfer $orderItem)
 {
     $refundItem = new RefundItemTransfer();
     $refundItem->setFkSalesOrderItem($orderItem->getIdSalesOrderItem());
     $refundItem->setQuantity($orderItem->getQuantity());
     $refundItem->setGrossPrice($orderItem->getUnitGrossPrice());
     $refundItem->setDiscountAmount($orderItem->getSumTotalDiscountAmount());
     $refundItem->setName($orderItem->getName());
     $refundItem->setGroupKey($orderItem->getGroupKey());
     $refundItem->setTaxRate($orderItem->getTaxRate());
     $refundItem->setTaxAmount($orderItem->getSumTaxAmount());
     return $refundItem;
 }
Ejemplo n.º 3
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\ItemTransfer $currentItemTransfer
  * @param \Generated\Shared\Transfer\ClauseTransfer $clauseTransfer
  *
  * @return bool
  */
 public function isSatisfiedBy(QuoteTransfer $quoteTransfer, ItemTransfer $currentItemTransfer, ClauseTransfer $clauseTransfer)
 {
     $this->moneyValueConverter->convertDecimalToCent($clauseTransfer);
     return $this->comparators->compare($clauseTransfer, $currentItemTransfer->getUnitGrossPrice());
 }
 /**
  * @param \Generated\Shared\Transfer\ItemTransfer $itemTransfer
  *
  * @return void
  */
 protected function setProductOptionAmountDefaults(ItemTransfer $itemTransfer)
 {
     $itemTransfer->setUnitGrossPriceWithProductOptions($itemTransfer->getUnitGrossPrice());
     $itemTransfer->setSumGrossPriceWithProductOptions($itemTransfer->getSumGrossPrice());
 }