Skip to content
Merged
5 changes: 5 additions & 0 deletions patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@
"3.2.0": "MAGECLOUD-4407__fix_namespace_vertex_tax__3.2.0.patch"
}
},
"amzn/amazon-pay-and-login-magento-2-module": {
"Set Payment info bug": {
"3.4.1": "BUNDLE-2554__set_payment_info_bug_fix__3.4.1.patch"
}
},
"magento/magento2-ee-base": {
"Fix pagebuilder module": {
"2.3.1": "PB-319__fix_pagebuilder_module__2.3.1.patch",
Expand Down
126 changes: 126 additions & 0 deletions patches/BUNDLE-2554__set_payment_info_bug_fix__3.4.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
diff --git a/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php b/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php
index 540b357..c18ef91 100644
--- a/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php
+++ b/vendor/amzn/amazon-pay-module/Model/OrderInformationManagement.php
@@ -144,24 +144,11 @@ public function saveOrderInformation($amazonOrderReferenceId, $allowedConstraint
];

$responseParser = $this->clientFactory->create($storeId)->setOrderReferenceDetails($data);
- try {
- $response = $this->amazonSetOrderDetailsResponseFactory->create(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much whitespace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BarnyShergold those lines are deleted. In patches need to pay attention to those which have + sign at the beginning, so only those line will exist after patch applying

- [
- 'response' => $responseParser
- ]
- );
+ $response = $this->amazonSetOrderDetailsResponseFactory->create([
+ 'response' => $responseParser
+ ]);

- $this->validateConstraints($response, $allowedConstraints);
- } catch (AmazonServiceUnavailableException $e) {
- if($e->getApiErrorCode() == 'OrderReferenceNotModifiable') {
- $this->logger->warning(
- "Could not modify Amazon order details for $amazonOrderReferenceId: "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't embed variables in strings. Use single quotes and concatenate or use sprintf

Copy link
Member

@shiftedreality shiftedreality May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for 3rd-party extension, can be ignored in favor of the original change

- . $e->getApiErrorMessage()
- );
- } else {
- throw $e;
- }
- }
+ $this->validateConstraints($response, $allowedConstraints);
} catch (LocalizedException $e) {
throw $e;
} catch (Exception $e) {
diff --git a/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php b/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php
index 6bad468..14b1264 100644
--- a/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php
+++ b/vendor/amzn/amazon-pay-module/Plugin/ConfirmOrderReference.php
@@ -25,6 +25,7 @@
use Amazon\Payment\Model\OrderInformationManagement;
use Magento\Quote\Api\Data\PaymentInterface;
use Magento\Quote\Api\Data\AddressInterface;
+use Magento\Framework\Webapi\Rest\Request;
use Magento\Framework\Exception\LocalizedException;
use Amazon\Payment\Gateway\Config\Config as GatewayConfig;
use Magento\Quote\Api\CartRepositoryInterface;
@@ -41,6 +42,11 @@ class ConfirmOrderReference
*/
private $checkoutSession;

+ /**
+ * @var Request
+ */
+ private $request;
+
/**
* @var OrderInformationManagement
*/
@@ -54,19 +60,31 @@ class ConfirmOrderReference
/**
* ConfirmOrderReference constructor.
* @param Session $checkoutSession
+ * @param Request $request
* @param OrderInformationManagement $orderInformationManagement
* @param CartRepositoryInterface $quoteRepository
*/
public function __construct(
Session $checkoutSession,
+ Request $request,
OrderInformationManagement $orderInformationManagement,
CartRepositoryInterface $quoteRepository
) {
$this->checkoutSession = $checkoutSession;
+ $this->request = $request;
$this->orderInformationManagement = $orderInformationManagement;
$this->quoteRepository = $quoteRepository;
}

+ /**
+ * @return boolean
+ */
+ protected function canConfirmOrderReference()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use private

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for 3rd-party extension, can be ignored in favor of the original change

+ {
+ $data = $this->request->getRequestData();
+ return !empty($data['confirmOrder']);
+ }
+
/**
* @param PaymentMethodManagementInterface $subject
* @param $result
@@ -94,10 +112,12 @@ public function afterSet(
$this->orderInformationManagement->saveOrderInformation($amazonOrderReferenceId);
}

- $this->orderInformationManagement->confirmOrderReference(
- $amazonOrderReferenceId,
- $quote->getStoreId()
- );
+ if ($this->canConfirmOrderReference()) {
+ $this->orderInformationManagement->confirmOrderReference(
+ $amazonOrderReferenceId,
+ $quote->getStoreId()
+ );
+ }
}
}

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
index 63caadf..a254c3d 100644
--- 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
@@ -40,6 +40,7 @@ define(
quoteId: quote.getQuoteId()
});
payload = {
+ confirmOrder: true,
cartId: quote.getQuoteId(),
email: quote.guestEmail,
paymentMethod: paymentData,
@@ -48,6 +49,7 @@ define(
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
payload = {
+ confirmOrder: true,
cartId: quote.getQuoteId(),
paymentMethod: paymentData,
billingAddress: quote.billingAddress()