fix translation

This commit is contained in:
O K
2025-06-08 15:40:24 +03:00
parent a35c8aa098
commit d258c6f5bf
11 changed files with 375 additions and 227 deletions

View File

@@ -36,7 +36,7 @@ class HutkoCallbackModuleFrontController extends ModuleFrontController
exit;
}
try {
// 1. Parse the incoming request body.
// Parse the incoming request body.
$calbackContent = $this->getCallbackContent();
@@ -55,13 +55,13 @@ class HutkoCallbackModuleFrontController extends ModuleFrontController
$this->context->customer = new Customer($order->id_customer);
$this->context->language = new Language($order->id_lang);
// 7. Handle payment status from the callback.
// Handle payment status from the callback.
$orderStatusCallback = $calbackContent['order_status'];
$currentOrderState = (int)$order->getCurrentState();
switch ($orderStatusCallback) {
case 'approved':
// Only success state if no refunds was done.
// Only process success state if no refunds was done.
if ($calbackContent['response_status'] == 'success' && (int)$calbackContent['reversal_amount'] === 0) {
$expectedState = (int)Configuration::get('HUTKO_SUCCESS_STATUS_ID', null, null, null, Configuration::get('PS_OS_PAYMENT'));
// Only change state if it's not already the success state or "Payment accepted".
@@ -121,13 +121,13 @@ class HutkoCallbackModuleFrontController extends ModuleFrontController
{
$calbackContent = json_decode(file_get_contents("php://input"), true);
if (!is_array($calbackContent) || !count($calbackContent)) {
PrestaShopLogger::addLog('Hutko Callback: Empty request body received.', 2, null, 'Cart', null, true);
PrestaShopLogger::addLog('Hutko Callback: Empty request body received.', 2);
throw new Exception('Empty request');
}
// Assuming validateResponse returns true on success, or a string error message on failure.
$isSignatureValid = $this->module->validateResponse($calbackContent);
if ($isSignatureValid !== true) {
PrestaShopLogger::addLog('Hutko Callback: Invalid signature. Error: ' . $isSignatureValid, 2, null, 'Cart', null, true);
PrestaShopLogger::addLog('Hutko Callback: Invalid signature. Error: ' . $isSignatureValid, 2);
throw new Exception('Invalid signature');
}
if (Configuration::get('HUTKO_SAVE_LOGS')) {