public static function cancelarNfe($id_ref, $justificativa, $id_empreendimento)
 {
     $ConfiguracaoDao = new ConfiguracaoDao();
     $id_empreendimento = $id_empreendimento;
     $conf = $ConfiguracaoDao->getConfiguracoes($id_empreendimento);
     $flg_ambiente_nfe = isset($conf['flg_ambiente_nfe']) && ((int) $conf['flg_ambiente_nfe'] == 1 || (int) $conf['flg_ambiente_nfe'] == 0) ? (int) $conf['flg_ambiente_nfe'] : 0;
     $tokens['token_focus_producao'] = isset($conf['token_focus_producao']) ? $conf['token_focus_producao'] : '';
     $tokens['token_focus_homologacao'] = isset($conf['token_focus_homologacao']) ? $conf['token_focus_homologacao'] : '';
     $NfeDao = new NfeDao($flg_ambiente_nfe, $tokens);
     $NfeDao->id_ref = $id_ref;
     $retorno = $NfeDao->cancelarNfe($justificativa);
     if ($retorno) {
         $NotaFiscalDao = new NotaFiscalDao();
         $nfTO = new stdClass();
         $nfTO->cod_nota_fiscal = $id_ref;
         $nfTO->status = 'processando_cancelamento';
         $NotaFiscalDao->updateNota($nfTO);
         Flight::halt(200);
     } else {
         Flight::halt(500);
     }
 }