Skip to content

Commit

Permalink
Merge pull request #10 from limegrow/feature/bump-2.7.0
Browse files Browse the repository at this point in the history
Bump v2.7.0
  • Loading branch information
olegisk authored Apr 18, 2021
2 parents b1ab8ec + 9a7f58c commit 92e601c
Show file tree
Hide file tree
Showing 64 changed files with 1,928 additions and 627 deletions.
10 changes: 3 additions & 7 deletions Block/Form/Flex.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace Ingenico\Payment\Block\Form;

use Ingenico\Payment\Model\Config as IngenicoConfig;
use Ingenico\Payment\Model\IngenicoConfigProvider;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View\Element\Template;

class Flex extends Method
{
protected $_template = 'form/flex.phtml';
Expand All @@ -16,7 +11,8 @@ class Flex extends Method
*
* @return array
*/
public function getFlexMethods() {
return $this->cnf->getFlexMethods();
public function getFlexMethods()
{
return $this->cnf->getFlexMethods($this->_storeManager->getStore()->getId());
}
}
3 changes: 2 additions & 1 deletion Block/Form/Ideal.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Ideal extends Method
*
* @return array
*/
public function getAvailableBanks() {
public function getAvailableBanks()
{
return ObjectManager::getInstance()->get('Ingenico\Payment\Block\Ideal\Banks')->getAvailableBanks();
}
}
2 changes: 1 addition & 1 deletion Block/Form/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public function __construct(
*/
public function isPaymentPageModeRedirect()
{
return $this->cnf->isPaymentPageModeRedirect();
return $this->cnf->isPaymentPageModeRedirect($this->_storeManager->getStore()->getId());
}
}
13 changes: 9 additions & 4 deletions Block/Ideal/Banks.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Magento\Widget\Block\BlockInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;
use Ingenico\Payment\Model\Config;

class Banks extends AbstractBlock implements BlockInterface
{
Expand Down Expand Up @@ -74,20 +76,23 @@ public function getAvailableBanks()
$om = ObjectManager::getInstance();

/** @var \Ingenico\Payment\Model\Config $config */
$config = $om->get('Ingenico\Payment\Model\Config');
$config = $om->get(Config::class);

$banks = $config->getIDealBanks();
/** @var \Magento\Store\Model\StoreManagerInterface $storeManger */
$storeManger = $om->get(StoreManagerInterface::class);

$banks = $config->getIDealBanks($storeManger->getStore()->getId());

/** @var \Ingenico\Payment\Model\Config\Source\Ideal\Banks $source */
$source = $om->get('Ingenico\Payment\Model\Config\Source\Ideal\Banks');
$source = $om->get(\Ingenico\Payment\Model\Config\Source\Ideal\Banks::class);
// @codingStandardsIgnoreEnd

// Get Banks
$options = $source->toOptionArray();

$result = [];
foreach ($options as $option) {
if (in_array($option['value'], $banks)) {
if (empty($option['value']) || in_array($option['value'], $banks)) {
$result[] = $option;
}
}
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [2.7.0] - 2021-04-18
### Added
- Multi Store configuration
- New option: Layout of Payment Methods
- Clean config cache automatically on settings save
- Multishipping: "Remove" button which allows removing saved alias

### Changes
- iDeal bufixes
- Blank payment method bugfixes
- "Pay with Saved Card" bugfixes
- Update Klarna translations
- Multishipping: Fixed missing brand of CC on alias payment
- Require billing address for Bancontact

## [2.6.0] - 2021-03-25
### Added
- "Remove" button which allows removing saved alias
Expand Down
2 changes: 1 addition & 1 deletion Controller/Payment/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function execute()
} else {
// Credit Card time
$orderId = $this->_session->getData('last_real_order_id');
if ($this->_cnf->isPaymentPageModeInline() && $this->_connector->isOrderCreated($orderId)) {
if ($this->_cnf->isPaymentPageModeInline($order->getStoreId()) && $this->_connector->isOrderCreated($orderId)) {
$response = $this->_connector->finishReturnInline(
$orderId,
$this->getRequest()->getParam('cardbrand'),
Expand Down
28 changes: 22 additions & 6 deletions Controller/Payment/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,34 @@ public function execute()
$corePaymentMethod = $this->ingenicoHelper->getCoreMethod($paymentMethodInstance::CORE_CODE);

try {
if (in_array($paymentMethodInstance->getCode(), [
\Ingenico\Payment\Model\Method\Ingenico::PAYMENT_METHOD_CODE,
\Ingenico\Payment\Model\Method\Alias::PAYMENT_METHOD_CODE
])) {
if (\Ingenico\Payment\Model\Method\Ingenico::PAYMENT_METHOD_CODE === $paymentMethodInstance->getCode()) {
// @see self::showPaymentListRedirectTemplate()
$this->_connector->processPaymentRedirect($aliasId);
} elseif ($paymentMethodInstance->getCode() === \Ingenico\Payment\Model\Method\Cc::PAYMENT_METHOD_CODE) {
} elseif (\Ingenico\Payment\Model\Method\Cc::PAYMENT_METHOD_CODE === $paymentMethodInstance->getCode()) {
// @see self::showPaymentListRedirectTemplate()
if ($aliasId) {
// There's specified card brand
$alias = $this->_connector->getAlias($aliasId);
$this->_connector->processPaymentRedirectSpecified(
$aliasId,
'CreditCard',
$alias['brand']
);
} else {
// Use "CreditCard" brands
$this->_connector->processPaymentRedirectSpecified(
$aliasId,
'CreditCard',
'CreditCard'
);
}
} elseif (\Ingenico\Payment\Model\Method\Alias::PAYMENT_METHOD_CODE === $paymentMethodInstance->getCode()) {
// @see self::showPaymentListRedirectTemplate()
$alias = $this->_connector->getAlias($aliasId);
$this->_connector->processPaymentRedirectSpecified(
$aliasId,
'CreditCard',
'CreditCard'
$alias['brand']
);
} elseif ($corePaymentMethod) {
// @see self::showPaymentListRedirectTemplate()
Expand Down
10 changes: 10 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,14 @@ public function getActiveMagentoPaymentMethods()

return $result;
}

/**
* Get Store ID.
*
* @return string
*/
public function getStoreId()
{
return $this->storeManager->getStore()->getId();
}
}
Loading

0 comments on commit 92e601c

Please sign in to comment.