checkout_submit_all_after event handler to store pagseguro order info

@param \Magento\Framework\Event\Observer $observer
@return void
773919
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();

        //verify pagseguro transaction
        if ($order->getStatus() == 'pagseguro_iniciado') {
            $orderId = $order->getId();
            $environment = $this->_scopeConfig->getValue('payment/pagseguro/environment');
            
            //save order in pagseguro_orders table
            $this->saveOrderAndEnvironment($orderId, $environment);

            //$this->getEnvironmentName($environment);
            $this->updateSalesOrderGridEnvironment($orderId, $environment);
        }

        return $this;
    }
1055960
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $productCollection = $observer->getEvent()->getData('product_collection');
        $storeId           = $observer->getEvent()->getData('store_id');

        if (($productCollection instanceof \Magento\Catalog\Model\ResourceModel\Product\Collection) && $storeId) {
            $this->logEvent($productCollection, $storeId);
        }
    }
247870
public function execute(Observer $observer)
    {
        // Get the order
        $order = $observer->getEvent()->getOrder();

        // Get the method id
        $methodId = $order->getPayment()->getMethodInstance()->getCode();

        if ($this->backendAuthSession->isLoggedIn() && $methodId == 'checkout_com_admin_method') {



        }
        
        return $this;
    }
1332244
public function hookToAddToWishlistBefore($observer)
    {
        $key = Mage::getSingleton('core/session')->getFormKey();
        $observer->getEvent()->getRequest()->setParam('form_key', $key);
        return $this;
    }
352902
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $additional = $observer->getAdditional();
        $conditions = (array) $additional->getConditions();
        $conditions = array_merge_recursive($conditions, [$this->getShopgateCondition()]);
        $additional->setConditions($conditions);

        return $this;
    }
1148167
public function controllerActionPredispatch(Varien_Event_Observer $observer)
    {
        if (!$this->_getHelper()->isActive()) {
            return $this;
        }

        /* @var $controllerAction Mage_Core_Controller_Front_Action */
        $controllerAction = $observer->getControllerAction();

        $this->_getHelper()->setCurrentPage(
            strtolower($controllerAction->getFullActionName('_'))
        );
        
        $surrogateCompatibility = $controllerAction->getRequest()->getServer('HTTP_SURROGATE_CAPABILITY', '');
        
        if (strpos($surrogateCompatibility, 'ESI/') !== false) {
            $this->_getHelper()->setIsEsiAllowed(true);
        }
        
        if ($this->_getHelper()->isAllowedCurrentPage() 
            || $this->_getHelper()->getIsInternal()) {
            // Disable ?__SID=U in urls
            Mage::app()->setUseSessionVar(false);
            Mage::app()->setUseSessionInUrl(false);
        }
        
        Mage::getSingleton('ecomdev_varnish/cookie')->setRequest($controllerAction->getRequest());

        if ($token = $controllerAction->getRequest()->getParam('form_key')) {
            if ($this->_getHelper()->validateToken($token)) {
                Mage::getSingleton('core/session')->setData('_form_key', $token);
                // After we set token, it is not valid anymore for next request, so we need to generate a new one
                $this->_getHelper()->generateToken();
            }
        }

        return $this;
    }
1125667
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $customer = $observer->getEvent()->getCustomer();
        $websiteId  = $customer->getWebsiteId();
        $storeId = $customer->getStoreId();

        //check if enabled
        if (!$this->helper->isEnabled($websiteId)) {
            return $this;
        }

        $email      = $customer->getEmail();
        $customerId = $customer->getEntityId();
        $subscriber = $this->subscriberFactory->create()
            ->loadByCustomerId($customerId);
        $isSubscribed = $subscriber->isSubscribed();

        $emailBefore = '';

        try {
            // fix for a multiple hit of the observer
            $emailReg = $this->registry->registry($email . '_customer_save');
            if ($emailReg) {
                return $this;
            }
            $this->registry->unregister($email . '_customer_save'); // additional measure
            $this->registry->register($email . '_customer_save', $email);

            $isContactExist = $this->contactFactory->create()
                ->loadByCustomerId($customerId);

            if ($isContactExist->getId()) {
                $emailBefore = $isContactExist->getEmail();
            }

            $emailAddress = empty($emailBefore) ? $email : $emailBefore;

            $contactModel = $this->contactFactory->create()
                ->loadByCustomerEmail($emailAddress, $websiteId);

            //email change detection
            if ($emailBefore && $email != $emailBefore) {
                //Reload contact model up update email
                $contactModel = $this->contactFactory->create()
                    ->loadByCustomerEmail($emailAddress, $websiteId);
                $contactModel->setEmail($email);

                $data = [
                    'emailBefore' => $emailBefore,
                    'email' => $email,
                    'isSubscribed' => $isSubscribed,
                ];
                $this->importerFactory->create()->registerQueue(
                    \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT_UPDATE,
                    $data,
                    \Dotdigitalgroup\Email\Model\Importer::MODE_CONTACT_EMAIL_UPDATE,
                    $websiteId
                );
            } elseif (!$emailBefore) {
                //for new contacts update email
                $contactModel->setEmail($email);
            }
            $contactModel->setEmailImported(\Dotdigitalgroup\Email\Model\Contact::EMAIL_CONTACT_NOT_IMPORTED)
                ->setStoreId($storeId)
                ->setCustomerId($customerId);
            $this->contactResource->save($contactModel);
        } catch (\Exception $e) {
            $this->helper->debug((string)$e, []);
        }

        return $this;
    }
1144855
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $customer = $observer->getEvent()->getCustomer();
        //New Automation enrolment to queue
        $this->automation->newCustomerAutomation($customer);

        return $this;
    }
