br.com.swconsultoria.mdfe.util.ConfiguracaoMdfeUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-mdfe Show documentation
Show all versions of java-mdfe Show documentation
API Java para consumo do WebService de MDFe
The newest version!
package br.com.swconsultoria.mdfe.util;
import br.com.swconsultoria.certificado.CertificadoService;
import br.com.swconsultoria.certificado.exception.CertificadoException;
import br.com.swconsultoria.mdfe.dom.ConfiguracoesMDFe;
import br.com.swconsultoria.mdfe.dom.ConfiguracoesMDFeInterface;
import br.com.swconsultoria.mdfe.exception.MdfeException;
/**
* Classe Responsavel Por Conter metodos de Certificado
*
* @author SaMuK
*/
public class ConfiguracaoMdfeUtil {
public static ConfiguracoesMDFeInterface iniciaConfiguracoes() throws MdfeException {
try {
CertificadoService.inicializaCertificado(ConfiguracoesMDFe.getInstance().getCertificado(), ConfiguracaoMdfeUtil.class.getResourceAsStream("/Cacert"));
return ConfiguracoesMDFe.getInstance();
} catch (CertificadoException e) {
throw new MdfeException(e.getMessage());
}
}
public static ConfiguracoesMDFeInterface iniciaConfiguracoes(ConfiguracoesMDFeInterface config) throws MdfeException {
try {
CertificadoService.inicializaCertificado(config.getCertificado(),
ConfiguracaoMdfeUtil.class.getResourceAsStream("/Cacert"));
} catch (CertificadoException e) {
throw new MdfeException(e.getMessage());
}
return config;
}
}