From 82e1eb745f83fafc077f2626586b113ff0bcf7b2 Mon Sep 17 00:00:00 2001 From: Elisei Date: Mon, 5 Feb 2024 16:36:57 -0300 Subject: [PATCH] =?UTF-8?q?PagBank=20=F0=9F=98=8D=20Magento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gateway/Response/FetchPaymentHandler.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Gateway/Response/FetchPaymentHandler.php b/Gateway/Response/FetchPaymentHandler.php index 82363a0..bacb76a 100644 --- a/Gateway/Response/FetchPaymentHandler.php +++ b/Gateway/Response/FetchPaymentHandler.php @@ -15,6 +15,7 @@ use Magento\Payment\Gateway\Data\PaymentDataObjectInterface; use Magento\Payment\Gateway\Response\HandlerInterface; use Magento\Payment\Model\InfoInterface; +use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Email\Sender\InvoiceSender; /** @@ -189,12 +190,15 @@ public function findForPaymentStatus($response, $charges) public function setPaymentAuth($payment) { $order = $payment->getOrder(); - $payment->setIsTransactionApproved(false); - $payment->setIsTransactionDenied(false); - $payment->setIsInProcess(false); - $order->setStatus('payment_review'); - $comment = __('Awaiting payment review.'); - $order->addStatusHistoryComment($comment, $payment->getOrder()->getStatus()); + + if ($order->getState() !== Order::STATE_PAYMENT_REVIEW) { + $payment->setIsTransactionApproved(false); + $payment->setIsTransactionDenied(false); + $payment->setIsInProcess(false); + $order->setStatus('payment_review'); + $comment = __('Awaiting payment review.'); + $order->addStatusHistoryComment($comment, $payment->getOrder()->getStatus()); + } } /**