554183
final public function attach($observer)
  {
    if (!in_array($observer, $this->_observers)) {
      array_push($this->_observers, $observer);
    }
    return $this;
  }
618460
public function afterStore(Event $event) {
		$this->pathBuilder($event->getSubject()->pathBuilder());
		$this->subject = $event->getSubject();

		$this->autoProcessImageVersions($event->getData('entity'), 'create');
	}
446916
public function dispatch(Varien_Event_Observer $observer)
    {
        if (!Mage::getStoreConfigFlag('system/cron/enable')) {
            return;
        }

        $processManager = Mage::getModel('aoe_scheduler/processManager'); /* @var $processManager Aoe_Scheduler_Model_ProcessManager */
        $processManager->watchdog();

        $scheduleManager = Mage::getModel('aoe_scheduler/scheduleManager'); /* @var $scheduleManager Aoe_Scheduler_Model_ScheduleManager */
        $scheduleManager->logRun();

        $helper = Mage::helper('aoe_scheduler'); /* @var Aoe_Scheduler_Helper_Data $helper */
        $includeJobs = $helper->addGroupJobs((array) $observer->getIncludeJobs(), (array) $observer->getIncludeGroups());
        $excludeJobs = $helper->addGroupJobs((array) $observer->getExcludeJobs(), (array) $observer->getExcludeGroups());

        // Coalesce all jobs that should have run before now, by job code, by marking the oldest entries as missed.
        $scheduleManager->skipMissedSchedules();

        // Iterate over all pending jobs
        foreach ($scheduleManager->getPendingSchedules($includeJobs, $excludeJobs) as $schedule) {
            /* @var Aoe_Scheduler_Model_Schedule $schedule */
            $schedule->process();
        }

        // Generate new schedules
        $scheduleManager->generateSchedules();

        // Clean up schedule history
        $scheduleManager->cleanup();
    }
458642
public function AttachObserver($observer)
	{
		parent::AttachObserver($observer);
		foreach ($this->DataAdapters as $adapter) {
			$adapter->AttachObserver($observer);
		}
	}
1078314
public function attach($observer)
	{
		if (is_array($observer))
		{
			if (!isset($observer['handler']) || !isset($observer['event']) || !is_callable($observer['handler']))
			{
				return;
			}

			// Make sure we haven't already attached this array as an observer
			foreach ($this->_observers as $check)
			{
				if (is_array($check) && $check['event'] == $observer['event'] && $check['handler'] == $observer['handler'])
				{
					return;
				}
			}

			$this->_observers[] = $observer;
			end($this->_observers);
			$methods = array($observer['event']);
		}
		else
		{
			if (!($observer instanceof JObserver))
			{
				return;
			}

			// Make sure we haven't already attached this object as an observer
			$class = get_class($observer);

			foreach ($this->_observers as $check)
			{
				if ($check instanceof $class)
				{
					return;
				}
			}

			$this->_observers[] = $observer;
			$methods = array_diff(get_class_methods($observer), get_class_methods('JPlugin'));
		}

		$key = key($this->_observers);

		foreach ($methods as $method)
		{
			$method = strtolower($method);

			if (!isset($this->_methods[$method]))
			{
				$this->_methods[$method] = array();
			}

			$this->_methods[$method][] = $key;
		}
	}
514880
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $grid = $observer->getBlock();

        /**
         * \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid
         */
        if ($grid instanceof \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid) {
            $grid->addColumnAfter(
                'expiration_date',
                [
                    'header' => __('Expiration date'),
                    'index' => 'expiration_date',
                    'type' => 'datetime',
                    'default' => '',
                    'align' => 'center',
                    'width' => '160'
                ],
                'created_at'
            )->addColumnAfter(
                'generated_by_dotmailer',
                [
                    'header' => __('Generated By dotmailer'),
                    'index' => 'generated_by_dotmailer',
                    'type' => 'options',
                    'default' => '',
                    'options' => ['null' => 'No', '1' => 'Yes'],
                    'width' => '30',
                    'align' => 'center',
                    'filter_condition_callback' =>
                        [$this->couponGridFiltererFactory->create(), 'filterByGeneratedByDotmailer']
                ],
                'expiration_date'
            );
        }
    }
1271363
public function execute(Observer $observer)
    {
        /** @var Subscriber $subscriber */
        $subscriber = $observer->getSubscriber();

        try {
            $store = $this->storeManager->getStore($subscriber->getStoreId());

            if ($subscriber->getCustomerId()) {
                $this->customerEventHandler->store(
                    $subscriber->getCustomerId(),
                    $store->getWebsiteId(),
                    $store->getId()
                );
            } else {
                $this->subscriptionEventHandler->store(
                    $subscriber,
                    $store->getWebsiteId(),
                    $store->getId(),
                    $this->subscriptionEventHandler->getEventType($observer->getEvent()->getName())
                );
            }
        } catch (\Exception $e) {
            $this->logger->warning('Emartech\\Emarsys\\Observers\\SubscriptionObserver: ' . $e->getMessage());
        }
    }
1080802
public function coreBlockAbstractToHtmlAfter(Varien_Event_Observer $observer)
    {
        if (!$this->_getHelper()->isAllowedCurrentPage()) {
            return $this;
        }
        
        $block = $observer->getBlock();
        $objects = $this->_getCollector()->collect($block);
        array_splice($this->_collectedObjects, count($this->_collectedObjects), 0, $objects);
        return $this;
    }
826185
public <T> void register(Class<T> event, EventObserver<T> observer){
        if(event == null){
            throw new IllegalArgumentException("Null Event type passed to register");
        }
        if(observer == null){
            throw new IllegalArgumentException("Null observer passed to register");
        }
        nullSafeGet(event).add(observer);
    }