Skip to content

Commit

Permalink
Merge pull request #425 from magento-mpi/MAGETWO-49845
Browse files Browse the repository at this point in the history
[MPI] Update Braintree module
  • Loading branch information
dkvashninbay committed Mar 15, 2016
2 parents f278923 + 4f3e5fc commit 798a842
Show file tree
Hide file tree
Showing 347 changed files with 1,899 additions and 21,088 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
namespace Magento\Braintree\Block\Adminhtml\Form\Field;

use Magento\BraintreeTwo\Helper\CcType;
use Magento\Braintree\Helper\CcType;
use Magento\Framework\View\Element\Context;
use Magento\Framework\View\Element\Html\Select;

Expand Down
80 changes: 0 additions & 80 deletions app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Cctypes.php

This file was deleted.

66 changes: 17 additions & 49 deletions app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,42 @@
*/
namespace Magento\Braintree\Block\Adminhtml\Form\Field;

class Countries extends \Magento\Framework\View\Element\Html\Select
{
/**
* Countries cache
*
* @var array
*/
protected $countries;

/**
* @var \Magento\Braintree\Model\System\Config\Source\Country
*/
protected $countrySource;
use Magento\Braintree\Helper\Country;
use Magento\Framework\View\Element\Context;
use Magento\Framework\View\Element\Html\Select;

/**
* Class Countries
*/
class Countries extends Select
{
/**
* @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory
* @var Country
*/
protected $countryCollectionFactory;
private $countryHelper;

/**
* Constructor
*
* @param \Magento\Framework\View\Element\Context $context
* @param \Magento\Braintree\Model\System\Config\Source\Country $countrySource
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
* @param Context $context
* @param Country $countryHelper
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Context $context,
\Magento\Braintree\Model\System\Config\Source\Country $countrySource,
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
array $data = []
) {
parent::__construct($context, $data);
$this->countrySource = $countrySource;
$this->countryCollectionFactory = $countryCollectionFactory;
}

/**
* Returns countries array
*
* @return array
*/
protected function _getCountries()
public function __construct(Context $context, Country $countryHelper, array $data = [])
{
if (!$this->countries) {
$restrictedCountries = $this->countrySource->getRestrictedCountries();
$this->countries = $this->countryCollectionFactory->create()
->addFieldToFilter('country_id', ['nin' => $restrictedCountries])
->loadData()
->toOptionArray(false);
}
return $this->countries;
parent::__construct($context, $data);
$this->countryHelper = $countryHelper;
}

/**
* Render block HTML
*
* @return string
*/
public function _toHtml()
protected function _toHtml()
{
if (!$this->getOptions()) {
foreach ($this->_getCountries() as $country) {
if (isset($country['value']) && $country['value'] && isset($country['label']) && $country['label']) {
$this->addOption($country['value'], $country['label']);
}
}
$this->setOptions($this->countryHelper->getCountries());
}
return parent::_toHtml();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
namespace Magento\Braintree\Block\Adminhtml\Form\Field;

use Magento\Framework\DataObject;
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
Expand Down

This file was deleted.

33 changes: 0 additions & 33 deletions app/code/Magento/Braintree/Block/Checkout/Review.php

This file was deleted.

Loading

0 comments on commit 798a842

Please sign in to comment.