From 9c7cfff5d6acd0e8436958db15ff2d1854e9e573 Mon Sep 17 00:00:00 2001 From: O K Date: Sat, 31 May 2025 16:13:17 +0300 Subject: [PATCH] fix callback context --- hutko.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hutko.php b/hutko.php index b20ac9a..40efce0 100644 --- a/hutko.php +++ b/hutko.php @@ -445,7 +445,7 @@ class Hutko extends PaymentModule $products[] = [ "id" => (int)$cartProduct['id_product'], "name" => $cartProduct['name'], - "price" => (float)$cartProduct['price'], + "price" => round((float)$cartProduct['price_with_reduction'], 2), "total_amount" => round((float) $cartProduct['price'] * (int)$cartProduct['quantity'], 2), "quantity" => (int)$cartProduct['quantity'], ]; @@ -473,9 +473,9 @@ class Hutko extends PaymentModule if (!$idState) { $idState = (int) Configuration::get('PS_OS_PREPARATION'); } - if (!$fromCallBack) { - $cart = new Cart($id_cart); - $this->context->customer = new Customer($cart->id_customer); + if ($fromCallBack) { + $this->context->cart = new Cart($id_cart); + $this->context->customer = new Customer($this->context->cart->id_customer); } // Call the parent validateOrder method with the "preparation" status. return $this->validateOrder($id_cart, $idState, $amount, $this->displayName, null, ['transaction_id' => $transaction_id], null, false, $this->context->customer->secure_key);