Skip to content

Commit 5170797

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/develop' into MAGETWO-36791-permission
2 parents b153469 + 3630d32 commit 5170797

File tree

435 files changed

+12958
-5879
lines changed

Some content is hidden

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

435 files changed

+12958
-5879
lines changed

app/code/Magento/Backend/Block/System/Design/Edit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function _prepareLayout()
6464
'Magento\Backend\Block\Widget\Button',
6565
[
6666
'label' => __('Delete'),
67-
'onclick' => 'confirmSetLocation(\'' . __(
67+
'onclick' => 'deleteConfirm(\'' . __(
6868
'Are you sure?'
6969
) . '\', \'' . $this->getDeleteUrl() . '\')',
7070
'class' => 'delete'

app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ $numColumns = sizeof($block->getColumns());
120120
<?php endif ?>
121121
</div>
122122
</div>
123-
<div class="admin__data-grid-wrap">
123+
<div class="admin__data-grid-wrap admin__data-grid-wrap-static">
124124
<?php if ($block->getGridCssClass()): ?>
125125
<table class="<?php echo $block->getGridCssClass() ?> data-grid" id="<?php echo $block->getId() ?>_table">
126126
<!-- Rendering column set -->

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ $numColumns = sizeof($block->getColumns());
132132
</div>
133133
<?php endif; ?>
134134

135-
<div class="admin__data-grid-wrap">
135+
<div class="admin__data-grid-wrap admin__data-grid-wrap-static">
136136
<table class="data-grid" id="<?php echo $block->getId() ?>_table">
137137
<?php
138138
/* This part is commented to remove all <col> tags from the code. */

app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123

124124
<div class="field required">
125125
<label for="password" class="label"><span><?php echo __('User Password')?></span></label>
126-
<div class="control"><input type="password" name="password" id="password" class="required-entry"></div>
126+
<div class="control"><input type="password" name="password" id="password" class="required-entry" autocomplete="off"></div>
127127
</div>
128128

129129
<div class="field maintenance-checkbox-container">
@@ -149,7 +149,7 @@
149149
</div>
150150
<div class="field required">
151151
<label for="ftp_pass"><span><?php echo __('FTP Password') ?></span></label>
152-
<div class="control"><input type="password" name="ftp_pass" id="ftp_pass"></div>
152+
<div class="control"><input type="password" name="ftp_pass" id="ftp_pass" autocomplete="off"></div>
153153
</div>
154154
<div class="field">
155155
<label for="ftp_path"><span><?php echo __('Magento root directory') ?></span></label>

app/code/Magento/Braintree/Model/Adapter/BraintreeClientToken.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ class BraintreeClientToken
1818
{
1919
/**
2020
* @param array $params
21-
* @return \Braintree_Result_Successful|\Braintree_Result_Error
21+
* @return \Braintree_Result_Successful|\Braintree_Result_Error|null
2222
*/
2323
public function generate(array $params = [])
2424
{
25-
return \Braintree_ClientToken::generate($params);
25+
try {
26+
return \Braintree_ClientToken::generate($params);
27+
} catch (\Exception $e) {
28+
return null;
29+
}
2630
}
2731
}

app/code/Magento/Braintree/Model/ConfigProvider/PayPal.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class PayPal implements ConfigProviderInterface
3232
* @var \Magento\Framework\Locale\ResolverInterface
3333
*/
3434
protected $localeResolver;
35+
3536
/**
3637
* @param PayPalConfig $config
3738
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver

app/code/Magento/Braintree/Model/Observer.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Braintree\Model;
77

8-
use Magento\Braintree\Model\Config\PayPal as PayPalConfig;
98

109
class Observer
1110
{
@@ -170,4 +169,17 @@ public function addPaypalShortcuts(\Magento\Framework\Event\Observer $observer)
170169
);
171170
$shortcutButtons->addShortcut($shortcut);
172171
}
172+
173+
/**
174+
* @param \Magento\Framework\Event\Observer $observer
175+
* @return void
176+
*/
177+
public function processBraintreeAddress(\Magento\Framework\Event\Observer $observer)
178+
{
179+
/** @var \Magento\Quote\Model\Quote $quote */
180+
$quote = $observer->getEvent()->getQuote();
181+
if ($quote->getPayment()->getMethod() === \Magento\Braintree\Model\PaymentMethod\PayPal:: METHOD_CODE) {
182+
$quote->getBillingAddress()->setShouldIgnoreValidation(true);
183+
}
184+
}
173185
}

app/code/Magento/Braintree/Model/PaymentMethod.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ public function cancel(InfoInterface $payment)
816816
* @param \Magento\Quote\Api\Data\CartInterface|null $quote
817817
* @return bool
818818
*/
819-
public function isAvailable($quote = null)
819+
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
820820
{
821821
if (parent::isAvailable($quote)) {
822822
if ($quote != null) {

app/code/Magento/Braintree/Model/PaymentMethod/PayPal.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function validate()
181181
* @param \Magento\Quote\Api\Data\CartInterface|null $quote
182182
* @return bool
183183
*/
184-
public function isAvailable($quote = null)
184+
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
185185
{
186186
return $this->isActive($quote ? $quote->getStoreId() : null);
187187
}

app/code/Magento/Braintree/Test/Unit/Model/ObserverTest.php

+44
Original file line numberDiff line numberDiff line change
@@ -507,4 +507,48 @@ public function testAddPaypalShortcutsSkipProductView()
507507
->method('getLayout');
508508
$this->model->addPaypalShortcuts($observer);
509509
}
510+
511+
public function testProcessBraintreeAddressIfPaymentIsBraintree()
512+
{
513+
$billingAddressMock = $this->getMock(
514+
'Magento\Quote\Model\Quote\Address',
515+
['setShouldIgnoreValidation'],
516+
[],
517+
'',
518+
false
519+
);
520+
$eventMock = $this->getMock('Magento\Framework\Event', ['getQuote'], [], '', false);
521+
$observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false);
522+
$observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
523+
$quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false);
524+
$eventMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
525+
$paymentMock = $this->getMock('Magento\Quote\Model\Quote\Payment', [], [], '', false);
526+
$quoteMock->expects($this->once())->method('getPayment')->willReturn($paymentMock);
527+
$paymentMock
528+
->expects($this->once())
529+
->method('getMethod')
530+
->willReturn(\Magento\Braintree\Model\PaymentMethod\PayPal:: METHOD_CODE);
531+
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($billingAddressMock);
532+
$billingAddressMock->expects($this->once())->method('setShouldIgnoreValidation')->with(true);
533+
$this->model->processBraintreeAddress($observerMock);
534+
535+
}
536+
537+
public function testProcessBraintreeAddressIfPaymentIsNotBraintree()
538+
{
539+
$eventMock = $this->getMock('Magento\Framework\Event', ['getQuote'], [], '', false);
540+
$observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false);
541+
$observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
542+
$quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false);
543+
$eventMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
544+
$paymentMock = $this->getMock('Magento\Quote\Model\Quote\Payment', [], [], '', false);
545+
$quoteMock->expects($this->once())->method('getPayment')->willReturn($paymentMock);
546+
$paymentMock
547+
->expects($this->once())
548+
->method('getMethod')
549+
->willReturn('checkmo');
550+
$quoteMock->expects($this->never())->method('getBillingAddress');
551+
$this->model->processBraintreeAddress($observerMock);
552+
553+
}
510554
}

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

