|
| 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() |
0 commit comments