Skip to content

Commit 0486d3d

Browse files
author
Alexander Makeev
committed
Merge branch 'PR-MPI-S76' into MAGETWO-31043
Conflicts: app/code/Magento/Paypal/Model/Config.php dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php
2 parents 1baf93d + fe4959c commit 0486d3d

File tree

578 files changed

+24449
-3377
lines changed

Some content is hidden

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

578 files changed

+24449
-3377
lines changed

app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ directPost.prototype = {
2020
var prepare = function (event, method) {
2121
if (method === 'authorizenet_directpost') {
2222
this.preparePayment();
23+
} else {
24+
jQuery('#edit_form')
25+
.off('submitOrder.authorizenet');
2326
}
2427
};
2528
this.iframeId = iframeId;
@@ -76,7 +79,7 @@ directPost.prototype = {
7679
this.changeInputOptions('autocomplete', 'off');
7780
jQuery('#edit_form')
7881
.off('submitOrder')
79-
.on('submitOrder', this.submitAdminOrder.bind(this));
82+
.on('submitOrder.authorizenet', this.submitAdminOrder.bind(this));
8083
if ($(this.iframeId)) {
8184
// Temporary solution will be removed after refactoring Authorize.Net (sales) functionality
8285
jQuery('.scalable.save:not(disabled)').removeAttr('onclick');

app/code/Magento/Backend/App/AbstractAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function __construct(Action\Context $context)
102102
*/
103103
protected function _isAllowed()
104104
{
105-
return $this->_authorization->isAllowed(self::ADMIN_RESOURCE);
105+
return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
106106
}
107107

108108
/**

app/code/Magento/Backend/Model/Locale/Manager.php

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,30 @@ class Manager
2626
* @var \Magento\Framework\TranslateInterface
2727
*/
2828
protected $_translator;
29+
30+
/**
31+
* @var \Magento\Backend\App\ConfigInterface
32+
*/
33+
protected $_backendConfig;
2934

3035
/**
3136
* Constructor
3237
*
3338
* @param \Magento\Backend\Model\Session $session
3439
* @param \Magento\Backend\Model\Auth\Session $authSession
3540
* @param \Magento\Framework\TranslateInterface $translator
41+
* @param \Magento\Backend\App\ConfigInterface $backendConfig
3642
*/
3743
public function __construct(
3844
\Magento\Backend\Model\Session $session,
3945
\Magento\Backend\Model\Auth\Session $authSession,
40-
\Magento\Framework\TranslateInterface $translator
46+
\Magento\Framework\TranslateInterface $translator,
47+
\Magento\Backend\App\ConfigInterface $backendConfig
4148
) {
4249
$this->_session = $session;
4350
$this->_authSession = $authSession;
4451
$this->_translator = $translator;
52+
$this->_backendConfig = $backendConfig;
4553
}
4654

4755
/**
@@ -53,28 +61,40 @@ public function __construct(
5361
public function switchBackendInterfaceLocale($localeCode)
5462
{
5563
$this->_session->setSessionLocale(null);
56-
64+
5765
$this->_authSession->getUser()->setInterfaceLocale($localeCode);
58-
66+
5967
$this->_translator->setLocale($localeCode)->loadData(null, true);
60-
68+
6169
return $this;
6270
}
6371

72+
/**
73+
* Get general interface locale
74+
*
75+
* @return string
76+
*/
77+
public function getGeneralLocale()
78+
{
79+
return $this->_backendConfig->getValue('general/locale/code');
80+
}
81+
6482
/**
6583
* Get user interface locale stored in session data
6684
*
6785
* @return string
6886
*/
6987
public function getUserInterfaceLocale()
7088
{
71-
$interfaceLocale = \Magento\Framework\Locale\Resolver::DEFAULT_LOCALE;
72-
7389
$userData = $this->_authSession->getUser();
90+
$interfaceLocale = \Magento\Framework\Locale\Resolver::DEFAULT_LOCALE;
91+
7492
if ($userData && $userData->getInterfaceLocale()) {
7593
$interfaceLocale = $userData->getInterfaceLocale();
94+
} elseif ($this->getGeneralLocale()) {
95+
$interfaceLocale = $this->getGeneralLocale();
7696
}
77-
97+
7898
return $interfaceLocale;
7999
}
80100
}

app/code/Magento/Backend/Test/Unit/Model/Locale/ManagerTest.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
1515
protected $_model;
1616

1717
/**
18-
* @var \Magento\Framework\TranslateInterface
18+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\TranslateInterface
1919
*/
2020
protected $_translator;
2121

@@ -25,9 +25,14 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
2525
protected $_session;
2626

2727
/**
28-
* @var \Magento\Backend\Model\Auth\Session
28+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Auth\Session
2929
*/
3030
protected $_authSession;
31+
32+
/**
33+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\App\ConfigInterface
34+
*/
35+
protected $_backendConfig;
3136

3237
protected function setUp()
3338
{
@@ -40,7 +45,9 @@ protected function setUp()
4045
'',
4146
false
4247
);
43-
48+
49+
$this->_backendConfig = $this->getMockForAbstractClass('Magento\Backend\App\ConfigInterface', [], '', false);
50+
4451
$userMock = new \Magento\Framework\DataObject();
4552

4653
$this->_authSession->expects($this->any())->method('getUser')->will($this->returnValue($userMock));
@@ -54,7 +61,8 @@ protected function setUp()
5461
$this->_model = new \Magento\Backend\Model\Locale\Manager(
5562
$this->_session,
5663
$this->_authSession,
57-
$this->_translator
64+
$this->_translator,
65+
$this->_backendConfig
5866
);
5967
}
6068

@@ -102,4 +110,17 @@ public function testGetUserInterfaceLocale()
102110

103111
$this->assertEquals($locale, 'de_DE');
104112
}
113+
114+
/**
115+
* @covers \Magento\Backend\Model\Locale\Manager::getUserInterfaceLocale
116+
*/
117+
public function testGetUserInterfaceGeneralLocale()
118+
{
119+
$this->_backendConfig->expects($this->any())
120+
->method('getValue')
121+
->with('general/locale/code')
122+
->willReturn('test_locale');
123+
$locale = $this->_model->getUserInterfaceLocale();
124+
$this->assertEquals($locale, 'test_locale');
125+
}
105126
}

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,16 +414,16 @@
414414
</group>
415415
<group id="security" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0">
416416
<label>Security</label>
417-
<field id="use_form_key" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
417+
<field id="use_form_key" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
418418
<label>Add Secret Key to URLs</label>
419419
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
420420
<backend_model>Magento\Config\Model\Config\Backend\Admin\Usesecretkey</backend_model>
421421
</field>
422-
<field id="use_case_sensitive_login" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
422+
<field id="use_case_sensitive_login" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
423423
<label>Login is Case Sensitive</label>
424424
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
425425
</field>
426-
<field id="session_lifetime" translate="label comment" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
426+
<field id="session_lifetime" translate="label comment" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
427427
<label>Admin Session Lifetime (seconds)</label>
428428
<comment>Values less than 60 are ignored.</comment>
429429
<validate>validate-digits</validate>

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
*/
66
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
77

