Beispiel #1
0
 public function testSaveDeleteConfig()
 {
     $connection = $this->_model->getReadConnection();
     $select = $connection->select()->from($this->_model->getMainTable())->where('path=?', 'test/config');
     $this->_model->saveConfig('test/config', 'test', 'default', 0);
     $this->assertNotEmpty($connection->fetchRow($select));
     $this->_model->deleteConfig('test/config', 'default', 0);
     $this->assertEmpty($connection->fetchRow($select));
 }
Beispiel #2
0
 /**
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function updateOrderStatusForPaymentMethods(\Magento\Framework\Event\Observer $observer)
 {
     if ($observer->getEvent()->getState() != \Magento\Sales\Model\Order::STATE_NEW) {
         return;
     }
     $status = $observer->getEvent()->getStatus();
     $defaultStatus = $this->_salesOrderConfig->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_NEW);
     $methods = $this->_paymentConfig->getActiveMethods();
     foreach ($methods as $method) {
         if ($method->getConfigData('order_status') == $status) {
             $this->_resourceConfig->saveConfig('payment/' . $method->getCode() . '/order_status', $defaultStatus, 'default', 0);
         }
     }
 }
Beispiel #3
0
 /**
  * Reset flag for showing tax notifications
  *
  * @param string $path
  * @return \Magento\Tax\Model\Config\Notification
  */
 protected function _resetNotificationFlag($path)
 {
     $this->resourceConfig->saveConfig($path, 0, \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT, 0);
     return $this;
 }