Skip to content

Commit

Permalink
Added store
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse committed Aug 24, 2021
1 parent 03852ad commit 3f16af3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Model/Paymentmethod/Ideal.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ public function assignData(\Magento\Framework\DataObject $data)
public function getBanks()
{
$show_banks = $this->_scopeConfig->getValue('payment/' . $this->_code . '/bank_selection', 'store');
if (!$show_banks) return [];
if (!$show_banks) {
return [];
}

$cache = $this->getCache();
$storeId = $this->storeManager->getStore()->getId();
$store = $this->storeManager->getStore();
$storeId = $store->getId();
$cacheName = 'paynl_banks_' . $this->getPaymentOptionId() . '_' . $storeId;

$banksJson = $cache->load($cacheName);
if ($banksJson) {
$banks = json_decode($banksJson);
} else {
$this->paynlConfig->setStore($store);
$this->paynlConfig->configureSDK();

$banks = \Paynl\Paymentmethods::getBanks($this->getPaymentOptionId());
Expand All @@ -73,4 +77,4 @@ private function getCache()
$cache = $om->get('Magento\Framework\App\CacheInterface');
return $cache;
}
}
}
4 changes: 3 additions & 1 deletion Model/Paymentmethod/Instore.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ public function assignData(\Magento\Framework\DataObject $data)
public function getBanks()
{
$cache = $this->getCache();
$storeId = $this->storeManager->getStore()->getId();
$store = $this->storeManager->getStore();
$storeId = $store->getId();
$cacheName = 'paynl_terminals_' . $this->getPaymentOptionId() . '_' . $storeId;
$banksJson = $cache->load($cacheName);
if ($banksJson) {
$banks = json_decode($banksJson);
} else {
$banks = [];
try {
$this->paynlConfig->setStore($store);
$this->paynlConfig->configureSDK();

$terminals = \Paynl\Instore::getAllTerminals();
Expand Down

0 comments on commit 3f16af3

Please sign in to comment.