/** * 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; }
/** * @param $status * @return bool|string */ protected function getStatusFromPaymentKey($status) { return \UOL\PagSeguro\Helper\Data::getStatusFromKey($status); }