Totvs - WS Fornecedor / WS Cliente / WS Pedido Compra (bug #6127)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@42725 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2015-04-02 17:09:17 +00:00
parent a903a30c2e
commit 00404cbfeb
2 changed files with 92 additions and 101 deletions

View File

@ -28,6 +28,7 @@ import com.rjconsultores.ventaboletos.service.PuntoVentaService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ws.totvs.service.TotvsService;
import com.rjconsultores.ws.utileria.Atributos;
import com.rjconsultores.ws.utileria.Atributos.CodPaisBanco;
import com.rjconsultores.ws.utileria.Atributos.ContribuinteICMS;
import com.rjconsultores.ws.utileria.Atributos.ContribuinteSimplesNacional;
@ -45,6 +46,12 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
private static Logger log = LoggerFactory.getLogger(PuntoVentaServiceImpl.class);
private static final int CANAL_VENTA_PROPRIAS = 11;
private static final int CANAL_VENTA_FRANQUEADAS = 12;
private static final int CANAL_VENTA_PRESTACAO_SERVICO = 13;
private static final int CANAL_VENTA_MOTORISTA = 14;
private static final int CANAL_VENTA_COBRADOR = 15;
@Autowired
private PuntoVentaDAO puntoVentaDAO;
@Autowired
@ -94,12 +101,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
forma.setActivo(Boolean.FALSE);
}
// for (PtovtaEstoque forma : entidad.getPtovtaEstoqueList()) {
// forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// forma.setFecmodif(Calendar.getInstance().getTime());
// forma.setActivo(Boolean.FALSE);
// }
if (entidad.getAgenciaId() != null) {
entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
@ -165,25 +166,20 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
return puntosVenta;
}
private boolean validaCanalVenta(Short tipoptovtaId) {
private boolean validaCanalVenta(Integer tipoptovtaId) {
boolean resp = false;
switch (tipoptovtaId) {
// PROPRIAS
case 11:
case CANAL_VENTA_PROPRIAS:
resp = true;
break;
// FRANQUEADAS
case 12:
case CANAL_VENTA_FRANQUEADAS:
resp = true;
break;
// COBRADOR
case 15:
case CANAL_VENTA_MOTORISTA:
resp = true;
break;
// MOTORISTA
case 14:
case CANAL_VENTA_COBRADOR:
resp = true;
break;
@ -196,8 +192,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
private void integracionTotvs(PuntoVenta puntoVenta) throws IntegracionException {
if (ApplicationProperties.getInstance().integracionTotvs()) {
boolean clienteValido = validaCanalVenta(puntoVenta.getTipoPuntoVenta().getTipoptovtaId());
boolean fornecedorValido = (puntoVenta.getTipoPuntoVenta().getTipoptovtaId() == 13);
boolean clienteValido = validaCanalVenta(puntoVenta.getTipoPuntoVenta().getTipoptovtaId().intValue());
boolean fornecedorValido = (puntoVenta.getTipoPuntoVenta().getTipoptovtaId() == CANAL_VENTA_PRESTACAO_SERVICO);
if (fornecedorValido)
clienteValido = true;
@ -207,7 +203,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String xidsvp = puntoVenta.getNumPuntoVenta();
String cnpjEmpresaProtheus = "25634551000138";
String cnpjEmpresaProtheus = Atributos.CNPJ_EMPRESA_PROTHEUS;
String nome = puntoVenta.getNombpuntoventa();
String cgc = puntoVenta.getNumDoCPuntoVenta();
@ -236,7 +232,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String email = puntoVenta.getDescCorreo();
String fax = puntoVenta.getNumfax();
String inscr = puntoVenta.getNumIEPuntoVenta(); // esse campo é validado na totvs. Tem que ser o mesmo do estado enviado
String inscr = puntoVenta.getNumIEPuntoVenta();
String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa();
@ -255,11 +251,10 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
obs = StringUtils.isBlank(obs) ? "sem obs." : obs;
String conta = "1110101001001"; // DEVE SER REVISADO COM A GUANABARA
String cnae = "";
String inscrm = "ISENTO"; // DEVE SER REVISADO COM A GUANABARA
String naturez = "";
String naturez = "";
String cnae = "";
String fator = "";
String agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia();
@ -278,10 +273,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
Exception respEx = null;
if (clienteValido) {
if (fornecedorValido) {
try {
log.info(" ------------- INICIO INTEGRACION FORNECEDOR TOTVS ------------- ");
TotvsService.cadastrarFornecedor(endpointFornecedor, bairro, cep, cgc, cnae, codmun, codpais, complemen, conta, ddd, email, endereco,
est, inscr, inscrm, naturez, nome, nreduz, simpnac, tel, tipoPessoa, tppessoa, cnpjEmpresaProtheus, xidsvp, agencia, banco,
dgverag, ctacorr, dgverct);
@ -296,11 +289,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String pais = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getPais().getNombpais();
pais = "";// segundo mateus, passar em branco, segundo orientação do mateus da totvs
if (fornecedorValido) {
try {
log.info(" ------------- INICIO INTEGRACION CLIENTE TOTVS ------------- ");
if (clienteValido) {
try {
TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, conta, contrib, ddd, email, cnpjEmpresaProtheus,
endereco, entid, fator, fax, inscr, inscrm, naturez, nome, nreduz, obs, pais, tppessoaCliente, tel, tipoPessoa, est, xidsvp);
} catch (Exception e) {

View File

@ -1,6 +1,6 @@
package com.rjconsultores.ventaboletos.utilerias;
public class InscricaoEstadual {
public class InscricaoEstadualUtil {
public enum Estado {
AC, AL, AM, AP, BA, CE, DF, ES, GO, MA, MG, MS, MT, PA, PB, PE, PI, PR, RJ, RN, RO, RR, RS, SC, SE, SP, TO
@ -78,19 +78,19 @@ public class InscricaoEstadual {
} else if (siglaUf.equals(Estado.DF.toString())) {
validaIEDistritoFederal(strIE);
} else {
throw new Exception("Estado não encontrado : " + siglaUf);
throw new Exception("Estado não encontrado : " + siglaUf);
}
}
private static void validaIEAcre(String ie) throws Exception {
if (ie.length() != 13) {
throw new Exception("Quantidade de digitos inválida.");
throw new Exception("Quantidade de digitos inválida.");
}
// valida os dois primeiros digitos - devem ser iguais a 01
for (int i = 0; i < 2; i++) {
if (Integer.parseInt(String.valueOf(ie.charAt(i))) != i) {
throw new Exception("Inscrição Estadual inválida");
throw new Exception("Inscrição Estadual inválida");
}
}
@ -139,18 +139,18 @@ public class InscricaoEstadual {
// valida os digitos verificadores
String dv = d1 + "" + d2;
if (!dv.equals(ie.substring(ie.length() - 2, ie.length()))) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
} // fim do validaIEAcre()
private static void validaIEAlagoas(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de d<EFBFBD>gitos inv<6E>lida.");
throw new Exception("Quantidade de dígitos inválida.");
}
if (!ie.substring(0, 2).equals("24")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int[] digits = { 0, 3, 5, 7, 8 };
@ -162,7 +162,7 @@ public class InscricaoEstadual {
}
}
if (!check) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int soma = 0;
@ -180,18 +180,18 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEAmapa(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!ie.substring(0, 2).equals("03")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int d1 = -1;
@ -224,14 +224,14 @@ public class InscricaoEstadual {
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEAmazonas(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -253,7 +253,7 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
@ -267,7 +267,7 @@ public class InscricaoEstadual {
private static void validaIEBahia(String ie) throws Exception {
if (ie.length() != 8 && ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas." + ie);
throw new Exception("Quantidade de digitos inválidas." + ie);
}
int modulo = 10;
@ -310,14 +310,14 @@ public class InscricaoEstadual {
// valida os digitos verificadores
String dv = d1 + "" + d2;
if (!dv.equals(ie.substring(ie.length() - 2, ie.length()))) {
throw new Exception("Digito verificador inválido." + ie);
throw new Exception("Digito verificador inválido." + ie);
}
}
private static void validaIECeara(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -335,14 +335,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEEspiritoSanto(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -363,20 +363,20 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEGoias(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!"10".equals(ie.substring(0, 2))) {
if (!"11".equals(ie.substring(0, 2))) {
if (!"15".equals(ie.substring(0, 2))) {
throw new Exception("Inscrição estadual inválida");
throw new Exception("Inscrição Estadual inválida");
}
}
}
@ -384,7 +384,7 @@ public class InscricaoEstadual {
if (ie.substring(0, ie.length() - 1).equals("11094402")) {
if (!ie.substring(ie.length() - 1, ie.length()).equals("0")) {
if (!ie.substring(ie.length() - 1, ie.length()).equals("1")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
}
} else {
@ -416,7 +416,7 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
}
@ -424,11 +424,11 @@ public class InscricaoEstadual {
private static void validaIEMaranhao(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!ie.substring(0, 2).equals("12")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int soma = 0;
@ -447,14 +447,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEMatoGrosso(String ie) throws Exception {
if (ie.length() != 11) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -481,18 +481,18 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEMatoGrossoSul(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!ie.substring(0, 2).equals("28")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int soma = 0;
@ -519,14 +519,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEMinasGerais(String ie) throws Exception {
if (ie.length() != 13) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
String str = "";
@ -589,18 +589,18 @@ public class InscricaoEstadual {
// valida os digitos verificadores
String dv = d1 + "" + d2;
if (!dv.equals(ie.substring(ie.length() - 2, ie.length()))) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEPara(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!ie.substring(0, 2).equals("15")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int soma = 0;
@ -619,14 +619,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEParaiba(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -645,14 +645,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEParana(String ie) throws Exception {
if (ie.length() != 10) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -696,14 +696,14 @@ public class InscricaoEstadual {
// valida os digitos verificadores
String dv = d1 + "" + d2;
if (!dv.equals(ie.substring(ie.length() - 2, ie.length()))) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEPernambuco(String ie) throws Exception {
if (ie.length() != 14) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -733,14 +733,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEPiaui(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -759,14 +759,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIERioJaneiro(String ie) throws Exception {
if (ie.length() != 8) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -789,18 +789,18 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIERioGrandeNorte(String ie) throws Exception {
if (ie.length() != 10 && ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!ie.substring(0, 2).equals("20")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
if (ie.length() == 9) {
@ -820,7 +820,7 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
} else {
int soma = 0;
@ -838,7 +838,7 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
@ -847,7 +847,7 @@ public class InscricaoEstadual {
private static void validaIERioGrandeSul(String ie) throws Exception {
if (ie.length() != 10) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = Integer.parseInt(String.valueOf(ie.charAt(0))) * 2;
@ -866,14 +866,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIERondonia(String ie) throws Exception {
if (ie.length() != 14) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -899,18 +899,18 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIERoraima(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (!ie.substring(0, 2).equals("24")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
int soma = 0;
@ -926,14 +926,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIESantaCatarina(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -952,14 +952,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIESaoPaulo(String ie) throws Exception {
if (ie.length() != 12 && ie.length() != 13) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
if (ie.length() == 12) {
@ -1000,16 +1000,16 @@ public class InscricaoEstadual {
d2 = Integer.parseInt(String.valueOf(strD2.charAt(strD2.length() - 1)));
if (!ie.substring(8, 9).equals(d1 + "")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
if (!ie.substring(11, 12).equals(d2 + "")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
} else {
// valida o primeiro caracter
if (ie.charAt(0) != 'P') {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
String strIE = ie.substring(1, 10);
@ -1032,7 +1032,7 @@ public class InscricaoEstadual {
d1 = Integer.parseInt(String.valueOf(strD1.charAt(strD1.length() - 1)));
if (!ie.substring(9, 10).equals(d1 + "")) {
throw new Exception("Inscrição estadual inválida.");
throw new Exception("Inscrição Estadual inválida.");
}
}
}
@ -1040,7 +1040,7 @@ public class InscricaoEstadual {
private static void validaIESergipe(String ie) throws Exception {
if (ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -1059,14 +1059,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIETocantins(String ie) throws Exception {
if (ie.length() != 9 && ie.length() != 11) {
throw new Exception("Quantidade de d<EFBFBD>gitos inv<6E>lida.");
throw new Exception("Quantidade de dígitos inválida.");
} else if (ie.length() == 9) {
ie = ie.substring(0, 2) + "02" + ie.substring(2);
}
@ -1088,14 +1088,14 @@ public class InscricaoEstadual {
// valida o digito verificador
String dv = d + "";
if (!ie.substring(ie.length() - 1, ie.length()).equals(dv)) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
private static void validaIEDistritoFederal(String ie) throws Exception {
if (ie.length() != 13) {
throw new Exception("Quantidade de digitos inválidas.");
throw new Exception("Quantidade de digitos inválidas.");
}
int soma = 0;
@ -1139,7 +1139,7 @@ public class InscricaoEstadual {
// valida os digitos verificadores
String dv = d1 + "" + d2;
if (!dv.equals(ie.substring(ie.length() - 2, ie.length()))) {
throw new Exception("Digito verificador inválido.");
throw new Exception("Digito verificador inválido.");
}
}
}