From 781d60476fa92c24e9960729256bfa1b3bfee3a7 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 22 Jul 2024 15:16:08 +0300 Subject: [PATCH] order states fix on old prestashop versions --- src/Service/SaferPayOrderStatusService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Service/SaferPayOrderStatusService.php b/src/Service/SaferPayOrderStatusService.php index 38dd60f0..711b837c 100755 --- a/src/Service/SaferPayOrderStatusService.php +++ b/src/Service/SaferPayOrderStatusService.php @@ -127,6 +127,12 @@ public function setComplete(Order $order) $saferPayOrder->captured = 1; $saferPayOrder->update(); + + //NOTE: Older PS versions does not handle same state change, so we need to check if state is already set + if ($order->getCurrentState() === _SAFERPAY_PAYMENT_COMPLETED_) { + return; + } + $order->setCurrentState(_SAFERPAY_PAYMENT_COMPLETED_); }