All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.swconsultoria.mdfe.util.ConfiguracaoMdfeUtil Maven / Gradle / Ivy

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy