Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 414 | espaco | 1 | package nfe; |
| 2 | |||
| 3 | import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; |
||
| 4 | import br.com.swconsultoria.nfe.dom.enuns.*; |
||
| 5 | import br.com.swconsultoria.nfe.exception.NfeException; |
||
| 6 | import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TEnvEvento; |
||
| 7 | import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TRetEnvEvento; |
||
| 8 | import br.com.swconsultoria.nfe.schema.retConsCad.TRetConsCad; |
||
| 9 | import br.com.swconsultoria.nfe.schema.retdistdfeint.RetDistDFeInt; |
||
| 10 | import br.com.swconsultoria.nfe.schema_4.enviNFe.TEnviNFe; |
||
| 11 | import br.com.swconsultoria.nfe.schema_4.enviNFe.TRetEnviNFe; |
||
| 12 | import br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe; |
||
| 13 | import br.com.swconsultoria.nfe.schema_4.inutNFe.TRetInutNFe; |
||
| 14 | import br.com.swconsultoria.nfe.schema_4.retConsReciNFe.TRetConsReciNFe; |
||
| 15 | import br.com.swconsultoria.nfe.schema_4.retConsSitNFe.TRetConsSitNFe; |
||
| 16 | import br.com.swconsultoria.nfe.schema_4.retConsStatServ.TRetConsStatServ; |
||
| 17 | import br.com.swconsultoria.nfe.util.ConfiguracoesUtil; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @author Samuel Oliveira - samuel@swconsultoria.com.br - www.swconsultoria.com.br |
||
| 21 | */ |
||
| 22 | public class Nfe { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Construtor privado |
||
| 26 | */ |
||
| 27 | private Nfe() { |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Classe Reponsavel Por Consultar a Distribuiçao da NFE na SEFAZ |
||
| 32 | * |
||
| 33 | * @param tipoPessoa Informar PessoaEnum.CPF ou PessoaEnum.CNPJ |
||
| 34 | * @param cpfCnpj |
||
| 35 | * @param tipoConsulta Informar ConsultaDFe.NSU ou ConsultaDFe.CHAVE |
||
| 36 | * @param nsuChave |
||
| 37 | * @return |
||
| 38 | * @throws NfeException |
||
| 39 | */ |
||
| 40 | public static RetDistDFeInt distribuicaoDfe(ConfiguracoesNfe configuracoesNfe, PessoaEnum tipoPessoa, String cpfCnpj, |
||
| 41 | ConsultaDFeEnum tipoConsulta, String nsuChave) throws NfeException { |
||
| 42 | |||
| 43 | return DistribuicaoDFe.consultaNfe(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, cpfCnpj), tipoPessoa, cpfCnpj, tipoConsulta, nsuChave); |
||
| 44 | |||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Metodo Responsavel Buscar o Status de Serviço do Servidor da Sefaz |
||
| 49 | * |
||
| 50 | * @param tipoDocumento informar DocumentoEnum.NFE ou DocumentoEnum.NFCE |
||
| 51 | * @return TRetConsStatServ - objeto a mensagem de retorno da |
||
| 52 | * transmissão. |
||
| 53 | * @throws NfeException |
||
| 54 | */ |
||
| 55 | public static TRetConsStatServ statusServico(ConfiguracoesNfe configuracoesNfe, DocumentoEnum tipoDocumento) throws NfeException { |
||
| 56 | |||
| 57 | return Status.statusServico(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe), tipoDocumento); |
||
| 58 | |||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Classe Reponsavel Por Consultar o status da NFE na SEFAZ No tipo Informar |
||
| 63 | * |
||
| 64 | * @param chave |
||
| 65 | * @param tipoDocumento USAR DocumentoEnum.NFE ou DocumentoEnum.NFCE |
||
| 66 | * @return TRetConsSitNFe |
||
| 67 | * @throws NfeException |
||
| 68 | */ |
||
| 69 | public static TRetConsSitNFe consultaXml(ConfiguracoesNfe configuracoesNfe, String chave, DocumentoEnum tipoDocumento) throws NfeException { |
||
| 70 | |||
| 71 | return ConsultaXml.consultaXml(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe), chave, tipoDocumento); |
||
| 72 | |||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Classe Reponsavel Por Consultar o cadastro do Cnpj/CPF na SEFAZ |
||
| 77 | * |
||
| 78 | * @param tipoPessoa Usar PessoaEnum.CNPJ ou PessoaEnum.CPF |
||
| 79 | * @param cnpjCpf |
||
| 80 | * @param estado |
||
| 81 | * @return TRetConsCad |
||
| 82 | * @throws NfeException |
||
| 83 | */ |
||
| 84 | public static TRetConsCad consultaCadastro(ConfiguracoesNfe configuracoesNfe, PessoaEnum tipoPessoa, String cnpjCpf, EstadosEnum estado) throws NfeException { |
||
| 85 | |||
| 86 | return ConsultaCadastro.consultaCadastro(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe), tipoPessoa, cnpjCpf, estado); |
||
| 87 | |||
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Classe Reponsavel Por Consultar o retorno da NFE na SEFAZ No tipo Informar |
||
| 92 | * |
||
| 93 | * @param recibo |
||
| 94 | * @param tipoDocumento USAR DocumentoEnum.NFE ou DocumentoEnum.NFCE |
||
| 95 | * @return |
||
| 96 | * @throws NfeException |
||
| 97 | */ |
||
| 98 | public static TRetConsReciNFe consultaRecibo(ConfiguracoesNfe configuracoesNfe, String recibo, DocumentoEnum tipoDocumento) throws NfeException { |
||
| 99 | return ConsultaRecibo.reciboNfe(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe), recibo, tipoDocumento); |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Classe Reponsavel Por Inutilizar a NFE na SEFAZ |
||
| 104 | * No tipo Informar DocumentoEnum.NFE ou DocumentoEnum.NFCE |
||
| 105 | * |
||
| 106 | * @param tipoDocumento |
||
| 107 | * @return |
||
| 108 | * @throws NfeException |
||
| 109 | */ |
||
| 110 | public static TRetInutNFe inutilizacao(ConfiguracoesNfe configuracoesNfe, TInutNFe inutNFe, DocumentoEnum tipoDocumento, boolean validar) throws NfeException { |
||
| 111 | return Inutilizar.inutiliza(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, inutNFe.getInfInut().getCNPJ()), inutNFe, tipoDocumento, validar); |
||
| 112 | } |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Metodo para Montar a NFE |
||
| 116 | * |
||
| 117 | * @param enviNFe |
||
| 118 | * @param valida |
||
| 119 | * @return |
||
| 120 | * @throws NfeException |
||
| 121 | */ |
||
| 122 | public static TEnviNFe montaNfe(ConfiguracoesNfe configuracoesNfe, TEnviNFe enviNFe, boolean valida) throws NfeException { |
||
| 123 | |||
| 124 | return Enviar.montaNfe(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, enviNFe.getNFe().get(0).getInfNFe().getEmit().getCNPJ()), enviNFe, valida); |
||
| 125 | |||
| 126 | } |
||
| 127 | |||
| 128 | |||
| 129 | /** |
||
| 130 | * Metodo para Enviar a NFE |
||
| 131 | * |
||
| 132 | * @param enviNFe |
||
| 133 | * @param tipoDocumento No tipo Informar DocumentoEnum.NFE ou DocumentoEnum.NFCE |
||
| 134 | * @return |
||
| 135 | * @throws NfeException |
||
| 136 | */ |
||
| 137 | public static TRetEnviNFe enviarNfe(ConfiguracoesNfe configuracoesNfe, TEnviNFe enviNFe, DocumentoEnum tipoDocumento) throws NfeException { |
||
| 138 | |||
| 139 | return Enviar.enviaNfe(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, enviNFe.getNFe().get(0).getInfNFe().getEmit().getCNPJ()), enviNFe, tipoDocumento); |
||
| 140 | |||
| 141 | } |
||
| 142 | |||
| 143 | /** |
||
| 144 | * Metodo para Cancelar a NFE |
||
| 145 | * No tipo Informar DocumentoEnum.NFE ou DocumentoEnum.NFCE |
||
| 146 | * |
||
| 147 | * @param envEvento |
||
| 148 | * @param valida |
||
| 149 | * @return |
||
| 150 | * @throws NfeException |
||
| 151 | */ |
||
| 152 | public static TRetEnvEvento cancelarNfe(ConfiguracoesNfe configuracoesNfe, TEnvEvento envEvento, boolean valida, DocumentoEnum tipoDocumento) throws NfeException { |
||
| 153 | |||
| 154 | return Cancelar.eventoCancelamento(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, envEvento.getEvento().get(0).getInfEvento().getCNPJ()), envEvento, valida, tipoDocumento); |
||
| 155 | |||
| 156 | } |
||
| 157 | |||
| 158 | /** |
||
| 159 | * Metodo para AtorInteressado da NFE |
||
| 160 | * |
||
| 161 | * @param envEvento |
||
| 162 | * @param valida |
||
| 163 | * @return |
||
| 164 | * @throws NfeException |
||
| 165 | */ |
||
| 166 | public static br.com.swconsultoria.nfe.schema.retEnvEventoAtorInteressado.TRetEnvEvento atorInteressadoNFe(ConfiguracoesNfe configuracoesNfe, br.com.swconsultoria.nfe.schema.envEventoAtorInteressado.TEnvEvento envEvento, boolean valida) throws NfeException { |
||
| 167 | |||
| 168 | return AtorInteressado.eventoAtorInteressado(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, envEvento.getEvento().get(0).getInfEvento().getCNPJ()), envEvento |
||
| 169 | , valida); |
||
| 170 | |||
| 171 | } |
||
| 172 | |||
| 173 | /** |
||
| 174 | * Metodo para Enviar Evento Manual |
||
| 175 | * |
||
| 176 | * @param configuracoesNfe |
||
| 177 | * @param xmlEvento |
||
| 178 | * @param tipoEvento |
||
| 179 | * @param valida |
||
| 180 | * @param assina |
||
| 181 | * @param tipoDocumento |
||
| 182 | * @return |
||
| 183 | * @throws NfeException |
||
| 184 | */ |
||
| 185 | public static String enviarEnventoManual(ConfiguracoesNfe configuracoesNfe, String xmlEvento, ServicosEnum tipoEvento, |
||
| 186 | boolean valida, boolean assina, |
||
| 187 | DocumentoEnum tipoDocumento) throws NfeException { |
||
| 188 | |||
| 189 | return Eventos.enviarEvento(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe), xmlEvento, tipoEvento, valida, assina, tipoDocumento); |
||
| 190 | |||
| 191 | } |
||
| 192 | |||
| 193 | /** |
||
| 194 | * Metodo para Cancelar a NFCE em Substituicao |
||
| 195 | * |
||
| 196 | * @param envEvento |
||
| 197 | * @param valida |
||
| 198 | * @return |
||
| 199 | * @throws NfeException |
||
| 200 | */ |
||
| 201 | public static br.com.swconsultoria.nfe.schema.envEventoCancSubst.TRetEnvEvento cancelarSubstituicaoNfe(ConfiguracoesNfe configuracoesNfe, br.com.swconsultoria.nfe.schema.envEventoCancSubst.TEnvEvento envEvento, boolean valida) throws NfeException { |
||
| 202 | |||
| 203 | return Cancelar.eventoCancelamentoSubstituicao(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, envEvento.getEvento().get(0).getInfEvento().getCNPJ()), envEvento, valida); |
||
| 204 | |||
| 205 | } |
||
| 206 | |||
| 207 | /** |
||
| 208 | * Metodo para Enviar o EPEC |
||
| 209 | * |
||
| 210 | * @param envEvento |
||
| 211 | * @return |
||
| 212 | * @throws NfeException |
||
| 213 | */ |
||
| 214 | public static br.com.swconsultoria.nfe.schema.envEpec.TRetEnvEvento enviarEpec(ConfiguracoesNfe configuracoesNfe, br.com.swconsultoria.nfe.schema.envEpec.TEnvEvento envEvento, boolean valida) throws NfeException { |
||
| 215 | |||
| 216 | return Epec.eventoEpec(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, envEvento.getEvento().get(0).getInfEvento().getCNPJ()), envEvento, valida); |
||
| 217 | |||
| 218 | } |
||
| 219 | |||
| 220 | /** |
||
| 221 | * Metodo para Envio da Carta De Correção da NFE. |
||
| 222 | * |
||
| 223 | * @param evento |
||
| 224 | * @param valida |
||
| 225 | * @return |
||
| 226 | * @throws NfeException |
||
| 227 | */ |
||
| 228 | public static br.com.swconsultoria.nfe.schema.envcce.TRetEnvEvento cce(ConfiguracoesNfe configuracoesNfe, |
||
| 229 | br.com.swconsultoria.nfe.schema.envcce.TEnvEvento evento, boolean valida) throws NfeException { |
||
| 230 | return CartaCorrecao.eventoCCe(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, evento.getEvento().get(0).getInfEvento().getCNPJ()), evento, valida); |
||
| 231 | } |
||
| 232 | |||
| 233 | /** |
||
| 234 | * Metodo para Manifestação da NFE. |
||
| 235 | * |
||
| 236 | * @param configuracoesNfe |
||
| 237 | * @param evento |
||
| 238 | * @param valida |
||
| 239 | * @return |
||
| 240 | * @throws NfeException |
||
| 241 | */ |
||
| 242 | public static br.com.swconsultoria.nfe.schema.envConfRecebto.TRetEnvEvento manifestacao(ConfiguracoesNfe configuracoesNfe, |
||
| 243 | br.com.swconsultoria.nfe.schema.envConfRecebto.TEnvEvento evento, boolean valida) throws NfeException { |
||
| 244 | return ManifestacaoDestinatario.eventoManifestacao(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesNfe, evento.getEvento().get(0).getInfEvento().getCNPJ()), evento, valida); |
||
| 245 | |||
| 246 | } |
||
| 247 | |||
| 248 | } |