Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Helper/Config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Paymentwall\Paymentwall\Helper;

use Magento\Store\Model\ScopeInterface;

class Config extends \Magento\Framework\App\Helper\AbstractHelper
{
private $config;
Expand All @@ -15,24 +17,24 @@ public function getInitConfig()
{
\Paymentwall_Config::getInstance()->set([
'api_type' => \Paymentwall_Config::API_GOODS,
'public_key' => $this->config->getValue('payment/paymentwall/api_key'),
'private_key' => $this->config->getValue('payment/paymentwall/secret_key')
'public_key' => $this->config->getValue('payment/paymentwall/api_key', ScopeInterface::SCOPE_STORE),
'private_key' => $this->config->getValue('payment/paymentwall/secret_key', ScopeInterface::SCOPE_STORE)
]);
}

public function getInitBrickConfig($isPingback = false)
{
$testMode = $this->config->getValue('payment/brick/test_mode');
$privateTestKey = $this->config->getValue('payment/brick/private_test_key');
$secretKey = $this->config->getValue('payment/brick/secret_key');
$testMode = $this->config->getValue('payment/brick/test_mode', ScopeInterface::SCOPE_STORE);
$privateTestKey = $this->config->getValue('payment/brick/private_test_key', ScopeInterface::SCOPE_STORE);
$secretKey = $this->config->getValue('payment/brick/secret_key', ScopeInterface::SCOPE_STORE);
if ($isPingback) {
\Paymentwall_Config::getInstance()->set([
'private_key' => $testMode ? $privateTestKey : $secretKey
]);
} else {
$publicTestKey = $this->config->getValue('payment/brick/public_test_key');
$publicKey = $this->config->getValue('payment/brick/public_key');
$privateKey = $this->config->getValue('payment/brick/private_key');
$publicTestKey = $this->config->getValue('payment/brick/public_test_key', ScopeInterface::SCOPE_STORE);
$publicKey = $this->config->getValue('payment/brick/public_key', ScopeInterface::SCOPE_STORE);
$privateKey = $this->config->getValue('payment/brick/private_key', ScopeInterface::SCOPE_STORE);
\Paymentwall_Config::getInstance()->set([
'api_type' => \Paymentwall_Config::API_GOODS,
'public_key' => $testMode ? $publicTestKey : $publicKey,
Expand All @@ -43,6 +45,6 @@ public function getInitBrickConfig($isPingback = false)

public function getConfig($name, $type = 'paymentwall')
{
return $this->config->getValue("payment/{$type}/{$name}");
return $this->config->getValue("payment/{$type}/{$name}", ScopeInterface::SCOPE_STORE);
}
}