/**
  * Update status in Magento2 Order
  *
  * @return bool
  */
 private function updateOrderStatus()
 {
     $this->_library->setEnvironment();
     $this->_library->setCharset();
     $this->_library->setLog();
     $transaction = $this->getTransaction();
     $order = $this->_order->get($this->_helperData->getReferenceDecryptOrderID($transaction->getReference()));
     $status = $this->_helperData->getStatusFromKey($transaction->getStatus());
     if (!$this->compareStatus($status, $order->getStatus())) {
         $history = array('status' => $this->_history->setStatus($status), 'comment' => $this->_history->setComment('PagSeguro Notification'));
         $transactionCode = $transaction->getCode();
         $orderId = $order->getId();
         $order->setStatus($status);
         $order->setStatusHistories($history);
         $order->save();
         $this->updateSalesOrderGridTransactionCode($orderId, $transactionCode);
         $this->updatePagSeguroOrdersTransactionCode($orderId, $transactionCode);
     }
     return true;
 }
Example #2
0
 /**
  * Request all PagSeguroTransaction in this _date interval
  *
  * @param $page
  * @return string
  * @throws \Exception
  */
 protected function requestPagSeguroAbandoned($page)
 {
     $date = $this->getDates();
     $options = ['initial_date' => $date['initial'], 'final_date' => $date['final'], 'page' => $page, 'max_per_page' => 1000];
     try {
         $this->_library->setEnvironment();
         $this->_library->setCharset();
         $this->_library->setLog();
         return \PagSeguro\Services\Transactions\Search\Abandoned::search($this->_library->getPagSeguroCredentials(), $options);
     } catch (Exception $exception) {
         throw $exception;
     }
 }