/** * @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; }
/** * @param \Generated\Shared\Transfer\RefundItemTransfer $itemTransfer * * @return void */ public function aggregate(RefundItemTransfer $itemTransfer) { $totalGrossPriceWithDiscount = $itemTransfer->getTotalGrossPrice() - $itemTransfer->getDiscountAmount(); $itemTransfer->setTotalGrossPriceWithDiscount($totalGrossPriceWithDiscount); }