Skip to content

Commit 798a842

Browse files
committed
Merge pull request #425 from magento-mpi/MAGETWO-49845
[MPI] Update Braintree module
2 parents f278923 + 4f3e5fc commit 798a842

File tree

347 files changed

+1899
-21088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

347 files changed

+1899
-21088
lines changed

app/code/Magento/BraintreeTwo/Block/Adminhtml/Form/Field/CcTypes.php renamed to app/code/Magento/Braintree/Block/Adminhtml/Form/Field/CcTypes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
6+
namespace Magento\Braintree\Block\Adminhtml\Form\Field;
77

8-
use Magento\BraintreeTwo\Helper\CcType;
8+
use Magento\Braintree\Helper\CcType;
99
use Magento\Framework\View\Element\Context;
1010
use Magento\Framework\View\Element\Html\Select;
1111

app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Cctypes.php

Lines changed: 0 additions & 80 deletions
This file was deleted.

app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countries.php

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,42 @@
55
*/
66
namespace Magento\Braintree\Block\Adminhtml\Form\Field;
77

8-
class Countries extends \Magento\Framework\View\Element\Html\Select
9-
{
10-
/**
11-
* Countries cache
12-
*
13-
* @var array
14-
*/
15-
protected $countries;
16-
17-
/**
18-
* @var \Magento\Braintree\Model\System\Config\Source\Country
19-
*/
20-
protected $countrySource;
8+
use Magento\Braintree\Helper\Country;
9+
use Magento\Framework\View\Element\Context;
10+
use Magento\Framework\View\Element\Html\Select;
2111

12+
/**
13+
* Class Countries
14+
*/
15+
class Countries extends Select
16+
{
2217
/**
23-
* @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory
18+
* @var Country
2419
*/
25-
protected $countryCollectionFactory;
20+
private $countryHelper;
2621

2722
/**
2823
* Constructor
2924
*
30-
* @param \Magento\Framework\View\Element\Context $context
31-
* @param \Magento\Braintree\Model\System\Config\Source\Country $countrySource
32-
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
25+
* @param Context $context
26+
* @param Country $countryHelper
3327
* @param array $data
3428
*/
35-
public function __construct(
36-
\Magento\Framework\View\Element\Context $context,
37-
\Magento\Braintree\Model\System\Config\Source\Country $countrySource,
38-
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
39-
array $data = []
40-
) {
41-
parent::__construct($context, $data);
42-
$this->countrySource = $countrySource;
43-
$this->countryCollectionFactory = $countryCollectionFactory;
44-
}
45-
46-
/**
47-
* Returns countries array
48-
*
49-
* @return array
50-
*/
51-
protected function _getCountries()
29+
public function __construct(Context $context, Country $countryHelper, array $data = [])
5230
{
53-
if (!$this->countries) {
54-
$restrictedCountries = $this->countrySource->getRestrictedCountries();
55-
$this->countries = $this->countryCollectionFactory->create()
56-
->addFieldToFilter('country_id', ['nin' => $restrictedCountries])
57-
->loadData()
58-
->toOptionArray(false);
59-
}
60-
return $this->countries;
31+
parent::__construct($context, $data);
32+
$this->countryHelper = $countryHelper;
6133
}
6234

6335
/**
6436
* Render block HTML
6537
*
6638
* @return string
6739
*/
68-
public function _toHtml()
40+
protected function _toHtml()
6941
{
7042
if (!$this->getOptions()) {
71-
foreach ($this->_getCountries() as $country) {
72-
if (isset($country['value']) && $country['value'] && isset($country['label']) && $country['label']) {
73-
$this->addOption($country['value'], $country['label']);
74-
}
75-
}
43+
$this->setOptions($this->countryHelper->getCountries());
7644
}
7745
return parent::_toHtml();
7846
}

app/code/Magento/BraintreeTwo/Block/Adminhtml/Form/Field/CountryCreditCard.php renamed to app/code/Magento/Braintree/Block/Adminhtml/Form/Field/CountryCreditCard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
6+
namespace Magento\Braintree\Block\Adminhtml\Form\Field;
77

88
use Magento\Framework\DataObject;
99
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;

app/code/Magento/Braintree/Block/Adminhtml/Form/Field/Countrycreditcard.php

Lines changed: 0 additions & 104 deletions
This file was deleted.

app/code/Magento/Braintree/Block/Checkout/Review.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)