Skip to content

Commit

Permalink
#11680: Merge branch '2.3-develop' of github.com:magento/magento2 int…
Browse files Browse the repository at this point in the history
…o 8022
  • Loading branch information
ishakhsuvarov committed Nov 7, 2017
2 parents 0f317bf + 4ee8196 commit 12a234a
Show file tree
Hide file tree
Showing 322 changed files with 14,171 additions and 1,443 deletions.
4 changes: 2 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
############################################
## adjust memory limit

php_value memory_limit 768M
php_value memory_limit 756M
php_value max_execution_time 18000

############################################
Expand All @@ -59,7 +59,7 @@
############################################
## adjust memory limit

php_value memory_limit 768M
php_value memory_limit 756M
php_value max_execution_time 18000

############################################
Expand Down
2 changes: 1 addition & 1 deletion .htaccess.sample
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
############################################
## adjust memory limit

php_value memory_limit 768M
php_value memory_limit 756M
php_value max_execution_time 18000

############################################
Expand Down
2 changes: 1 addition & 1 deletion .user.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
memory_limit = 768M
memory_limit = 756M
max_execution_time = 18000
session.auto_start = off
suhosin.session.cryptua = off
2 changes: 2 additions & 0 deletions app/code/Magento/Backend/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ public function getChartUrl($directUrl = true)
$tmpstring = implode('|', $this->_axisLabels[$idx]);

$valueBuffer[] = $indexid . ":|" . $tmpstring;
} elseif ($idx == 'y') {
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
}
$indexid++;
}
Expand Down
15 changes: 13 additions & 2 deletions app/code/Magento/Backend/Block/Media/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Backend\Block\Media;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Serialize\Serializer\Json;

/**
* Adminhtml media library uploader
* @api
Expand All @@ -27,17 +30,25 @@ class Uploader extends \Magento\Backend\Block\Widget
*/
protected $_fileSizeService;

/**
* @var Json
*/
private $jsonEncoder;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\File\Size $fileSize
* @param array $data
* @param Json $jsonEncoder
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\File\Size $fileSize,
array $data = []
array $data = [],
Json $jsonEncoder = null
) {
$this->_fileSizeService = $fileSize;
$this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class);
parent::__construct($context, $data);
}

