Skip to content

Commit 08016a9

Browse files
Merge branch 2.2-develop into ENGCOM-4687-magento-magento2-21340
2 parents 7453e4c + 51fcebd commit 08016a9

File tree

88 files changed

+1754
-212
lines changed

Some content is hidden

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

88 files changed

+1754
-212
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAccountSetInterfaceLocaleActionGroup">
12+
<arguments>
13+
<argument name="localeName" type="string"/>
14+
</arguments>
15+
<!-- Navigate to admin System Account Page-->
16+
<amOnPage url="{{AdminSystemAccountPage.url}}" stepKey="openAdminSystemAccountPage"/>
17+
<!-- Change Admin locale to {{localeName}} -->
18+
<selectOption selector="{{AdminSystemAccountSection.interfaceLocale}}" userInput="{{localeName}}" stepKey="setInterfaceLocale"/>
19+
<fillField selector="{{AdminSystemAccountSection.currentPassword}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="fillCurrentPassword"/>
20+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
21+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
22+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the account." stepKey="seeSuccessMessage"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminSystemAccountPage" url="admin/system_account/index/" area="admin" module="Magento_Backend">
12+
<section name="AdminSystemAccountSection"/>
13+
</page>
14+
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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:Page/etc/SectionObject.xsd">
11+
<section name="AdminSystemAccountSection">
12+
<element name="interfaceLocale" type="text" selector="#interface_locale"/>
13+
<element name="currentPassword" type="text" selector="#current_password"/>
14+
</section>
15+
</sections>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontPayWithPaypalFromMiniCartActionGroup" extends="StorefrontViewAndEditCartFromMiniCartActionGroup">
11+
<remove keyForRemoval="viewAndEditCart"/>
12+
<remove keyForRemoval="seeInCurrentUrl"/>
13+
<waitForElementVisible selector="{{StorefrontMiniCartSection.payWithPayPal}}" stepKey="waitForPaypalButtonIsVisible"/>
14+
<click selector="{{StorefrontMiniCartSection.payWithPayPal}}" stepKey="clickPayWithPaypalButton"/>
15+
</actionGroup>
16+
</actionGroups>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@
7171
<data key="value"/>
7272
</entity>
7373

74+
<entity name="DefaultBraintreeWithPaypalConfig" extends="DefaultBraintreeConfig">
75+
<requiredEntity type="active_braintree_paypal">DefaultActiveBraintreePaypal</requiredEntity>
76+
</entity>
77+
<entity name="DefaultActiveBraintreePaypal" type="active_braintree_paypal">
78+
<data key="value">0</data>
79+
</entity>
80+
7481
<entity name="SandboxBraintreeConfig" type="braintree_config_state">
7582
<requiredEntity type="title">EnabledTitle</requiredEntity>
7683
<requiredEntity type="payment_action">AuthorizePaymentAction</requiredEntity>
@@ -106,6 +113,13 @@
106113
<data key="value">Magneto</data>
107114
</entity>
108115

