// Proceed normally
            }
        }
    }
}
// Store transaction in DB
if (isset($_POST['payment_method']->token)) {
    $cart_id = (int) $_POST['order']->id;
    $order_id = '0';
    $customer_id = $cart->id_customer;
    $transaction_reference = $_POST['transaction_reference'];
    $device_id = $_POST['device_id'];
    $ip_address = $_POST['ip_address'];
    $ip_country = $_POST['ip_country'];
    $token = $_POST['payment_method']->token;
    HipayLogger::addTransaction($cart_id, $order_id, $customer_id, $transaction_reference, $device_id, $ip_address, $ip_country, $token);
}
switch ($log_state) {
    case 'completed':
        processStatusCompleted($cart);
        break;
    case 'pending':
    case 'forwarding':
        processStatusPending($cart);
        break;
    case 'declined':
        processStatusDeclined($cart);
        break;
    case 'error':
    default:
        processStatusError($cart);