diff --git a/pom.xml b/pom.xml index 237337418..3ccdefd25 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores ModelWeb - 1.105.3 + 1.105.4 diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java b/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java index 03dbe0899..dc639e54d 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java @@ -5,6 +5,10 @@ import org.brazilutils.br.cpfcnpj.Cnpj; import org.brazilutils.br.cpfcnpj.Cpf; import org.brazilutils.validation.ValidationException; +/** + **Criar Enumns com quantidade máxima de 10 caracteres, pois existe uma restrição com a Globus (Praxio) + ***/ + public enum TipoIdentificacionDoc { RG(1), CPF(2), @@ -22,7 +26,7 @@ public enum TipoIdentificacionDoc { J_CARENTE(29), GRATUIDADE(30), NIS(31), - PASSE_LIVRE(32), + PASSELIVRE(32), ID_JOVEM(33), TODOS(0); @@ -88,7 +92,7 @@ public enum TipoIdentificacionDoc { tmp = TipoIdentificacionDoc.NIS; break; case 32: - tmp = TipoIdentificacionDoc.PASSE_LIVRE; + tmp = TipoIdentificacionDoc.PASSELIVRE; break; case 33: tmp = TipoIdentificacionDoc.ID_JOVEM; @@ -117,7 +121,7 @@ public enum TipoIdentificacionDoc { TipoIdentificacionDoc.J_CARENTE, TipoIdentificacionDoc.GRATUIDADE, TipoIdentificacionDoc.NIS, - TipoIdentificacionDoc.PASSE_LIVRE, + TipoIdentificacionDoc.PASSELIVRE, TipoIdentificacionDoc.ID_JOVEM }; } @@ -128,44 +132,68 @@ public enum TipoIdentificacionDoc { if (id == null) { return null; } + String descricao = ""; + switch (id) { case 1: case 10: - return "RG"; + descricao= "RG"; + break; case 2: case 11: - return "CPF"; + descricao= "CPF"; + break; case 12: - return "CI"; + descricao= "CI"; + break; case 13: - return "PASPT"; + descricao= "PASPT"; + break; case 14: - return "RUT"; + descricao= "RUT"; + break; case 22: - return "DOCX"; + descricao= "DOCX"; + break; case 15: - return "CNPJ"; + descricao= "CNPJ"; + break; case 23: - return "CN"; + descricao= "CN"; + break; case 24: - return "RNE"; + descricao= "RNE"; + break; case 25: - return "DOC_IDOSO"; + descricao= "DOC_IDOSO"; + break; case 26: - return "DNI"; + descricao= "DNI"; + break; case 27: - return "RE_PM"; + descricao= "RE_PM"; + break; case 28: - return "D_FISICO"; + descricao= "D_FISICO"; + break; case 29: - return "J_CARENTE"; + descricao= "J_CARENTE"; + break; + case 30: + descricao= "GRATUIDADE"; + break; case 31: - return "NIS"; + descricao= "NIS"; + break; case 32: - return "PASSE_LIVRE"; + descricao= "PASSELIVRE"; + break; case 33: - return "ID_JOVEM"; + descricao= "ID_JOVEM"; + break; default: - return ""; + descricao= ""; + break; } + return descricao.length()> 10 ? descricao.substring(0,10) : descricao; } public static TipoIdentificacionDoc[] getTipoDocExcluindoCPF() { @@ -181,7 +209,7 @@ public enum TipoIdentificacionDoc { TipoIdentificacionDoc.DNI, TipoIdentificacionDoc.RE_PM, TipoIdentificacionDoc.NIS, - TipoIdentificacionDoc.PASSE_LIVRE, + TipoIdentificacionDoc.PASSELIVRE, TipoIdentificacionDoc.ID_JOVEM, TipoIdentificacionDoc.D_FISICO, TipoIdentificacionDoc.J_CARENTE @@ -216,8 +244,10 @@ public enum TipoIdentificacionDoc { return TipoIdentificacionDoc.RE_PM; }else if(descTipoDoc.equals("NIS")) { return TipoIdentificacionDoc.NIS; - }else if(descTipoDoc.equals("PASSE_LIVRE")) { - return TipoIdentificacionDoc.PASSE_LIVRE; + } + // mantendo a retrocompatibilidade + else if(descTipoDoc.equals("PASSE_LIVRE") || descTipoDoc.equals("PASSELIVRE")) { + return TipoIdentificacionDoc.PASSELIVRE; }else if(descTipoDoc.equals("ID_JOVEM")) { return TipoIdentificacionDoc.ID_JOVEM; }else if(descTipoDoc.equals("D_FISICO")) {