+21-15
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,26 @@
1818
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
1919
<comment><![CDATA[<a href="https://www.braintreegateway.com/login" target="_blank">Click here to login to your existing Braintree account</a>. Or to setup a new account and accept payments on your website, <a href="https://apply.braintreegateway.com/signup/us" target="_blank">click here to signup for a Braintree account</a>.]]></comment>
2020
<attribute type="activity_path">payment/braintree/active</attribute>
21+
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
22+
<label>Enabled Braintree</label>
23+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
24+
<config_path>payment/braintree/active</config_path>
25+
<requires>
26+
<group id="braintree_required"/>
27+
</requires>
28+
</field>
29+
<field id="active_braintree_pay_pal" translate="label" type="select" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="0">
30+
<label>Enabled PayPal through Braintree</label>
31+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
32+
<config_path>payment/braintree_paypal/active</config_path>
33+
<requires>
34+
<group id="braintree_required"/>
35+
</requires>
36+
</field>
2137
<group id="braintree_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="5">
2238
<label>Basic Braintree Settings</label>
2339
<attribute type="expanded">1</attribute>
2440
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
25-
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
26-
<label>Enabled</label>
27-
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
28-
<config_path>payment/braintree/active</config_path>
29-
</field>
3041
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
3142
<label>Title</label>
3243
<config_path>payment/braintree/title</config_path>
@@ -59,11 +70,6 @@
5970
<config_path>payment/braintree/private_key</config_path>
6071
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
6172
</field>
62-
<field id="sort_order" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="0">
63-
<label>Sort Order</label>
64-
<frontend_class>validate-number</frontend_class>
65-
<config_path>payment/braintree/sort_order</config_path>
66-
</field>
6773
</group>
6874
<group id="braintree_advanced" translate="label" showInDefault="1" showInWebsite="1" sortOrder="20">
6975
<label>Advanced Braintree Settings</label>
@@ -128,6 +134,11 @@
128134
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
129135
<config_path>payment/braintree/usecache</config_path>
130136
</field>
137+
<field id="sort_order" translate="label" type="text" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="0">
138+
<label>Sort Order</label>
139+
<frontend_class>validate-number</frontend_class>
140+
<config_path>payment/braintree/sort_order</config_path>
141+
</field>
131142
</group>
132143
<group id="braintree_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="30">
133144
<label>Country Specific Settings</label>
@@ -153,11 +164,6 @@
153164
<group id="braintree_paypal" translate="label" showInDefault="1" showInWebsite="1" sortOrder="40">
154165
<label>PayPal through Braintree</label>
155166
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
156-
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
157-
<label>Enabled</label>
158-
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
159-
<config_path>payment/braintree_paypal/active</config_path>
160-
</field>
161167
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
162168
<label>Title</label>
163169
<config_path>payment/braintree_paypal/title</config_path>

