fix translation
This commit is contained in:
@@ -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')) {
|
||||
|
||||
@@ -57,7 +57,7 @@ class HutkoRedirectModuleFrontController extends ModuleFrontController
|
||||
return;
|
||||
}
|
||||
$this->context->smarty->assign([
|
||||
'hutko_response' => $responseData['response'], // The URL of the Hutko payment gateway.
|
||||
'hutko_response' => $responseData['response'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,6 @@ class HutkoReturnModuleFrontController extends ModuleFrontController
|
||||
// Validate the decoded JSON:
|
||||
// 1. Check if json_decode returned an array.
|
||||
// 2. Check if all expected keys ('id_cart', 'id_module', 'id_order', 'key') exist in the array.
|
||||
// 3. Check if the 'key' from the decoded data matches the secure key of the currently logged-in customer.
|
||||
// This is a critical security step to prevent unauthorized access to order details.
|
||||
if (
|
||||
is_array($decodedPV)
|
||||
&& isset($decodedPV['id_cart'])
|
||||
|
||||
Reference in New Issue
Block a user