Expand Down Expand Up @@ -107,7 +118,7 @@ public function getJsObjectName()
*/
public function getConfigJson()
{
return $this->_coreData->jsonEncode($this->getConfig()->getData());
return $this->jsonEncoder->encode($this->getConfig()->getData());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Braintree\Model\InstantPurchase\CreditCard;

use Magento\Braintree\Gateway\Config\Config;
use Magento\InstantPurchase\PaymentMethodIntegration\AvailabilityCheckerInterface;

/**
* Availability of Braintree vaults for instant purchase.
*/
class AvailabilityChecker implements AvailabilityCheckerInterface
{
/**
* @var Config
*/
private $config;

/**
* AvailabilityChecker constructor.
* @param Config $config
*/
public function __construct(Config $config)
{
$this->config = $config;
}

/**
* @inheritdoc
*/
public function isAvailable(): bool
{
if ($this->config->isVerify3DSecure()) {
// Support of 3D secure not implemented for instant purchase yet.
return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Braintree\Model\InstantPurchase\CreditCard;

use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;

/**
* Braintree stored credit card formatter.
*/
class TokenFormatter implements PaymentTokenFormatterInterface
{
/**
* Most used credit card types
* @var array
*/
public static $baseCardTypes = [
'AE' => 'American Express',
'VI' => 'Visa',
'MC' => 'MasterCard',
'DI' => 'Discover',
'JBC' => 'JBC',
'CUP' => 'China Union Pay',
'MI' => 'Maestro',
];

/**
* @inheritdoc
*/
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string
{
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
if (!isset($details['type'], $details['maskedCC'], $details['expirationDate'])) {
throw new \InvalidArgumentException('Invalid Braintree credit card token details.');
}

if (isset(self::$baseCardTypes[$details['type']])) {
$ccType = self::$baseCardTypes[$details['type']];
} else {
$ccType = $details['type'];
}

$formatted = sprintf(
'%s: %s, %s: %s (%s: %s)',
__('Credit Card'),
$ccType,
__('ending'),
$details['maskedCC'],
__('expires'),
$details['expirationDate']
);

return $formatted;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Braintree\Model\InstantPurchase\PayPal;

use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;

/**
* Braintree PayPal token formatter.
*/
class TokenFormatter implements PaymentTokenFormatterInterface
{
/**
* @inheritdoc
*/
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string
{
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
if (!isset($details['payerEmail'])) {
throw new \InvalidArgumentException('Invalid Braintree PayPal token details.');
}

$formatted = sprintf(
'%s: %s',
__('PayPal'),
$details['payerEmail']
);

return $formatted;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Braintree\Model\InstantPurchase;

use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand;
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentAdditionalInformationProviderInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;

/**
* Provides Braintree specific payment additional information for instant purchase.
*/
class PaymentAdditionalInformationProvider implements PaymentAdditionalInformationProviderInterface
{
/**
* @var GetPaymentNonceCommand
*/
private $getPaymentNonceCommand;

/**
* PaymentAdditionalInformationProvider constructor.
* @param GetPaymentNonceCommand $getPaymentNonceCommand
*/
public function __construct(GetPaymentNonceCommand $getPaymentNonceCommand)
{
$this->getPaymentNonceCommand = $getPaymentNonceCommand;
}

/**
* @inheritdoc
*/
public function getAdditionalInformation(PaymentTokenInterface $paymentToken): array
{
$paymentMethodNonce = $this->getPaymentNonceCommand->execute([
PaymentTokenInterface::CUSTOMER_ID => $paymentToken->getCustomerId(),
PaymentTokenInterface::PUBLIC_HASH => $paymentToken->getPublicHash(),
])->get()['paymentMethodNonce'];

return [
'payment_method_nonce' => $paymentMethodNonce,
];
}
}
1 change: 1 addition & 0 deletions app/code/Magento/Braintree/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"magento/module-config": "100.3.*",
"magento/module-customer": "100.3.*",
"magento/module-directory": "100.3.*",
"magento/module-instant-purchase": "100.3.*",
"magento/module-payment": "100.3.*",
"magento/module-paypal": "100.3.*",
"magento/module-quote": "100.3.*",
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Braintree/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,21 @@
<braintree_cc_vault>
<model>BraintreeCreditCardVaultFacade</model>
<title>Stored Cards (Braintree)</title>
<instant_purchase>
<available>Magento\Braintree\Model\InstantPurchase\CreditCard\AvailabilityChecker</available>
<tokenFormat>Magento\Braintree\Model\InstantPurchase\CreditCard\TokenFormatter</tokenFormat>
<additionalInformation>Magento\Braintree\Model\InstantPurchase\PaymentAdditionalInformationProvider</additionalInformation>
</instant_purchase>
</braintree_cc_vault>
<braintree_paypal_vault>
<model>BraintreePayPalVaultFacade</model>
<title>Stored Accounts (Braintree PayPal)</title>
<can_use_internal>1</can_use_internal>
<instant_purchase>
<available>Magento\Braintree\Model\InstantPurchase\CreditCard\AvailabilityChecker</available>
<tokenFormat>Magento\Braintree\Model\InstantPurchase\CreditCard\TokenFormatter</tokenFormat>
<additionalInformation>Magento\Braintree\Model\InstantPurchase\PaymentAdditionalInformationProvider</additionalInformation>
</instant_purchase>
</braintree_paypal_vault>
</payment>
</default>
Expand Down
11 changes: 8 additions & 3 deletions app/code/Magento/Catalog/Model/ImageExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
*/
namespace Magento\Catalog\Model;

use Magento\Catalog\Model\Product\Attribute\Backend\Media\ImageEntryConverter;
use Magento\Catalog\Helper\Image;
use Magento\Catalog\Model\Product\Attribute\Backend\Media\ImageEntryConverter;
use Magento\Framework\View\Xsd\Media\TypeDataExtractorInterface;

class ImageExtractor implements \Magento\Framework\View\Xsd\Media\TypeDataExtractorInterface
class ImageExtractor implements TypeDataExtractorInterface
{
/**
* Extract configuration data of images from the DOM structure
Expand All @@ -30,8 +31,11 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
if ($attribute->nodeType != XML_ELEMENT_NODE) {
continue;
}
if ($attribute->tagName == 'background') {
$attributeTagName = $attribute->tagName;
if ($attributeTagName === 'background') {
$nodeValue = $this->processImageBackground($attribute->nodeValue);
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
$nodeValue = intval($attribute->nodeValue);
} else {
$nodeValue = $attribute->nodeValue;
}
Expand All @@ -55,6 +59,7 @@ private function processImageBackground($backgroundString)
$backgroundArray = [];
if (preg_match($pattern, $backgroundString, $backgroundArray)) {
array_shift($backgroundArray);
$backgroundArray = array_map('intval', $backgroundArray);
}
return $backgroundArray;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet)
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
{
$this->searchCriteriaBuilder->setFilterGroups((array)$searchCriteria->getFilterGroups());
$this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
Expand All @@ -71,9 +72,15 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
->create(),
]
);

$this->searchCriteriaBuilder->setSortOrders((array)$searchCriteria->getSortOrders());
$this->searchCriteriaBuilder->setCurrentPage($searchCriteria->getCurrentPage());
$this->searchCriteriaBuilder->setPageSize($searchCriteria->getPageSize());
return $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create());

$searchResult = $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create());
$searchResult->setSearchCriteria($searchCriteria);

return $searchResult;
}

/**
Expand Down
Loading

0 comments on commit 12a234a

Please sign in to comment.