Skip to content

Commit 6342bf7

Browse files
author
Dmytro Voskoboinikov
committed
Merge branch 'develop' into bugfixes
2 parents 08d9ce5 + 777f782 commit 6342bf7

File tree

106 files changed

+2094
-883
lines changed

Some content is hidden

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

106 files changed

+2094
-883
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ protected function populateAuthorizeRequest(InfoInterface $payment, $token)
409409
if ($token) {
410410
$transactionParams['paymentMethodToken'] = $token;
411411
$transactionParams['customerId'] = $customerId;
412+
$transactionParams['billing'] = $this->toBraintreeAddress($billing);
413+
$transactionParams['shipping'] = $this->toBraintreeAddress($shipping);
412414
} elseif ($this->getInfoInstance()->getAdditionalInformation('payment_method_nonce')) {
413415
$transactionParams['paymentMethodNonce'] =
414416
$this->getInfoInstance()->getAdditionalInformation('payment_method_nonce');

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,8 +1361,6 @@ public function authorizeDataProvider()
13611361
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
13621362
'paymentMethodToken' => self::CC_TOKEN,
13631363
'customerId' => self::CUSTOMER_ID,
1364-
'billing' => null,
1365-
'shipping' => null,
13661364
'deviceData' => 'fraud_detection_data',
13671365
],
13681366
'braintree_response' => [
@@ -1429,8 +1427,6 @@ public function authorizeDataProvider()
14291427
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
14301428
'paymentMethodNonce' => self::PAYMENT_METHOD_NONCE,
14311429
'customerId' => self::CUSTOMER_ID,
1432-
'billing' => null,
1433-
'shipping' => null,
14341430
'deviceData' => 'fraud_detection_data',
14351431
'options' => [
14361432
'three_d_secure' => [
@@ -1502,8 +1498,6 @@ public function authorizeDataProvider()
15021498
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
15031499
'paymentMethodToken' => self::CC_TOKEN,
15041500
'customerId' => self::CUSTOMER_ID,
1505-
'billing' => null,
1506-
'shipping' => null,
15071501
'deviceData' => 'fraud_detection_data',
15081502
],
15091503
'braintree_response' => [

app/code/Magento/Bundle/Pricing/Adjustment/BundleCalculatorInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ interface BundleCalculatorInterface extends CalculatorInterface
1717
/**
1818
* @param float|string $amount
1919
* @param Product $saleableItem
20-
* @param null|bool $exclude
20+
* @param null|bool|string|array $exclude
2121
* @return \Magento\Framework\Pricing\Amount\AmountInterface
2222
*/
2323
public function getMaxAmount($amount, Product $saleableItem, $exclude = null);
2424

2525
/**
2626
* @param float|string $amount
2727
* @param Product $saleableItem
28-
* @param null|bool $exclude
28+
* @param null|bool|string|array $exclude
2929
* @return \Magento\Framework\Pricing\Amount\AmountInterface
3030
*/
3131
public function getMaxRegularAmount($amount, Product $saleableItem, $exclude = null);
3232

3333
/**
3434
* @param float|string $amount
3535
* @param Product $saleableItem
36-
* @param null|bool $exclude
36+
* @param null|bool|string|array $exclude
3737
* @return \Magento\Framework\Pricing\Amount\AmountInterface
3838
*/
3939
public function getMinRegularAmount($amount, Product $saleableItem, $exclude = null);
@@ -42,7 +42,7 @@ public function getMinRegularAmount($amount, Product $saleableItem, $exclude = n
4242
* Option amount calculation for saleable item
4343
*
4444
* @param Product $saleableItem
45-
* @param null|string $exclude
45+
* @param null|bool|string|array $exclude
4646
* @param bool $searchMin
4747
* @param \Magento\Framework\Pricing\Amount\AmountInterface|null $bundleProductAmount
4848
* @return \Magento\Framework\Pricing\Amount\AmountInterface
@@ -60,7 +60,7 @@ public function getOptionsAmount(
6060
* @param float $basePriceValue
6161
* @param Product $bundleProduct
6262
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
63-
* @param null|string $exclude code of adjustment that has to be excluded
63+
* @param null|bool|string|array $exclude code of adjustment that has to be excluded
6464
* @return \Magento\Framework\Pricing\Amount\AmountInterface
6565
*/
6666
public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude = null);

app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct(
7777
*
7878
* @param float|string $amount
7979
* @param SaleableInterface $saleableItem
80-
* @param null|string $exclude
80+
* @param null|bool|string|array $exclude
8181
* @param null|array $context
8282
* @return \Magento\Framework\Pricing\Amount\AmountInterface
8383
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -92,7 +92,7 @@ public function getAmount($amount, SaleableInterface $saleableItem, $exclude = n
9292
*
9393
* @param float $amount
9494
* @param Product $saleableItem
95-
* @param null|string $exclude
95+
* @param null|bool|string|array $exclude
9696
* @return \Magento\Framework\Pricing\Amount\AmountInterface
9797
*/
9898
public function getMinRegularAmount($amount, Product $saleableItem, $exclude = null)
@@ -105,7 +105,7 @@ public function getMinRegularAmount($amount, Product $saleableItem, $exclude = n
105105
*
106106
* @param float $amount
107107
* @param Product $saleableItem
108-
* @param null|string $exclude
108+
* @param null|bool|string|array $exclude
109109
* @return \Magento\Framework\Pricing\Amount\AmountInterface
110110
*/
111111
public function getMaxAmount($amount, Product $saleableItem, $exclude = null)
@@ -118,7 +118,7 @@ public function getMaxAmount($amount, Product $saleableItem, $exclude = null)
118118
*
119119
* @param float $amount
120120
* @param Product $saleableItem
121-
* @param null|string $exclude
121+
* @param null|bool|string|array $exclude
122122
* @return \Magento\Framework\Pricing\Amount\AmountInterface
123123
*/
124124
public function getMaxRegularAmount($amount, Product $saleableItem, $exclude = null)
@@ -130,7 +130,7 @@ public function getMaxRegularAmount($amount, Product $saleableItem, $exclude = n
130130
* Option amount calculation for bundle product
131131
*
132132
* @param Product $saleableItem
133-
* @param null|string $exclude
133+
* @param null|bool|string|array $exclude
134134
* @param bool $searchMin
135135
* @param float $baseAmount
136136
* @param bool $useRegularPrice
@@ -260,7 +260,7 @@ protected function getBundleOptions(Product $saleableItem)
260260
* @param float $basePriceValue
261261
* @param Product $bundleProduct
262262
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
263-
* @param null|string $exclude
263+
* @param null|bool|string|array $exclude
264264
* @return \Magento\Framework\Pricing\Amount\AmountInterface
265265
*/
266266
public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude = null)
@@ -278,7 +278,7 @@ public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectio
278278
* @param float $basePriceValue
279279
* @param Product $bundleProduct
280280
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
281-
* @param null|string $exclude
281+
* @param null|bool|string|arrayy $exclude
282282
* @return \Magento\Framework\Pricing\Amount\AmountInterface
283283
*/
284284
protected function calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude)
@@ -297,7 +297,7 @@ protected function calculateFixedBundleAmount($basePriceValue, $bundleProduct, $
297297
* @param float $basePriceValue
298298
* @param Product $bundleProduct
299299
* @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList
300-
* @param null|string $exclude
300+
* @param null|bool|string|array $exclude
301301
* @return \Magento\Framework\Pricing\Amount\AmountInterface
302302
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
303303
*/
@@ -340,9 +340,18 @@ protected function calculateDynamicBundleAmount($basePriceValue, $bundleProduct,
340340
}
341341
}
342342
}
343-
if ($exclude && isset($adjustments[$exclude])) {
344-
$fullAmount -= $adjustments[$exclude];
345-
unset($adjustments[$exclude]);
343+
if (is_array($exclude) == false) {
344+
if ($exclude && isset($adjustments[$exclude])) {
345+
$fullAmount -= $adjustments[$exclude];
346+
unset($adjustments[$exclude]);
347+
}
348+
} else {
349+
foreach ($exclude as $oneExclusion) {
350+
if ($oneExclusion && isset($adjustments[$oneExclusion])) {
351+
$fullAmount -= $adjustments[$oneExclusion];
352+
unset($adjustments[$oneExclusion]);
353+
}
354+
}
346355
}
347356
return $this->amountFactory->create($fullAmount, $adjustments);
348357
}

app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class BundleSelectionPrice extends AbstractPrice
6868
* @param ManagerInterface $eventManager
6969
* @param DiscountCalculator $discountCalculator
7070
* @param bool $useRegularPrice
71-
* @param string $excludeAdjustment
71+
* @param array $excludeAdjustment
7272
*/
7373
public function __construct(
7474
Product $saleableItem,

app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,21 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje
119119
$optionId = $connection->fetchOne($statement);
120120

121121
if ($optionId) {
122-
if ($object->getStoreId() == '0') {
123-
$data = $this->_prepareDataForTable(
124-
new \Magento\Framework\DataObject(
125-
['price' => $object->getPrice(), 'price_type' => $object->getPriceType()]
126-
),
127-
$priceTable
128-
);
122+
$data = $this->_prepareDataForTable(
123+
new \Magento\Framework\DataObject(
124+
['price' => $object->getPrice(), 'price_type' => $object->getPriceType()]
125+
),
126+
$priceTable
127+
);
129128

130-
$connection->update(
131-
$priceTable,
132-
$data,
133-
[
134-
'option_id = ?' => $object->getId(),
135-
'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID
136-
]
137-
);
138-
}
129+
$connection->update(
130+
$priceTable,
131+
$data,
132+
[
133+
'option_id = ?' => $object->getId(),
134+
'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID
135+
]
136+
);
139137
} else {
140138
$data = $this->_prepareDataForTable(
141139
new \Magento\Framework\DataObject(

app/code/Magento/Catalog/Pricing/Price/CustomOptionPrice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class CustomOptionPrice extends AbstractPrice implements CustomOptionPriceInterf
4141
* @param float $quantity
4242
* @param CalculatorInterface $calculator
4343
* @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
44-
* @param string $excludeAdjustment
44+
* @param array $excludeAdjustment
4545
*/
4646
public function __construct(
4747
SaleableInterface $saleableItem,
@@ -113,7 +113,7 @@ public function getValue()
113113

114114
/**
115115
* @param float $amount
116-
* @param null|bool|string $exclude
116+
* @param null|bool|string|array $exclude
117117
* @param null|array $context
118118
* @return AmountInterface|bool|float
119119
*/

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,9 +2223,14 @@ private function _parseAdditionalAttributes($rowData)
22232223

22242224
$attributeNameValuePairs = explode($this->getMultipleValueSeparator(), $rowData['additional_attributes']);
22252225
foreach ($attributeNameValuePairs as $attributeNameValuePair) {
2226-
$nameAndValue = explode(self::PAIR_NAME_VALUE_SEPARATOR, $attributeNameValuePair);
2227-
if (!empty($nameAndValue)) {
2228-
$rowData[$nameAndValue[0]] = isset($nameAndValue[1]) ? $nameAndValue[1] : '';
2226+
$separatorPosition = strpos($attributeNameValuePair, self::PAIR_NAME_VALUE_SEPARATOR);
2227+
if ($separatorPosition !== false) {
2228+
$key = substr($attributeNameValuePair, 0, $separatorPosition);
2229+
$value = substr(
2230+
$attributeNameValuePair,
2231+
$separatorPosition + strlen(self::PAIR_NAME_VALUE_SEPARATOR)
2232+
);
2233+
$rowData[$key] = $value === false ? '' : $value;
22292234
}
22302235
}
22312236
return $rowData;

app/code/Magento/CatalogInventory/Model/StockRegistryProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public function getStockItem($productId, $websiteId)
148148
if (!isset($this->stockItems[$key])) {
149149
$criteria = $this->stockItemCriteriaFactory->create();
150150
$criteria->setProductsFilter($productId);
151-
$criteria->setWebsiteFilter($websiteId);
152151
$collection = $this->stockItemRepository->getList($criteria);
153152
$stockItem = current($collection->getItems());
154153
if ($stockItem && $stockItem->getItemId()) {

app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockRegistryProviderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ public function testGetStock()
253253
public function testGetStockItem()
254254
{
255255
$this->stockItemCriteriaFactory->expects($this->once())->method('create')->willReturn($this->stockItemCriteria);
256-
$this->stockItemCriteria->expects($this->once())->method('setWebsiteFilter')->willReturn(null);
257256
$this->stockItemCriteria->expects($this->once())->method('setProductsFilter')->willReturn(null);
258257
$stockItemCollection = $this->getMock(
259258
'\Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Collection',

app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class ConfigurableProductHandler
2020
/** @var ConfigurableProductsProvider */
2121
private $configurableProductsProvider;
2222

23-
/** @var array */
24-
private $subProductsValidationResults = [];
25-
2623
/**
2724
* @param \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable $configurable
2825
* @param ConfigurableProductsProvider $configurableProductsProvider
@@ -39,45 +36,24 @@ public function __construct(
3936
* @param \Magento\CatalogRule\Model\Rule $rule
4037
* @param array $productIds
4138
* @return array
39+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4240
*/
4341
public function afterGetMatchingProductIds(\Magento\CatalogRule\Model\Rule $rule, array $productIds)
4442
{
4543
$configurableProductIds = $this->configurableProductsProvider->getIds(array_keys($productIds));
4644
foreach ($configurableProductIds as $productId) {
47-
$subProductsIds = $this->configurable->getChildrenIds($productId)[0];
48-
$parentValidationResult = $productIds[$productId];
49-
foreach ($subProductsIds as $subProductsId) {
50-
$productIds[$subProductsId] = $this->getSubProductValidationResult(
51-
$rule->getId(),
52-
$subProductsId,
53-
$parentValidationResult
54-
);
45+
$subProductIds = $this->configurable->getChildrenIds($productId)[0];
46+
$parentValidationResult = isset($productIds[$productId])
47+
? array_filter($productIds[$productId])
48+
: [];
49+
foreach ($subProductIds as $subProductId) {
50+
$childValidationResult = isset($productIds[$subProductId])
51+
? array_filter($productIds[$subProductId])
52+
: [];
53+
$productIds[$subProductId] = $parentValidationResult + $childValidationResult;
5554
}
5655
unset($productIds[$productId]);
5756
}
5857
return $productIds;
5958
}
60-
61-
/**
62-
* Return validation result for sub-product.
63-
* If any of configurable product is valid for current rule, then their sub-product must be valid too
64-
*
65-
* @param int $urlId
66-
* @param int $subProductsId
67-
* @param array $parentValidationResult
68-
* @return array
69-
*/
70-
private function getSubProductValidationResult($urlId, $subProductsId, $parentValidationResult)
71-
{
72-
if (!isset($this->subProductsValidationResults[$urlId][$subProductsId])) {
73-
$this->subProductsValidationResults[$urlId][$subProductsId] = array_filter($parentValidationResult);
74-
} else {
75-
$parentValidationResult = array_intersect_key(
76-
$this->subProductsValidationResults[$urlId][$subProductsId] + $parentValidationResult,
77-
$parentValidationResult
78-
);
79-
$this->subProductsValidationResults[$urlId][$subProductsId] = $parentValidationResult;
80-
}
81-
return $parentValidationResult;
82-
}
8359
}

app/code/Magento/CatalogRuleConfigurable/Test/Unit/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandlerTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,9 @@ public function testAfterGetMatchingProductIdsWithConfigurableProduct()
9393
0 => true,
9494
1 => true,
9595
3 => true,
96-
4 => false,
9796
],
9897
'simple2' => [
99-
0 => false,
100-
1 => false,
10198
3 => true,
102-
4 => false,
10399
]
104100
],
105101
$this->configurableProductHandler->afterGetMatchingProductIds(

app/code/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\CatalogUrlRewrite\Observer;
77

8+
use Magento\Catalog\Model\Product\Visibility;
89
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
910
use Magento\UrlRewrite\Model\UrlPersistInterface;
1011
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
@@ -53,7 +54,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
5354
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
5455
]);
5556
}
56-
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
57+
if ($product->getVisibility() != Visibility::VISIBILITY_NOT_VISIBLE) {
58+
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
59+
}
5760
}
5861
}
5962
}

app/code/Magento/CatalogUrlRewrite/Observer/ProductToWebsiteChangeObserver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7272
UrlRewrite::ENTITY_ID => $product->getId(),
7373
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
7474
]);
75-
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
75+
if ($product->getVisibility() != Visibility::VISIBILITY_NOT_VISIBLE) {
76+
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
77+
}
7678
}
7779
}
7880
}

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ public function getConfig()
278278
);
279279
$output['postCodes'] = $this->postCodesConfig->getPostCodes();
280280
$output['imageData'] = $this->imageProvider->getImages($quoteId);
281-
$output['defaultCountryId'] = $this->directoryHelper->getDefaultCountry();
282281
$output['totalsData'] = $this->getTotalsData();
283282
$output['shippingPolicy'] = [
284283
'isEnabled' => $this->scopeConfig->isSetFlag(

0 commit comments

Comments
 (0)