fix callback context

This commit is contained in:
O K
2025-05-31 16:13:17 +03:00
parent 2e14f76135
commit 9c7cfff5d6

View File

@@ -445,7 +445,7 @@ class Hutko extends PaymentModule
$products[] = [ $products[] = [
"id" => (int)$cartProduct['id_product'], "id" => (int)$cartProduct['id_product'],
"name" => $cartProduct['name'], "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), "total_amount" => round((float) $cartProduct['price'] * (int)$cartProduct['quantity'], 2),
"quantity" => (int)$cartProduct['quantity'], "quantity" => (int)$cartProduct['quantity'],
]; ];
@@ -473,9 +473,9 @@ class Hutko extends PaymentModule
if (!$idState) { if (!$idState) {
$idState = (int) Configuration::get('PS_OS_PREPARATION'); $idState = (int) Configuration::get('PS_OS_PREPARATION');
} }
if (!$fromCallBack) { if ($fromCallBack) {
$cart = new Cart($id_cart); $this->context->cart = new Cart($id_cart);
$this->context->customer = new Customer($cart->id_customer); $this->context->customer = new Customer($this->context->cart->id_customer);
} }
// Call the parent validateOrder method with the "preparation" status. // 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); return $this->validateOrder($id_cart, $idState, $amount, $this->displayName, null, ['transaction_id' => $transaction_id], null, false, $this->context->customer->secure_key);