Closed
Description
Steps to reproduce
- Enable Braintree
- run the functions getActiveMethods from vendor/magento/module-payment/Model/Config.php in somewhere
Expected result
- Show list of active payment methods
Actual result
- Exception Call to undefined method Magento\Payment\Model\Method\Adapter::setId() in vendor/magento/module-payment/Model/Config.php on line 98
when $data['model'] is BraintreeFacade
$methodModel = $this->_paymentMethodFactory->create($data['model']);
$methodModel->setId($code);
The factory can't create the model and then the following setId fails
Example code (put in magento/test/test.php):
<?php
require '../app/bootstrap.php';
class TestApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
public function __construct(
\Magento\Framework\ObjectManagerInterface $objectManager,
\Magento\Payment\Model\Config $paymentConfig,
\Magento\Framework\App\Response\Http $response,
\Magento\Framework\App\ResourceConnection $resource
) {
$this->_objectManager = $objectManager;
$this->_paymentConfig = $paymentConfig;
$this->_response = $response;
$this->_resource = $resource;
}
public function launch()
{
$state = $this->_objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('adminhtml');
$payments = $this->_paymentConfig->getActiveMethods();
print_r($payments);
return $this->_response;
}
public function catchException(Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
{
print_r($exception->getTraceAsString());
return false;
}
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication('TestApp');
error_reporting(E_ALL);
ini_set("display_error", 1);
$bootstrap->run($app);