Skip to content

Commit

Permalink
Merge branch 2.2-develop into ENGCOM-4687-magento-magento2-21340
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Apr 12, 2019
2 parents 7453e4c + 51fcebd commit 08016a9
Show file tree
Hide file tree
Showing 88 changed files with 1,754 additions and 212 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminAccountSetInterfaceLocaleActionGroup">
<arguments>
<argument name="localeName" type="string"/>
</arguments>
<!-- Navigate to admin System Account Page-->
<amOnPage url="{{AdminSystemAccountPage.url}}" stepKey="openAdminSystemAccountPage"/>
<!-- Change Admin locale to {{localeName}} -->
<selectOption selector="{{AdminSystemAccountSection.interfaceLocale}}" userInput="{{localeName}}" stepKey="setInterfaceLocale"/>
<fillField selector="{{AdminSystemAccountSection.currentPassword}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="fillCurrentPassword"/>
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSave"/>
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the account." stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
14 changes: 14 additions & 0 deletions app/code/Magento/Backend/Test/Mftf/Page/AdminSystemAccountPage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminSystemAccountPage" url="admin/system_account/index/" area="admin" module="Magento_Backend">
<section name="AdminSystemAccountSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminSystemAccountSection">
<element name="interfaceLocale" type="text" selector="#interface_locale"/>
<element name="currentPassword" type="text" selector="#current_password"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontPayWithPaypalFromMiniCartActionGroup" extends="StorefrontViewAndEditCartFromMiniCartActionGroup">
<remove keyForRemoval="viewAndEditCart"/>
<remove keyForRemoval="seeInCurrentUrl"/>
<waitForElementVisible selector="{{StorefrontMiniCartSection.payWithPayPal}}" stepKey="waitForPaypalButtonIsVisible"/>
<click selector="{{StorefrontMiniCartSection.payWithPayPal}}" stepKey="clickPayWithPaypalButton"/>
</actionGroup>
</actionGroups>
14 changes: 14 additions & 0 deletions app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@
<data key="value"/>
</entity>

<entity name="DefaultBraintreeWithPaypalConfig" extends="DefaultBraintreeConfig">
<requiredEntity type="active_braintree_paypal">DefaultActiveBraintreePaypal</requiredEntity>
</entity>
<entity name="DefaultActiveBraintreePaypal" type="active_braintree_paypal">
<data key="value">0</data>
</entity>

<entity name="SandboxBraintreeConfig" type="braintree_config_state">
<requiredEntity type="title">EnabledTitle</requiredEntity>
<requiredEntity type="payment_action">AuthorizePaymentAction</requiredEntity>
Expand Down Expand Up @@ -106,6 +113,13 @@
<data key="value">Magneto</data>
</entity>

<entity name="SandboxBraintreeWithPaypalConfig" extends="SandboxBraintreeConfig">
<requiredEntity type="active_braintree_paypal">EnableActiveBraintreePaypal</requiredEntity>
</entity>
<entity name="EnableActiveBraintreePaypal" type="active_braintree_paypal">
<data key="value">1</data>
</entity>

<entity name="BraintreeCard" type="creditCard">
<data key="cc_type">MasterCard</data>
<data key="card_number">5105105105105100</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
<object key="active" dataType="active">
<field key="value">integer</field>
</object>
<object key="active_braintree_paypal" dataType="active_braintree_paypal">
<field key="value">integer</field>
</object>
</object>
</object>
</object>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="StorefrontPaypalReviewOrderPage" url="/braintree/paypal/review" area="storefront" module="Magento_Braintree">
<section name="StorefrontPaypalReviewOrderShippingSection"/>
<section name="StorefrontPaypalReviewOrderItemsSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontMiniCartSection">
<element name="payWithPayPal" type="button" selector=".braintree-paypal-button-hidden" timeout="30"/>
<element name="proceedWithSandboxPurchase" type="text" selector="#return_url"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontPaypalReviewOrderItemsSection">
<element name="placeOrder" type="button" selector="#review-button" timeout="30"/>
<element name="orderSummaryTotal" type="text" selector="tr.grand.totals span.price"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontPaypalReviewOrderShippingSection">
<element name="selectShippingMethodByName" type="select" selector="//select[@id='shipping-method']//option[contains(text(),'{{shippingMethod}}')]" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Bundle\Block\DataProviders;

use Magento\Catalog\Model\Product;
use Magento\Catalog\Pricing\Price\TierPrice;
use Magento\Framework\Pricing\Render;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Magento\Framework\View\LayoutInterface;

/**
* Provides additional data for bundle options
*/
class OptionPriceRenderer implements ArgumentInterface
{
/**
* Parent layout of the block
*
* @var LayoutInterface
*/
private $layout;

/**
* @param LayoutInterface $layout
*/
public function __construct(LayoutInterface $layout)
{
$this->layout = $layout;
}

/**
* Format tier price string
*
* @param Product $selection
* @param array $arguments
* @return string
*/
public function renderTierPrice(Product $selection, array $arguments = []): string
{
if (!array_key_exists('zone', $arguments)) {
$arguments['zone'] = Render::ZONE_ITEM_OPTION;
}

$priceHtml = '';

/** @var Render $priceRender */
$priceRender = $this->layout->getBlock('product.price.render.default');
if ($priceRender !== false) {
$priceHtml = $priceRender->render(
TierPrice::PRICE_CODE,
$selection,
$arguments
);
}

return $priceHtml;
}
}
70 changes: 38 additions & 32 deletions app/code/Magento/Bundle/Model/Product/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory;

