Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 /**
  * Get all transactions and orders and return builded data
  *
  * @return array
  */
 public function request()
 {
     //load payments by date
     $this->getPagSeguroAbandoned();
     if ($this->_PagSeguroPaymentList->getTransactions()) {
         foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) {
             date_default_timezone_set('UTC');
             $order = \UOL\PagSeguro\Helper\Data::getReferenceDecryptOrderID($payment->getReference());
             $order = $this->_order->load($order);
             if ($this->getStoreReference() == \UOL\PagSeguro\Helper\Data::getReferenceDecrypt($payment->getReference())) {
                 if (!is_null($this->_session->getData('store_id'))) {
                     array_push($this->_arrayPayments, $this->build($payment, $order));
                 }
                 if ($order) {
                     array_push($this->_arrayPayments, $this->build($payment, $order));
                 }
             }
         }
     }
     date_default_timezone_set($this->_timezone->getConfigTimezone());
     return $this->_arrayPayments;
 }
Esempio n. 3
0
 /**
  * @param $payment
  * @return mixed
  */
 protected function decryptOrderById($payment)
 {
     return $this->_order->load(\UOL\PagSeguro\Helper\Data::getReferenceDecryptOrderID($payment->getReference()));
 }