Subversion Repositories Integrator Subversion

Rev

Go to most recent revision | 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.DocumentoEnum;
5
import br.com.swconsultoria.nfe.dom.enuns.ServicosEnum;
6
import br.com.swconsultoria.nfe.exception.NfeException;
7
import br.com.swconsultoria.nfe.schema.envEpec.TEnvEvento;
8
import br.com.swconsultoria.nfe.schema.envEpec.TRetEnvEvento;
9
import br.com.swconsultoria.nfe.util.XmlNfeUtil;
10
 
11
import javax.xml.bind.JAXBException;
12
 
13
/**
14
 * @author Samuel Oliveira - samuel@swconsultoria.com.br
15
 * Data: 28/09/2017 - 11:11
16
 */
17
class Epec {
18
 
19
    static TRetEnvEvento eventoEpec(ConfiguracoesNfe config, TEnvEvento enviEvento, boolean valida) throws NfeException {
20
 
21
        try {
22
 
23
            String xml = XmlNfeUtil.objectToXml(enviEvento, config.getEncode());
24
            xml = xml.replaceAll(" xmlns:ns2=\"http://www.w3.org/2000/09/xmldsig#\"", "");
25
            xml = xml.replaceAll("<evento v", "<evento xmlns=\"http://www.portalfiscal.inf.br/nfe\" v");
26
 
27
            xml = Eventos.enviarEvento(config, xml, ServicosEnum.EPEC, valida,true, DocumentoEnum.NFE);
28
 
29
            return XmlNfeUtil.xmlToObject(xml, TRetEnvEvento.class);
30
 
31
        } catch (JAXBException e) {
32
            throw new NfeException(e.getMessage(),e);
33
        }
34
 
35
    }
36
 
37
}