/**
* Bundle product type price model
*
* @api
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @since 100.0.2
*/
class Price extends \Magento\Catalog\Model\Product\Type\Price
Expand Down Expand Up @@ -180,9 +183,9 @@ protected function getBundleSelectionIds(\Magento\Catalog\Model\Product $product
/**
* Get product final price
*
* @param float $qty
* @param \Magento\Catalog\Model\Product $product
* @return float
* @param float $qty
* @param \Magento\Catalog\Model\Product $product
* @return float
*/
public function getFinalPrice($qty, $product)
{
Expand All @@ -207,9 +210,9 @@ public function getFinalPrice($qty, $product)
* Returns final price of a child product
*
* @param \Magento\Catalog\Model\Product $product
* @param float $productQty
* @param float $productQty
* @param \Magento\Catalog\Model\Product $childProduct
* @param float $childProductQty
* @param float $childProductQty
* @return float
*/
public function getChildFinalPrice($product, $productQty, $childProduct, $childProductQty)
Expand All @@ -220,10 +223,10 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP
/**
* Retrieve Price considering tier price
*
* @param \Magento\Catalog\Model\Product $product
* @param string|null $which
* @param bool|null $includeTax
* @param bool $takeTierPrice
* @param \Magento\Catalog\Model\Product $product
* @param string|null $which
* @param bool|null $includeTax
* @param bool $takeTierPrice
* @return float|array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
Expand Down Expand Up @@ -402,8 +405,8 @@ public function getOptions($product)
*
* @param \Magento\Catalog\Model\Product $bundleProduct
* @param \Magento\Catalog\Model\Product $selectionProduct
* @param float|null $selectionQty
* @param null|bool $multiplyQty Whether to multiply selection's price by its quantity
* @param float|null $selectionQty
* @param null|bool $multiplyQty Whether to multiply selection's price by its quantity
* @return float
*
* @see \Magento\Bundle\Model\Product\Price::getSelectionFinalTotalPrice()
Expand All @@ -418,7 +421,7 @@ public function getSelectionPrice($bundleProduct, $selectionProduct, $selectionQ
*
* @param \Magento\Catalog\Model\Product $bundleProduct
* @param \Magento\Catalog\Model\Product $selectionProduct
* @param float $qty
* @param float $qty
* @return float
*/
public function getSelectionPreFinalPrice($bundleProduct, $selectionProduct, $qty = null)
Expand All @@ -427,15 +430,14 @@ public function getSelectionPreFinalPrice($bundleProduct, $selectionProduct, $qt
}

/**
* Calculate final price of selection
* with take into account tier price
* Calculate final price of selection with take into account tier price
*
* @param \Magento\Catalog\Model\Product $bundleProduct
* @param \Magento\Catalog\Model\Product $selectionProduct
* @param float $bundleQty
* @param float $selectionQty
* @param bool $multiplyQty
* @param bool $takeTierPrice
* @param \Magento\Catalog\Model\Product $bundleProduct
* @param \Magento\Catalog\Model\Product $selectionProduct
* @param float $bundleQty
* @param float $selectionQty
* @param bool $multiplyQty
* @param bool $takeTierPrice
* @return float
*/
public function getSelectionFinalTotalPrice(
Expand All @@ -454,7 +456,11 @@ public function getSelectionFinalTotalPrice(
}

if ($bundleProduct->getPriceType() == self::PRICE_TYPE_DYNAMIC) {
$price = $selectionProduct->getFinalPrice($takeTierPrice ? $selectionQty : 1);
$totalQty = $bundleQty * $selectionQty;
if (!$takeTierPrice || $totalQty === 0) {
$totalQty = 1;
}
$price = $selectionProduct->getFinalPrice($totalQty);
} else {
if ($selectionProduct->getSelectionPriceType()) {
// percent
Expand Down Expand Up @@ -485,10 +491,10 @@ public function getSelectionFinalTotalPrice(
/**
* Apply tier price for bundle
*
* @param \Magento\Catalog\Model\Product $product
* @param float $qty
* @param float $finalPrice
* @return float
* @param \Magento\Catalog\Model\Product $product
* @param float $qty
* @param float $finalPrice
* @return float
*/
protected function _applyTierPrice($product, $qty, $finalPrice)
{
Expand All @@ -509,9 +515,9 @@ protected function _applyTierPrice($product, $qty, $finalPrice)
/**
* Get product tier price by qty
*
* @param float $qty
* @param \Magento\Catalog\Model\Product $product
* @return float|array
* @param float $qty
* @param \Magento\Catalog\Model\Product $product
* @return float|array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
Expand Down Expand Up @@ -605,11 +611,11 @@ public function getTierPrice($qty, $product)
/**
* Calculate and apply special price
*
* @param float $finalPrice
* @param float $specialPrice
* @param float $finalPrice
* @param float $specialPrice
* @param string $specialPriceFrom
* @param string $specialPriceTo
* @param mixed $store
* @param mixed $store
* @return float
*/
public function calculateSpecialPrice(
Expand All @@ -634,7 +640,7 @@ public function calculateSpecialPrice(
*
* @param /Magento/Catalog/Model/Product $bundleProduct
* @param float|string $price
* @param int $bundleQty
* @param int $bundleQty
* @return float
*/
public function getLowestPrice($bundleProduct, $price, $bundleQty = 1)
Expand Down
Loading

0 comments on commit 08016a9

Please sign in to comment.