Ejemplo n.º 1
0
 /**
  * @param \Generated\Shared\Transfer\RefundItemTransfer $itemTransfer
  *
  * @return void
  */
 public function aggregate(RefundItemTransfer $itemTransfer)
 {
     if (!$itemTransfer->getTaxRate()) {
         return;
     }
     $this->taxBridge->resetAccruedTaxCalculatorRoundingErrorDelta();
     $itemTransfer->requireGrossPrice()->requireTotalGrossPrice();
     $taxAmount = $this->taxBridge->getTaxAmountFromGrossPrice($itemTransfer->getTotalGrossPrice(), $itemTransfer->getTaxRate());
     $itemTransfer->setTaxAmount($taxAmount);
     $taxAmountWithDiscount = $this->taxBridge->getTaxAmountFromGrossPrice($itemTransfer->getTotalGrossPriceWithDiscount(), $itemTransfer->getTaxRate());
     $itemTransfer->setTaxAmountWithDiscount($taxAmountWithDiscount);
 }
Ejemplo n.º 2
0
 /**
  * @param \Generated\Shared\Transfer\GroupedRefundItemTransfer $groupedRefundItem
  * @param \Generated\Shared\Transfer\RefundItemTransfer $refundItem
  *
  * @return \Generated\Shared\Transfer\GroupedRefundItemTransfer
  */
 protected function aggregateItem(GroupedRefundItemTransfer $groupedRefundItem, RefundItemTransfer $refundItem)
 {
     $groupTaxAmount = $groupedRefundItem->getTaxAmount() + $refundItem->getTaxAmount();
     $groupTotalGrossPrice = $groupedRefundItem->getTotalGrossPrice() + $refundItem->getTotalGrossPrice();
     $groupTotalGrossPriceWithDiscount = $groupedRefundItem->getTotalGrossPriceWithDiscount() + $refundItem->getTotalGrossPriceWithDiscount();
     $groupQuantity = $groupedRefundItem->getQuantity() + 1;
     $groupDiscountAmount = $groupedRefundItem->getDiscountAmount() + $refundItem->getDiscountAmount();
     $groupedRefundItem->setTotalGrossPriceWithDiscount($groupTotalGrossPriceWithDiscount);
     $groupedRefundItem->setTotalGrossPrice($groupTotalGrossPrice);
     $groupedRefundItem->setQuantity($groupQuantity);
     $groupedRefundItem->setTaxAmount($groupTaxAmount);
     $groupedRefundItem->setDiscountAmount($groupDiscountAmount);
     return $groupedRefundItem;
 }