116+
<entity name="SandboxBraintreeWithPaypalConfig" extends="SandboxBraintreeConfig">
117+
<requiredEntity type="active_braintree_paypal">EnableActiveBraintreePaypal</requiredEntity>
118+
</entity>
119+
<entity name="EnableActiveBraintreePaypal" type="active_braintree_paypal">
120+
<data key="value">1</data>
121+
</entity>
122+
109123
<entity name="BraintreeCard" type="creditCard">
110124
<data key="cc_type">MasterCard</data>
111125
<data key="card_number">5105105105105100</data>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
<object key="active" dataType="active">
5050
<field key="value">integer</field>
5151
</object>
52+
<object key="active_braintree_paypal" dataType="active_braintree_paypal">
53+
<field key="value">integer</field>
54+
</object>
5255
</object>
5356
</object>
5457
</object>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="StorefrontPaypalReviewOrderPage" url="/braintree/paypal/review" area="storefront" module="Magento_Braintree">
12+
<section name="StorefrontPaypalReviewOrderShippingSection"/>
13+
<section name="StorefrontPaypalReviewOrderItemsSection"/>
14+
</page>
15+
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontMiniCartSection">
12+
<element name="payWithPayPal" type="button" selector=".braintree-paypal-button-hidden" timeout="30"/>
13+
<element name="proceedWithSandboxPurchase" type="text" selector="#return_url"/>
14+
</section>
15+
</sections>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontPaypalReviewOrderItemsSection">
12+
<element name="placeOrder" type="button" selector="#review-button" timeout="30"/>
13+
<element name="orderSummaryTotal" type="text" selector="tr.grand.totals span.price"/>
14+
</section>
15+
</sections>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontPaypalReviewOrderShippingSection">
12+
<element name="selectShippingMethodByName" type="select" selector="//select[@id='shipping-method']//option[contains(text(),'{{shippingMethod}}')]" parameterized="true"/>
13+
</section>
14+
</sections>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Bundle\Block\DataProviders;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Catalog\Pricing\Price\TierPrice;
12+
use Magento\Framework\Pricing\Render;
13+
use Magento\Framework\View\Element\Block\ArgumentInterface;
14+
use Magento\Framework\View\LayoutInterface;
15+
16+
/**
17+
* Provides additional data for bundle options
18+
*/
19+
class OptionPriceRenderer implements ArgumentInterface
20+
{
21+
/**
22+
* Parent layout of the block
23+
*
24+
* @var LayoutInterface
25+
*/
26+
private $layout;
27+
28+
/**
29+
* @param LayoutInterface $layout
30+
*/
31+
public function __construct(LayoutInterface $layout)
32+
{
33+
$this->layout = $layout;
34+
}
35+
36+
/**
37+
* Format tier price string
38+
*
39+
* @param Product $selection
40+
* @param array $arguments
41+
* @return string
42+
*/
43+
public function renderTierPrice(Product $selection, array $arguments = []): string
44+
{
45+
if (!array_key_exists('zone', $arguments)) {
46+
$arguments['zone'] = Render::ZONE_ITEM_OPTION;
47+
}
48+
49+
$priceHtml = '';
50+
51+
/** @var Render $priceRender */
52+
$priceRender = $this->layout->getBlock('product.price.render.default');
53+
if ($priceRender !== false) {
54+
$priceHtml = $priceRender->render(
55+
TierPrice::PRICE_CODE,
56+
$selection,
57+
$arguments
58+
);
59+
}
60+
61+
return $priceHtml;
62+
}
63+
}

app/code/Magento/Bundle/Model/Product/Price.php

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory;
1212

