Skip to content

Commit 6af7f78

Browse files
authored
Merge pull request #436 from magento-troll/sprint20
[EPAM] Sprint20
2 parents 67c29c6 + 773e33a commit 6af7f78

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/code/Magento/Quote/Model/Quote/Payment.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class Payment extends \Magento\Payment\Model\Info implements PaymentInterface
6060
*/
6161
protected $methodSpecificationFactory;
6262

63+
/**
64+
* @var array
65+
*/
66+
private $additionalChecks;
67+
6368
/**
6469
* @param \Magento\Framework\Model\Context $context
6570
* @param \Magento\Framework\Registry $registry
@@ -71,6 +76,7 @@ class Payment extends \Magento\Payment\Model\Info implements PaymentInterface
7176
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
7277
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
7378
* @param array $data
79+
* @param array $additionalChecks
7480
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7581
*/
7682
public function __construct(
@@ -83,9 +89,11 @@ public function __construct(
8389
\Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory,
8490
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
8591
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
86-
array $data = []
92+
array $data = [],
93+
array $additionalChecks = []
8794
) {
8895
$this->methodSpecificationFactory = $methodSpecificationFactory;
96+
$this->additionalChecks = $additionalChecks;
8997
parent::__construct(
9098
$context,
9199
$registry,
@@ -162,7 +170,8 @@ public function importData(array $data)
162170
*/
163171
$quote->collectTotals();
164172

165-
$methodSpecification = $this->methodSpecificationFactory->create($data->getChecks());
173+
$checks = array_merge($data->getChecks(), $this->additionalChecks);
174+
$methodSpecification = $this->methodSpecificationFactory->create($checks);
166175
if (!$method->isAvailable($quote) || !$methodSpecification->isApplicable($method, $quote)) {
167176
throw new \Magento\Framework\Exception\LocalizedException(
168177
__('The requested Payment Method is not available.')

0 commit comments

Comments
 (0)