diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index f4e5e0b5c..5f02b3c25 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -75,44 +75,45 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad.setActivo(Boolean.TRUE); Exception respEx = null; - try { - if (entidad.getIndIntegracion() == TipoRetorno.PENDENTE.getValor() - || entidad.getIndIntegracion() == TipoRetorno.ERRO.getValor()) { - String resp = integracionTotvs(entidad); - - TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); - - switch (retornoTotvs) { - case CONCLUIDA: - entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); - break; - - case JA_CADASTRADA: - entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); - respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); - break; - - case ERRO: - entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); - respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); - break; - - default: - break; + if (ApplicationProperties.getInstance().integracionTotvs()) { + try { + if (entidad.getIndIntegracion() == TipoRetorno.PENDENTE.getValor() + || entidad.getIndIntegracion() == TipoRetorno.ERRO.getValor()) { + String resp = integracionTotvs(entidad); + + TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); + + switch (retornoTotvs) { + case CONCLUIDA: + entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); + break; + + case JA_CADASTRADA: + entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); + break; + + case ERRO: + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); + break; + + default: + break; + } + } else { + respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); } - } else { - respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); + } catch (ValidacionCampoException ev) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = ev; + + } catch (Exception e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + log.error(Atributos.MSG_ERRO_GENERICA, e); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); } - } catch (ValidacionCampoException ev) { - entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); - respEx = ev; - - } catch (Exception e) { - entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); - log.error(Atributos.MSG_ERRO_GENERICA, e); - respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); } - entidad = puntoVentaDAO.suscribir(entidad); if (respEx != null) { @@ -131,44 +132,48 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - + Exception respEx = null; - try { - if (entidad.getIndIntegracion() == TipoRetorno.PENDENTE.getValor() - || entidad.getIndIntegracion() == TipoRetorno.ERRO.getValor()) { - String resp = integracionTotvs(entidad); - - TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); - - switch (retornoTotvs) { - case CONCLUIDA: - entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); - break; - - case JA_CADASTRADA: - entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); - respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); - break; - - case ERRO: - entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); - respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); - break; - - default: - break; + + if (ApplicationProperties.getInstance().integracionTotvs()) { + + try { + if (entidad.getIndIntegracion() == TipoRetorno.PENDENTE.getValor() + || entidad.getIndIntegracion() == TipoRetorno.ERRO.getValor()) { + String resp = integracionTotvs(entidad); + + TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); + + switch (retornoTotvs) { + case CONCLUIDA: + entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); + break; + + case JA_CADASTRADA: + entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); + break; + + case ERRO: + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); + break; + + default: + break; + } + } else { + respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); } - } else { - respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); + } catch (ValidacionCampoException e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = e; + + } catch (Exception e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + log.error(Atributos.MSG_ERRO_GENERICA, e); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); } - } catch (ValidacionCampoException e) { - entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); - respEx = e; - - } catch (Exception e) { - entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); - log.error(Atributos.MSG_ERRO_GENERICA, e); - respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); } entidad = puntoVentaDAO.actualizacion(entidad);