1313
/**
14+
* Bundle product type price model
15+
*
1416
* @api
1517
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1619
* @since 100.0.2
1720
*/
1821
class Price extends \Magento\Catalog\Model\Product\Type\Price
@@ -180,9 +183,9 @@ protected function getBundleSelectionIds(\Magento\Catalog\Model\Product $product
180183
/**
181184
* Get product final price
182185
*
183-
* @param float $qty
184-
* @param \Magento\Catalog\Model\Product $product
185-
* @return float
186+
* @param float $qty
187+
* @param \Magento\Catalog\Model\Product $product
188+
* @return float
186189
*/
187190
public function getFinalPrice($qty, $product)
188191
{
@@ -207,9 +210,9 @@ public function getFinalPrice($qty, $product)
207210
* Returns final price of a child product
208211
*
209212
* @param \Magento\Catalog\Model\Product $product
210-
* @param float $productQty
213+
* @param float $productQty
211214
* @param \Magento\Catalog\Model\Product $childProduct
212-
* @param float $childProductQty
215+
* @param float $childProductQty
213216
* @return float
214217
*/
215218
public function getChildFinalPrice($product, $productQty, $childProduct, $childProductQty)
@@ -220,10 +223,10 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP
220223
/**
221224
* Retrieve Price considering tier price
222225
*
223-
* @param \Magento\Catalog\Model\Product $product
224-
* @param string|null $which
225-
* @param bool|null $includeTax
226-
* @param bool $takeTierPrice
226+
* @param \Magento\Catalog\Model\Product $product
227+
* @param string|null $which
228+
* @param bool|null $includeTax
229+
* @param bool $takeTierPrice
227230
* @return float|array
228231
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
229232
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -402,8 +405,8 @@ public function getOptions($product)
402405
*
403406
* @param \Magento\Catalog\Model\Product $bundleProduct
404407
* @param \Magento\Catalog\Model\Product $selectionProduct
405-
* @param float|null $selectionQty
406-
* @param null|bool $multiplyQty Whether to multiply selection's price by its quantity
408+
* @param float|null $selectionQty
409+
* @param null|bool $multiplyQty Whether to multiply selection's price by its quantity
407410
* @return float
408411
*
409412
* @see \Magento\Bundle\Model\Product\Price::getSelectionFinalTotalPrice()
@@ -418,7 +421,7 @@ public function getSelectionPrice($bundleProduct, $selectionProduct, $selectionQ
418421
*
419422
* @param \Magento\Catalog\Model\Product $bundleProduct
420423
* @param \Magento\Catalog\Model\Product $selectionProduct
421-
* @param float $qty
424+
* @param float $qty
422425
* @return float
423426
*/
424427
public function getSelectionPreFinalPrice($bundleProduct, $selectionProduct, $qty = null)
@@ -427,15 +430,14 @@ public function getSelectionPreFinalPrice($bundleProduct, $selectionProduct, $qt
427430
}
428431

429432
/**
430-
* Calculate final price of selection
431-
* with take into account tier price
433+
* Calculate final price of selection with take into account tier price
432434
*
433-
* @param \Magento\Catalog\Model\Product $bundleProduct
434-
* @param \Magento\Catalog\Model\Product $selectionProduct
435-
* @param float $bundleQty
436-
* @param float $selectionQty
437-
* @param bool $multiplyQty
438-
* @param bool $takeTierPrice
435+
* @param \Magento\Catalog\Model\Product $bundleProduct
436+
* @param \Magento\Catalog\Model\Product $selectionProduct
437+
* @param float $bundleQty
438+
* @param float $selectionQty
439+
* @param bool $multiplyQty
440+
* @param bool $takeTierPrice
439441
* @return float
440442
*/
441443
public function getSelectionFinalTotalPrice(
@@ -454,7 +456,11 @@ public function getSelectionFinalTotalPrice(
454456
}
455457

456458
if ($bundleProduct->getPriceType() == self::PRICE_TYPE_DYNAMIC) {
457-
$price = $selectionProduct->getFinalPrice($takeTierPrice ? $selectionQty : 1);
459+
$totalQty = $bundleQty * $selectionQty;
460+
if (!$takeTierPrice || $totalQty === 0) {
461+
$totalQty = 1;
462+
}
463+
$price = $selectionProduct->getFinalPrice($totalQty);
458464
} else {
459465
if ($selectionProduct->getSelectionPriceType()) {
460466
// percent
@@ -485,10 +491,10 @@ public function getSelectionFinalTotalPrice(
485491
/**
486492
* Apply tier price for bundle
487493
*
488-
* @param \Magento\Catalog\Model\Product $product
489-
* @param float $qty
490-
* @param float $finalPrice
491-
* @return float
494+
* @param \Magento\Catalog\Model\Product $product
495+
* @param float $qty
496+
* @param float $finalPrice
497+
* @return float
492498
*/
493499
protected function _applyTierPrice($product, $qty, $finalPrice)
494500
{
@@ -509,9 +515,9 @@ protected function _applyTierPrice($product, $qty, $finalPrice)
509515
/**
510516
* Get product tier price by qty
511517
*
512-
* @param float $qty
513-
* @param \Magento\Catalog\Model\Product $product
514-
* @return float|array
518+
* @param float $qty
519+
* @param \Magento\Catalog\Model\Product $product
520+
* @return float|array
515521
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
516522
* @SuppressWarnings(PHPMD.NPathComplexity)
517523
*/
@@ -605,11 +611,11 @@ public function getTierPrice($qty, $product)
605611
/**
606612
* Calculate and apply special price
607613
*
608-
* @param float $finalPrice
609-
* @param float $specialPrice
614+
* @param float $finalPrice
615+
* @param float $specialPrice
610616
* @param string $specialPriceFrom
611617
* @param string $specialPriceTo
612-
* @param mixed $store
618+
* @param mixed $store
613619
* @return float
614620
*/
615621
public function calculateSpecialPrice(
@@ -634,7 +640,7 @@ public function calculateSpecialPrice(
634640
*
635641
* @param /Magento/Catalog/Model/Product $bundleProduct
636642
* @param float|string $price
637-
* @param int $bundleQty
643+
* @param int $bundleQty
638644
* @return float
639645
*/
640646
public function getLowestPrice($bundleProduct, $price, $bundleQty = 1)

0 commit comments

Comments
 (0)