-- Script para reprocessar o callback específico

-- 1. Verificar estado atual do callback
SELECT 
    '=== ESTADO ATUAL DO CALLBACK ===' AS info,
    id, seller_id, usuario_id, order_id, processed,
    LENGTH(seller_id) as tamanho_seller_id,
    CHAR_LENGTH(seller_id) as char_length_seller_id
FROM cliquedrop.callback_vendas_shopee 
WHERE order_id = '25120187HSB24K';

-- 2. Verificar se a loja existe
SELECT 
    '=== VERIFICAÇÃO DA LOJA ===' AS info,
    id, nome, seller_id, 
    LENGTH(seller_id) as tamanho_seller_id,
    CHAR_LENGTH(seller_id) as char_length_seller_id,
    integracao, fornecedor
FROM cliquedrop.usuarios_api_contas 
WHERE seller_id = '291686659';

-- 3. Comparar os seller_id (byte a byte)
SELECT 
    '=== COMPARAÇÃO BYTE A BYTE ===' AS info,
    c.seller_id as callback_seller_id,
    u.seller_id as usuarios_seller_id,
    c.seller_id = u.seller_id as sao_iguais,
    BINARY c.seller_id = BINARY u.seller_id as sao_iguais_binary,
    HEX(c.seller_id) as hex_callback,
    HEX(u.seller_id) as hex_usuarios
FROM cliquedrop.callback_vendas_shopee c
LEFT JOIN cliquedrop.usuarios_api_contas u ON u.seller_id = c.seller_id
WHERE c.order_id = '25120187HSB24K';

-- 4. Reprocessar o callback (marcar como pendente)
-- DESCOMENTE A LINHA ABAIXO PARA REPROCESSAR
-- UPDATE cliquedrop.callback_vendas_shopee SET processed = 0 WHERE order_id = '25120187HSB24K';