8+
use Magento\BraintreeTwo\Helper\CcType;
89
use Magento\Framework\View\Element\Context;
910
use Magento\Framework\View\Element\Html\Select;
10-
use Magento\BraintreeTwo\Helper\CcType;
1111

1212
/**
13-
* Class Cctypes
13+
* Class CcTypes
1414
*/
15-
class Cctypes extends Select
15+
class CcTypes extends Select
1616
{
1717
/**
18-
* @var \
18+
* @var CcType
1919
*/
2020
private $ccTypeHelper;
2121

2222
/**
2323
* Constructor
2424
*
25-
* @param \Magento\Framework\View\Element\Context $context
26-
* @param \Magento\BraintreeTwo\Helper\CcType $ccTypeHelper
25+
* @param Context $context
26+
* @param CcType $ccTypeHelper
2727
* @param array $data
2828
*/
2929
public function __construct(

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
class Countries extends Select
1616
{
1717
/**
18-
* @var \Magento\BraintreeTwo\Helper\Country
18+
* @var Country
1919
*/
2020
private $countryHelper;
2121

2222
/**
2323
* Constructor
2424
*
25-
* @param \Magento\Framework\View\Element\Context $context
26-
* @param \Magento\BraintreeTwo\Helper\Country $countryHelper
25+
* @param Context $context
26+
* @param Country $countryHelper
2727
* @param array $data
2828
*/
2929
public function __construct(Context $context, Country $countryHelper, array $data = [])

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
*/
66
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
77

8-
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
98
use Magento\Framework\DataObject;
9+
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
1010

1111
/**
1212
* Class CountryCreditCard
1313
*/
1414
class CountryCreditCard extends AbstractFieldArray
1515
{
1616
/**
17-
* @var \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\Countries
17+
* @var Countries
1818
*/
1919
protected $countryRenderer = null;
2020

2121
/**
22-
* @var \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\CcTypes
22+
* @var CcTypes
2323
*/
2424
protected $ccTypesRenderer = null;
2525

2626
/**
2727
* Returns renderer for country element
2828
*
29-
* @return \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\Countries
29+
* @return Countries
3030
*/
3131
protected function getCountryRenderer()
3232
{
@@ -43,13 +43,13 @@ protected function getCountryRenderer()
4343
/**
4444
* Returns renderer for country element
4545
*
46-
* @return \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\Cctypes
46+
* @return CcTypes
4747
*/
4848
protected function getCcTypesRenderer()
4949
{
5050
if (!$this->ccTypesRenderer) {
5151
$this->ccTypesRenderer = $this->getLayout()->createBlock(
52-
Cctypes::class,
52+
CcTypes::class,
5353
'',
5454
['data' => ['is_render_to_js_template' => true]]
5555
);
@@ -84,7 +84,7 @@ protected function _prepareToRender()
8484
/**
8585
* Prepare existing row data object
8686
*
87-
* @param \Magento\Framework\DataObject $row
87+
* @param DataObject $row
8888
* @return void
8989
*/
9090
protected function _prepareArrayRow(DataObject $row)
@@ -102,6 +102,5 @@ protected function _prepareArrayRow(DataObject $row)
102102
}
103103
}
104104
$row->setData('option_extra_attrs', $options);
105-
return;
106105
}
107106
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\BraintreeTwo\Block\Customer;
7+
8+
use Magento\BraintreeTwo\Model\Ui\ConfigProvider;
9+
use Magento\Framework\View\Element\Template;
10+
use Magento\Vault\Api\Data\PaymentTokenInterface;
11+
use Magento\Vault\Block\AbstractCardRenderer;
12+
13+
class CardRenderer extends AbstractCardRenderer
14+
{
15+
/**
16+
* Can render specified token
17+
*
18+
* @param PaymentTokenInterface $token
19+
* @return boolean
20+
*/
21+
public function canRender(PaymentTokenInterface $token)
22+
{
23+
return $token->getPaymentMethodCode() === ConfigProvider::CODE;
24+
}
25+
26+
/**
27+
* @return string
28+
*/
29+
public function getNumberLast4Digits()
30+
{
31+
return $this->getTokenDetails()['maskedCC'];
32+
}
33+
34+
/**
35+
* @return string
36+
*/
37+
public function getExpDate()
38+
{
39+
return $this->getTokenDetails()['expirationDate'];
40+
}
41+
42+
/**
43+
* @return string
44+
*/
45+
public function getIconUrl()
46+
{
47+
return $this->getIconForType($this->getTokenDetails()['type'])['url'];
48+
}
49+
50+
/**
51+
* @return int
52+
*/
53+
public function getIconHeight()
54+
{
55+
return $this->getIconForType($this->getTokenDetails()['type'])['height'];
56+
}
57+
58+
/**
59+
* @return int
60+
*/
61+
public function getIconWidth()
62+
{
63+
return $this->getIconForType($this->getTokenDetails()['type'])['width'];
64+
}
65+
}

0 commit comments

Comments
 (0)