app/code/Magento/Braintree/etc/events.xml

+3
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212
<event name="customer_delete_commit_after">
1313
<observer name="braintree" instance="Magento\Braintree\Model\Observer" method="deleteBraintreeCustomer" />
1414
</event>
15+
<event name="checkout_submit_before">
16+
<observer name="braintree" instance="Magento\Braintree\Model\Observer" method="processBraintreeAddress" />
17+
</event>
1518
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../Customer/etc/sections.xsd">
10+
<action name="braintree/paypal/placeOrder">
11+
<section name="cart"/>
12+
<section name="checkout-data"/>
13+
</action>
14+
</config>

app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml

+4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
<block class="Magento\Framework\View\Element\Js\Components" name="paypal_express_review_checkout_head_components" template="Magento_Checkout::js/components.phtml"/>
1313
<block class="Magento\Framework\View\Element\Js\Components" name="paypal_express_review_head_components" template="Magento_Paypal::js/components.phtml"/>
1414
</referenceBlock>
15+
<referenceContainer name="page.messages">
16+
<block class="Magento\Paypal\Block\Cart\ValidationMessages" name="paypal.cart.validationmessages"/>
17+
</referenceContainer>
1518
<referenceContainer name="content">
1619
<block class="Magento\Braintree\Block\Checkout\Review" name="braintree.paypal.review" template="Magento_Paypal::express/review.phtml">
1720
<block class="Magento\Paypal\Block\Express\Review" name="express.review.shipping.method" as="shipping_method" template="express/review/shipping/method.phtml"/>
21+
<block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions"/>
1822
<block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="express/review/details.phtml">
1923
<block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
2024
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>

app/code/Magento/Braintree/view/frontend/layout/checkout_index_index.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
3131
</item>
3232
<item name="braintree_paypal" xsi:type="array">
33-
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
33+
<item name="isBillingAddressRequired" xsi:type="boolean">false</item>
3434
</item>
3535
</item>
3636
</item>

app/code/Magento/Braintree/view/frontend/templates/PayPal/shortcut.phtml

+10-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ $paymentMethodNonceId = $block->getPaymentMethodNonceId();
1818
$paymentDetailsId = $block->getPaymentDetailsId();
1919
$labelPosition = $block->getShowOrPosition();
2020
?>
21-
<div data-label="or" class="paypal checkout <?php echo $labelPosition ?> paypal-logo">
22-
23-
<fieldset class="fieldset paypal items" id="braintree_paypal_shortcut">
24-
<div id="<?php echo $containerId ?>"></div>
25-
<form id="<?php echo $submitFormId ?>" action="<?php echo $url ?>" method="post" >
26-
<input id="<?php echo $paymentMethodNonceId ?>" type="hidden" name="payment_method_nonce" />
27-
<input id="<?php echo $paymentDetailsId ?>" type="hidden" name="details" />
28-
</form>
29-
</fieldset>
21+
<div data-label="<?php echo $block->escapeHtml(__('or')); ?>"
22+
class="paypal checkout <?php echo $labelPosition ?> paypal-logo"
23+
>
24+
<fieldset class="fieldset paypal items" id="braintree_paypal_shortcut">
25+
<div id="<?php echo $containerId ?>"></div>
26+
<form id="<?php echo $submitFormId ?>" action="<?php echo $url ?>" method="post" >
27+
<input id="<?php echo $paymentMethodNonceId ?>" type="hidden" name="payment_method_nonce" />
28+
<input id="<?php echo $paymentDetailsId ?>" type="hidden" name="details" />
29+
</form>
30+
</fieldset>
3031
</div>
3132

3233
<?php

0 commit comments

Comments
 (0)