예제 #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);
 }
 /**
  * @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;
 }