From e555010ccecd145af988b8988d9a4d1f660182a9 Mon Sep 17 00:00:00 2001 From: panariga Date: Tue, 9 Jun 2026 14:49:26 +0300 Subject: [PATCH] double conversion fixed --- upload/catalog/controller/extension/payment/hutko.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/upload/catalog/controller/extension/payment/hutko.php b/upload/catalog/controller/extension/payment/hutko.php index e897066..43549a8 100644 --- a/upload/catalog/controller/extension/payment/hutko.php +++ b/upload/catalog/controller/extension/payment/hutko.php @@ -143,7 +143,8 @@ class ControllerExtensionPaymentHutko extends Controller if ($current_order_status_id != $target_status_id) { $callbackAmount = $callbackContent['actual_amount'] ?? $callbackContent['amount']; $amountFloat = round($callbackAmount / 100, 2); - $comment = $this->language->get('text_payment_approved') . " " . $this->currency->format($amountFloat, $callbackContent['currency'], '', false) . ". " . $comment_details; + // do not convert callback currency + $comment = $this->language->get('text_payment_approved') . " " . $this->currency->format($amountFloat, $callbackContent['currency'], 1.0, true) . ". " . $comment_details; $this->model_checkout_order->addOrderHistory($order_id, $target_status_id, $comment, $notify_customer); } echo "OK"; // Hutko expects "OK" on success @@ -204,6 +205,7 @@ class ControllerExtensionPaymentHutko extends Controller $total_products += $product['total_amount']; } $total = (float)$order_info['total']; + $total_converted = (float)$this->currency->format($total, $order_info['currency_code'], $order_info['currency_value'], false); $order_totals = $this->model_checkout_order->getOrderTotals($order_info['order_id']); $total_shipping_cost = 0; // we need update shipping cost only if shipping was not included in products array already @@ -215,7 +217,7 @@ class ControllerExtensionPaymentHutko extends Controller } } } - $total_discounts = $total - $total_shipping_cost - $total_products; + $total_discounts = $total_converted - $total_shipping_cost - $total_products; if ($this->config->get('payment_hutko_include_discount_to_total')) { $amount = $total_products + $total_discounts; } else { @@ -223,7 +225,7 @@ class ControllerExtensionPaymentHutko extends Controller } - $amount_int = (int)round($this->currency->format($amount, $order_info['currency_code'], $order_info['currency_value'], false) * 100); + $amount_int = (int)round($amount * 100); $data = [ 'order_id' => $hutko_order_id, @@ -429,7 +431,7 @@ class ControllerExtensionPaymentHutko extends Controller return $responseData; } - protected function logOC(string $message) + protected function logOC(string $message): void { if ($this->config->get('payment_hutko_save_logs')) { $this->log->write('Hutko Payment: ' . $message);