Skip to content

Commit

Permalink
[PIPRES-526] optimize and fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijusCoding committed Jan 10, 2025
1 parent 24adcd5 commit 684f66a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/front/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,19 @@ 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,
]));
}

/* @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([
Expand Down

0 comments on commit 684f66a

Please sign in to comment.