コード例 #1
0
ファイル: Backend.php プロジェクト: nja78/magento2
 /**
  * Get selected merchant country code in system configuration
  *
  * @return string
  */
 public function getConfigurationCountryCode()
 {
     $countryCode = $this->_request->getParam(\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY);
     if ($countryCode === null || preg_match('/^[a-zA-Z]{2}$/', $countryCode) == 0) {
         $countryCode = $this->_backendConfig->getConfigDataValue(\Magento\Paypal\Block\Adminhtml\System\Config\Field\Country::FIELD_CONFIG_PATH);
     }
     if (empty($countryCode)) {
         $countryCode = $this->directoryHelper->getDefaultCountry();
     }
     return $countryCode;
 }
コード例 #2
0
ファイル: Payment.php プロジェクト: pradeep-wagento/magento2
 /**
  * Check whether current payment method is enabled
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return bool
  */
 protected function _isPaymentEnabled($element)
 {
     $groupConfig = $element->getGroup();
     $activityPaths = isset($groupConfig['activity_path']) ? $groupConfig['activity_path'] : [];
     if (!is_array($activityPaths)) {
         $activityPaths = [$activityPaths];
     }
     $isPaymentEnabled = false;
     foreach ($activityPaths as $activityPath) {
         $isPaymentEnabled = $isPaymentEnabled || (bool) (string) $this->_backendConfig->getConfigDataValue($activityPath);
     }
     return $isPaymentEnabled;
 }
コード例 #3
0
 /**
  * Execute per test initialization.
  */
 public function setUp()
 {
     $this->accountManagement = Bootstrap::getObjectManager()->get('Magento\\Customer\\Api\\AccountManagementInterface');
     $this->searchCriteriaBuilder = Bootstrap::getObjectManager()->create('Magento\\Framework\\Api\\SearchCriteriaBuilder');
     $this->sortOrderBuilder = Bootstrap::getObjectManager()->create('Magento\\Framework\\Api\\SortOrderBuilder');
     $this->filterGroupBuilder = Bootstrap::getObjectManager()->create('Magento\\Framework\\Api\\Search\\FilterGroupBuilder');
     $this->customerHelper = new CustomerHelper();
     $this->dataObjectProcessor = Bootstrap::getObjectManager()->create('Magento\\Framework\\Reflection\\DataObjectProcessor');
     $this->config = Bootstrap::getObjectManager()->create('Magento\\Config\\Model\\Config');
     if ($this->config->getConfigDataValue(SecurityConfig::XML_PATH_FRONTED_AREA . SecurityConfig::XML_PATH_LIMIT_PASSWORD_RESET_REQUESTS_METHOD) != 0) {
         $this->configValue = $this->config->getConfigDataValue(SecurityConfig::XML_PATH_FRONTED_AREA . SecurityConfig::XML_PATH_LIMIT_PASSWORD_RESET_REQUESTS_METHOD);
         $this->config->setDataByPath(SecurityConfig::XML_PATH_FRONTED_AREA . SecurityConfig::XML_PATH_LIMIT_PASSWORD_RESET_REQUESTS_METHOD, 0);
         $this->config->save();
     }
 }
コード例 #4
0
 public function aroundSave(\Magento\Config\Model\Config $config, \Closure $proceed)
 {
     $ret = $proceed();
     $sectionId = $config->getSection();
     if ($sectionId == 'mandrill' && !$config->getConfigDataValue('mandrill/general/active')) {
         $modules = $this->_loader->load();
         if (isset($modules['Ebizmarts_AbandonedCart'])) {
             $this->_writer->save(\Ebizmarts\AbandonedCart\Model\Config::ACTIVE, 0, $config->getScope(), $config->getScopeId());
         }
         if (isset($modules['Ebizmarts_AutoResponder'])) {
             $this->_writer->save(\Ebizmarts\AutoResponder\Model\Config::ACTIVE, 0, $config->getScope(), $config->getScopeId());
         }
     }
     return $ret;
 }