From 964b5815f230822a402f960cdec7a8d42a72e593 Mon Sep 17 00:00:00 2001 From: Arkadii Chyzhov Date: Tue, 5 Apr 2016 19:56:12 +0300 Subject: [PATCH 01/26] MAGETWO-46242: Merchant can't import Currency rates - added new class to fetch data from Yahoo Finance Exchange - added missed records in config files for Fixer.Io - covered YahooFinance class with unit tests --- .../Model/Currency/Import/YahooFinance.php | 177 ++++++++++++++++++ .../Currency/Import/YahooFinanceTest.php | 94 ++++++++++ .../Directory/etc/adminhtml/system.xml | 12 ++ app/code/Magento/Directory/etc/config.xml | 6 + app/code/Magento/Directory/etc/di.xml | 4 + 5 files changed, 293 insertions(+) create mode 100644 app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php create mode 100644 app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php diff --git a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php new file mode 100644 index 0000000000000..4581d2ab2abcd --- /dev/null +++ b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php @@ -0,0 +1,177 @@ +scopeConfig = $scopeConfig; + $this->httpClientFactory = $httpClientFactory; + } + + /** + * {@inheritdoc} + */ + public function fetchRates() + { + $data = []; + $currencies = $this->_getCurrencyCodes(); + $defaultCurrencies = $this->_getDefaultCurrencyCodes(); + + foreach ($defaultCurrencies as $currencyFrom) { + if (!isset($data[$currencyFrom])) { + $data[$currencyFrom] = []; + } + $data = $this->convertBatch($data, $currencyFrom, $currencies); + ksort($data[$currencyFrom]); + } + return $data; + } + + /** + * Return currencies convert rates in batch mode + * + * @param array $data + * @param string $currencyFrom + * @param array $currenciesTo + * @return array + */ + private function convertBatch($data, $currencyFrom, $currenciesTo) + { + $url = $this->buildUrl($currencyFrom, $currenciesTo); + set_time_limit(0); + $response = $this->getServiceResponse($url); + ini_restore('max_execution_time'); + $response = array_column($response['query']['results']['rate'], 'Rate', 'id'); + foreach ($currenciesTo as $currencyTo) { + if ($currencyFrom == $currencyTo) { + $data[$currencyFrom][$currencyTo] = $this->_numberFormat(1); + } else { + if (empty($response[$currencyFrom . $currencyTo])) { + $this->_messages[] = __('We can\'t retrieve a rate from %1 for %2.', $url, $currencyTo); + $data[$currencyFrom][$currencyTo] = null; + } else { + $data[$currencyFrom][$currencyTo] = $this->_numberFormat( + (double)$response[$currencyFrom . $currencyTo] + ); + } + } + } + return $data; + } + + /** + * Get Fixer.io service response + * + * @param string $url + * @param int $retry + * @return array + */ + private function getServiceResponse($url, $retry = 0) + { + /** @var \Magento\Framework\HTTP\ZendClient $httpClient */ + $httpClient = $this->httpClientFactory->create(); + $response = []; + try { + $jsonResponse = $httpClient->setUri( + $url + )->setConfig( + [ + 'timeout' => $this->scopeConfig->getValue( + $this->timeoutConfigPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ), + ] + )->request( + 'GET' + )->getBody(); + + $response = json_decode($jsonResponse, true); + } catch (\Exception $e) { + if ($retry == 0) { + $response = $this->getServiceResponse($url, 1); + } + } + return $response; + } + + /** + * {@inheritdoc} + */ + protected function _convert($currencyFrom, $currencyTo) + { + } + + /** + * Build url for Currency Service + * + * @param string $currencyFrom + * @param string[] $currenciesTo + * @return string + */ + private function buildUrl($currencyFrom, $currenciesTo) + { + $query = urlencode('select ') . '*' . urlencode(' from yahoo.finance.xchange where pair in ('); + $query .= + urlencode( + implode( + ',', + array_map( + function ($currencyTo) use ($currencyFrom) { + return '"' . $currencyFrom . $currencyTo . '"'; + }, + $currenciesTo + ) + ) + ); + $query .= ')'; + return str_replace('{{YQL_STRING}}', $query, $this->currencyConverterUrl); + } +} diff --git a/app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php b/app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php new file mode 100644 index 0000000000000..4add2ca82d19b --- /dev/null +++ b/app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php @@ -0,0 +1,94 @@ +currencyFactoryMock = $this->getMockBuilder('Magento\Directory\Model\CurrencyFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->httpClientFactoryMock = $this->getMockBuilder('Magento\Framework\HTTP\ZendClientFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $scopeMock = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + + $this->model = $objectManagerHelper->getObject( + 'Magento\Directory\Model\Currency\Import\YahooFinance', + [ + 'currencyFactory' => $this->currencyFactoryMock, + 'scopeConfig' => $scopeMock, + 'httpClientFactory' => $this->httpClientFactoryMock + ] + ); + } + + public function testFetchRates() + { + $currencyFromList = ['USD']; + $currencyToList = ['EUR', 'UAH']; + $responseBody = '{"query":{"count":7,"created":"2016-04-05T16:46:55Z","lang":"en-US","results":{"rate":' + . '[{"id":"USDEUR","Name":"USD/EUR","Rate":"0.9022","Date":"4/5/2016"}]}}}'; + $expectedCurrencyRateList = ['USD' => ['EUR' => 0.9022, 'UAH' => null]]; + $message = "We can't retrieve a rate from http://query.yahooapis.com/v1/public/yql?format=json" + . "&q=select+*+from+yahoo.finance.xchange+where+pair+in+%28%22USDEUR%22%2C%22USDUAH%22)" + . "&env=store://datatables.org/alltableswithkeys for UAH."; + + /** @var \Magento\Directory\Model\Currency|\PHPUnit_Framework_MockObject_MockObject $currencyMock */ + $currencyMock = $this->getMockBuilder('Magento\Directory\Model\Currency') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + /** @var \Magento\Framework\HTTP\ZendClient|\PHPUnit_Framework_MockObject_MockObject $currencyMock */ + $httpClientMock = $this->getMockBuilder('Magento\Framework\HTTP\ZendClient') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + /** @var \Zend_Http_Response|\PHPUnit_Framework_MockObject_MockObject $currencyMock */ + $httpResponseMock = $this->getMockBuilder('Zend_Http_Response') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + $this->currencyFactoryMock->expects($this->any())->method('create')->willReturn($currencyMock); + $currencyMock->expects($this->once())->method('getConfigBaseCurrencies')->willReturn($currencyFromList); + $currencyMock->expects($this->once())->method('getConfigAllowCurrencies')->willReturn($currencyToList); + $this->httpClientFactoryMock->expects($this->any())->method('create')->willReturn($httpClientMock); + $httpClientMock->expects($this->atLeastOnce())->method('setUri')->willReturnSelf(); + $httpClientMock->expects($this->atLeastOnce())->method('setConfig')->willReturnSelf(); + $httpClientMock->expects($this->atLeastOnce())->method('request')->willReturn($httpResponseMock); + $httpResponseMock->expects($this->any())->method('getBody')->willReturn($responseBody); + + $this->assertEquals($expectedCurrencyRateList, $this->model->fetchRates()); + $messages = $this->model->getMessages(); + $this->assertNotEmpty($messages); + $this->assertTrue(is_array($messages)); + $this->assertEquals($message, (string)$messages[0]); + } +} diff --git a/app/code/Magento/Directory/etc/adminhtml/system.xml b/app/code/Magento/Directory/etc/adminhtml/system.xml index 5e61820f49c60..f2a9e6448c50f 100644 --- a/app/code/Magento/Directory/etc/adminhtml/system.xml +++ b/app/code/Magento/Directory/etc/adminhtml/system.xml @@ -34,6 +34,18 @@ 1 + + + + + + + + + + + + diff --git a/app/code/Magento/Directory/etc/config.xml b/app/code/Magento/Directory/etc/config.xml index 8bb69e52687d2..5c4de023286c8 100644 --- a/app/code/Magento/Directory/etc/config.xml +++ b/app/code/Magento/Directory/etc/config.xml @@ -18,6 +18,12 @@ USD USD + + 100 + + + 100 + 100 diff --git a/app/code/Magento/Directory/etc/di.xml b/app/code/Magento/Directory/etc/di.xml index 724a7fcce1b9c..f868197e60593 100644 --- a/app/code/Magento/Directory/etc/di.xml +++ b/app/code/Magento/Directory/etc/di.xml @@ -9,6 +9,10 @@ + + Yahoo Finance Exchange + Magento\Directory\Model\Currency\Import\YahooFinance + Webservicex Magento\Directory\Model\Currency\Import\Webservicex From 9232061b984e65a13bc0c97c3eb466f2b4914977 Mon Sep 17 00:00:00 2001 From: Arkadii Chyzhov Date: Wed, 6 Apr 2016 13:08:33 +0300 Subject: [PATCH 02/26] MAGETWO-46242: Merchant can't import Currency rates - code refactoring --- .../Directory/Model/Currency/Import/YahooFinance.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php index 4581d2ab2abcd..cc0d06ff30794 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php +++ b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php @@ -89,7 +89,6 @@ private function convertBatch($data, $currencyFrom, $currenciesTo) set_time_limit(0); $response = $this->getServiceResponse($url); ini_restore('max_execution_time'); - $response = array_column($response['query']['results']['rate'], 'Rate', 'id'); foreach ($currenciesTo as $currencyTo) { if ($currencyFrom == $currencyTo) { $data[$currencyFrom][$currencyTo] = $this->_numberFormat(1); @@ -133,7 +132,10 @@ private function getServiceResponse($url, $retry = 0) 'GET' )->getBody(); - $response = json_decode($jsonResponse, true); + $jsonResponse = json_decode($jsonResponse, true); + if (!empty($jsonResponse['query']['results']['rate']) ) { + $response = array_column($jsonResponse['query']['results']['rate'], 'Rate', 'id'); + } } catch (\Exception $e) { if ($retry == 0) { $response = $this->getServiceResponse($url, 1); From e1ee93f52d41624ac5939cc4696e885c1a9504a5 Mon Sep 17 00:00:00 2001 From: Steven Vandeputte Date: Mon, 11 Apr 2016 10:33:03 +0200 Subject: [PATCH 03/26] Fix Call to a member function getCode() on string for convert method in currency model --- app/code/Magento/Directory/Model/Currency.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php index 576c946d0d647..727303e34d951 100644 --- a/app/code/Magento/Directory/Model/Currency.php +++ b/app/code/Magento/Directory/Model/Currency.php @@ -233,7 +233,13 @@ public function convert($price, $toCurrency = null) return $price * $rate; } - throw new \Exception(__('Undefined rate from "%1-%2".', $this->getCode(), $toCurrency->getCode())); + throw new \Exception( + __( + 'Undefined rate from "%1-%2".', + $this->getCode(), + (is_string($toCurrency)) ? $toCurrency : $toCurrency->getCode() + ) + ); } /** From 8bd8118e9a0f02d41bc0726b7481dd4d64252e3e Mon Sep 17 00:00:00 2001 From: Arkadii Chyzhov Date: Wed, 13 Apr 2016 17:17:17 +0300 Subject: [PATCH 04/26] MAGETWO-46242: Merchant can't import Currency rates - restore max excecution time in case of exception --- .../Magento/Directory/Model/Currency/Import/FixerIo.php | 7 +++++-- .../Directory/Model/Currency/Import/YahooFinance.php | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php b/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php index c618baa701525..a2137e9bd6c63 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php +++ b/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php @@ -80,8 +80,11 @@ private function convertBatch($data, $currencyFrom, $currenciesTo) $url = str_replace('{{CURRENCY_TO}}', $currenciesStr, $url); set_time_limit(0); - $response = $this->getServiceResponse($url); - ini_restore('max_execution_time'); + try { + $response = $this->getServiceResponse($url); + } finally { + ini_restore('max_execution_time'); + } foreach ($currenciesTo as $currencyTo) { if ($currencyFrom == $currencyTo) { diff --git a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php index cc0d06ff30794..24749252549bf 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php +++ b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php @@ -87,8 +87,12 @@ private function convertBatch($data, $currencyFrom, $currenciesTo) { $url = $this->buildUrl($currencyFrom, $currenciesTo); set_time_limit(0); - $response = $this->getServiceResponse($url); - ini_restore('max_execution_time'); + try { + $response = $this->getServiceResponse($url); + } finally { + ini_restore('max_execution_time'); + } + foreach ($currenciesTo as $currencyTo) { if ($currencyFrom == $currencyTo) { $data[$currencyFrom][$currencyTo] = $this->_numberFormat(1); From bef88dfe53759f88f6ed6368a322a4b55ccce26f Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 14 Apr 2016 14:29:54 -0500 Subject: [PATCH 05/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- app/code/Magento/Persistent/Model/Session.php | 22 +++++++++++++++++++ .../Framework/App/PageCache/Version.php | 1 + .../Magento/Framework/Session/Config.php | 1 + 3 files changed, 24 insertions(+) diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 48ba5e8918d29..8ecedd3fb88ae 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -94,6 +94,13 @@ class Session extends \Magento\Framework\Model\AbstractModel */ protected $sessionConfig; + /** + * Request + * + * @var \Magento\Framework\App\Request\Http + */ + protected $request; + /** * Constructor * @@ -379,6 +386,7 @@ private function setCookie($value, $duration, $path) $publicCookieMetadata = $this->_cookieMetadataFactory->createPublicCookieMetadata() ->setDuration($duration) ->setPath($path) + ->setSecure($this->getRequest()->isSecure()) ->setHttpOnly(true); $this->_cookieManager->setPublicCookie( self::COOKIE_NAME, @@ -386,4 +394,18 @@ private function setCookie($value, $duration, $path) $publicCookieMetadata ); } + + /** + * Get request object + * + * @return \Magento\Framework\App\Request\Http + */ + private function getRequest() + { + if ($this->request == null) { + $this->request = \Magento\Framework\App\ObjectManager::getInstance() + ->get('\Magento\Framework\App\Request\Http'); + } + return $this->request; + } } diff --git a/lib/internal/Magento/Framework/App/PageCache/Version.php b/lib/internal/Magento/Framework/App/PageCache/Version.php index 6f15cbc70e0a6..272ad8ce5c02f 100644 --- a/lib/internal/Magento/Framework/App/PageCache/Version.php +++ b/lib/internal/Magento/Framework/App/PageCache/Version.php @@ -79,6 +79,7 @@ public function process() $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata() ->setDuration(self::COOKIE_PERIOD) ->setPath('/') + ->setSecure($this->request->isSecure()) ->setHttpOnly(false); $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata); } diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index 67282dac1c114..91697143472d3 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -109,6 +109,7 @@ public function __construct( $this->_httpRequest = $request; $this->_scopeType = $scopeType; $this->lifetimePath = $lifetimePath; + $this->setCookieSecure($this->_httpRequest->isSecure()); /** * Session handler From 0f8ecae43712a0de34eda96a4b1b193ae823e846 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Wed, 20 Apr 2016 14:43:14 +0200 Subject: [PATCH 06/26] Missing a slash in SFTP file listing id The output is now ``` [7765]=> array(2) { ["text"]=> string(48) "6112290001-lgm_score_shirts-chasin-riser-l_2.jpg" ["id"]=> string(120) "/var/www/dev/magento2/new6112290001-lgm_score_shirts-chasin-riser-l_2.jpg" } [7766]=> array(2) { ["text"]=> string(57) "9a10500056-090_score_accessoires-g-star-raw-ladd-belt.JPG" ["id"]=> string(129) "/var/www/dev/magento2/new9a10500056-090_score_accessoires-g-star-raw-ladd-belt.JPG" } [7767]=> array(2) { ["text"]=> string(53) "5211500548-flm_score_t-shirts-g-star-raw-nerx-r_2.JPG" ["id"]=> string(125) "/var/www/dev/magento2/new5211500548-flm_score_t-shirts-g-star-raw-nerx-r_2.JPG" } ``` instead of ``` [7765]=> array(2) { ["text"]=> string(48) "6112290001-lgm_score_shirts-chasin-riser-l_2.jpg" ["id"]=> string(120) "/var/www/dev/magento2/new/6112290001-lgm_score_shirts-chasin-riser-l_2.jpg" } [7766]=> array(2) { ["text"]=> string(57) "9a10500056-090_score_accessoires-g-star-raw-ladd-belt.JPG" ["id"]=> string(129) "/var/www/dev/magento2/new/9a10500056-090_score_accessoires-g-star-raw-ladd-belt.JPG" } [7767]=> array(2) { ["text"]=> string(53) "5211500548-flm_score_t-shirts-g-star-raw-nerx-r_2.JPG" ["id"]=> string(125) "/var/www/dev/magento2/new/5211500548-flm_score_t-shirts-g-star-raw-nerx-r_2.JPG" } ``` --- lib/internal/Magento/Framework/Filesystem/Io/Sftp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php index 97439e1bd728b..30bed420be66c 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php @@ -239,7 +239,7 @@ public function ls($grep = null) $currentWorkingDir = $this->pwd(); $result = []; foreach ($list as $name) { - $result[] = ['text' => $name, 'id' => "{$currentWorkingDir}{$name}"]; + $result[] = ['text' => $name, 'id' => "{$currentWorkingDir}/{$name}"]; } return $result; } From 78ace0314ed8e4c5c0ac95c34df0ae7420f39fbb Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 21 Apr 2016 15:47:25 -0500 Subject: [PATCH 07/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- lib/internal/Magento/Framework/Session/Config.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index 91697143472d3..e6245ab20b7c4 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -42,6 +42,10 @@ class Config implements ConfigInterface /** Cookie default lifetime */ const COOKIE_LIFETIME_DEFAULT = 3600; + const XML_PATH_UNSECURE_BASE_URL = 'web/unsecure/base_url'; + + const XML_PATH_SECURE_BASE_URL = 'web/secure/base_url'; + /** * All options * @@ -109,7 +113,6 @@ public function __construct( $this->_httpRequest = $request; $this->_scopeType = $scopeType; $this->lifetimePath = $lifetimePath; - $this->setCookieSecure($this->_httpRequest->isSecure()); /** * Session handler @@ -162,6 +165,11 @@ public function __construct( $this->setCookieHttpOnly( $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_HTTPONLY, $this->_scopeType) ); + + $secureURL = $this->_scopeConfig->getValue(self::XML_PATH_SECURE_BASE_URL, $this->_scopeType); + $unSecureURL = $this->_scopeConfig->getValue(self::XML_PATH_UNSECURE_BASE_URL, $this->_scopeType); + $isFullySecuredURL = $secureURL == $unSecureURL; + $this->setCookieSecure($isFullySecuredURL && $this->_httpRequest->isSecure()); } /** From d34a7c33952fd233caedbf201320eed0cc1e9678 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 27 Apr 2016 11:08:51 -0500 Subject: [PATCH 08/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- app/code/Magento/Persistent/Model/Session.php | 3 ++- lib/internal/Magento/Framework/Session/Config.php | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 8ecedd3fb88ae..b77a41f0eab38 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -99,7 +99,7 @@ class Session extends \Magento\Framework\Model\AbstractModel * * @var \Magento\Framework\App\Request\Http */ - protected $request; + private $request; /** * Constructor @@ -399,6 +399,7 @@ private function setCookie($value, $duration, $path) * Get request object * * @return \Magento\Framework\App\Request\Http + * @deprecated */ private function getRequest() { diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index e6245ab20b7c4..a373e72584b9b 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -15,6 +15,7 @@ /** * Magento session configuration + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Config implements ConfigInterface { @@ -42,10 +43,6 @@ class Config implements ConfigInterface /** Cookie default lifetime */ const COOKIE_LIFETIME_DEFAULT = 3600; - const XML_PATH_UNSECURE_BASE_URL = 'web/unsecure/base_url'; - - const XML_PATH_SECURE_BASE_URL = 'web/secure/base_url'; - /** * All options * @@ -166,9 +163,9 @@ public function __construct( $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_HTTPONLY, $this->_scopeType) ); - $secureURL = $this->_scopeConfig->getValue(self::XML_PATH_SECURE_BASE_URL, $this->_scopeType); - $unSecureURL = $this->_scopeConfig->getValue(self::XML_PATH_UNSECURE_BASE_URL, $this->_scopeType); - $isFullySecuredURL = $secureURL == $unSecureURL; + $secureURL = $this->_scopeConfig->getValue('web/secure/base_url', $this->_scopeType); + $unsecureURL = $this->_scopeConfig->getValue('web/unsecure/base_url', $this->_scopeType); + $isFullySecuredURL = $secureURL == $unsecureURL; $this->setCookieSecure($isFullySecuredURL && $this->_httpRequest->isSecure()); } From 07cee603cbd7b1277618bb63c8f7a1db07b47ec7 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 27 Apr 2016 11:12:27 -0500 Subject: [PATCH 09/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- .../Magento/Persistent/Test/Unit/Model/SessionTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php b/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php index 1cb59428f709f..5f99301ac4864 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php @@ -70,6 +70,7 @@ protected function setUp() 'cookieManager' => $this->cookieManagerMock, 'context' => $context, 'cookieMetadataFactory' => $this->cookieMetadataFactoryMock, + 'request' => $this->getMock('\Magento\Framework\App\Request\Http', [], [], '', false, false), 'resource' => $resourceMock, ] ); @@ -129,6 +130,10 @@ public function testSetPersistentCookie() ->method('setDuration') ->with($duration) ->will($this->returnSelf()); + $cookieMetadataMock->expects($this->once()) + ->method('setSecure') + ->with(false) + ->will($this->returnSelf()); $cookieMetadataMock->expects($this->once()) ->method('setHttpOnly') ->with(true) @@ -172,6 +177,10 @@ public function testRenewPersistentCookie( ->method('setDuration') ->with($cookieDuration) ->will($this->returnSelf()); + $cookieMetadataMock->expects($this->exactly($numCalls)) + ->method('setSecure') + ->with(false) + ->will($this->returnSelf()); $cookieMetadataMock->expects($this->exactly($numCalls)) ->method('setHttpOnly') ->with(true) From d18ab4138f7ce7397394ced7c8538bbb03d90705 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 27 Apr 2016 11:22:37 -0500 Subject: [PATCH 10/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- app/code/Magento/Persistent/Model/Session.php | 1 + lib/internal/Magento/Framework/Session/Config.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index b77a41f0eab38..53da1abcca982 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -10,6 +10,7 @@ * * @method int getCustomerId() * @method Session setCustomerId() + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Session extends \Magento\Framework\Model\AbstractModel { diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index a373e72584b9b..27cdd57c571dc 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -15,7 +15,6 @@ /** * Magento session configuration - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Config implements ConfigInterface { From ce6797e5d19b2ef2e5fb9441626354e55ac67111 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 27 Apr 2016 14:08:17 -0500 Subject: [PATCH 11/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- .../Framework/App/Test/Unit/PageCache/VersionTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php index 22d6f910b8287..b1e8748c3ec8f 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php @@ -88,6 +88,11 @@ public function testProcess($isPost) ->with(Version::COOKIE_PERIOD) ->will($this->returnSelf()); + $publicCookieMetadataMock->expects($this->once()) + ->method('setSecure') + ->with(false) + ->will($this->returnSelf()); + $publicCookieMetadataMock->expects($this->once()) ->method('setHttpOnly') ->with(false) From 75bf49ab285d0af78f3f3fdbf9ce2a51a0e15388 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 27 Apr 2016 14:20:53 -0500 Subject: [PATCH 12/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- .../Magento/Framework/Session/Test/Unit/ConfigTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php index 7866ee433dbcd..be2249f3c07d8 100644 --- a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php @@ -380,6 +380,7 @@ public function constructorDataProvider() 'session.cookie_path' => '/', 'session.cookie_domain' => 'init.host', 'session.cookie_httponly' => false, + 'session.cookie_secure' => false, ], ], 'all invalid' => [ @@ -389,6 +390,7 @@ public function constructorDataProvider() 'session.save_handler' => 'files', 'session.cache_limiter' => 'files', 'session.cookie_httponly' => false, + 'session.cookie_secure' => false, ], ], 'invalid_valid' => [ @@ -401,6 +403,7 @@ public function constructorDataProvider() 'session.cookie_path' => '/', 'session.cookie_domain' => 'init.host', 'session.cookie_httponly' => false, + 'session.cookie_secure' => false, ], ], ]; From 63edab28d052cff91544115cef0ee2ab8facf56a Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 27 Apr 2016 15:34:07 -0500 Subject: [PATCH 13/26] MAGETWO-50952: [ZAP-M2]: Cookie set without secure flag --- .../Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php index 7380ffe0e271a..c875da549e8ef 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php @@ -112,7 +112,7 @@ public function testSetCookiePathNonDefault() public function testSetSessionSettingsByConstructor($secureRequest) { $sessionName = 'admin'; - $this->requestMock->expects($this->once())->method('isSecure')->willReturn($secureRequest); + $this->requestMock->expects($this->exactly(2))->method('isSecure')->willReturn($secureRequest); $validatorMock = $this->getMockBuilder('Magento\Framework\Validator\ValidatorInterface') ->disableOriginalConstructor() From 2b28097227f886aab1e4cedb7db61a8bd61ec163 Mon Sep 17 00:00:00 2001 From: nevvermind Date: Wed, 27 Apr 2016 11:52:25 +0100 Subject: [PATCH 14/26] \Magento\Framework\App\Helper\AbstractHelper leaking undeclared property /cc https://github.com/magento/magento2/issues/2103 --- lib/internal/Magento/Framework/App/Helper/AbstractHelper.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php index 7b03f1c864069..6d7963d9a9b6f 100644 --- a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php +++ b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php @@ -72,6 +72,11 @@ abstract class AbstractHelper * @var \Magento\Framework\App\Config\ScopeConfigInterface */ protected $scopeConfig; + + /** + * @var \Magento\Framework\Cache\ConfigInterface + */ + protected $_cacheConfig; /** * @param Context $context From 6975a69d0ee5af7922cdadf1d54168efc477def8 Mon Sep 17 00:00:00 2001 From: nevvermind Date: Sat, 30 Apr 2016 10:58:49 +0100 Subject: [PATCH 15/26] Remove whitespace --- lib/internal/Magento/Framework/App/Helper/AbstractHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php index 6d7963d9a9b6f..e33badff9a638 100644 --- a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php +++ b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php @@ -72,11 +72,11 @@ abstract class AbstractHelper * @var \Magento\Framework\App\Config\ScopeConfigInterface */ protected $scopeConfig; - + /** * @var \Magento\Framework\Cache\ConfigInterface */ - protected $_cacheConfig; + protected $_cacheConfig; /** * @param Context $context From 3f47be45616398cd855dda89dd71eeec6a15a37d Mon Sep 17 00:00:00 2001 From: NikolasSumrak Date: Tue, 3 May 2016 12:52:34 +0300 Subject: [PATCH 16/26] Update Export.php fix for export grid with the number of lines > 1000 (collection not loaded second time) --- app/code/Magento/Backend/Block/Widget/Grid/Export.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index 4b0eceae2e116..b32bdff510eab 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -257,6 +257,7 @@ public function _exportIterateCollection($callback, array $args) $break = false; while ($break !== true) { + $originalCollection->clear(); $originalCollection->setPageSize($this->getExportPageSize()); $originalCollection->setCurPage($page); $originalCollection->load(); From 01ed4a80724a9d66887b6c47c858c36529ad634a Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Tue, 10 May 2016 11:51:54 -0500 Subject: [PATCH 17/26] MAGETWO-52621: [Github] The cron setting `use_separate_process` is not actually parallelized #4435 - Changed background shell command for bash environments. --- .../Magento/Framework/Shell/CommandRendererBackground.php | 3 ++- .../Shell/Test/Unit/CommandRendererBackgroundTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php b/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php index 64c21db08bb5a..dccceb70cdc48 100644 --- a/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php +++ b/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php @@ -32,8 +32,9 @@ public function __construct(OsInfo $osInfo) public function render($command, array $arguments = []) { $command = parent::render($command, $arguments); + return $this->osInfo->isWindows() ? 'start /B "magento background task" ' . $command - : $command . ' > /dev/null &'; + : str_replace('2>&1', '> /dev/null &', $command); } } diff --git a/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php b/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php index bac1f118035eb..b40394c853637 100644 --- a/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php +++ b/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php @@ -53,7 +53,7 @@ public function commandPerOsTypeDataProvider() { return [ 'windows' => [true, 'start /B "magento background task" ' . $this->testCommand . ' 2>&1'], - 'unix' => [false, $this->testCommand . ' 2>&1 > /dev/null &'], + 'unix' => [false, $this->testCommand . ' > /dev/null &'], ]; } } From c15593f128d2a297e667702c8b51a02f336d9841 Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Thu, 12 May 2016 21:30:10 -0500 Subject: [PATCH 18/26] MAGETWO-52707: [github] SMTP settings are not used - Added a plugin to configure php init according to settings if on windows host. --- .../Email/Model/Plugin/WindowsSMTPConfig.php | 58 +++++++++++++++++++ app/code/Magento/Email/etc/di.xml | 3 + 2 files changed, 61 insertions(+) create mode 100644 app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php diff --git a/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php b/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php new file mode 100644 index 0000000000000..4eb0d11dbca5e --- /dev/null +++ b/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php @@ -0,0 +1,58 @@ +config = $config; + $this->osInfo = $osInfo; + } + + /** + * @param \Magento\Framework\Mail\TransportInterface $subject + * return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject) + { + if (!$this->osInfo->isWindows()) { + ini_set('SMTP', $this->config->getValue(self::XML_SMTP_HOST)); + ini_set('smtp_port', $this->config->getValue(self::XML_SMTP_PORT)); + } + } +} diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml index 494d32a6557b1..90283717d5bda 100644 --- a/app/code/Magento/Email/etc/di.xml +++ b/app/code/Magento/Email/etc/di.xml @@ -57,4 +57,7 @@ + + + From 48910d5783e06776aaed4a1438e848b8af3701f7 Mon Sep 17 00:00:00 2001 From: Arkadii Chyzhov Date: Fri, 13 May 2016 15:44:42 +0300 Subject: [PATCH 19/26] MAGETWO-52780: [Github] webservicex.net currency converter can return -1 in case of its internal failure #3118 --- .../Magento/Directory/Model/Currency/Import/Webservicex.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php b/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php index 107743d4ad04c..f8f0dcd021e07 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php +++ b/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php @@ -72,7 +72,7 @@ protected function _convert($currencyFrom, $currencyTo, $retry = 0) )->getBody(); $xml = simplexml_load_string($response, null, LIBXML_NOERROR); - if (!$xml) { + if (!$xml || (isset($xml[0]) && $xml[0] == -1)) { $this->_messages[] = __('We can\'t retrieve a rate from %1.', $url); return null; } From 4bbd01bbf8b10c59eef79668c3d4858850560fc4 Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 13 May 2016 11:52:21 -0500 Subject: [PATCH 20/26] MAGETWO-52707: [github] SMTP settings are not used - Added a plugin to configure php init according to settings if on windows host. --- app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php | 7 ++++--- app/code/Magento/Email/etc/di.xml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php b/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php index 4eb0d11dbca5e..11fa2f9353276 100644 --- a/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php +++ b/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php @@ -8,7 +8,7 @@ /** * Plugin for \Magento\Framework\Mail\TransportInterface */ -class WindowsSMTPConfig +class WindowsSmtpConfig { /** * host config path @@ -43,14 +43,15 @@ public function __construct( } /** + * To configure smtp settings for session right before sending message on windows server + * * @param \Magento\Framework\Mail\TransportInterface $subject * return void - * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject) { - if (!$this->osInfo->isWindows()) { + if ($this->osInfo->isWindows()) { ini_set('SMTP', $this->config->getValue(self::XML_SMTP_HOST)); ini_set('smtp_port', $this->config->getValue(self::XML_SMTP_PORT)); } diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml index 90283717d5bda..5be5efeb0b678 100644 --- a/app/code/Magento/Email/etc/di.xml +++ b/app/code/Magento/Email/etc/di.xml @@ -58,6 +58,6 @@ - + From 268aa9d4015a4e07b19ee532323418fa40a0bb08 Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 13 May 2016 11:58:03 -0500 Subject: [PATCH 21/26] MAGETWO-52707: [github] SMTP settings are not used - File name change. temp. --- .../Plugin/{WindowsSMTPConfig.php => WindowsSmtpConfig1.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/code/Magento/Email/Model/Plugin/{WindowsSMTPConfig.php => WindowsSmtpConfig1.php} (100%) diff --git a/app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php b/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig1.php similarity index 100% rename from app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php rename to app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig1.php From 719b2e8b7a7641197e302cb370ce2ba5659746af Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 13 May 2016 11:58:37 -0500 Subject: [PATCH 22/26] MAGETWO-52707: [github] SMTP settings are not used - File name change. --- .../Plugin/{WindowsSmtpConfig1.php => WindowsSmtpConfig.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/code/Magento/Email/Model/Plugin/{WindowsSmtpConfig1.php => WindowsSmtpConfig.php} (100%) diff --git a/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig1.php b/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php similarity index 100% rename from app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig1.php rename to app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php From 54cb05bc94edc45189643eff2baec9ba7ccd7b82 Mon Sep 17 00:00:00 2001 From: Cari Spruiell Date: Fri, 13 May 2016 14:38:23 -0500 Subject: [PATCH 23/26] MAGETWO-52803: PR Creation & Stabilization - fix static test failures --- .../Magento/Directory/Model/Currency/Import/YahooFinance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php index 24749252549bf..f2270ef20e61d 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php +++ b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php @@ -137,7 +137,7 @@ private function getServiceResponse($url, $retry = 0) )->getBody(); $jsonResponse = json_decode($jsonResponse, true); - if (!empty($jsonResponse['query']['results']['rate']) ) { + if (!empty($jsonResponse['query']['results']['rate'])) { $response = array_column($jsonResponse['query']['results']['rate'], 'Rate', 'id'); } } catch (\Exception $e) { From fdb73a42573c8239831bc1945f7f4c515c65ca25 Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 13 May 2016 14:58:40 -0500 Subject: [PATCH 24/26] MAGETWO-52340: Gift Message Data for Sales Order not available for retrieval using API - Added notice for getList methods on behalf of Kevin Harper. --- .../Magento/Customer/Api/CustomerRepositoryInterface.php | 8 ++++++-- .../Magento/Customer/Api/GroupRepositoryInterface.php | 4 ++++ .../Magento/Eav/Api/AttributeSetRepositoryInterface.php | 4 ++++ app/code/Magento/Quote/Api/CartRepositoryInterface.php | 5 +++++ .../Quote/Api/GuestPaymentMethodManagementInterface.php | 4 ++++ .../Quote/Api/PaymentMethodManagementInterface.php | 4 ++++ .../Magento/Sales/Api/CreditmemoRepositoryInterface.php | 4 ++++ app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php | 4 ++++ .../Magento/Sales/Api/OrderItemRepositoryInterface.php | 4 ++++ app/code/Magento/Sales/Api/OrderRepositoryInterface.php | 4 ++++ .../Magento/Sales/Api/ShipmentRepositoryInterface.php | 4 ++++ .../Magento/Sales/Api/TransactionRepositoryInterface.php | 4 ++++ .../Magento/SalesRule/Api/CouponRepositoryInterface.php | 8 ++++++-- .../Magento/SalesRule/Api/RuleRepositoryInterface.php | 6 +++++- app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php | 4 ++++ app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php | 4 ++++ app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php | 4 ++++ 17 files changed, 74 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php b/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php index fc577973edfb1..bfb3f619ae36d 100644 --- a/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php +++ b/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php @@ -13,7 +13,7 @@ interface CustomerRepositoryInterface { /** - * Create customer. + * Create or update a customer. * * @api * @param \Magento\Customer\Api\Data\CustomerInterface $customer @@ -38,7 +38,7 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa public function get($email, $websiteId = null); /** - * Retrieve customer. + * Get customer by customer ID. * * @api * @param int $customerId @@ -51,6 +51,10 @@ public function getById($customerId); /** * Retrieve customers which match a specified criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CustomerRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * * @api * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Customer\Api\Data\CustomerSearchResultsInterface diff --git a/app/code/Magento/Customer/Api/GroupRepositoryInterface.php b/app/code/Magento/Customer/Api/GroupRepositoryInterface.php index 1ba4a0546989a..67b4b42128534 100644 --- a/app/code/Magento/Customer/Api/GroupRepositoryInterface.php +++ b/app/code/Magento/Customer/Api/GroupRepositoryInterface.php @@ -41,6 +41,10 @@ public function getById($id); * The list of groups can be filtered to exclude the NOT_LOGGED_IN group using the first parameter and/or it can * be filtered by tax class. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#GroupRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * * @api * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Customer\Api\Data\GroupSearchResultsInterface diff --git a/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php b/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php index 4529920024b83..6c5e9d4ad2de8 100644 --- a/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php +++ b/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php @@ -15,6 +15,10 @@ interface AttributeSetRepositoryInterface /** * Retrieve list of Attribute Sets * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#AttributeSetRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Eav\Api\Data\AttributeSetSearchResultsInterface */ diff --git a/app/code/Magento/Quote/Api/CartRepositoryInterface.php b/app/code/Magento/Quote/Api/CartRepositoryInterface.php index 2244e4505eb3c..a8ef3dfba7690 100644 --- a/app/code/Magento/Quote/Api/CartRepositoryInterface.php +++ b/app/code/Magento/Quote/Api/CartRepositoryInterface.php @@ -23,6 +23,11 @@ public function get($cartId); /** * Enables administrative users to list carts that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CartRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Quote\Api\Data\CartSearchResultsInterface */ diff --git a/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php b/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php index 493e455246ce9..9566cdaf6fe62 100644 --- a/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php @@ -35,6 +35,10 @@ public function get($cartId); /** * List available payment methods for a specified shopping cart. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#GuestPaymentMethodManagementInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param string $cartId The cart ID. * @return \Magento\Quote\Api\Data\PaymentMethodInterface[] Array of payment methods. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist. diff --git a/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php b/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php index 49f143ae21734..f836a42be1fcf 100644 --- a/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php @@ -35,6 +35,10 @@ public function get($cartId); /** * Lists available payment methods for a specified shopping cart. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#PaymentMethodManagementInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param int $cartId The cart ID. * @return \Magento\Quote\Api\Data\PaymentMethodInterface[] Array of payment methods. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist. diff --git a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php index 30b8d3e14538c..e922ca104daea 100644 --- a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php @@ -18,6 +18,10 @@ interface CreditmemoRepositoryInterface /** * Lists credit memos that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CreditmemoRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoSearchResultInterface Credit memo search result interface. */ diff --git a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php index 1670de1230289..b2250a1c9b6e2 100644 --- a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php @@ -16,6 +16,10 @@ interface InvoiceRepositoryInterface /** * Lists invoices that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#InvoiceRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\InvoiceSearchResultInterface Invoice search result interface. */ diff --git a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php index b1eb49e9fe429..dde41bda84bb5 100644 --- a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php @@ -18,6 +18,10 @@ interface OrderItemRepositoryInterface /** * Lists order items that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#OrderItemRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderItemSearchResultInterface Order item search result interface. */ diff --git a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php index 867b8d21318f8..15b616986c666 100644 --- a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php @@ -18,6 +18,10 @@ interface OrderRepositoryInterface /** * Lists orders that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#OrderRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderSearchResultInterface Order search result interface. */ diff --git a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php index d9e49ab9286de..8ca32a107df6c 100644 --- a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php @@ -17,6 +17,10 @@ interface ShipmentRepositoryInterface /** * Lists shipments that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#ShipmentRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentSearchResultInterface Shipment search results interface. */ diff --git a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php index bdf8d27ca6d16..1d100f9f75082 100644 --- a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php @@ -16,6 +16,10 @@ interface TransactionRepositoryInterface /** * Lists transactions that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TransactionRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\TransactionSearchResultInterface Transaction search result interface. */ diff --git a/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php b/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php index c06a75d1ec652..d6bccbe98e019 100644 --- a/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php +++ b/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php @@ -13,7 +13,7 @@ interface CouponRepositoryInterface { /** - * Save coupon. + * Save a coupon. * * @param \Magento\SalesRule\Api\Data\CouponInterface $coupon * @return \Magento\SalesRule\Api\Data\CouponInterface @@ -34,7 +34,11 @@ public function save(\Magento\SalesRule\Api\Data\CouponInterface $coupon); public function getById($couponId); /** - * Retrieve coupon. + * Retrieve a coupon using the specified search criteria. + * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#RuleRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\SalesRule\Api\Data\CouponSearchResultInterface diff --git a/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php b/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php index 5e29813f8fe78..d45b163d5d834 100644 --- a/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php +++ b/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php @@ -34,7 +34,11 @@ public function save(\Magento\SalesRule\Api\Data\RuleInterface $rule); public function getById($ruleId); /** - * Retrieve sales rules. + * Retrieve sales rules that match te specified criteria. + * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#RuleRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\SalesRule\Api\Data\RuleSearchResultInterface diff --git a/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php b/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php index bdbd968635880..af08e14325e94 100644 --- a/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php +++ b/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php @@ -25,6 +25,10 @@ public function get($taxClassId); /** * Retrieve tax classes which match a specific criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TaxClassRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Tax\Api\Data\TaxClassSearchResultsInterface containing Data\TaxClassInterface * @throws \Magento\Framework\Exception\InputException diff --git a/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php b/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php index 88ec624cdbdd3..b4fa0d9ef64fd 100644 --- a/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php +++ b/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php @@ -45,6 +45,10 @@ public function deleteById($rateId); /** * Search TaxRates * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TaxRateRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Tax\Api\Data\TaxRateSearchResultsInterface containing Data\TaxRateInterface objects * @throws \Magento\Framework\Exception\InputException If there is a problem with the input diff --git a/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php b/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php index 29ff3d423e17b..5f477f33bae2e 100644 --- a/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php +++ b/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php @@ -53,6 +53,10 @@ public function deleteById($ruleId); /** * Search TaxRules * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TaxRuleRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Tax\Api\Data\TaxRuleSearchResultsInterface containing TaxRuleInterface objects * @throws \Magento\Framework\Exception\InputException If there is a problem with the input From fa17685ff5a830311d0e34abb0f4496e79eff541 Mon Sep 17 00:00:00 2001 From: Hayder Sharhan Date: Fri, 13 May 2016 15:10:32 -0500 Subject: [PATCH 25/26] MAGETWO-52340: Gift Message Data for Sales Order not available for retrieval using API - Wrong link. --- app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php b/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php index d6bccbe98e019..b1f7108e1dc48 100644 --- a/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php +++ b/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php @@ -37,7 +37,7 @@ public function getById($couponId); * Retrieve a coupon using the specified search criteria. * * This call returns an array of objects, but detailed information about each object’s attributes might not be - * included. See http://devdocs.magento.com/codelinks/attributes.html#RuleRepositoryInterface to + * included. See http://devdocs.magento.com/codelinks/attributes.html#CouponRepositoryInterface to * determine which call to use to get detailed information about all attributes for an object. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria From 745c3fd6d7f430ebb0a9321af3ae35689ee65e29 Mon Sep 17 00:00:00 2001 From: Cari Spruiell Date: Fri, 13 May 2016 15:35:27 -0500 Subject: [PATCH 26/26] MAGETWO-52803: PR Creation & Stabilization - fix static test failures --- app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php b/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php index 11fa2f9353276..742716cb36d08 100644 --- a/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php +++ b/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php @@ -46,7 +46,7 @@ public function __construct( * To configure smtp settings for session right before sending message on windows server * * @param \Magento\Framework\Mail\TransportInterface $subject - * return void + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject)