Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 181987e

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into MAGETWO-91439-Price-prices-disappearing-on-category-page-remove-resolver
2 parents 82783ae + 6c529ec commit 181987e

File tree

128 files changed

+3881
-645
lines changed

Some content is hidden

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

128 files changed

+3881
-645
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<actionGroup name="StorefrontFillCartDataActionGroup">
11+
<arguments>
12+
<argument name="cartData" defaultValue="PaymentAndShippingInfo"/>
13+
</arguments>
14+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.cartFrame}}" stepKey="switchToIframe"/>
15+
<fillField selector="{{BraintreeConfigurationPaymentSection.cartCode}}" userInput="{{cartData.cardNumber}}" stepKey="setCartCode"/>
16+
<switchToIFrame stepKey="switchBack"/>
17+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.monthFrame}}" stepKey="switchToIframe1"/>
18+
<fillField selector="{{BraintreeConfigurationPaymentSection.month}}" userInput="{{cartData.month}}" stepKey="setMonth"/>
19+
<switchToIFrame stepKey="switchBack1"/>
20+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.yearFrame}}" stepKey="switchToIframe2"/>
21+
<fillField selector="{{BraintreeConfigurationPaymentSection.year}}" userInput="{{cartData.year}}" stepKey="setYear"/>
22+
<switchToIFrame stepKey="switchBack2"/>
23+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.codeFrame}}" stepKey="switchToIframe3"/>
24+
<fillField selector="{{BraintreeConfigurationPaymentSection.verificationNumber}}" userInput="{{cartData.cvv}}" stepKey="setVerificationNumber"/>
25+
<switchToIFrame stepKey="SwitchBackToWindow"/>
26+
27+
</actionGroup>
28+
29+
</actionGroups>

app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@
3535
<data key="value">somePrivateKey</data>
3636
</entity>
3737

38+
<entity name="BraintreeConfig" type="braintree_config_state">
39+
<requiredEntity type="title">BraintreeTitle</requiredEntity>
40+
<requiredEntity type="payment_action">PaymentAction</requiredEntity>
41+
<requiredEntity type="environment">Environment</requiredEntity>
42+
<requiredEntity type="merchant_id">MerchantId</requiredEntity>
43+
<requiredEntity type="public_key">PublicKey</requiredEntity>
44+
<requiredEntity type="private_key">PrivateKey</requiredEntity>
45+
</entity>
46+
<entity name="BraintreeTitle" type="title">
47+
<data key="value">Credit Card (Braintree)</data>
48+
</entity>
49+
<entity name="PaymentAction" type="payment_action">
50+
<data key="value">authorize</data>
51+
</entity>
52+
<entity name="Environment" type="environment">
53+
<data key="value">sandbox</data>
54+
</entity>
55+
<entity name="MerchantId" type="merchant_id">
56+
<data key="value">d4pdjhxgjfrsmzbf</data>
57+
</entity>
58+
<entity name="PublicKey" type="public_key">
59+
<data key="value">m7q4wmh43xrgyrst</data>
60+
</entity>
61+
<entity name="PrivateKey" type="private_key">
62+
<data key="value">67de364080b1b4e2492d7a3de413a572</data>
63+
</entity>
64+
3865
<!-- default configuration used to restore Magento config -->
3966
<entity name="DefaultBraintreeConfig" type="braintree_config_state">
4067
<requiredEntity type="title">DefaultTitle</requiredEntity>
@@ -63,6 +90,28 @@
6390
<data key="value"/>
6491
</entity>
6592

93+
<entity name="CustomBraintreeConfigurationData" type="custom_braintree_config_state">
94+
<requiredEntity type="braintree_cc_vault_active">BraintreeValuteActive</requiredEntity>
95+
<requiredEntity type="active">EnableSolution</requiredEntity>
96+
</entity>
97+
<entity name="BraintreeValuteActive" type="braintree_cc_vault_active">
98+
<data key="value">1</data>
99+
</entity>
100+
<entity name="EnableSolution" type="active">
101+
<data key="value">1</data>
102+
</entity>
103+
104+
<entity name="RollBackCustomBraintreeConfigurationData" type="custom_braintree_config_state">
105+
<requiredEntity type="braintree_cc_vault_active">DefaultBraintreeValuteActive</requiredEntity>
106+
<requiredEntity type="active">DefaultEnableSolution</requiredEntity>
107+
</entity>
108+
<entity name="DefaultBraintreeValuteActive" type="braintree_cc_vault_active">
109+
<data key="value">0</data>
110+
</entity>
111+
<entity name="DefaultEnableSolution" type="active">
112+
<data key="value">0</data>
113+
</entity>
114+
66115
<entity name="testData" type="data">
67116
<data key="websiteName" unique="suffix">Website</data>
68117
<data key="websiteCode" unique="suffix">new_website</data>

