/**
  * Create credit memo from order on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
     $this->salesOrderView->getPageActions()->orderCreditMemo();
     if (!empty($this->data)) {
         $this->orderCreditMemoNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']);
         $this->orderCreditMemoNew->getFormBlock()->updateQty();
     }
     $this->orderCreditMemoNew->getFormBlock()->submit();
     return ['creditMemoIds' => $this->getCreditMemoIds()];
 }
 /**
  * Get Credit Memo new product prices.
  *
  * @param InjectableFixture $product
  * @param array $actualPrices
  * @return array
  */
 public function getCreditMemoNewPrices($actualPrices, InjectableFixture $product)
 {
     $productBlock = $this->orderCreditMemoNew->getFormBlock()->getItemsBlock()->getItemProductBlock($product);
     $actualPrices['cart_item_price_excl_tax'] = $productBlock->getItemPriceExclTax();
     $actualPrices['cart_item_price_incl_tax'] = $productBlock->getItemPriceInclTax();
     $actualPrices['cart_item_subtotal_excl_tax'] = $productBlock->getItemSubExclTax();
     $actualPrices['cart_item_subtotal_incl_tax'] = $productBlock->getItemSubInclTax();
     return $actualPrices;
 }
 /**
  * Create credit memo.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
     /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Invoices\Grid $invoicesGrid */
     $invoicesGrid = $this->salesOrderView->getOrderForm()->getTab('invoices')->getGridBlock();
     $this->salesOrderView->getOrderForm()->openTab('invoices');
     $invoicesGrid->viewInvoice();
     $this->salesOrderView->getPageActions()->orderInvoiceCreditMemo();
     if (!empty($this->refundData)) {
         $this->orderCreditMemoNew->getFormBlock()->fillProductData($this->refundData, $this->order->getEntityId()['products']);
         $this->orderCreditMemoNew->getFormBlock()->updateQty();
     }
     $this->orderCreditMemoNew->getFormBlock()->submit();
     return ['ids' => ['creditMemoIds' => $this->getCreditMemoIds()]];
 }