Skip to content

Commit 46711d4

Browse files
Merge pull request #47 from magento/1.0-forward
Forward-port 1.0 branch
2 parents b0948e3 + 54df094 commit 46711d4

File tree

4 files changed

+287
-1
lines changed

4 files changed

+287
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-patches",
33
"description": "Provides critical fixes for Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "1.0.3",
5+
"version": "1.0.4",
66
"license": "OSL-3.0",
77
"require": {
88
"php": "^7.0",

patches.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@
241241
"Sitemap Generation Warnings": {
242242
">=2.3.0 <2.3.2": "MCLOUD-3025__sitemap_generation_warnings__2.3.0.patch",
243243
">=2.3.2 <2.3.5": "MCLOUD-3025__sitemap_generation_warnings__2.3.3.patch"
244+
},
245+
"Fix load balancer issue": {
246+
">=2.3.4 <2.3.6": "MCLOUD-5837__fix_filesystem_load_balancer_issue__2.3.4.patch"
244247
}
245248
},
246249
"magento/module-paypal": {
@@ -311,6 +314,11 @@
311314
"3.2.0": "MAGECLOUD-4407__fix_namespace_vertex_tax__3.2.0.patch"
312315
}
313316
},
317+
"amzn/amazon-pay-and-login-magento-2-module": {
318+
"Set Payment info bug": {
319+
"3.4.1": "BUNDLE-2554__set_payment_info_bug_fix__3.4.1.patch"
320+
}
321+
},
314322
"magento/magento2-ee-base": {
315323
"Fix pagebuilder module": {
316324
"2.3.1": "PB-319__fix_pagebuilder_module__2.3.1.patch",
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
diff --git a/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php b/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php
2+
index 540b357..c18ef91 100644
3+
--- a/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php
4+
+++ b/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php
5+
@@ -144,24 +144,11 @@ public function saveOrderInformation($amazonOrderReferenceId, $allowedConstraint
6+
];
7+
8+
$responseParser = $this->clientFactory->create($storeId)->setOrderReferenceDetails($data);
9+
- try {
10+
- $response = $this->amazonSetOrderDetailsResponseFactory->create(
11+
- [
12+
- 'response' => $responseParser
13+
- ]
14+
- );
15+
+ $response = $this->amazonSetOrderDetailsResponseFactory->create([
16+
+ 'response' => $responseParser
17+
+ ]);
18+
19+
- $this->validateConstraints($response, $allowedConstraints);
20+
- } catch (AmazonServiceUnavailableException $e) {
21+
- if($e->getApiErrorCode() == 'OrderReferenceNotModifiable') {
22+
- $this->logger->warning(
23+
- "Could not modify Amazon order details for $amazonOrderReferenceId: "
24+
- . $e->getApiErrorMessage()
25+
- );
26+
- } else {
27+
- throw $e;
28+
- }
29+
- }
30+
+ $this->validateConstraints($response, $allowedConstraints);
31+
} catch (LocalizedException $e) {
32+
throw $e;
33+
} catch (Exception $e) {
34+
diff --git a/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php b/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php
35+
index 6bad468..14b1264 100644
36+
--- a/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php
37+
+++ b/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php
38+
@@ -25,6 +25,7 @@
39+
use Amazon\Payment\Model\OrderInformationManagement;
40+
use Magento\Quote\Api\Data\PaymentInterface;
41+
use Magento\Quote\Api\Data\AddressInterface;
42+
+use Magento\Framework\Webapi\Rest\Request;
43+
use Magento\Framework\Exception\LocalizedException;
44+
use Amazon\Payment\Gateway\Config\Config as GatewayConfig;
45+
use Magento\Quote\Api\CartRepositoryInterface;
46+
@@ -41,6 +42,11 @@ class ConfirmOrderReference
47+
*/
48+
private $checkoutSession;
49+
50+
+ /**
51+
+ * @var Request
52+
+ */
53+
+ private $request;
54+
+
55+
/**
56+
* @var OrderInformationManagement
57+
*/
58+
@@ -54,19 +60,31 @@ class ConfirmOrderReference
59+
/**
60+
* ConfirmOrderReference constructor.
61+
* @param Session $checkoutSession
62+
+ * @param Request $request
63+
* @param OrderInformationManagement $orderInformationManagement
64+
* @param CartRepositoryInterface $quoteRepository
65+
*/
66+
public function __construct(
67+
Session $checkoutSession,
68+
+ Request $request,
69+
OrderInformationManagement $orderInformationManagement,
70+
CartRepositoryInterface $quoteRepository
71+
) {
72+
$this->checkoutSession = $checkoutSession;
73+
+ $this->request = $request;
74+
$this->orderInformationManagement = $orderInformationManagement;
75+
$this->quoteRepository = $quoteRepository;
76+
}
77+
78+
+ /**
79+
+ * @return boolean
80+
+ */
81+
+ protected function canConfirmOrderReference()
82+
+ {
83+
+ $data = $this->request->getRequestData();
84+
+ return !empty($data['confirmOrder']);
85+
+ }
86+
+
87+
/**
88+
* @param PaymentMethodManagementInterface $subject
89+
* @param $result
90+
@@ -94,10 +112,12 @@ public function afterSet(
91+
$this->orderInformationManagement->saveOrderInformation($amazonOrderReferenceId);
92+
}
93+
94+
- $this->orderInformationManagement->confirmOrderReference(
95+
- $amazonOrderReferenceId,
96+
- $quote->getStoreId()
97+
- );
98+
+ if ($this->canConfirmOrderReference()) {
99+
+ $this->orderInformationManagement->confirmOrderReference(
100+
+ $amazonOrderReferenceId,
101+
+ $quote->getStoreId()
102+
+ );
103+
+ }
104+
}
105+
}
106+
107+
diff --git a/vendor/amzn/amazon-pay-module/view/frontend/web/js/action/place-order.js b/vendor/amzn/amazon-pay-module/view/frontend/web/js/action/place-order.js
108+
index 63caadf..a254c3d 100644
109+
--- a/vendor/amzn/amazon-pay-module/view/frontend/web/js/action/place-order.js
110+
+++ b/vendor/amzn/amazon-pay-module/view/frontend/web/js/action/place-order.js
111+
@@ -40,6 +40,7 @@ define(
112+
quoteId: quote.getQuoteId()
113+
});
114+
payload = {
115+
+ confirmOrder: true,
116+
cartId: quote.getQuoteId(),
117+
email: quote.guestEmail,
118+
paymentMethod: paymentData,
119+
@@ -48,6 +49,7 @@ define(
120+
} else {
121+
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
122+
payload = {
123+
+ confirmOrder: true,
124+
cartId: quote.getQuoteId(),
125+
paymentMethod: paymentData,
126+
billingAddress: quote.billingAddress()
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
diff -Naur a/vendor/magento/framework/File/Uploader.php b/vendor/magento/framework/File/Uploader.php
2+
--- a/vendor/magento/framework/File/Uploader.php
3+
+++ b/vendor/magento/framework/File/Uploader.php
4+
@@ -6,7 +6,10 @@
5+
namespace Magento\Framework\File;
6+
7+
use Magento\Framework\App\Filesystem\DirectoryList;
8+
+use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Exception\FileSystemException;
10+
+use Magento\Framework\Filesystem\DriverInterface;
11+
+use Magento\Framework\Filesystem\DriverPool;
12+
use Magento\Framework\Validation\ValidationException;
13+
14+
/**
15+
@@ -144,15 +147,13 @@ class Uploader
16+
17+
/**
18+
* Maximum Image Width resolution in pixels. For image resizing on client side
19+
- * @deprecated
20+
- * @see \Magento\Framework\Image\Adapter\UploadConfigInterface::getMaxWidth()
21+
+ * @deprecated @see \Magento\Framework\Image\Adapter\UploadConfigInterface::getMaxWidth()
22+
*/
23+
const MAX_IMAGE_WIDTH = 1920;
24+
25+
/**
26+
* Maximum Image Height resolution in pixels. For image resizing on client side
27+
- * @deprecated
28+
- * @see \Magento\Framework\Image\Adapter\UploadConfigInterface::getMaxHeight()
29+
+ * @deprecated @see \Magento\Framework\Image\Adapter\UploadConfigInterface::getMaxHeight()
30+
*/
31+
const MAX_IMAGE_HEIGHT = 1200;
32+
33+
@@ -169,21 +170,32 @@ class Uploader
34+
*/
35+
private $directoryList;
36+
37+
+ /**
38+
+ * @var DriverPool|null
39+
+ */
40+
+ private $driverPool;
41+
+
42+
+ /**
43+
+ * @var DriverInterface|null
44+
+ */
45+
+ private $fileDriver;
46+
+
47+
/**
48+
* Init upload
49+
*
50+
* @param string|array $fileId
51+
* @param \Magento\Framework\File\Mime|null $fileMime
52+
* @param DirectoryList|null $directoryList
53+
+ * @param DriverPool|null $driverPool
54+
* @throws \DomainException
55+
*/
56+
public function __construct(
57+
$fileId,
58+
Mime $fileMime = null,
59+
- DirectoryList $directoryList = null
60+
+ DirectoryList $directoryList = null,
61+
+ DriverPool $driverPool = null
62+
) {
63+
- $this->directoryList= $directoryList ?: \Magento\Framework\App\ObjectManager::getInstance()
64+
- ->get(DirectoryList::class);
65+
+ $this->directoryList= $directoryList ?: ObjectManager::getInstance()->get(DirectoryList::class);
66+
67+
$this->_setUploadFileId($fileId);
68+
if (!file_exists($this->_file['tmp_name'])) {
69+
@@ -192,7 +204,8 @@ class Uploader
70+
} else {
71+
$this->_fileExists = true;
72+
}
73+
- $this->fileMime = $fileMime ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Mime::class);
74+
+ $this->fileMime = $fileMime ?: ObjectManager::getInstance()->get(Mime::class);
75+
+ $this->driverPool = $driverPool;
76+
}
77+
78+
/**
79+
@@ -230,7 +243,7 @@ class Uploader
80+
$this->setAllowCreateFolders(true);
81+
$this->_dispretionPath = static::getDispersionPath($fileName);
82+
$destinationFile .= $this->_dispretionPath;
83+
- $this->_createDestinationFolder($destinationFile);
84+
+ $this->createDestinationFolder($destinationFile);
85+
}
86+
87+
if ($this->_allowRenameFiles) {
88+
@@ -275,13 +288,11 @@ class Uploader
89+
* @return void
90+
* @throws FileSystemException
91+
*/
92+
- private function validateDestination($destinationFolder)
93+
+ private function validateDestination(string $destinationFolder): void
94+
{
95+
if ($this->_allowCreateFolders) {
96+
- $this->_createDestinationFolder($destinationFolder);
97+
- }
98+
-
99+
- if (!is_writable($destinationFolder)) {
100+
+ $this->createDestinationFolder($destinationFolder);
101+
+ } elseif (!$this->getFileDriver()->isWritable($destinationFolder)) {
102+
throw new FileSystemException(__('Destination folder is not writable or does not exists.'));
103+
}
104+
}
105+
@@ -655,7 +666,7 @@ class Uploader
106+
* @return \Magento\Framework\File\Uploader
107+
* @throws FileSystemException
108+
*/
109+
- private function _createDestinationFolder($destinationFolder)
110+
+ private function createDestinationFolder(string $destinationFolder)
111+
{
112+
if (!$destinationFolder) {
113+
return $this;
114+
@@ -665,11 +676,13 @@ class Uploader
115+
$destinationFolder = substr($destinationFolder, 0, -1);
116+
}
117+
118+
- if (!(@is_dir($destinationFolder)
119+
- || @mkdir($destinationFolder, 0777, true)
120+
- )) {
121+
- throw new FileSystemException(__('Unable to create directory %1.', $destinationFolder));
122+
+ if (!$this->getFileDriver()->isDirectory($destinationFolder)) {
123+
+ $result = $this->getFileDriver()->createDirectory($destinationFolder);
124+
+ if (!$result) {
125+
+ throw new FileSystemException(__('Unable to create directory %1.', $destinationFolder));
126+
+ }
127+
}
128+
+
129+
return $this;
130+
}
131+
132+
@@ -732,4 +745,20 @@ class Uploader
133+
}
134+
return $dispersionPath;
135+
}
136+
+
137+
+ /**
138+
+ * Get driver for file
139+
+ *
140+
+ * @deprecated
141+
+ * @return DriverInterface
142+
+ */
143+
+ private function getFileDriver(): DriverInterface
144+
+ {
145+
+ if (!$this->fileDriver) {
146+
+ $this->driverPool = $this->driverPool ?: ObjectManager::getInstance()->get(DriverPool::class);
147+
+ $this->fileDriver = $this->driverPool->getDriver(DriverPool::FILE);
148+
+ }
149+
+
150+
+ return $this->fileDriver;
151+
+ }
152+
}

0 commit comments

Comments
 (0)