/**
  * Get transaction id from order comments
  * @return mixed
  */
 private function getTransactionId()
 {
     $comments = $this->salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
     $transactionId = null;
     preg_match('/(\\w+-*\\w+)"/', $comments, $matches);
     if (!empty($matches[1])) {
         $transactionId = $matches[1];
     }
     return $transactionId;
 }
 /**
  * Assert  that comment about authorized amount exist in Comments History section on order page in backend.
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $salesOrder
  * @param string $orderId
  * @param array $prices
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, array $prices)
 {
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
     \PHPUnit_Framework_Assert::assertContains(self::AUTHORIZED_AMOUNT . $prices['grandTotal'], $actualAuthorizedAmount, 'Incorrect authorized amount value for the order #' . $orderId);
 }
 /**
  * Assert that comment about captured amount exist in Comments History section on order page in Admin.
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $salesOrder
  * @param string $orderId
  * @param array $capturedPrices
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, array $capturedPrices)
 {
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $actualCapturedAmount = $salesOrderView->getOrderHistoryBlock()->getCapturedAmount();
     foreach ($capturedPrices as $key => $capturedPrice) {
         \PHPUnit_Framework_Assert::assertContains(self::CAPTURED_AMOUNT . $capturedPrice, $actualCapturedAmount[$key], 'Incorrect captured amount value for the order #' . $orderId);
     }
 }
 /**
  * Assert that comment about authorized amount exist in Comments History section on order page in Admin.
  *
  * @param SalesOrderView $salesOrderView
  * @param OrderIndex $salesOrder
  * @param string $orderId
  * @param array $transactionDetails
  * @throws \Exception
  */
 public function processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, $orderId, array $transactionDetails)
 {
     $transactionId = '';
     $salesOrder->open();
     $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $comment = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
     preg_match('/(ID: ")(\\w+-*\\w+)(")/', $comment, $matches);
     if (!empty($matches[2])) {
         $transactionId = $matches[2];
     }
     \PHPUnit_Framework_Assert::assertNotEmpty($transactionId);
     $orderForm = $salesOrderView->getOrderForm()->openTab('transactions');
     /** @var Grid $grid */
     $grid = $orderForm->getTab('transactions')->getGridBlock();
     $actualTxnIds = $grid->getIds();
     \PHPUnit_Framework_Assert::assertEquals($transactionDetails, $actualTxnIds[$transactionId], 'Incorrect transaction details for the order #' . $orderId);
 }