/** * 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 (is_null($countryCode) || 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->_coreHelper->getDefaultCountry(); } return $countryCode; }
/** * 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; }