public function searchTransactions()
    {
        try {
            $connection = $this->getConnection();
            $select = $connection->select()
                ->from( ['order' => 'sales_order'], ['status', 'created_at', 'increment_id', 'store_id', 'entity_id'] )
                ->join( ['ps' => 'pagseguro_orders'], 'order.entity_id = ps.order_id')
                ->where('ps.transaction_code != ?', '')
                ->order('order.created_at DESC');

            if (!is_null($this->_session->getData('store_id'))) {
                $select = $select->where('order.store_id = ?', $this->_session->getData('store_id'));
            }

            if ($this->_scopeConfig->getValue('payment/pagseguro/environment')) {
                $select = $select->where('ps.environment = ?', $this->_scopeConfig->getValue('payment/pagseguro/environment'));
            }

            if (!empty($this->_idMagento)) {
                $select = $select->where('order.increment_id = ?', $this->_idMagento);
            }

            if (!empty($this->_idPagseguro)) {
                $select = $select->where('ps.transaction_code = ?', $this->_idPagseguro);
            }

            if (!empty($this->_status)) {
                $select = $this->getStatusFromPaymentKey($this->_status) == 'partially_refunded'
                    ? $select->where('ps.partially_refunded = ?', 1)
                    : $select->where('order.status = ?', $this->getStatusFromPaymentKey($this->_status));
            }

            if (!empty($this->_dateBegin) && !empty($this->_dateEnd)) {
                $startDate = date('Y-m-d H:i:s', strtotime(str_replace("/", "-", $this->_dateBegin)));
                $endDate = date('Y-m-d'.' 23:59:59', strtotime(str_replace("/", "-", $this->_dateEnd)));
                $select = $select->where('order.created_at >= ?', $startDate)->where('order.created_at <= ?', $endDate);
            }

            $connection->prepare($select);
            return $connection->fetchAll($select);
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
public function searchTransactions()
    {
        try {
            $connection = $this->getConnection();
            $select = $connection->select()
                ->from( ['order' => 'sales_order'], ['status', 'created_at', 'increment_id', 'store_id', 'entity_id'] )
                ->join( ['ps' => 'pagseguro_orders'], 'order.entity_id = ps.order_id')
                ->where('ps.transaction_code != ?', '')
                ->order('order.created_at DESC');

            if (!is_null($this->_session->getData('store_id'))) {
                $select = $select->where('order.store_id = ?', $this->_session->getData('store_id'));
            }

            if ($this->_scopeConfig->getValue('payment/pagseguro/environment')) {
                $select = $select->where('ps.environment = ?', $this->_scopeConfig->getValue('payment/pagseguro/environment'));
            }

            if (!empty($this->_idMagento)) {
                $select = $select->where('order.increment_id = ?', $this->_idMagento);
            }

            if (!empty($this->_idPagseguro)) {
                $select = $select->where('ps.transaction_code = ?', $this->_idPagseguro);
            }

            if (!empty($this->_status)) {
                $select = $this->getStatusFromPaymentKey($this->_status) == 'partially_refunded'
                    ? $select->where('ps.partially_refunded = ?', 1)
                    : $select->where('order.status = ?', $this->getStatusFromPaymentKey($this->_status));
            }

            if (!empty($this->_dateBegin) && !empty($this->_dateEnd)) {
                $startDate = date('Y-m-d H:i:s', strtotime(str_replace("/", "-", $this->_dateBegin)));
                $endDate = date('Y-m-d'.' 23:59:59', strtotime(str_replace("/", "-", $this->_dateEnd)));
                $select = $select->where('order.created_at >= ?', $startDate)->where('order.created_at <= ?', $endDate);
            }

            $connection->prepare($select);
            return $connection->fetchAll($select);
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
public function searchTransactions ( ) { try { $ connection = $ this -> getConnection ( ) ; $ select = $ connection -> select ( ) -> from ( [ 'order' => 'sales_order' ] , [ 'status' , 'created_at' , 'increment_id' , 'store_id' , 'entity_id' ] ) -> join ( [ 'ps' => 'pagseguro_orders' ] , 'order.entity_id = ps.order_id' ) -> where ( 'ps.transaction_code != ?' , '' ) -> order ( 'order.created_at DESC' ) ; if ( ! is_null ( $ this -> _session -> getData ( 'store_id' ) ) ) { $ select = $ select -> where ( 'order.store_id = ?' , $ this -> _session -> getData ( 'store_id' ) ) ; } if ( $ this -> _scopeConfig -> getValue ( 'payment/pagseguro/environment' ) ) { $ select = $ select -> where ( 'ps.environment = ?' , $ this -> _scopeConfig -> getValue ( 'payment/pagseguro/environment' ) ) ; } if ( ! empty ( $ this -> _idMagento ) ) { $ select = $ select -> where ( 'order.increment_id = ?' , $ this -> _idMagento ) ; } if ( ! empty ( $ this -> _idPagseguro ) ) { $ select = $ select -> where ( 'ps.transaction_code = ?' , $ this -> _idPagseguro ) ; } if ( ! empty ( $ this -> _status ) ) { $ select = $ this -> getStatusFromPaymentKey ( $ this -> _status ) == 'partially_refunded' ? $ select -> where ( 'ps.partially_refunded = ?' , 1 ) : $ select -> where ( 'order.status = ?' , $ this -> getStatusFromPaymentKey ( $ this -> _status ) ) ; } if ( ! empty ( $ this -> _dateBegin ) && ! empty ( $ this -> _dateEnd ) ) { $ startDate = date ( 'Y-m-d H:i:s' , strtotime ( str_replace ( "/" , "-" , $ this -> _dateBegin ) ) ) ; $ endDate = date ( 'Y-m-d' . ' 23:59:59' , strtotime ( str_replace ( "/" , "-" , $ this -> _dateEnd ) ) ) ; $ select = $ select -> where ( 'order.created_at >= ?' , $ startDate ) -> where ( 'order.created_at <= ?' , $ endDate ) ; } $ connection -> prepare ( $ select ) ; return $ connection -> fetchAll ( $ select ) ; } catch ( \ Exception $ exception ) { throw $ exception ; } }
Get all transactions where there is a pagseguro transaction code
@return array
@throws \Exception
Get all transactions where there is a pagseguro transaction code