Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from PayEx/bugfix/payment-config-scope
Browse files Browse the repository at this point in the history
Fixes an issue with payment config scope
  • Loading branch information
asbjornu authored Jun 18, 2019
2 parents 7951409 + 6fd1a2a commit bec4401
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,8 @@ public function getPaymentValue($code, $paymentMethod, $store = null)
*/
public function isPayment($module = '')
{
$isPayment = false;

try {
$paymentConfigPath = $this->getPaymentConfigPath('active', $module);
if ($this->pathValidator->validate($paymentConfigPath)) {
$isPayment = true;
}
} catch (ValidatorException $e) {
}
$paymentConfigPath = $this->getPaymentConfigPath('active', $module);
$isPayment = ($this->scopeConfig->isSetFlag($paymentConfigPath) == null) ? false : true;

return $isPayment;
}
Expand All @@ -186,25 +179,25 @@ public function isPayment($module = '')
*/
public function isActive($store = null, $module = '')
{
$isActive = false;

if ($isPayment = $this->isPayment($module)) {
$isActive = $this->scopeConfig->isSetFlag($this->getPaymentConfigPath('active', $module));
if ($this->isPayment($module)) {
$configPath = $this->getPaymentConfigPath('active', $module);
}

if (!$isPayment) {
$isActive = $this->scopeConfig->isSetFlag($this->getConfigPath('active', $module));
if (!isset($configPath)) {
$configPath = $this->getConfigPath('active', $module);
}

if (!$isActive || $module != '') {
return $isActive;
}
$isActive = $this->scopeConfig->isSetFlag($configPath, $this->getScope($store), $store);

if (in_array($this->_getModuleName(), $this->moduleDependencies)) {
$key = array_search($this->_getModuleName(), $this->moduleDependencies);
unset($this->moduleDependencies[$key]);
}

if (!$isActive || $module != '' || count($this->moduleDependencies) == 0) {
return $isActive;
}

foreach ($this->moduleDependencies as $dependency) {
if ($dependency == 'PayEx_Core') {
continue;
Expand Down

0 comments on commit bec4401

Please sign in to comment.