From 684f66a01e5d8c40e007d12e50246033bece0d2b Mon Sep 17 00:00:00 2001 From: MarijusCoding Date: Fri, 10 Jan 2025 11:32:25 +0200 Subject: [PATCH] [PIPRES-526] optimize and fix code --- controllers/front/return.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/front/return.php b/controllers/front/return.php index dfa6a7979..7ea86c42c 100644 --- a/controllers/front/return.php +++ b/controllers/front/return.php @@ -204,7 +204,9 @@ protected function processGetStatus() $transactionId = $dbPayment['transaction_id'] ?: Tools::getValue('transaction_id'); - if (!isset($dbPayment) || !\Validate::isLoadedObject($cart = new Cart((int) Tools::getValue('cart_id')))) { + $cart = new Cart((int) $dbPayment['cart_id']); + + if (!isset($dbPayment) || !Validate::isLoadedObject($cart)) { exit(json_encode([ 'success' => false, ])); @@ -212,8 +214,9 @@ protected function processGetStatus() /* @phpstan-ignore-next-line */ $orderId = (int) Order::getOrderByCartId((int) $cart->id); + /** @phpstan-ignore-line */ - $order = new Order((int) $orderId); + $order = new Order($orderId); if ((int) $cart->id_customer !== (int) $this->context->customer->id) { exit(json_encode([