diff --git a/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-bg.png b/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-bg.png index a0e6f2545f8c1..0526b51bba886 100644 Binary files a/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-bg.png and b/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-bg.png differ diff --git a/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-vertical.png b/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-vertical.png index ec7a8d1f175a1..2515d1fac7476 100644 Binary files a/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-vertical.png and b/app/code/Magento/Backend/view/adminhtml/web/images/draggable-handle-vertical.png differ diff --git a/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-base-label.png b/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-base-label.png index 8e1c5ab204d65..9d49743ba9366 100644 Binary files a/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-base-label.png and b/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-base-label.png differ diff --git a/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-panel-corner.png b/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-panel-corner.png index 47b94524838b7..da77893131127 100644 Binary files a/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-panel-corner.png and b/app/code/Magento/Backend/view/adminhtml/web/images/gallery-image-panel-corner.png differ diff --git a/app/code/Magento/Backend/view/adminhtml/web/images/image-placeholder.png b/app/code/Magento/Backend/view/adminhtml/web/images/image-placeholder.png index 23f218fa5981f..423285d18731c 100644 Binary files a/app/code/Magento/Backend/view/adminhtml/web/images/image-placeholder.png and b/app/code/Magento/Backend/view/adminhtml/web/images/image-placeholder.png differ diff --git a/app/code/Magento/Braintree/Model/AvsEmsCodeMapper.php b/app/code/Magento/Braintree/Model/AvsEmsCodeMapper.php new file mode 100644 index 0000000000000..5832e5bf0a35b --- /dev/null +++ b/app/code/Magento/Braintree/Model/AvsEmsCodeMapper.php @@ -0,0 +1,71 @@ + 'Y', + 'NM' => 'A', + 'MN' => 'Z', + 'NN' => 'N', + 'UU' => 'U', + 'II' => 'U', + 'AA' => 'E' + ]; + + /** + * Gets payment AVS verification code. + * + * @param OrderPaymentInterface $orderPayment + * @return string + * @throws \InvalidArgumentException If specified order payment has different payment method code. + */ + public function getCode(OrderPaymentInterface $orderPayment) + { + if ($orderPayment->getMethod() !== ConfigProvider::CODE) { + throw new \InvalidArgumentException( + 'The "' . $orderPayment->getMethod() . '" does not supported by Braintree AVS mapper.' + ); + } + + $additionalInfo = $orderPayment->getAdditionalInformation(); + if (empty($additionalInfo[PaymentDetailsHandler::AVS_POSTAL_RESPONSE_CODE]) || + empty($additionalInfo[PaymentDetailsHandler::AVS_STREET_ADDRESS_RESPONSE_CODE]) + ) { + return self::$unavailableCode; + } + + $streetCode = $additionalInfo[PaymentDetailsHandler::AVS_STREET_ADDRESS_RESPONSE_CODE]; + $zipCode = $additionalInfo[PaymentDetailsHandler::AVS_POSTAL_RESPONSE_CODE]; + $key = $zipCode . $streetCode; + return isset(self::$avsMap[$key]) ? self::$avsMap[$key] : self::$unavailableCode; + } +} diff --git a/app/code/Magento/Braintree/Model/CvvEmsCodeMapper.php b/app/code/Magento/Braintree/Model/CvvEmsCodeMapper.php new file mode 100644 index 0000000000000..5accc222c1fe5 --- /dev/null +++ b/app/code/Magento/Braintree/Model/CvvEmsCodeMapper.php @@ -0,0 +1,66 @@ + 'M', + 'N' => 'N', + 'U' => 'P', + 'I' => 'P', + 'S' => 'S', + 'A' => '' + ]; + + /** + * Gets payment CVV verification code. + * + * @param OrderPaymentInterface $orderPayment + * @return string + * @throws \InvalidArgumentException If specified order payment has different payment method code. + */ + public function getCode(OrderPaymentInterface $orderPayment) + { + if ($orderPayment->getMethod() !== ConfigProvider::CODE) { + throw new \InvalidArgumentException( + 'The "' . $orderPayment->getMethod() . '" does not supported by Braintree CVV mapper.' + ); + } + + $additionalInfo = $orderPayment->getAdditionalInformation(); + if (empty($additionalInfo[PaymentDetailsHandler::CVV_RESPONSE_CODE])) { + return self::$notProvidedCode; + } + + $cvv = $additionalInfo[PaymentDetailsHandler::CVV_RESPONSE_CODE]; + return isset(self::$cvvMap[$cvv]) ? self::$cvvMap[$cvv] : self::$notProvidedCode; + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Model/AvsEmsCodeMapperTest.php b/app/code/Magento/Braintree/Test/Unit/Model/AvsEmsCodeMapperTest.php new file mode 100644 index 0000000000000..586a60fe91f3b --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/AvsEmsCodeMapperTest.php @@ -0,0 +1,101 @@ +mapper = new AvsEmsCodeMapper(); + } + + /** + * Checks different variations for AVS codes mapping. + * + * @covers \Magento\Braintree\Model\AvsEmsCodeMapper::getCode + * @param string $avsZip + * @param string $avsStreet + * @param string $expected + * @dataProvider getCodeDataProvider + */ + public function testGetCode($avsZip, $avsStreet, $expected) + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::once()) + ->method('getMethod') + ->willReturn(ConfigProvider::CODE); + + $orderPayment->expects(self::once()) + ->method('getAdditionalInformation') + ->willReturn([ + 'avsPostalCodeResponseCode' => $avsZip, + 'avsStreetAddressResponseCode' => $avsStreet + ]); + + self::assertEquals($expected, $this->mapper->getCode($orderPayment)); + } + + /** + * Checks a test case, when payment order is not Braintree payment method. + * + * @covers \Magento\Braintree\Model\AvsEmsCodeMapper::getCode + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "some_payment" does not supported by Braintree AVS mapper. + */ + public function testGetCodeWithException() + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::exactly(2)) + ->method('getMethod') + ->willReturn('some_payment'); + + $this->mapper->getCode($orderPayment); + } + + /** + * Gets list of AVS codes. + * + * @return array + */ + public function getCodeDataProvider() + { + return [ + ['avsZip' => null, 'avsStreet' => null, 'expected' => 'U'], + ['avsZip' => null, 'avsStreet' => 'M', 'expected' => 'U'], + ['avsZip' => 'M', 'avsStreet' => null, 'expected' => 'U'], + ['avsZip' => 'M', 'avsStreet' => 'Unknown', 'expected' => 'U'], + ['avsZip' => 'I', 'avsStreet' => 'A', 'expected' => 'U'], + ['avsZip' => 'M', 'avsStreet' => 'M', 'expected' => 'Y'], + ['avsZip' => 'N', 'avsStreet' => 'M', 'expected' => 'A'], + ['avsZip' => 'M', 'avsStreet' => 'N', 'expected' => 'Z'], + ['avsZip' => 'N', 'avsStreet' => 'N', 'expected' => 'N'], + ['avsZip' => 'U', 'avsStreet' => 'U', 'expected' => 'U'], + ['avsZip' => 'I', 'avsStreet' => 'I', 'expected' => 'U'], + ['avsZip' => 'A', 'avsStreet' => 'A', 'expected' => 'E'], + ]; + } +} diff --git a/app/code/Magento/Braintree/Test/Unit/Model/CvvEmsCodeMapperTest.php b/app/code/Magento/Braintree/Test/Unit/Model/CvvEmsCodeMapperTest.php new file mode 100644 index 0000000000000..fd54f9e751012 --- /dev/null +++ b/app/code/Magento/Braintree/Test/Unit/Model/CvvEmsCodeMapperTest.php @@ -0,0 +1,94 @@ +mapper = new CvvEmsCodeMapper(); + } + + /** + * Checks different variations for cvv codes mapping. + * + * @covers \Magento\Braintree\Model\CvvEmsCodeMapper::getCode + * @param string $cvvCode + * @param string $expected + * @dataProvider getCodeDataProvider + */ + public function testGetCode($cvvCode, $expected) + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::once()) + ->method('getMethod') + ->willReturn(ConfigProvider::CODE); + + $orderPayment->expects(self::once()) + ->method('getAdditionalInformation') + ->willReturn(['cvvResponseCode' => $cvvCode]); + + self::assertEquals($expected, $this->mapper->getCode($orderPayment)); + } + + /** + * Checks a test case, when payment order is not Braintree payment method. + * + * @covers \Magento\Braintree\Model\CvvEmsCodeMapper::getCode + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "some_payment" does not supported by Braintree CVV mapper. + */ + public function testGetCodeWithException() + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::exactly(2)) + ->method('getMethod') + ->willReturn('some_payment'); + + $this->mapper->getCode($orderPayment); + } + + /** + * Gets variations of cvv codes and expected mapping result. + * + * @return array + */ + public function getCodeDataProvider() + { + return [ + ['cvvCode' => '', 'expected' => 'P'], + ['cvvCode' => null, 'expected' => 'P'], + ['cvvCode' => 'Unknown', 'expected' => 'P'], + ['cvvCode' => 'M', 'expected' => 'M'], + ['cvvCode' => 'N', 'expected' => 'N'], + ['cvvCode' => 'U', 'expected' => 'P'], + ['cvvCode' => 'I', 'expected' => 'P'], + ['cvvCode' => 'S', 'expected' => 'S'], + ['cvvCode' => 'A', 'expected' => ''], + ]; + } +} diff --git a/app/code/Magento/Braintree/etc/config.xml b/app/code/Magento/Braintree/etc/config.xml index eaa233da109ce..43328406e2012 100644 --- a/app/code/Magento/Braintree/etc/config.xml +++ b/app/code/Magento/Braintree/etc/config.xml @@ -40,6 +40,8 @@ cvv,number avsPostalCodeResponseCode,avsStreetAddressResponseCode,cvvResponseCode,processorAuthorizationCode,processorResponseCode,processorResponseText,liabilityShifted,liabilityShiftPossible,riskDataId,riskDataDecision cc_type,cc_number,avsPostalCodeResponseCode,avsStreetAddressResponseCode,cvvResponseCode,processorAuthorizationCode,processorResponseCode,processorResponseText,liabilityShifted,liabilityShiftPossible,riskDataId,riskDataDecision + Magento\Braintree\Model\AvsEmsCodeMapper + Magento\Braintree\Model\CvvEmsCodeMapper BraintreePayPalFacade diff --git a/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_allinone.png b/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_allinone.png index 675c94581921e..377490cc51123 100644 Binary files a/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_allinone.png and b/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_allinone.png differ diff --git a/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_logo.png b/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_logo.png index 0267a8c8881f5..791fe3f3391c0 100644 Binary files a/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_logo.png and b/app/code/Magento/Braintree/view/adminhtml/web/images/braintree_logo.png differ diff --git a/app/code/Magento/Braintree/view/base/web/images/paypal-small.png b/app/code/Magento/Braintree/view/base/web/images/paypal-small.png index 92d5c63bca442..912cd1fb20cb1 100644 Binary files a/app/code/Magento/Braintree/view/base/web/images/paypal-small.png and b/app/code/Magento/Braintree/view/base/web/images/paypal-small.png differ diff --git a/app/code/Magento/Braintree/view/base/web/images/paypal.png b/app/code/Magento/Braintree/view/base/web/images/paypal.png index 291693037814a..2da695608d4b7 100644 Binary files a/app/code/Magento/Braintree/view/base/web/images/paypal.png and b/app/code/Magento/Braintree/view/base/web/images/paypal.png differ diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 859e039acd094..2e1d7964b7480 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -67,6 +67,7 @@ public function sendPurgeRequest($tagsPattern) '1.1', $headers ); + $socketAdapter->read(); $socketAdapter->close(); } catch (\Exception $e) { $this->logger->critical($e->getMessage(), compact('server', 'tagsPattern')); diff --git a/app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php b/app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php index fead947d85e4a..9fe34acd1ae86 100644 --- a/app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php +++ b/app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php @@ -71,6 +71,8 @@ public function testSendPurgeRequest($hosts) $this->socketAdapterMock->expects($this->at($i++)) ->method('write') ->with('PURGE', $uri, '1.1', ['X-Magento-Tags-Pattern' => 'tags', 'Host' => $uri->getHost()]); + $this->socketAdapterMock->expects($this->at($i++)) + ->method('read'); $i++; } $this->socketAdapterMock->expects($this->exactly(count($uris))) diff --git a/app/code/Magento/Captcha/view/adminhtml/web/reload.png b/app/code/Magento/Captcha/view/adminhtml/web/reload.png index 0ad46c613ccbc..68d4bffe4ecb8 100644 Binary files a/app/code/Magento/Captcha/view/adminhtml/web/reload.png and b/app/code/Magento/Captcha/view/adminhtml/web/reload.png differ diff --git a/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/somefile.png b/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/somefile.png index 551553888c745..fa9f1ea4d0554 100644 Binary files a/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/somefile.png and b/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/somefile.png differ diff --git a/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/watermark/somefile.png b/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/watermark/somefile.png index 551553888c745..fa9f1ea4d0554 100644 Binary files a/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/watermark/somefile.png and b/app/code/Magento/Catalog/Test/Unit/_files/catalog/product/watermark/somefile.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2.png b/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2.png index 1d804ffb99699..4e62ed8b5a8fe 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2.png and b/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2x2.png b/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2x2.png index da0790f1fada9..76047cd5f85a0 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2x2.png and b/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/select2x2.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/spinner.gif b/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/spinner.gif index 82d06cc97f0b9..d44cf73a17680 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/spinner.gif and b/app/code/Magento/Catalog/view/adminhtml/web/catalog/images/spinner.gif differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/images/ajax-loader-big.gif b/app/code/Magento/Catalog/view/adminhtml/web/images/ajax-loader-big.gif index 1612bcee36660..460734dfdadec 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/images/ajax-loader-big.gif and b/app/code/Magento/Catalog/view/adminhtml/web/images/ajax-loader-big.gif differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/images/category_widget_link.png b/app/code/Magento/Catalog/view/adminhtml/web/images/category_widget_link.png index 4b15458182559..2093479a00430 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/images/category_widget_link.png and b/app/code/Magento/Catalog/view/adminhtml/web/images/category_widget_link.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_link.png b/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_link.png index 614ddd3632eb0..b754992728921 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_link.png and b/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_link.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_new.png b/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_new.png index c2573967031e1..1367e88e17875 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_new.png and b/app/code/Magento/Catalog/view/adminhtml/web/images/product_widget_new.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_18_b81900_40x40.png index c243bfa4f619f..c079ee1dddd28 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_18_b81900_40x40.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_18_b81900_40x40.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_20_666666_40x40.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_20_666666_40x40.png index 9e24b2eeeaed9..fc796d43b3930 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_20_666666_40x40.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_diagonals-thick_20_666666_40x40.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_flat_10_000000_40x100.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_flat_10_000000_40x100.png index b10f59cd34249..cdddc6df6821b 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_flat_10_000000_40x100.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_flat_10_000000_40x100.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_f6f6f6_1x400.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_f6f6f6_1x400.png index 9b383f4d2eab0..06a4b479d91f6 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_f6f6f6_1x400.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_f6f6f6_1x400.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_fdf5ce_1x400.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_fdf5ce_1x400.png index a23baad25b1d1..8f1e5feab0f2b 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_fdf5ce_1x400.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_100_fdf5ce_1x400.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_65_ffffff_1x400.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_65_ffffff_1x400.png index 8569c1bc9f4bf..80b2b05bbaa99 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_65_ffffff_1x400.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_gloss-wave_35_f67028_500x100.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_gloss-wave_35_f67028_500x100.png index 734cb2c3c99e7..2538b68fd3dfe 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_gloss-wave_35_f67028_500x100.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_gloss-wave_35_f67028_500x100.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_100_eeeeee_1x100.png index f1273672d2532..9e62f3b67683d 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_100_eeeeee_1x100.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_100_eeeeee_1x100.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_75_ffe45c_1x100.png index 359397acffdd8..398d9409630d3 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_75_ffe45c_1x100.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-bg_highlight-soft_75_ffe45c_1x100.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_222222_256x240.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_222222_256x240.png index 362f289fce3a2..82643e291f7ce 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_222222_256x240.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_222222_256x240.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_228ef1_256x240.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_228ef1_256x240.png index 7b3d2e9353cbb..75c5e56b461a7 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_228ef1_256x240.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_228ef1_256x240.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ef8c08_256x240.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ef8c08_256x240.png index 65d8d914c23b8..5b55fd57fd7c1 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ef8c08_256x240.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ef8c08_256x240.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffd27a_256x240.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffd27a_256x240.png index 599fb0044dd47..8d5d75366bcea 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffd27a_256x240.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffd27a_256x240.png differ diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffffff_256x240.png b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffffff_256x240.png index e921df9b5929d..4d4639569acb9 100644 Binary files a/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffffff_256x240.png and b/app/code/Magento/Catalog/view/adminhtml/web/product/images/ui-icons_ffffff_256x240.png differ diff --git a/app/code/Magento/Catalog/view/base/web/images/product/placeholder/image.jpg b/app/code/Magento/Catalog/view/base/web/images/product/placeholder/image.jpg index b8baef2dfe036..3526efa91f55a 100644 Binary files a/app/code/Magento/Catalog/view/base/web/images/product/placeholder/image.jpg and b/app/code/Magento/Catalog/view/base/web/images/product/placeholder/image.jpg differ diff --git a/app/code/Magento/Catalog/view/base/web/images/product/placeholder/small_image.jpg b/app/code/Magento/Catalog/view/base/web/images/product/placeholder/small_image.jpg index b8611cfdab5ca..aeda35c364bd8 100644 Binary files a/app/code/Magento/Catalog/view/base/web/images/product/placeholder/small_image.jpg and b/app/code/Magento/Catalog/view/base/web/images/product/placeholder/small_image.jpg differ diff --git a/app/code/Magento/Catalog/view/base/web/images/product/placeholder/thumbnail.jpg b/app/code/Magento/Catalog/view/base/web/images/product/placeholder/thumbnail.jpg index b8fc9043f6f84..0d5ef7e1bd412 100644 Binary files a/app/code/Magento/Catalog/view/base/web/images/product/placeholder/thumbnail.jpg and b/app/code/Magento/Catalog/view/base/web/images/product/placeholder/thumbnail.jpg differ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml index 640ad1c3d8d3d..4917490240949 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml @@ -94,7 +94,7 @@ getShortDescription short_description overview - none + none Overview itemprop="description" diff --git a/app/code/Magento/CatalogWidget/view/adminhtml/web/images/products_list.png b/app/code/Magento/CatalogWidget/view/adminhtml/web/images/products_list.png index 3a33a55a7df00..9f7c71829cb5c 100644 Binary files a/app/code/Magento/CatalogWidget/view/adminhtml/web/images/products_list.png and b/app/code/Magento/CatalogWidget/view/adminhtml/web/images/products_list.png differ diff --git a/app/code/Magento/Checkout/view/frontend/web/cvv.png b/app/code/Magento/Checkout/view/frontend/web/cvv.png index 59911fd45bdf1..f7a1af77d39f8 100644 Binary files a/app/code/Magento/Checkout/view/frontend/web/cvv.png and b/app/code/Magento/Checkout/view/frontend/web/cvv.png differ diff --git a/app/code/Magento/Cms/view/adminhtml/web/images/placeholder_thumbnail.jpg b/app/code/Magento/Cms/view/adminhtml/web/images/placeholder_thumbnail.jpg index 2486ce6fc3064..d9d78b5d2e34d 100644 Binary files a/app/code/Magento/Cms/view/adminhtml/web/images/placeholder_thumbnail.jpg and b/app/code/Magento/Cms/view/adminhtml/web/images/placeholder_thumbnail.jpg differ diff --git a/app/code/Magento/Cms/view/adminhtml/web/images/widget_block.png b/app/code/Magento/Cms/view/adminhtml/web/images/widget_block.png index 05ce742bbc8b8..97c41cb9ff571 100644 Binary files a/app/code/Magento/Cms/view/adminhtml/web/images/widget_block.png and b/app/code/Magento/Cms/view/adminhtml/web/images/widget_block.png differ diff --git a/app/code/Magento/Cms/view/adminhtml/web/images/widget_page_link.png b/app/code/Magento/Cms/view/adminhtml/web/images/widget_page_link.png index c05065e92ef7e..adafab804e6c1 100644 Binary files a/app/code/Magento/Cms/view/adminhtml/web/images/widget_page_link.png and b/app/code/Magento/Cms/view/adminhtml/web/images/widget_page_link.png differ diff --git a/app/code/Magento/Cms/view/adminhtml/web/images/wysiwyg_skin_image.png b/app/code/Magento/Cms/view/adminhtml/web/images/wysiwyg_skin_image.png index 0b22d2f629176..e72f28e8b03fd 100644 Binary files a/app/code/Magento/Cms/view/adminhtml/web/images/wysiwyg_skin_image.png and b/app/code/Magento/Cms/view/adminhtml/web/images/wysiwyg_skin_image.png differ diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php index 9c7efd803fba7..69cfac839198a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php @@ -39,10 +39,15 @@ public function getFinalPrice($qty, $product) */ public function getPrice($product) { - if ($product->getCustomOption('simple_product')) { - return $product->getCustomOption('simple_product')->getProduct()->getPrice(); - } else { - return 0; + if (!empty($product)) { + $simpleProductOption = $product->getCustomOption('simple_product'); + if (!empty($simpleProductOption)) { + $simpleProduct = $simpleProductOption->getProduct(); + if (!empty($simpleProduct)) { + return $simpleProduct->getPrice(); + } + } } + return 0; } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/_files/logo.gif b/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/_files/logo.gif index b404af6133629..237dc9d0a060e 100644 Binary files a/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/_files/logo.gif and b/app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/_files/logo.gif differ diff --git a/app/code/Magento/Dhl/view/adminhtml/web/logo.jpg b/app/code/Magento/Dhl/view/adminhtml/web/logo.jpg index 4f80976c6a2c6..70c6ce22df739 100644 Binary files a/app/code/Magento/Dhl/view/adminhtml/web/logo.jpg and b/app/code/Magento/Dhl/view/adminhtml/web/logo.jpg differ diff --git a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/_files/image.jpg b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/_files/image.jpg index f8e1802e54465..d49c3bf70319a 100644 Binary files a/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/_files/image.jpg and b/app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/_files/image.jpg differ diff --git a/app/code/Magento/Email/view/frontend/web/logo_email.png b/app/code/Magento/Email/view/frontend/web/logo_email.png index 4031893124b15..d01b530456e81 100644 Binary files a/app/code/Magento/Email/view/frontend/web/logo_email.png and b/app/code/Magento/Email/view/frontend/web/logo_email.png differ diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index f00b4e3164cfb..1d2f7d773c76f 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -1570,9 +1570,9 @@ private function processTrackingDetails(\stdClass $trackInfo) 'progressdetail' => [], ]; - if (!empty($trackInfo->ShipTimestamp)) { - $datetime = \DateTime::createFromFormat(\DateTime::ISO8601, $trackInfo->ShipTimestamp); - $result['shippeddate'] = $datetime->format('Y-m-d'); + $datetime = $this->parseDate(!empty($trackInfo->ShipTimestamp) ? $trackInfo->ShipTimestamp : null); + if ($datetime) { + $result['shippeddate'] = gmdate('Y-m-d', $datetime->getTimestamp()); } $result['signedby'] = !empty($trackInfo->DeliverySignatureName) ? @@ -1588,8 +1588,8 @@ private function processTrackingDetails(\stdClass $trackInfo) $datetime = $this->getDeliveryDateTime($trackInfo); if ($datetime) { - $result['deliverydate'] = $datetime->format('Y-m-d'); - $result['deliverytime'] = $datetime->format('H:i:s'); + $result['deliverydate'] = gmdate('Y-m-d', $datetime->getTimestamp()); + $result['deliverytime'] = gmdate('H:i:s', $datetime->getTimestamp()); } $address = null; @@ -1636,7 +1636,7 @@ private function getDeliveryDateTime(\stdClass $trackInfo) $timestamp = $trackInfo->ActualDeliveryTimestamp; } - return $timestamp ? \DateTime::createFromFormat(\DateTime::ISO8601, $timestamp) : null; + return $timestamp ? $this->parseDate($timestamp) : null; } /** @@ -1685,10 +1685,10 @@ private function processTrackDetailsEvents(array $events) 'deliverylocation' => null ]; - if (!empty($event->Timestamp)) { - $datetime = \DateTime::createFromFormat(\DateTime::ISO8601, $event->Timestamp); - $item['deliverydate'] = $datetime->format('Y-m-d'); - $item['deliverytime'] = $datetime->format('H:i:s'); + $datetime = $this->parseDate(!empty($event->Timestamp) ? $event->Timestamp : null); + if ($datetime) { + $item['deliverydate'] = gmdate('Y-m-d', $datetime->getTimestamp()); + $item['deliverytime'] = gmdate('H:i:s', $datetime->getTimestamp()); } if (!empty($event->Address)) { @@ -1716,4 +1716,30 @@ private function appendTrackingError($trackingValue, $errorMessage) $result = $this->getResult(); $result->append($error); } + + /** + * Parses datetime string from FedEx response. + * According to FedEx API, datetime string should be in \DateTime::ATOM format, but + * sometimes FedEx returns datetime without timezone and in that case timezone will be set as UTC. + * + * @param string $timestamp + * @return bool|\DateTime + */ + private function parseDate($timestamp) + { + if ($timestamp === null) { + return false; + } + $formats = [\DateTime::ATOM, 'Y-m-d\TH:i:s']; + foreach ($formats as $format) { + // set UTC timezone for a case if timestamp does not contain any timezone + $utcTimezone = new \DateTimeZone('UTC'); + $dateTime = \DateTime::createFromFormat($format, $timestamp, $utcTimezone); + if ($dateTime !== false) { + return $dateTime; + } + } + + return false; + } } diff --git a/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php index 04d4ce7ea24b2..abcad0bcf9c85 100644 --- a/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php @@ -393,8 +393,12 @@ public function testGetTrackingErrorResponse() /** * @covers \Magento\Fedex\Model\Carrier::getTracking + * @param string $shipTimeStamp + * @param string $expectedDate + * @param string $expectedTime + * @dataProvider shipDateDataProvider */ - public function testGetTracking() + public function testGetTracking($shipTimeStamp, $expectedDate, $expectedTime) { $tracking = '123456789012'; @@ -404,7 +408,7 @@ public function testGetTracking() $response->CompletedTrackDetails = new \stdClass(); $trackDetails = new \stdClass(); - $trackDetails->ShipTimestamp = '2016-08-05T14:06:35+00:00'; + $trackDetails->ShipTimestamp = $shipTimeStamp; $trackDetails->DeliverySignatureName = 'signature'; $trackDetails->StatusDetail = new \stdClass(); @@ -412,7 +416,7 @@ public function testGetTracking() $trackDetails->Service = new \stdClass(); $trackDetails->Service->Description = 'ground'; - $trackDetails->EstimatedDeliveryTimestamp = '2016-08-10T10:20:26+00:00'; + $trackDetails->EstimatedDeliveryTimestamp = $shipTimeStamp; $trackDetails->EstimatedDeliveryAddress = new \stdClass(); $trackDetails->EstimatedDeliveryAddress->City = 'Culver City'; @@ -444,9 +448,6 @@ public function testGetTracking() 'signedby', 'status', 'service', - 'shippeddate', - 'deliverydate', - 'deliverytime', 'deliverylocation', 'weight', ]; @@ -454,15 +455,37 @@ public function testGetTracking() static::assertNotEmpty($current[$field]); }); - static::assertEquals('2016-08-10', $current['deliverydate']); - static::assertEquals('10:20:26', $current['deliverytime']); - static::assertEquals('2016-08-05', $current['shippeddate']); + static::assertEquals($expectedDate, $current['deliverydate']); + static::assertEquals($expectedTime, $current['deliverytime']); + static::assertEquals($expectedDate, $current['shippeddate']); + } + + /** + * Gets list of variations for testing ship date. + * + * @return array + */ + public function shipDateDataProvider() + { + return [ + ['shipTimestamp' => '2016-08-05T14:06:35+01:00', 'expectedDate' => '2016-08-05', '13:06:35'], + ['shipTimestamp' => '2016-08-05T02:06:35+03:00', 'expectedDate' => '2016-08-04', '23:06:35'], + ['shipTimestamp' => '2016-08-05T14:06:35', 'expectedDate' => '2016-08-05', '14:06:35'], + ['shipTimestamp' => '2016-08-05 14:06:35', 'expectedDate' => null, null], + ['shipTimestamp' => '2016-08-05 14:06:35+00:00', 'expectedDate' => null, null], + ['shipTimestamp' => '2016-08-05', 'expectedDate' => null, null], + ['shipTimestamp' => '2016/08/05', 'expectedDate' => null, null], + ]; } /** * @covers \Magento\Fedex\Model\Carrier::getTracking + * @param string $shipTimeStamp + * @param string $expectedDate + * @param string $expectedTime + * @dataProvider shipDateDataProvider */ - public function testGetTrackingWithEvents() + public function testGetTrackingWithEvents($shipTimeStamp, $expectedDate, $expectedTime) { $tracking = '123456789012'; @@ -473,7 +496,7 @@ public function testGetTrackingWithEvents() $event = new \stdClass(); $event->EventDescription = 'Test'; - $event->Timestamp = '2016-08-05T19:14:53+00:00'; + $event->Timestamp = $shipTimeStamp; $event->Address = new \stdClass(); $event->Address->City = 'Culver City'; @@ -504,12 +527,12 @@ public function testGetTrackingWithEvents() static::assertEquals(1, count($current['progressdetail'])); $event = $current['progressdetail'][0]; - $fields = ['activity', 'deliverydate', 'deliverytime', 'deliverylocation']; + $fields = ['activity', 'deliverylocation']; array_walk($fields, function ($field) use ($event) { static::assertNotEmpty($event[$field]); }); - static::assertEquals('2016-08-05', $event['deliverydate']); - static::assertEquals('19:14:53', $event['deliverytime']); + static::assertEquals($expectedDate, $event['deliverydate']); + static::assertEquals($expectedTime, $event['deliverytime']); } /** diff --git a/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png b/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png index 594b5b49d163c..575563f341b35 100644 Binary files a/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png and b/app/code/Magento/Marketplace/view/adminhtml/web/partners/images/magento-connect.png differ diff --git a/app/code/Magento/Payment/Api/PaymentVerificationInterface.php b/app/code/Magento/Payment/Api/PaymentVerificationInterface.php new file mode 100644 index 0000000000000..f5c05080cfe9c --- /dev/null +++ b/app/code/Magento/Payment/Api/PaymentVerificationInterface.php @@ -0,0 +1,34 @@ + 'Y', + 'NY' => 'A', + 'YN' => 'Z', + 'NN' => 'N' + ]; + + /** + * Gets payment AVS verification code. + * + * @param OrderPaymentInterface $orderPayment + * @return string + * @throws \InvalidArgumentException If specified order payment has different payment method code. + */ + public function getCode(OrderPaymentInterface $orderPayment) + { + if ($orderPayment->getMethod() !== Config::METHOD_PAYFLOWPRO) { + throw new \InvalidArgumentException( + 'The "' . $orderPayment->getMethod() . '" does not supported by Payflow AVS mapper.' + ); + } + + $additionalInfo = $orderPayment->getAdditionalInformation(); + if (empty($additionalInfo[Info::PAYPAL_AVSADDR]) || + empty($additionalInfo[Info::PAYPAL_AVSZIP]) + ) { + return self::$unavailableCode; + } + + $streetCode = $additionalInfo[Info::PAYPAL_AVSADDR]; + $zipCode = $additionalInfo[Info::PAYPAL_AVSZIP]; + $key = $zipCode . $streetCode; + + return isset(self::$avsMap[$key]) ? self::$avsMap[$key] : self::$unavailableCode; + } +} diff --git a/app/code/Magento/Paypal/Model/Payflow/CvvEmsCodeMapper.php b/app/code/Magento/Paypal/Model/Payflow/CvvEmsCodeMapper.php new file mode 100644 index 0000000000000..214881504b4c3 --- /dev/null +++ b/app/code/Magento/Paypal/Model/Payflow/CvvEmsCodeMapper.php @@ -0,0 +1,63 @@ + 'M', + 'N' => 'N' + ]; + + /** + * Gets payment CVV verification code. + * + * @param OrderPaymentInterface $orderPayment + * @return string + * @throws \InvalidArgumentException If specified order payment has different payment method code. + */ + public function getCode(OrderPaymentInterface $orderPayment) + { + if ($orderPayment->getMethod() !== Config::METHOD_PAYFLOWPRO) { + throw new \InvalidArgumentException( + 'The "' . $orderPayment->getMethod() . '" does not supported by Payflow CVV mapper.' + ); + } + + $additionalInfo = $orderPayment->getAdditionalInformation(); + if (empty($additionalInfo[Info::PAYPAL_CVV2MATCH])) { + return self::$notProvidedCode; + } + + $cvv = $additionalInfo[Info::PAYPAL_CVV2MATCH]; + + return isset(self::$cvvMap[$cvv]) ? self::$cvvMap[$cvv] : self::$notProvidedCode; + } +} diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/AvsEmsCodeMapperTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/AvsEmsCodeMapperTest.php new file mode 100644 index 0000000000000..7051903150ba7 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/AvsEmsCodeMapperTest.php @@ -0,0 +1,101 @@ +mapper = new AvsEmsCodeMapper(); + } + + /** + * Checks different variations for AVS codes mapping. + * + * @covers \Magento\Paypal\Model\Payflow\AvsEmsCodeMapper::getCode + * @param string $avsZip + * @param string $avsStreet + * @param string $expected + * @dataProvider getCodeDataProvider + */ + public function testGetCode($avsZip, $avsStreet, $expected) + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::once()) + ->method('getMethod') + ->willReturn(Config::METHOD_PAYFLOWPRO); + + $orderPayment->expects(self::once()) + ->method('getAdditionalInformation') + ->willReturn([ + Info::PAYPAL_AVSZIP => $avsZip, + Info::PAYPAL_AVSADDR => $avsStreet + ]); + + self::assertEquals($expected, $this->mapper->getCode($orderPayment)); + } + + /** + * Checks a test case, when payment order is not Payflow payment method. + * + * @covers \Magento\Paypal\Model\Payflow\AvsEmsCodeMapper::getCode + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "some_payment" does not supported by Payflow AVS mapper. + */ + public function testGetCodeWithException() + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::exactly(2)) + ->method('getMethod') + ->willReturn('some_payment'); + + $this->mapper->getCode($orderPayment); + } + + /** + * Gets list of AVS codes. + * + * @return array + */ + public function getCodeDataProvider() + { + return [ + ['avsZip' => null, 'avsStreet' => null, 'expected' => 'U'], + ['avsZip' => null, 'avsStreet' => 'Y', 'expected' => 'U'], + ['avsZip' => 'Y', 'avsStreet' => null, 'expected' => 'U'], + ['avsZip' => 'Y', 'avsStreet' => 'Y', 'expected' => 'Y'], + ['avsZip' => 'N', 'avsStreet' => 'Y', 'expected' => 'A'], + ['avsZip' => 'Y', 'avsStreet' => 'N', 'expected' => 'Z'], + ['avsZip' => 'N', 'avsStreet' => 'N', 'expected' => 'N'], + ['avsZip' => 'X', 'avsStreet' => 'Y', 'expected' => 'U'], + ['avsZip' => 'N', 'avsStreet' => 'X', 'expected' => 'U'], + ['avsZip' => '', 'avsStreet' => 'Y', 'expected' => 'U'], + ['avsZip' => 'N', 'avsStreet' => '', 'expected' => 'U'] + ]; + } +} diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/CvvEmsCodeMapperTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/CvvEmsCodeMapperTest.php new file mode 100644 index 0000000000000..b07c6b4e3f936 --- /dev/null +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/CvvEmsCodeMapperTest.php @@ -0,0 +1,91 @@ +mapper = new CvvEmsCodeMapper(); + } + + /** + * Checks different variations for cvv codes mapping. + * + * @covers \Magento\Paypal\Model\Payflow\CvvEmsCodeMapper::getCode + * @param string $cvvCode + * @param string $expected + * @dataProvider getCodeDataProvider + */ + public function testGetCode($cvvCode, $expected) + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::once()) + ->method('getMethod') + ->willReturn(Config::METHOD_PAYFLOWPRO); + + $orderPayment->expects(self::once()) + ->method('getAdditionalInformation') + ->willReturn([Info::PAYPAL_CVV2MATCH => $cvvCode]); + + self::assertEquals($expected, $this->mapper->getCode($orderPayment)); + } + + /** + * Checks a test case, when payment order is not Payflow payment method. + * + * @covers \Magento\Paypal\Model\Payflow\CvvEmsCodeMapper::getCode + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "some_payment" does not supported by Payflow CVV mapper. + */ + public function testGetCodeWithException() + { + /** @var OrderPaymentInterface|MockObject $orderPayment */ + $orderPayment = $this->getMockBuilder(OrderPaymentInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $orderPayment->expects(self::exactly(2)) + ->method('getMethod') + ->willReturn('some_payment'); + + $this->mapper->getCode($orderPayment); + } + + /** + * Gets variations of cvv codes and expected mapping result. + * + * @return array + */ + public function getCodeDataProvider() + { + return [ + ['cvvCode' => '', 'expected' => 'P'], + ['cvvCode' => null, 'expected' => 'P'], + ['cvvCode' => 'Y', 'expected' => 'M'], + ['cvvCode' => 'N', 'expected' => 'N'], + ['cvvCode' => 'X', 'expected' => 'P'] + ]; + } +} diff --git a/app/code/Magento/Paypal/etc/config.xml b/app/code/Magento/Paypal/etc/config.xml index f72b9324beeb5..442c87ad840ca 100644 --- a/app/code/Magento/Paypal/etc/config.xml +++ b/app/code/Magento/Paypal/etc/config.xml @@ -91,6 +91,8 @@ 2 1 1 + Magento\Paypal\Model\Payflow\AvsEmsCodeMapper + Magento\Paypal\Model\Payflow\CvvEmsCodeMapper PayflowProCreditCardVaultFacade diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/AM_mc_vs_dc_ae.jpg b/app/code/Magento/Paypal/view/adminhtml/web/images/AM_mc_vs_dc_ae.jpg index 962e7d36b6c16..26298ac099d0f 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/AM_mc_vs_dc_ae.jpg and b/app/code/Magento/Paypal/view/adminhtml/web/images/AM_mc_vs_dc_ae.jpg differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/logo-paypal.png b/app/code/Magento/Paypal/view/adminhtml/web/images/logo-paypal.png index ec4ef3de7eaaf..fdd5a9c9eb28f 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/logo-paypal.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/logo-paypal.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/paypal-logo.png b/app/code/Magento/Paypal/view/adminhtml/web/images/paypal-logo.png index ca7bfd5e5558b..b59dc2e1ea6bc 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/paypal-logo.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/paypal-logo.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-allinone.png b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-allinone.png index 2c62225329223..fa0b2661e9495 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-allinone.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-allinone.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-alt.png b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-alt.png index 0451af060daf3..a8305fa760ff7 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-alt.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-alt.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-gateways.png b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-gateways.png index 5b76c7b390672..d8a1512e6a054 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-gateways.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-gateways.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-logo-200px.png b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-logo-200px.png index 780c84f6c563d..e801ed9b61f27 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-logo-200px.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-logo-200px.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-payflow-mark.png b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-payflow-mark.png index 040f73c6c1dc2..5aef38ba52f51 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-payflow-mark.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-payflow-mark.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-uk.png b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-uk.png index cbed8f986ab1b..41041277e91b3 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/images/pp-uk.png and b/app/code/Magento/Paypal/view/adminhtml/web/images/pp-uk.png differ diff --git a/app/code/Magento/Paypal/view/adminhtml/web/section.png b/app/code/Magento/Paypal/view/adminhtml/web/section.png index ec4ef3de7eaaf..fdd5a9c9eb28f 100644 Binary files a/app/code/Magento/Paypal/view/adminhtml/web/section.png and b/app/code/Magento/Paypal/view/adminhtml/web/section.png differ diff --git a/app/code/Magento/ProductVideo/view/adminhtml/web/images/camera.png b/app/code/Magento/ProductVideo/view/adminhtml/web/images/camera.png index 468f922ecb12d..bee824192cda9 100644 Binary files a/app/code/Magento/ProductVideo/view/adminhtml/web/images/camera.png and b/app/code/Magento/ProductVideo/view/adminhtml/web/images/camera.png differ diff --git a/app/code/Magento/ProductVideo/view/adminhtml/web/images/gallery-sprite.png b/app/code/Magento/ProductVideo/view/adminhtml/web/images/gallery-sprite.png index c2a8a9a2a76e7..7aa6877b626cb 100644 Binary files a/app/code/Magento/ProductVideo/view/adminhtml/web/images/gallery-sprite.png and b/app/code/Magento/ProductVideo/view/adminhtml/web/images/gallery-sprite.png differ diff --git a/app/code/Magento/ProductVideo/view/frontend/web/img/gallery-sprite.png b/app/code/Magento/ProductVideo/view/frontend/web/img/gallery-sprite.png index c2a8a9a2a76e7..7aa6877b626cb 100644 Binary files a/app/code/Magento/ProductVideo/view/frontend/web/img/gallery-sprite.png and b/app/code/Magento/ProductVideo/view/frontend/web/img/gallery-sprite.png differ diff --git a/app/code/Magento/Quote/Model/ResourceModel/Quote.php b/app/code/Magento/Quote/Model/ResourceModel/Quote.php index f9d12628fa0be..e88b57f90826b 100644 --- a/app/code/Magento/Quote/Model/ResourceModel/Quote.php +++ b/app/code/Magento/Quote/Model/ResourceModel/Quote.php @@ -242,6 +242,9 @@ public function substractProductFromQuotes($product) } $connection = $this->getConnection(); $subSelect = $connection->select(); + $conditionCheck = $connection->quoteIdentifier('q.items_count') . " > 0"; + $conditionTrue = $connection->quoteIdentifier('q.items_count') . ' - 1'; + $ifSql = "IF (" . $conditionCheck . "," . $conditionTrue . ", 0)"; $subSelect->from( false, @@ -249,7 +252,7 @@ public function substractProductFromQuotes($product) 'items_qty' => new \Zend_Db_Expr( $connection->quoteIdentifier('q.items_qty') . ' - ' . $connection->quoteIdentifier('qi.qty') ), - 'items_count' => new \Zend_Db_Expr($connection->quoteIdentifier('q.items_count') . ' - 1') + 'items_count' => new \Zend_Db_Expr($ifSql) ] )->join( ['qi' => $this->getTable('quote_item')], diff --git a/app/code/Magento/Sales/Model/ResourceModel/AbstractGrid.php b/app/code/Magento/Sales/Model/ResourceModel/AbstractGrid.php index 10cbb175c70bc..9da95269ca418 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/AbstractGrid.php +++ b/app/code/Magento/Sales/Model/ResourceModel/AbstractGrid.php @@ -67,6 +67,7 @@ public function getGridTable() { return $this->getTable($this->gridTableName); } + /** * Purge grid row * @@ -89,6 +90,9 @@ public function purge($value, $field = null) * * @param string $default * @return string + * @deprecated this method is not used in abstract model but only in single child so + * this deprecation is a part of cleaning abstract classes. + * @see \Magento\Sales\Model\ResourceModel\Provider\UpdatedIdListProvider */ protected function getLastUpdatedAtValue($default = '0000-00-00 00:00:00') { diff --git a/app/code/Magento/Sales/Model/ResourceModel/Grid.php b/app/code/Magento/Sales/Model/ResourceModel/Grid.php index ba3419d0cd96e..f537074ad66f1 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Grid.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Grid.php @@ -5,9 +5,10 @@ */ namespace Magento\Sales\Model\ResourceModel; +use Magento\Framework\App\ObjectManager; use Magento\Framework\DB\Adapter\AdapterInterface; -use Magento\Sales\Model\ResourceModel\AbstractGrid; use Magento\Framework\Model\ResourceModel\Db\Context; +use Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProviderInterface; /** * Class Grid @@ -39,6 +40,11 @@ class Grid extends AbstractGrid */ protected $columns; + /** + * @var NotSyncedDataProviderInterface + */ + private $notSyncedDataProvider; + /** * @param Context $context * @param string $mainTableName @@ -47,6 +53,7 @@ class Grid extends AbstractGrid * @param array $joins * @param array $columns * @param string $connectionName + * @param NotSyncedDataProviderInterface $notSyncedDataProvider */ public function __construct( Context $context, @@ -55,13 +62,16 @@ public function __construct( $orderIdField, array $joins = [], array $columns = [], - $connectionName = null + $connectionName = null, + NotSyncedDataProviderInterface $notSyncedDataProvider = null ) { $this->mainTableName = $mainTableName; $this->gridTableName = $gridTableName; $this->orderIdField = $orderIdField; $this->joins = $joins; $this->columns = $columns; + $this->notSyncedDataProvider = + $notSyncedDataProvider ?: ObjectManager::getInstance()->get(NotSyncedDataProviderInterface::class); parent::__construct($context, $connectionName); } @@ -99,7 +109,10 @@ public function refresh($value, $field = null) public function refreshBySchedule() { $select = $this->getGridOriginSelect() - ->where($this->mainTableName . '.updated_at >= ?', $this->getLastUpdatedAtValue()); + ->where( + $this->mainTableName . '.entity_id IN (?)', + $this->notSyncedDataProvider->getIds($this->mainTableName, $this->gridTableName) + ); return $this->getConnection()->query( $this->getConnection() diff --git a/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php b/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php new file mode 100644 index 0000000000000..8215eaaf0ad2e --- /dev/null +++ b/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProvider.php @@ -0,0 +1,48 @@ +providers = $tmapFactory->create( + [ + 'array' => $providers, + 'type' => NotSyncedDataProviderInterface::class + ] + ); + } + + /** + * @inheritDoc + */ + public function getIds($mainTableName, $gridTableName) + { + $result = []; + foreach ($this->providers as $provider) { + $result = array_merge($result, $provider->getIds($mainTableName, $gridTableName)); + } + + return array_unique($result); + } +} diff --git a/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProviderInterface.php b/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProviderInterface.php new file mode 100644 index 0000000000000..489e771d968b5 --- /dev/null +++ b/app/code/Magento/Sales/Model/ResourceModel/Provider/NotSyncedDataProviderInterface.php @@ -0,0 +1,21 @@ +resourceConnection = $resourceConnection; + } + + /** + * @inheritdoc + */ + public function getIds($mainTableName, $gridTableName) + { + $select = $this->getConnection()->select() + ->from($this->getConnection()->getTableName($mainTableName), [$mainTableName.'.entity_id']) + ->joinLeft( + [$gridTableName => $this->getConnection()->getTableName($gridTableName)], + sprintf( + '%s.%s = %s.%s', + $mainTableName, + 'entity_id', + $gridTableName, + 'entity_id' + ), + [] + ) + ->where($gridTableName.'.entity_id IS NULL'); + + return $this->getConnection()->fetchAll($select, [], \Zend_Db::FETCH_COLUMN); + } + + /** + * Returns connection. + * + * @return AdapterInterface + */ + private function getConnection() + { + if (!$this->connection) { + $this->connection = $this->resourceConnection->getConnection('sales'); + } + + return $this->connection; + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Provider/NotSyncedDataProviderTest.php b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Provider/NotSyncedDataProviderTest.php new file mode 100644 index 0000000000000..92a40e2638fe8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Provider/NotSyncedDataProviderTest.php @@ -0,0 +1,99 @@ +getMockBuilder(TMapFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $tMap = $this->getMockBuilder(TMap::class) + ->disableOriginalConstructor() + ->getMock(); + + $tMapFactory->expects(static::once()) + ->method('create') + ->with( + [ + 'array' => [], + 'type' => NotSyncedDataProviderInterface::class + ] + ) + ->willReturn($tMap); + $tMap->expects(static::once()) + ->method('getIterator') + ->willReturn(new \ArrayIterator([])); + + $provider = new NotSyncedDataProvider($tMapFactory, []); + static::assertEquals([], $provider->getIds('main_table', 'grid_table')); + } + + /** + * @covers \Magento\Sales\Model\ResourceModel\Provider\NotSyncedDataProvider::getIds + */ + public function testGetIds() + { + /** @var TMapFactory|MockObject $tMapFactory */ + $tMapFactory = $this->getMockBuilder(TMapFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $tMap = $this->getMockBuilder(TMap::class) + ->disableOriginalConstructor() + ->getMock(); + + $provider1 = $this->getMockBuilder(NotSyncedDataProviderInterface::class) + ->getMockForAbstractClass(); + $provider1->expects(static::once()) + ->method('getIds') + ->willReturn([1, 2]); + + $provider2 = $this->getMockBuilder(NotSyncedDataProviderInterface::class) + ->getMockForAbstractClass(); + $provider2->expects(static::once()) + ->method('getIds') + ->willReturn([2, 3, 4]); + + $tMapFactory->expects(static::once()) + ->method('create') + ->with( + [ + 'array' => [ + 'provider1' => NotSyncedDataProviderInterface::class, + 'provider2' => NotSyncedDataProviderInterface::class + ], + 'type' => NotSyncedDataProviderInterface::class + ] + ) + ->willReturn($tMap); + $tMap->expects(static::once()) + ->method('getIterator') + ->willReturn(new \ArrayIterator([$provider1, $provider2])); + + $provider = new NotSyncedDataProvider( + $tMapFactory, + [ + 'provider1' => NotSyncedDataProviderInterface::class, + 'provider2' => NotSyncedDataProviderInterface::class, + ] + ); + + static::assertEquals([1, 2, 3, 4], array_values($provider->getIds('main_table', 'grid_table'))); + } +} diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index 91e5f07e7f61a..0f14946c89a42 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -114,6 +114,14 @@ + + + + + Magento\Sales\Model\ResourceModel\Provider\UpdatedIdListProvider + + + diff --git a/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml b/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml index 533235f6f20fa..1f7a344b15acf 100644 --- a/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml +++ b/app/code/Magento/Shipping/view/frontend/templates/tracking/details.phtml @@ -8,6 +8,7 @@ /** @var $block \Magento\Framework\View\Element\Template */ +$parentBlock = $block->getParentBlock(); $track = $block->getData('track'); $email = $block->getData('storeSupportEmail'); $fields = [ @@ -18,14 +19,15 @@ $fields = [ 'Service Type' => 'getService', 'Weight' => 'getWeight', ]; +$number = is_object($track) ? $track->getTracking() : $track['number']; ?> - +
- + getCarrierTitle()): ?> @@ -38,8 +40,8 @@ $fields = [ diff --git a/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml b/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml index b695f024cde47..fb17a79b7c22b 100644 --- a/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml +++ b/app/code/Magento/Shipping/view/frontend/templates/tracking/popup.phtml @@ -31,7 +31,7 @@ $results = $block->getTrackingInfo(); ?> getChildHtml('shipping.tracking.details.' . $counter); ?> - getProgressdetail())): ?> + getProgressdetail())): ?> addChild('shipping.tracking.progress.'. $counter, Template::class, [ 'track' => $track, diff --git a/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml b/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml index 9022a5815824b..54dbfb5377e88 100644 --- a/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml +++ b/app/code/Magento/Shipping/view/frontend/templates/tracking/progress.phtml @@ -7,6 +7,7 @@ // @codingStandardsIgnoreFile /** @var $block \Magento\Framework\View\Element\Template */ +$parentBlock = $block->getParentBlock(); $track = $block->getData('track'); ?>
@@ -22,8 +23,8 @@ $track = $block->getData('track');
getProgressdetail() as $detail): ?> - formatDeliveryDate($detail['deliverydate']) : ''); ?> - formatDeliveryTime($detail['deliverytime'], $detail['deliverydate']) : ''); ?> + formatDeliveryDate($detail['deliverydate']) : ''); ?> + formatDeliveryTime($detail['deliverytime'], $detail['deliverydate']) : ''); ?>
escapeHtml(__('Order tracking')); ?>
escapeHtml(__('Tracking Number:')); ?>escapeHtml($track->getTracking()); ?>escapeHtml($number); ?>
escapeHtml(__('Error:')); ?> escapeHtml(__('Tracking information is currently not available. Please ')); ?> - getContactUsEnabled()) : ?> - getContactUsEnabled()) : ?> + escapeHtml(__('contact us')); ?> @@ -77,7 +79,7 @@ $fields = [
escapeHtml(__('Delivered on:')); ?> - formatDeliveryDateTime($track->getDeliverydate(), $track->getDeliverytime()); ?> + formatDeliveryDateTime($track->getDeliverydate(), $track->getDeliverytime()); ?>
escapeHtml($detail['deliverylocation']) : ''); ?> diff --git a/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml b/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml index 059fdb7fb2a8d..567e983cf3466 100644 --- a/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml +++ b/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml @@ -9,12 +9,12 @@ * * The original name of this file, as part of the swagger-ui package, was dist/index.html. * - * Modified by Magento, Modifications Copyright © 2016 Magento. + * Modified by Magento, Modifications Copyright © 2013-2017 Magento. */ /** @var \Magento\Framework\View\Element\Template $block */ -$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/default/schema?services=all'; +$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/all/schema?services=all'; ?>