app/code/Magento/Braintree/Test/Mftf/Metadata/braintree_config-meta.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,22 @@
4242
</object>
4343
</object>
4444
</operation>
45+
<operation name="CustomBraintreeConfigState" dataType="custom_braintree_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST">
46+
<object key="groups" dataType="custom_braintree_config_state">
47+
<object key="braintree_section" dataType="custom_braintree_config_state">
48+
<object key="groups" dataType="custom_braintree_config_state">
49+
<object key="braintree" dataType="custom_braintree_config_state">
50+
<object key="fields" dataType="custom_braintree_config_state">
51+
<object key="braintree_cc_vault_active" dataType="braintree_cc_vault_active">
52+
<field key="value">integer</field>
53+
</object>
54+
<object key="active" dataType="active">
55+
<field key="value">string</field>
56+
</object>
57+
</object>
58+
</object>
59+
</object>
60+
</object>
61+
</object>
62+
</operation>
4563
</operations>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<section name="BraintreeConfigurationPaymentSection">
12+
<element name="creditCart" type="radio" selector="#braintree"/>
13+
<element name="paymentMethod" type="radio" selector="//div[@class='payment-group']//input[contains(@id, 'braintree_cc_vault_')]"/>
14+
<element name="cartFrame" type="iframe" selector="braintree-hosted-field-number"/>
15+
<element name="monthFrame" type="iframe" selector="braintree-hosted-field-expirationMonth"/>
16+
<element name="yearFrame" type="iframe" selector="braintree-hosted-field-expirationYear"/>
17+
<element name="codeFrame" type="iframe" selector="braintree-hosted-field-cvv"/>
18+
<element name="cartCode" type="input" selector="#credit-card-number"/>
19+
<element name="month" type="input" selector="#expiration-month"/>
20+
<element name="year" type="input" selector="#expiration-year"/>
21+
<element name="verificationNumber" type="input" selector="#cvv"/>
22+
</section>
23+
</sections>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="BraintreeCreditCardOnCheckoutTest">
12+
<annotations>
13+
<features value="Braintree"/>
14+
<stories value="MAGETWO-91624 - Braintree saved cards use billing address the same as shipping"/>
15+
<title value="Use saved for Braintree credit card on checkout with selecting billing address"/>
16+
<description value="Use saved for Braintree credit card on checkout with selecting billing address"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MAGETWO-93767"/>
19+
<group value="braintree"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="category"/>
24+
<createData entity="SimpleProduct" stepKey="product">
25+
<requiredEntity createDataKey="category"/>
26+
</createData>
27+
<createData entity="Simple_US_Customer" stepKey="customer"/>
28+
<createData entity="BraintreeConfig" stepKey="BraintreeConfigurationData"/>
29+
<createData entity="CustomBraintreeConfigurationData" stepKey="CustomBraintreeConfigurationData"/>
30+
</before>
31+
32+
<after>
33+
<deleteData createDataKey="product" stepKey="deleteProduct1"/>
34+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
35+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
36+
<createData entity="DefaultBraintreeConfig" stepKey="DefaultBraintreeConfig"/>
37+
<createData entity="RollBackCustomBraintreeConfigurationData" stepKey="RollBackCustomBraintreeConfigurationData"/>
38+
<actionGroup ref="StorefrontSignOutActionGroup" stepKey="StorefrontSignOutActionGroup"/>
39+
</after>
40+
<!--Go to storefront-->
41+
<amOnPage url="" stepKey="DoToStorefront"/>
42+
<!--Create account-->
43+
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUserFromStorefrontActionGroup">
44+
<argument name="Customer" value="Simple_US_Customer"/>
45+
</actionGroup>
46+
47+
<!--Add product to cart-->
48+
<amOnPage url="$$product.sku$$.html" stepKey="goToProductPage"/>
49+
<waitForPageLoad stepKey="waitForPageLoad"/>
50+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/>
51+
<waitForPageLoad stepKey="waitForPageLoad1"/>
52+
<!--Proceed to checkout-->
53+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup"/>
54+
55+
<actionGroup ref="LoggedInCheckoutFillNewBillingAddressActionGroup" stepKey="LoggedInCheckoutFillNewBillingAddressActionGroup">
56+
<argument name="Address" value="US_Address_CA"/>
57+
</actionGroup>
58+
<waitForPageLoad stepKey="waitForPageLoad2"/>
59+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
60+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
61+
<!--Fill cart data-->
62+
<click selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="SelectBraintreePaymentMethod"/>
63+
<waitForPageLoad stepKey="waitForPageLoad3"/>
64+
<actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="StorefrontFillCartDataActionGroup"/>
65+
<waitForPageLoad stepKey="waitForPageLoad4"/>
66+
<!--Place order-->
67+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="PlaceOrder"/>
68+
<waitForPageLoad stepKey="waitForPageLoad5"/>
69+
70+
<!--Add product to cart again-->
71+
<amOnPage url="$$product.sku$$.html" stepKey="goToProductPage1"/>
72+
<waitForPageLoad stepKey="waitForPageLoad6"/>
73+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart1"/>
74+
<waitForPageLoad stepKey="waitForPageLoad7"/>
75+
<!--Proceed to checkout-->
76+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="GoToCheckoutFromMinicartActionGroup1"/>
77+
<click selector="{{CheckoutPaymentSection.addressAction('New Address')}}" stepKey="clickOnNewAddress"/>
78+
<waitForPageLoad stepKey="waitForPageLoad8"/>
79+
<actionGroup ref="LoggedInCheckoutFillNewBillingAddressActionGroup" stepKey="LoggedInCheckoutFillNewBillingAddressActionGroup1">
80+
<argument name="Address" value="US_Address_NY"/>
81+
</actionGroup>
82+
<click selector="{{CheckoutPaymentSection.addressAction('Save Address')}}" stepKey="SaveAddress"/>
83+
<waitForPageLoad stepKey="waitForPageLoad9"/>
84+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext1"/>
85+
<waitForPageLoad stepKey="waitForPageLoad10"/>
86+
<click selector="{{BraintreeConfigurationPaymentSection.paymentMethod}}" stepKey="SelectBraintreePaymentMethod1"/>
87+
<waitForPageLoad stepKey="waitForPageLoad11"/>
88+
<click selector="{{CheckoutPaymentSection.shippingAndBillingAddressSame}}" stepKey="UncheckCheckBox"/>
89+
90+
<click selector="{{CheckoutShippingSection.updateAddress}}" stepKey="clickToUpdate"/>
91+
<waitForPageLoad stepKey="waitForPageLoad12"/>
92+
<!--Place order-->
93+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="PlaceOrder1"/>
94+
<waitForPageLoad stepKey="waitForPageLoad13"/>
95+
96+
<click selector="{{CheckoutOrderSummarySection.orderNumber}}" stepKey="ClickOnOrderNumber"/>
97+
<waitForPageLoad stepKey="waitForPageLoad14"/>
98+
<!--Check billing and shipping addresses also additional Address info-->
99+
<click selector="{{CheckoutPaymentSection.addressBook}}" stepKey="goToAddressBook"/>
100+
<grabTextFrom selector="{{CheckoutOrderSummarySection.shippingAddress}}" stepKey="shippingAddr"/>
101+
<grabTextFrom selector="{{CheckoutOrderSummarySection.billingAddress}}" stepKey="billingAddr"/>
102+
<grabTextFrom selector="{{CheckoutOrderSummarySection.additionalAddress}}" stepKey="additionalAddress"/>
103+
<see userInput="Shipping Address" stepKey="seeShippingAddress"/>
104+
<see userInput="Billing Address" stepKey="seeBillingAddress"/>
105+
<assertEquals stepKey="assertValuesAreEqual" actual="$billingAddr" expected="$shippingAddr"/>
106+
<assertNotEquals stepKey="assertValuesAreNotEqual" actual="$billingAddr" expected="$additionalAddress"/>
107+
</test>
108+
</tests>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
<item name="braintree_paypal" xsi:type="array">
3636
<item name="isBillingAddressRequired" xsi:type="boolean">false</item>
3737
</item>
38+
<item name="braintree_cc_vault" xsi:type="array">
39+
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
40+
</item>
3841
</item>
3942
</item>
4043
</item>

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
5656
*/
5757
private $catalogRuleProcessor;
5858

