Skip to content

Commit 773e33a

Browse files
committed
MAGETWO-58409: Checkout Flow Improvements
Merge branch 'develop' of github.com:magento/magento2ce into sprint20
2 parents 26ddbdf + 67c29c6 commit 773e33a

File tree

717 files changed

+21076
-3523
lines changed

Some content is hidden

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

717 files changed

+21076
-3523
lines changed

app/code/Magento/Backend/Block/Widget/Form/Container.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class Container extends \Magento\Backend\Block\Widget\Container
3737
* @var string
3838
*/
3939
protected $_blockGroup = 'Magento_Backend';
40+
41+
/**
42+
* @var string
43+
*/
44+
const PARAM_BLOCK_GROUP = 'block_group';
45+
46+
/**
47+
* @var string
48+
*/
49+
const PARAM_MODE = 'mode';
4050

4151
/**
4252
* @var string
@@ -49,6 +59,12 @@ class Container extends \Magento\Backend\Block\Widget\Container
4959
protected function _construct()
5060
{
5161
parent::_construct();
62+
if ($this->hasData(self::PARAM_BLOCK_GROUP)) {
63+
$this->_blockGroup = $this->_getData(self::PARAM_BLOCK_GROUP);
64+
}
65+
if ($this->hasData(self::PARAM_MODE)) {
66+
$this->_mode = $this->_getData(self::PARAM_MODE);
67+
}
5268

5369
$this->addButton(
5470
'back',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
<resource>Magento_Config::config_general</resource>
199199
<group id="country" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
200200
<label>Country Options</label>
201-
<field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
201+
<field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
202202
<label>Allow Countries</label>
203203
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
204204
<can_be_empty>1</can_be_empty>

app/code/Magento/Backend/view/adminhtml/templates/system/shipping/applicable_country.phtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ CountryModel.prototype = {
6161
if (applyCountryElement && applyCountryElement.id) {
6262
var specifCountryElement = $(applyCountryElement.id.replace(/sallowspecific/, 'specificcountry'));
6363
var showMethodElement = $(applyCountryElement.id.replace(/sallowspecific/, 'showmethod'));
64+
// 'Use Default' checkbox of the related county list UI element
65+
var useDefaultElement = document.getElementById(specifCountryElement.id + '_inherit');
66+
6467
//var specifErrMsgElement = $(applyCountryElement.id.replace(/sallowspecific/, 'specificerrmsg'));
6568
if (specifCountryElement) {
6669
if (applyCountryElement.value == 1) {
67-
//if specific country element selected
68-
specifCountryElement.enable();
70+
// enable related country select only if its 'Use Default' checkbox is absent or is unchecked
71+
specifCountryElement.disabled = useDefaultElement ? useDefaultElement.checked : false;
6972
if (showMethodElement) {
7073
this.showElement(showMethodElement.up(1));
7174
}

app/code/Magento/Braintree/Helper/Country.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
namespace Magento\Braintree\Helper;
77

88
use Magento\Directory\Model\ResourceModel\Country\CollectionFactory;
9+
use Magento\Braintree\Model\Adminhtml\System\Config\Country as CountryConfig;
910

1011
/**
1112
* Class Country
1213
*/
1314
class Country
1415
{
1516
/**
16-
* @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory
17+
* @var CollectionFactory
1718
*/
1819
private $collectionFactory;
1920

2021
/**
21-
* @var \Magento\Braintree\Model\Adminhtml\System\Config\Country
22+
* @var CountryConfig
2223
*/
2324
private $countryConfig;
2425

@@ -28,13 +29,11 @@ class Country
2829
private $countries;
2930

3031
/**
31-
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $factory
32-
* @param \Magento\Braintree\Model\Adminhtml\System\Config\Country $countryConfig
32+
* @param CollectionFactory $factory
33+
* @param CountryConfig $countryConfig
3334
*/
34-
public function __construct(
35-
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $factory,
36-
\Magento\Braintree\Model\Adminhtml\System\Config\Country $countryConfig
37-
) {
35+
public function __construct(CollectionFactory $factory, CountryConfig $countryConfig)
36+
{
3837
$this->collectionFactory = $factory;
3938
$this->countryConfig = $countryConfig;
4039
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</requires>
3434
</field>
3535
<field id="braintree_cc_vault_active" translate="label" type="select" sortOrder="12" showInDefault="1" showInWebsite="1" showInStore="0">
36-
<label>Vault enabled</label>
36+
<label>Vault Enabled</label>
3737
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3838
<config_path>payment/braintree_cc_vault/active</config_path>
3939
<requires>
@@ -155,7 +155,7 @@
155155
<comment>It is recommended to set this value to "PayPal" per store views.</comment>
156156
</field>
157157
<field id="braintree_paypal_vault_active" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="0">
158-
<label>Vault enabled</label>
158+
<label>Vault Enabled</label>
159159
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
160160
<config_path>payment/braintree_paypal_vault/active</config_path>
161161
<requires>

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<argument name="code" xsi:type="const">Magento\Braintree\Model\Ui\PayPal\ConfigProvider::PAYPAL_CODE</argument>
2323
<argument name="infoBlockType" xsi:type="string">BraintreePayPalInfo</argument>
2424
<argument name="valueHandlerPool" xsi:type="object">BraintreePayPalValueHandlerPool</argument>
25+
<argument name="validatorPool" xsi:type="object">BraintreePayPalValidatorPool</argument>
2526
<argument name="commandPool" xsi:type="object">BraintreePayPalCommandPool</argument>
2627
</arguments>
2728
</virtualType>
@@ -474,7 +475,7 @@
474475
</arguments>
475476
</virtualType>
476477

477-
<!-- Value validators infrastructure -->
478+
<!-- Braintree validators infrastructure -->
478479
<virtualType name="BraintreeCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
479480
<arguments>
480481
<argument name="config" xsi:type="object">Magento\Braintree\Gateway\Config\Config</argument>
@@ -487,6 +488,22 @@
487488
</argument>
488489
</arguments>
489490
</virtualType>
491+
<!-- Braintree validators infrastructure -->
492+
493+
<!-- Braintree PayPal validators -->
494+
<virtualType name="BraintreePayPalCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
495+
<arguments>
496+
<argument name="config" xsi:type="object">Magento\Braintree\Gateway\Config\PayPal\Config</argument>
497+
</arguments>
498+
</virtualType>
499+
<virtualType name="BraintreePayPalValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
500+
<arguments>
501+
<argument name="validators" xsi:type="array">
502+
<item name="country" xsi:type="string">BraintreePayPalCountryValidator</item>
503+
</argument>
504+
</arguments>
505+
</virtualType>
506+
<!-- END Braintree PayPal validators -->
490507

491508
<type name="Magento\Braintree\Block\Info">
492509
<arguments>

app/code/Magento/Braintree/view/adminhtml/web/styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
.braintree-section .heading {display: inline-block; background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
7-
.braintree-section .button-container {display: inline-block; float: right;}
6+
.braintree-section .heading {background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
7+
.braintree-section .button-container {float: right;}
88
.braintree-section .config-alt {background: url("images/braintree_allinone.png") no-repeat scroll 0 0 / 100% auto; height: 28px; margin: 0.5rem 0 0; width: 230px;}

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@ define([
1212
'Magento_Checkout/js/model/quote',
1313
'Magento_Checkout/js/model/full-screen-loader',
1414
'Magento_Checkout/js/model/payment/additional-validators',
15-
'Magento_Vault/js/view/payment/vault-enabler'
16-
], function ($, _, Component, Braintree, quote, fullScreenLoader, additionalValidators, VaultEnabler) {
15+
'Magento_Vault/js/view/payment/vault-enabler',
16+
'Magento_Checkout/js/action/create-billing-address'
17+
], function (
18+
$,
19+
_,
20+
Component,
21+
Braintree,
22+
quote,
23+
fullScreenLoader,
24+
additionalValidators,
25+
VaultEnabler,
26+
createBillingAddress
27+
) {
1728
'use strict';
1829

1930
return Component.extend({
@@ -172,14 +183,16 @@ define([
172183
var billingAddress = {
173184
street: [address.streetAddress],
174185
city: address.locality,
175-
regionCode: address.region,
176186
postcode: address.postalCode,
177187
countryId: address.countryCodeAlpha2,
188+
email: customer.email,
178189
firstname: customer.firstName,
179190
lastname: customer.lastName,
180191
telephone: customer.phone
181192
};
182193

194+
billingAddress['region_code'] = address.region;
195+
billingAddress = createBillingAddress(billingAddress);
183196
quote.billingAddress(billingAddress);
184197
},
185198

app/code/Magento/Braintree/view/frontend/web/template/payment/form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
<input type="checkbox"
110110
name="vault[is_enabled]"
111111
class="checkbox"
112-
data-bind="attr: {'id': getCode() + '_vault_enabler'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
113-
<label class="label" data-bind="attr: {'for': getCode() + '_vault_enabler'}">
112+
data-bind="attr: {'id': getCode() + '_enable_vault'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
113+
<label class="label" data-bind="attr: {'for': getCode() + '_enable_vault'}">
114114
<span><!-- ko i18n: 'Save for later use.'--><!-- /ko --></span>
115115
</label>
116116
<div class="field-tooltip toggle">

app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<input type="checkbox"
3333
name="vault[is_enabled]"
3434
class="checkbox"
35-
data-bind="attr: {'id': getCode() + '_vault_enabler'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
36-
<label class="label" data-bind="attr: {'for': getCode() + '_vault_enabler'}">
35+
data-bind="attr: {'id': getCode() + '_enable_vault'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
36+
<label class="label" data-bind="attr: {'for': getCode() + '_enable_vault'}">
3737
<span><!-- ko i18n: 'Save for later use.'--><!-- /ko --></span>
3838
</label>
3939
<div class="field-tooltip toggle">

0 commit comments

Comments
 (0)