diff --git a/Controller/Standard/AbstractStandard.php b/Controller/Standard/AbstractStandard.php index 1098520..c3df17d 100644 --- a/Controller/Standard/AbstractStandard.php +++ b/Controller/Standard/AbstractStandard.php @@ -242,8 +242,9 @@ protected function _retrieveQuote() if (!$sessionQuote) { $this->_logger->error(__("Session Quote does not exist.")); $use_checkout_api_quote = true; - } elseif ($checkout_id != $zipMoneyCheckoutId && $checkout_id != 'au-'.$zipMoneyCheckoutId) { + } elseif ($checkout_id != $zipMoneyCheckoutId && $checkout_id != 'au-' . $zipMoneyCheckoutId) { $this->_logger->error(__("Checkout Id does not match with the session quote.")); + $this->_logger->debug(__("Sesion Checkout Id: %s and Zip callback Checkout Id: %s.", $checkout_id, $zipMoneyCheckoutId)); $use_checkout_api_quote = true; } else { return $sessionQuote; @@ -292,6 +293,13 @@ protected function _getQuoteByUsingCheckoutApi($zip_checkout_id) ->create() ->addFieldToFilter("entity_id", $quoteId) ->getFirstItem(); + // update checkout id by latest checckout id in payment additional data. + if ($this->_quote) { + $additionalPaymentInfo = $this->_quote->getPayment()->getAdditionalInformation(); + $additionalPaymentInfo['zip_checkout_id'] = $zip_checkout_id; + $this->_quote->getPayment()->setAdditionalInformation($additionalPaymentInfo); + $this->_quoteRepository->save($this->_quote); + } return $this->_quote; } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->_logger->error($e->getMessage()); @@ -535,8 +543,10 @@ protected function _sendResponse($data, $responseCode = \Magento\Framework\Webap */ protected function _isResultValid() { - if (!$this->getRequest()->getParam('result') || - !in_array($this->getRequest()->getParam('result'), $this->_validResults)) { + if ( + !$this->getRequest()->getParam('result') || + !in_array($this->getRequest()->getParam('result'), $this->_validResults) + ) { $this->_logger->error(__("Invalid Result")); return false; }