59+
/**
60+
* @var array
61+
*/
62+
private $optionsPosition = [];
63+
5964
/**
6065
* @param \Magento\Catalog\Block\Product\Context $context
6166
* @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils
@@ -86,6 +91,8 @@ public function __construct(
8691
}
8792

8893
/**
94+
* Return catalog rule processor or creates processor if it does not exist
95+
*
8996
* @deprecated 100.2.0
9097
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
9198
*/
@@ -101,6 +108,7 @@ private function getCatalogRuleProcessor()
101108

102109
/**
103110
* Returns the bundle product options
111+
*
104112
* Will return cached options data if the product options are already initialized
105113
* In a case when $stripSelection parameter is true will reload stored bundle selections collection from DB
106114
*
@@ -135,6 +143,8 @@ public function getOptions($stripSelection = false)
135143
}
136144

137145
/**
146+
* Return true if product has options
147+
*
138148
* @return bool
139149
*/
140150
public function hasOptions()
@@ -150,7 +160,6 @@ public function hasOptions()
150160
* Returns JSON encoded config to be used in JS scripts
151161
*
152162
* @return string
153-
*
154163
*/
155164
public function getJsonConfig()
156165
{
@@ -172,6 +181,7 @@ public function getJsonConfig()
172181
}
173182
$optionId = $optionItem->getId();
174183
$options[$optionId] = $this->getOptionItemData($optionItem, $currentProduct, $position);
184+
$this->optionsPosition[$position] = $optionId;
175185

176186
// Add attribute default value (if set)
177187
if ($preConfiguredFlag) {
@@ -370,6 +380,7 @@ private function getConfigData(Product $product, array $options)
370380
$config = [
371381
'options' => $options,
372382
'selected' => $this->selectedOptions,
383+
'positions' => $this->optionsPosition,
373384
'bundleId' => $product->getId(),
374385
'priceFormat' => $this->localeFormat->getPriceFormat(),
375386
'prices' => [

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ protected function _construct()
151151
*/
152152
public function _afterLoad()
153153
{
154-
parent::_afterLoad();
155-
if ($this->getStoreId() && $this->_items) {
156-
foreach ($this->_items as $item) {
157-
$item->setStoreId($this->getStoreId());
158-
}
159-
}
160-
return $this;
154+
return parent::_afterLoad();
161155
}
162156

163157
/**
@@ -356,7 +350,10 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
356350
}
357351

358352
/**
353+
* Get Catalog Rule Processor.
354+
*
359355
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
356+
*
360357
* @deprecated 100.2.0
361358
*/
362359
private function getCatalogRuleProcessor()

app/code/Magento/Bundle/Test/Unit/Block/Catalog/Product/View/Type/BundleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ public function testGetJsonConfigFixedPriceBundle()
280280
$this->assertEquals(110, $jsonConfig['prices']['oldPrice']['amount']);
281281
$this->assertEquals(100, $jsonConfig['prices']['basePrice']['amount']);
282282
$this->assertEquals(100, $jsonConfig['prices']['finalPrice']['amount']);
283+
$this->assertEquals([1], $jsonConfig['positions']);
283284
}
284285

285286
/**

app/code/Magento/Bundle/view/frontend/web/js/product-summary.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ define([
5656

5757
// Clear Summary box
5858
this.element.html('');
59-
60-
$.each(this.cache.currentElement.selected, $.proxy(this._renderOption, this));
59+
this.cache.currentElement.positions.forEach(function (optionId) {
60+
this._renderOption(optionId, this.cache.currentElement.selected[optionId]);
61+
}, this);
6162
this.element
6263
.parents(this.options.bundleSummaryContainer)
6364
.toggleClass('empty', !this.cache.currentElementCount); // Zero elements equal '.empty' container

0 commit comments

Comments
 (0)