22 private $returnProcessor;
27 private $creditmemoRepository;
32 private $orderRepository;
37 private $stockConfiguration;
53 $this->returnProcessor = $returnProcessor;
54 $this->creditmemoRepository = $creditmemoRepository;
56 $this->stockConfiguration = $stockConfiguration;
77 $appendComment =
false,
78 \
Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment =
null,
81 $order = $this->orderRepository->get($orderId);
83 $returnToStockItems = [];
85 &&
$arguments->getExtensionAttributes() !==
null 86 &&
$arguments->getExtensionAttributes()->getReturnToStockItems() !== null
88 $returnToStockItems =
$arguments->getExtensionAttributes()->getReturnToStockItems();
90 $isAutoReturn = $this->stockConfiguration->isAutoReturnEnabled();
91 if ($isAutoReturn || !empty($returnToStockItems)) {
92 $creditmemo = $this->creditmemoRepository->get($resultEntityId);
93 $this->returnProcessor->execute(
$creditmemo,
$order, $returnToStockItems, $isAutoReturn);
95 return $resultEntityId;
__construct(ReturnProcessor $returnProcessor, CreditmemoRepositoryInterface $creditmemoRepository, OrderRepositoryInterface $orderRepository, StockConfigurationInterface $stockConfiguration)
afterExecute(RefundOrderInterface $refundService, $resultEntityId, $orderId, array $items=[], $notify=false, $appendComment=false, \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment=null, \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface $arguments=null)