File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
src/main/java/br/com/swconsultoria/nfe/util Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ ________________________________________________________________________________
4848- Atualizado Servidro DFe Homologação
4949- Adicionado Compatibilidade com Java 14+
5050- Adicionado Envento Ator Interessado
51+ - Corrigido erro de Logs
52+ - Adicionado Melhorias JaxB
5153
5254Snapshot é a versão que se encontra em teste, só use em caso de extrema necessidade.
5355Para usar, adicione o repositorio de Snapshot ao Maven:
Original file line number Diff line number Diff line change 1212 */
1313public class RetornoUtil {
1414
15+ /**
16+ * Valida Retorno Assincrono Trasmissão de Contingencia!
17+ *
18+ * @param retorno
19+ * @throws NfeException
20+ */
21+ public static void validaSincronoTrasmissaoContingencia (TRetEnviNFe retorno ) throws NfeException {
22+
23+ if (!retorno .getCStat ().equals (StatusEnum .LOTE_RECEBIDO .getCodigo ()) && !retorno .getCStat ().equals (StatusEnum .LOTE_PROCESSADO .getCodigo ())) {
24+ throw new NfeException (retorno .getCStat () + " - " + retorno .getXMotivo ());
25+ }
26+
27+ if (!retorno .getProtNFe ().getInfProt ().getCStat ().equals (StatusEnum .AUTORIZADO .getCodigo ()) && !retorno .getProtNFe ().getInfProt ().getCStat ().equals (StatusEnum .AUTORIZADO_FORA_PRAZO .getCodigo ())) {
28+ throw new NfeException (retorno .getProtNFe ().getInfProt ().getCStat () + " - " + retorno .getProtNFe ().getInfProt ().getXMotivo ());
29+ }
30+ }
31+
1532 /**
1633 * Valida o Retorno Do Cancelamento
1734 *
Original file line number Diff line number Diff line change @@ -103,11 +103,7 @@ public class XmlNfeUtil {
103103 * @return T
104104 */
105105 public static <T > T xmlToObject (String xml , Class <T > classe ) throws JAXBException {
106-
107- JAXBContext context = JAXBContext .newInstance (classe );
108- Unmarshaller unmarshaller = context .createUnmarshaller ();
109-
110- return unmarshaller .unmarshal (new StreamSource (new StringReader (xml )), classe ).getValue ();
106+ return JAXB .unmarshal (new StreamSource (new StringReader (xml )), classe );
111107 }
112108
113109 /**
You can’t perform that action at this time.
0 commit comments