Skip to content

Commit 404e8b3

Browse files
author
Mac
committed
Merge remote-tracking branch 'remotes/github/MAGETWO-96432' into EPAM-PR-32
2 parents b8e3a0b + 62c5acc commit 404e8b3

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

app/code/Magento/Payment/Helper/Data.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public function __construct(
8484
}
8585

8686
/**
87+
* Get config name of method model
88+
*
8789
* @param string $code
8890
* @return string
8991
*/

app/code/Magento/Payment/Ui/Component/Listing/Column/Method/Options.php

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Payment\Ui\Component\Listing\Column\Method;
77

8+
use Magento\Payment\Api\PaymentMethodListInterface;
9+
use Magento\Store\Model\StoreManagerInterface;
10+
811
/**
912
* Class Options
1013
*/
@@ -20,14 +23,29 @@ class Options implements \Magento\Framework\Data\OptionSourceInterface
2023
*/
2124
protected $paymentHelper;
2225

26+
/**
27+
* @var PaymentMethodListInterface
28+
*/
29+
private $paymentMethodList;
30+
31+
/**
32+
* @var StoreManagerInterface
33+
*/
34+
private $storeManager;
35+
2336
/**
2437
* Constructor
2538
*
2639
* @param \Magento\Payment\Helper\Data $paymentHelper
2740
*/
28-
public function __construct(\Magento\Payment\Helper\Data $paymentHelper)
29-
{
41+
public function __construct(
42+
\Magento\Payment\Helper\Data $paymentHelper,
43+
\Magento\Payment\Api\PaymentMethodListInterface $paymentMethodList,
44+
\Magento\Store\Model\StoreManagerInterface $storeManager
45+
) {
3046
$this->paymentHelper = $paymentHelper;
47+
$this->paymentMethodList = $paymentMethodList;
48+
$this->storeManager = $storeManager;
3149
}
3250

3351
/**
@@ -38,8 +56,23 @@ public function __construct(\Magento\Payment\Helper\Data $paymentHelper)
3856
public function toOptionArray()
3957
{
4058
if ($this->options === null) {
41-
$this->options = $this->paymentHelper->getPaymentMethodList(true, true);
59+
$this->options = $this->getPaymentOptions();
60+
// $this->options = $this->paymentHelper->getPaymentMethodList(true, true);
4261
}
4362
return $this->options;
4463
}
64+
65+
/**
66+
* @return array
67+
* @throws \Magento\Framework\Exception\NoSuchEntityException
68+
*/
69+
private function getPaymentOptions()
70+
{
71+
$options = [];
72+
foreach ($this->paymentMethodList->getList($this->storeManager->getStore()->getId()) as $option) {
73+
$options[$option->getCode()] = ['value' => $option->getCode(), 'label' => $option->getTitle()];
74+
}
75+
asort($options);
76+
return $options;
77+
}
4578
}

0 commit comments

Comments
 (0)