node-sped-nfe 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/utils/eventos.js +212 -18
- package/dist/utils/extras.d.ts +3 -1
- package/dist/utils/extras.js +21 -1
- package/dist/utils/make.js +8 -8
- package/dist/utils/tools.d.ts +2 -1
- package/dist/utils/tools.js +45 -45
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/utils/eventos.js
CHANGED
@@ -628,66 +628,226 @@ const urlEventos400 = {
|
|
628
628
|
"cUF": "23"
|
629
629
|
},
|
630
630
|
"ES": {
|
631
|
+
"mod55": {
|
632
|
+
"producao": {
|
633
|
+
"NFeStatusServico": "https://nfe.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
634
|
+
"NFeAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
635
|
+
"NFeRetAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
636
|
+
"NFeInutilizacao": "https://nfe.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
637
|
+
"NFeConsultaProtocolo": "https://nfe.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
638
|
+
"RecepcaoEvento": "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
639
|
+
"NFeConsultaCadastro": "https://cad.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
640
|
+
},
|
641
|
+
"homologacao": {
|
642
|
+
"NFeStatusServico": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
643
|
+
"NFeAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NfeAutorizacao4.asmx",
|
644
|
+
"NFeRetAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NfeRetAutorizacao4.asmx",
|
645
|
+
"NFeInutilizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
646
|
+
"NFeConsultaProtocolo": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
647
|
+
"RecepcaoEvento": "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
648
|
+
"NFeConsultaCadastro": "https://cad-homologacao.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
649
|
+
}
|
650
|
+
},
|
631
651
|
"mod65": {
|
632
652
|
"producao": {
|
633
|
-
"
|
634
|
-
"
|
653
|
+
"NFeStatusServico": "https://nfce.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
654
|
+
"NFeAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
655
|
+
"NFeRetAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
656
|
+
"NFeInutilizacao": "https://nfce.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
657
|
+
"NFeConsultaProtocolo": "https://nfce.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
658
|
+
"RecepcaoEvento": "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
659
|
+
"NFeConsultaQR": "http://app.sefaz.es.gov.br/ConsultaNFCe",
|
660
|
+
"urlChave": "http://app.sefaz.es.gov.br/ConsultaNFCe"
|
635
661
|
},
|
636
662
|
"homologacao": {
|
637
|
-
"
|
638
|
-
"
|
663
|
+
"NFeStatusServico": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
664
|
+
"NFeAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
665
|
+
"NFeRetAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
666
|
+
"NFeInutilizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
667
|
+
"NFeConsultaProtocolo": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
668
|
+
"RecepcaoEvento": "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
669
|
+
"NFeConsultaQR": "http://app.sefaz.es.gov.br/ConsultaNFCe",
|
670
|
+
"urlChave": "http://app.sefaz.es.gov.br/ConsultaNFCe"
|
639
671
|
}
|
640
672
|
},
|
641
673
|
"cUF": "32"
|
642
674
|
},
|
643
675
|
"DF": {
|
676
|
+
"mod55": {
|
677
|
+
"producao": {
|
678
|
+
"NFeStatusServico": "https://nfe.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
679
|
+
"NFeAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
680
|
+
"NFeRetAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
681
|
+
"NFeInutilizacao": "https://nfe.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
682
|
+
"NFeConsultaProtocolo": "https://nfe.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
683
|
+
"RecepcaoEvento": "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
684
|
+
"NFeConsultaCadastro": "https://cad.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
685
|
+
},
|
686
|
+
"homologacao": {
|
687
|
+
"NFeStatusServico": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
688
|
+
"NFeAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
689
|
+
"NFeRetAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
690
|
+
"NFeInutilizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
691
|
+
"NFeConsultaProtocolo": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
692
|
+
"RecepcaoEvento": "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
693
|
+
"NFeConsultaCadastro": "https://cad-homologacao.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
694
|
+
}
|
695
|
+
},
|
644
696
|
"mod65": {
|
645
697
|
"producao": {
|
698
|
+
"NFeStatusServico": "https://nfce.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
699
|
+
"NFeAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
700
|
+
"NFeRetAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
701
|
+
"NFeInutilizacao": "https://nfce.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
702
|
+
"NFeConsultaProtocolo": "https://nfce.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
703
|
+
"RecepcaoEvento": "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
646
704
|
"NFeConsultaQR": "http://www.fazenda.df.gov.br/nfce/qrcode",
|
647
|
-
"urlChave": "www.fazenda.df.gov.br/nfce/consulta"
|
705
|
+
"urlChave": "http://www.fazenda.df.gov.br/nfce/consulta"
|
648
706
|
},
|
649
707
|
"homologacao": {
|
650
|
-
"
|
651
|
-
"
|
708
|
+
"NFeStatusServico": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
709
|
+
"NFeAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
710
|
+
"NFeRetAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
711
|
+
"NFeInutilizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
712
|
+
"NFeConsultaProtocolo": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
713
|
+
"RecepcaoEvento": "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
714
|
+
"NFeConsultaQR": "http://www.fazenda.df.gov.br/nfce/qrcode",
|
715
|
+
"urlChave": "http://www.fazenda.df.gov.br/nfce/consulta"
|
652
716
|
}
|
653
717
|
},
|
654
718
|
"cUF": "53"
|
655
719
|
},
|
656
720
|
"MA": {
|
721
|
+
"mod55": {
|
722
|
+
"producao": {
|
723
|
+
"NFeStatusServico": "https://www.sefazvirtual.fazenda.gov.br/NFeStatusServico4/NFeStatusServico4.asmx",
|
724
|
+
"NFeAutorizacao": "https://www.sefazvirtual.fazenda.gov.br/NFeAutorizacao4/NFeAutorizacao4.asmx",
|
725
|
+
"NFeRetAutorizacao": "https://www.sefazvirtual.fazenda.gov.br/NFeRetAutorizacao4/NFeRetAutorizacao4.asmx",
|
726
|
+
"NFeInutilizacao": "https://www.sefazvirtual.fazenda.gov.br/NFeInutilizacao4/NFeInutilizacao4.asmx",
|
727
|
+
"NFeConsultaProtocolo": "https://www.sefazvirtual.fazenda.gov.br/NFeConsultaProtocolo4/NFeConsultaProtocolo4.asmx",
|
728
|
+
"RecepcaoEvento": "https://www.sefazvirtual.fazenda.gov.br/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx",
|
729
|
+
"NFeConsultaCadastro": "https://www.sefazvirtual.fazenda.gov.br/CadConsultaCadastro4/CadConsultaCadastro4.asmx"
|
730
|
+
},
|
731
|
+
"homologacao": {
|
732
|
+
"NFeStatusServico": "https://hom.nfe.fazenda.gov.br/NFeStatusServico4/NFeStatusServico4.asmx",
|
733
|
+
"NFeAutorizacao": "https://hom.nfe.fazenda.gov.br/NFeAutorizacao4/NFeAutorizacao4.asmx",
|
734
|
+
"NFeRetAutorizacao": "https://hom.nfe.fazenda.gov.br/NFeRetAutorizacao4/NFeRetAutorizacao4.asmx",
|
735
|
+
"NFeInutilizacao": "https://hom.nfe.fazenda.gov.br/NFeInutilizacao4/NFeInutilizacao4.asmx",
|
736
|
+
"NFeConsultaProtocolo": "https://hom.nfe.fazenda.gov.br/NFeConsultaProtocolo4/NFeConsultaProtocolo4.asmx",
|
737
|
+
"RecepcaoEvento": "https://hom.nfe.fazenda.gov.br/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx",
|
738
|
+
"NFeConsultaCadastro": "https://hom.nfe.fazenda.gov.br/CadConsultaCadastro4/CadConsultaCadastro4.asmx"
|
739
|
+
}
|
740
|
+
},
|
657
741
|
"mod65": {
|
658
742
|
"producao": {
|
743
|
+
"NFeStatusServico": "https://nfce.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
744
|
+
"NFeAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
745
|
+
"NFeRetAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
746
|
+
"NFeInutilizacao": "https://nfce.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
747
|
+
"NFeConsultaProtocolo": "https://nfce.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
748
|
+
"RecepcaoEvento": "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
659
749
|
"NFeConsultaQR": "http://www.nfce.sefaz.ma.gov.br/portal/consultarNFCe.jsp",
|
660
|
-
"urlChave": "www.sefaz.ma.gov.br/
|
750
|
+
"urlChave": "http://www.nfce.sefaz.ma.gov.br/portal/consultarNFCe.jsp"
|
661
751
|
},
|
662
752
|
"homologacao": {
|
753
|
+
"NFeStatusServico": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
754
|
+
"NFeAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
755
|
+
"NFeRetAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
756
|
+
"NFeInutilizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
757
|
+
"NFeConsultaProtocolo": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
758
|
+
"RecepcaoEvento": "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
663
759
|
"NFeConsultaQR": "http://www.hom.nfce.sefaz.ma.gov.br/portal/consultarNFCe.jsp",
|
664
|
-
"urlChave": "www.sefaz.ma.gov.br/
|
760
|
+
"urlChave": "http://www.hom.nfce.sefaz.ma.gov.br/portal/consultarNFCe.jsp"
|
665
761
|
}
|
666
762
|
},
|
667
763
|
"cUF": "21"
|
668
764
|
},
|
669
765
|
"PA": {
|
766
|
+
"mod55": {
|
767
|
+
"producao": {
|
768
|
+
"NFeStatusServico": "https://nfe.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
769
|
+
"NFeAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
770
|
+
"NFeRetAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
771
|
+
"NFeInutilizacao": "https://nfe.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
772
|
+
"NFeConsultaProtocolo": "https://nfe.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
773
|
+
"RecepcaoEvento": "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
774
|
+
"NFeConsultaCadastro": "https://cad.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
775
|
+
},
|
776
|
+
"homologacao": {
|
777
|
+
"NFeStatusServico": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
778
|
+
"NFeAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
779
|
+
"NFeRetAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
780
|
+
"NFeInutilizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
781
|
+
"NFeConsultaProtocolo": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
782
|
+
"RecepcaoEvento": "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
783
|
+
"NFeConsultaCadastro": "https://cad-homologacao.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
784
|
+
}
|
785
|
+
},
|
670
786
|
"mod65": {
|
671
787
|
"producao": {
|
672
|
-
"
|
673
|
-
"
|
788
|
+
"NFeStatusServico": "https://nfce.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
789
|
+
"NFeAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
790
|
+
"NFeRetAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
791
|
+
"NFeInutilizacao": "https://nfce.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
792
|
+
"NFeConsultaProtocolo": "https://nfce.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
793
|
+
"RecepcaoEvento": "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
794
|
+
"NFeConsultaQR": "https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam",
|
795
|
+
"urlChave": "https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam"
|
674
796
|
},
|
675
797
|
"homologacao": {
|
676
|
-
"
|
677
|
-
"
|
798
|
+
"NFeStatusServico": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
799
|
+
"NFeAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
800
|
+
"NFeRetAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
801
|
+
"NFeInutilizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
802
|
+
"NFeConsultaProtocolo": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
803
|
+
"RecepcaoEvento": "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
804
|
+
"NFeConsultaQR": "https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam",
|
805
|
+
"urlChave": "https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam"
|
678
806
|
}
|
679
807
|
},
|
680
808
|
"cUF": "15"
|
681
809
|
},
|
682
810
|
"PB": {
|
811
|
+
"mod55": {
|
812
|
+
"producao": {
|
813
|
+
"NFeStatusServico": "https://nfe.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
814
|
+
"NFeAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
815
|
+
"NFeRetAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
816
|
+
"NFeInutilizacao": "https://nfe.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
817
|
+
"NFeConsultaProtocolo": "https://nfe.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
818
|
+
"RecepcaoEvento": "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
819
|
+
"NFeConsultaCadastro": "https://cad.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
820
|
+
},
|
821
|
+
"homologacao": {
|
822
|
+
"NFeStatusServico": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
823
|
+
"NFeAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NfeAutorizacao4.asmx",
|
824
|
+
"NFeRetAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NfeRetAutorizacao4.asmx",
|
825
|
+
"NFeInutilizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
826
|
+
"NFeConsultaProtocolo": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
827
|
+
"RecepcaoEvento": "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
828
|
+
"NFeConsultaCadastro": "https://cad-homologacao.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
829
|
+
}
|
830
|
+
},
|
683
831
|
"mod65": {
|
684
832
|
"producao": {
|
833
|
+
"NFeStatusServico": "https://nfce.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
834
|
+
"NFeAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
835
|
+
"NFeRetAutorizacao": "https://nfce.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
836
|
+
"NFeInutilizacao": "https://nfce.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
837
|
+
"NFeConsultaProtocolo": "https://nfce.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
838
|
+
"RecepcaoEvento": "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
685
839
|
"NFeConsultaQR": "http://www.sefaz.pb.gov.br/nfce",
|
686
|
-
"urlChave": "www.
|
840
|
+
"urlChave": "http://www.sefaz.pb.gov.br/nfce"
|
687
841
|
},
|
688
842
|
"homologacao": {
|
689
|
-
"
|
690
|
-
"
|
843
|
+
"NFeStatusServico": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico2.asmx",
|
844
|
+
"NFeAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao.asmx",
|
845
|
+
"NFeRetAutorizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao.asmx",
|
846
|
+
"NFeInutilizacao": "https://nfce-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao2.asmx",
|
847
|
+
"NFeConsultaProtocolo": "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta2.asmx",
|
848
|
+
"RecepcaoEvento": "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento.asmx",
|
849
|
+
"NFeConsultaQR": "http://www.sefaz.pb.gov.br/nfce",
|
850
|
+
"urlChave": "http://www.sefaz.pb.gov.br/nfce"
|
691
851
|
}
|
692
852
|
},
|
693
853
|
"cUF": "25"
|
@@ -771,12 +931,46 @@ const urlEventos400 = {
|
|
771
931
|
"SE": {
|
772
932
|
"mod65": {
|
773
933
|
"producao": {
|
934
|
+
"NFeAutorizacao": "https://www.nfce.se.gov.br/ws/NFeAutorizacao4.asmx",
|
935
|
+
"NFeRetAutorizacao": "https://www.nfce.se.gov.br/ws/NFeRetAutorizacao4.asmx",
|
936
|
+
"NFeInutilizacao": "https://www.nfce.se.gov.br/ws/NFeInutilizacao4.asmx",
|
937
|
+
"NFeConsultaProtocolo": "https://www.nfce.se.gov.br/ws/NFeConsultaProtocolo4.asmx",
|
938
|
+
"NFeStatusServico": "https://www.nfce.se.gov.br/ws/NFeStatusServico4.asmx",
|
939
|
+
"RecepcaoEvento": "https://www.nfce.se.gov.br/ws/RecepcaoEvento4.asmx",
|
940
|
+
"NFeConsultaCadastro": "https://www.nfce.se.gov.br/ws/CadConsultaCadastro4.asmx",
|
774
941
|
"NFeConsultaQR": "http://www.nfce.se.gov.br/nfce/qrcode",
|
775
942
|
"urlChave": "http://www.nfce.se.gov.br/nfce/consulta"
|
776
943
|
},
|
777
944
|
"homologacao": {
|
778
|
-
"
|
779
|
-
"
|
945
|
+
"NFeAutorizacao": "https://www.hom.nfce.se.gov.br/ws/NFeAutorizacao4.asmx",
|
946
|
+
"NFeRetAutorizacao": "https://www.hom.nfce.se.gov.br/ws/NFeRetAutorizacao4.asmx",
|
947
|
+
"NFeInutilizacao": "https://www.hom.nfce.se.gov.br/ws/NFeInutilizacao4.asmx",
|
948
|
+
"NFeConsultaProtocolo": "https://www.hom.nfce.se.gov.br/ws/NFeConsultaProtocolo4.asmx",
|
949
|
+
"NFeStatusServico": "https://www.hom.nfce.se.gov.br/ws/NFeStatusServico4.asmx",
|
950
|
+
"RecepcaoEvento": "https://www.hom.nfce.se.gov.br/ws/RecepcaoEvento4.asmx",
|
951
|
+
"NFeConsultaCadastro": "https://www.hom.nfce.se.gov.br/ws/CadConsultaCadastro4.asmx",
|
952
|
+
"NFeConsultaQR": "http://www.hom.nfce.se.gov.br/nfce/qrcode",
|
953
|
+
"urlChave": "http://www.hom.nfce.se.gov.br/nfce/consulta"
|
954
|
+
}
|
955
|
+
},
|
956
|
+
"mod55": {
|
957
|
+
"producao": {
|
958
|
+
"NFeStatusServico": "https://nfe.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
959
|
+
"NFeAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
960
|
+
"NFeConsultaProtocolo": "https://nfe.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
961
|
+
"NFeInutilizacao": "https://nfe.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
962
|
+
"NFeRetAutorizacao": "https://nfe.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
963
|
+
"RecepcaoEvento": "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
964
|
+
"NFeConsultaCadastro": "https://cad.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
965
|
+
},
|
966
|
+
"homologacao": {
|
967
|
+
"NFeStatusServico": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx",
|
968
|
+
"NFeAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeAutorizacao/NFeAutorizacao4.asmx",
|
969
|
+
"NFeConsultaProtocolo": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx",
|
970
|
+
"NFeInutilizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/nfeinutilizacao/nfeinutilizacao4.asmx",
|
971
|
+
"NFeRetAutorizacao": "https://nfe-homologacao.svrs.rs.gov.br/ws/NfeRetAutorizacao/NFeRetAutorizacao4.asmx",
|
972
|
+
"RecepcaoEvento": "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx",
|
973
|
+
"NFeConsultaCadastro": "https://cad-homologacao.svrs.rs.gov.br/ws/cadconsultacadastro/cadconsultacadastro4.asmx"
|
780
974
|
}
|
781
975
|
},
|
782
976
|
"cUF": "28"
|
package/dist/utils/extras.d.ts
CHANGED
package/dist/utils/extras.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { XMLParser, XMLBuilder } from "fast-xml-parser";
|
1
2
|
const cUF2UF = {
|
2
3
|
"11": "RO",
|
3
4
|
"12": "AC",
|
@@ -272,4 +273,23 @@ const impEstrutura = (imposto) => {
|
|
272
273
|
};
|
273
274
|
imposto = configStruct(imposto, gStruct);
|
274
275
|
};
|
275
|
-
|
276
|
+
const xml2json = (xml) => {
|
277
|
+
return new Promise((resvol, reject) => {
|
278
|
+
let XMLPar = new XMLParser({
|
279
|
+
ignoreAttributes: false,
|
280
|
+
attributeNamePrefix: "@",
|
281
|
+
parseTagValue: false, // Evita conversão automática de valores
|
282
|
+
});
|
283
|
+
resvol(XMLPar.parse(xml));
|
284
|
+
});
|
285
|
+
};
|
286
|
+
const json2xml = (obj) => {
|
287
|
+
return new Promise((resvol, reject) => {
|
288
|
+
let XMLBuil = new XMLBuilder({
|
289
|
+
ignoreAttributes: false,
|
290
|
+
attributeNamePrefix: "@",
|
291
|
+
});
|
292
|
+
resvol(XMLBuil.build(obj));
|
293
|
+
});
|
294
|
+
};
|
295
|
+
export { cUF2UF, UF2cUF, json2xml, xml2json };
|
package/dist/utils/make.js
CHANGED
@@ -572,14 +572,14 @@ class Make {
|
|
572
572
|
}
|
573
573
|
}
|
574
574
|
_Make_NFe = new WeakMap(), _Make_ICMSTot = new WeakMap(), _Make_instances = new WeakSet(), _Make_gerarChaveNFe = function _Make_gerarChaveNFe() {
|
575
|
-
const chaveSemDV = __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cUF
|
575
|
+
const chaveSemDV = `${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cUF}`.padStart(2, '0') + // Código da UF (2 dígitos)
|
576
576
|
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.dhEmi.substring(2, 4) + __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.dhEmi.substring(5, 7) + // Ano e Mês da emissão (AAMM, 4 dígitos)
|
577
|
-
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.emit.CNPJ
|
578
|
-
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.mod
|
579
|
-
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.serie
|
580
|
-
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.nNF
|
581
|
-
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.tpEmis
|
582
|
-
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cNF
|
577
|
+
`${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.emit.CNPJ}`.padStart(14, '0') + // CNPJ do emitente (14 dígitos)
|
578
|
+
`${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.mod}`.padStart(2, '0') + // Modelo da NF (2 dígitos)
|
579
|
+
`${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.serie}`.padStart(3, '0') + // Série da NF (3 dígitos)
|
580
|
+
`${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.nNF}`.padStart(9, '0') + // Número da NF (9 dígitos)
|
581
|
+
`${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.tpEmis}`.padStart(1, '0') + // Tipo de Emissão (1 dígito)
|
582
|
+
`${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cNF}`.padStart(8, '0'); // Código Numérico da NF (8 dígitos)
|
583
583
|
__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cDV = __classPrivateFieldGet(this, _Make_instances, "m", _Make_calcularDigitoVerificador).call(this, chaveSemDV);
|
584
584
|
return `${chaveSemDV}${__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cDV}`;
|
585
585
|
}, _Make_calcularDigitoVerificador = function _Make_calcularDigitoVerificador(key) {
|
@@ -604,7 +604,7 @@ _Make_NFe = new WeakMap(), _Make_ICMSTot = new WeakMap(), _Make_instances = new
|
|
604
604
|
}, _Make_calICMSTot = function _Make_calICMSTot(obj) {
|
605
605
|
Object.keys(obj).map(key => {
|
606
606
|
if (__classPrivateFieldGet(this, _Make_ICMSTot, "f")[key] !== undefined) {
|
607
|
-
__classPrivateFieldGet(this, _Make_ICMSTot, "f")[key] +=
|
607
|
+
__classPrivateFieldGet(this, _Make_ICMSTot, "f")[key] += (obj[key]) * 1;
|
608
608
|
}
|
609
609
|
});
|
610
610
|
};
|
package/dist/utils/tools.d.ts
CHANGED
@@ -9,7 +9,7 @@ declare class Tools {
|
|
9
9
|
CSCid: string;
|
10
10
|
versao: string;
|
11
11
|
timeout: number;
|
12
|
-
openssl:
|
12
|
+
openssl: null;
|
13
13
|
}, certificado?: {
|
14
14
|
pfx: string;
|
15
15
|
senha: string;
|
@@ -21,5 +21,6 @@ declare class Tools {
|
|
21
21
|
getCertificado(): Promise<object>;
|
22
22
|
consultarNFe(chNFe: string): Promise<string>;
|
23
23
|
sefazStatus(): Promise<string>;
|
24
|
+
validarNFe(xml: string): Promise<any>;
|
24
25
|
}
|
25
26
|
export { Tools };
|
package/dist/utils/tools.js
CHANGED
@@ -9,8 +9,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
11
|
};
|
12
|
-
var _Tools_instances, _Tools_cert,
|
13
|
-
import {
|
12
|
+
var _Tools_instances, _Tools_cert, _Tools_pem, _Tools_config, _Tools_gerarQRCodeNFCe, _Tools_xmlValido, _Tools_certTools;
|
13
|
+
import { XMLBuilder } from "fast-xml-parser";
|
14
14
|
import https from "https";
|
15
15
|
import { spawnSync } from "child_process";
|
16
16
|
import tmp from "tmp";
|
@@ -20,16 +20,13 @@ import fs from "fs";
|
|
20
20
|
import path from 'path';
|
21
21
|
import { fileURLToPath } from 'url';
|
22
22
|
import pem from 'pem';
|
23
|
+
import { cUF2UF, json2xml, xml2json } from "./extras.js";
|
23
24
|
const __filename = fileURLToPath(import.meta.url);
|
24
25
|
const __dirname = path.dirname(__filename);
|
25
26
|
class Tools {
|
26
|
-
constructor(config = { mod: "", xmllint: 'xmllint', UF: '', tpAmb: 2, CSC: "", CSCid: "", versao: "4.00", timeout: 30, openssl:
|
27
|
+
constructor(config = { mod: "", xmllint: 'xmllint', UF: '', tpAmb: 2, CSC: "", CSCid: "", versao: "4.00", timeout: 30, openssl: null }, certificado = { pfx: "", senha: "" }) {
|
27
28
|
_Tools_instances.add(this);
|
28
29
|
_Tools_cert.set(this, void 0);
|
29
|
-
_Tools_xmlTools.set(this, {
|
30
|
-
XMLBuilder: {},
|
31
|
-
XMLParser: {}
|
32
|
-
});
|
33
30
|
_Tools_pem.set(this, {
|
34
31
|
key: "", // A chave privada extraída do PKCS#12, em formato PEM
|
35
32
|
cert: "", // O certificado extraído, em formato PEM
|
@@ -50,19 +47,10 @@ class Tools {
|
|
50
47
|
if (typeof config.xmllint == "undefined")
|
51
48
|
config.xmllint = 'xmllint';
|
52
49
|
if (typeof config.openssl == "undefined")
|
53
|
-
config.openssl =
|
50
|
+
config.openssl = null;
|
54
51
|
//Configurar certificado
|
55
52
|
__classPrivateFieldSet(this, _Tools_config, config, "f");
|
56
53
|
__classPrivateFieldSet(this, _Tools_cert, certificado, "f");
|
57
|
-
__classPrivateFieldGet(this, _Tools_xmlTools, "f").XMLBuilder = new XMLBuilder({
|
58
|
-
ignoreAttributes: false,
|
59
|
-
attributeNamePrefix: "@",
|
60
|
-
});
|
61
|
-
__classPrivateFieldGet(this, _Tools_xmlTools, "f").XMLParser = new XMLParser({
|
62
|
-
ignoreAttributes: false,
|
63
|
-
attributeNamePrefix: "@",
|
64
|
-
parseTagValue: false, // Evita conversão automática de valores
|
65
|
-
});
|
66
54
|
}
|
67
55
|
sefazEnviaLote(xml, data = { idLote: 1, indSinc: 0, compactar: false }) {
|
68
56
|
return new Promise(async (resvol, reject) => {
|
@@ -188,7 +176,8 @@ class Tools {
|
|
188
176
|
xml.NFe.infNFeSupl.qrCode = __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_gerarQRCodeNFCe).call(this, xml.NFe, "2", __classPrivateFieldGet(this, _Tools_config, "f").CSCid, __classPrivateFieldGet(this, _Tools_config, "f").CSC);
|
189
177
|
}
|
190
178
|
this.json2xml(xml).then(async (res) => {
|
191
|
-
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, res, `nfe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
|
179
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, res, `nfe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).catch(reject);
|
180
|
+
;
|
192
181
|
resvol(res);
|
193
182
|
}).catch(err => {
|
194
183
|
reject(err);
|
@@ -197,12 +186,12 @@ class Tools {
|
|
197
186
|
}
|
198
187
|
async xml2json(xml) {
|
199
188
|
return new Promise((resvol, reject) => {
|
200
|
-
|
189
|
+
xml2json(xml).then(resvol).catch(reject);
|
201
190
|
});
|
202
191
|
}
|
203
192
|
async json2xml(obj) {
|
204
193
|
return new Promise((resvol, reject) => {
|
205
|
-
|
194
|
+
json2xml(obj).then(resvol).catch(reject);
|
206
195
|
});
|
207
196
|
}
|
208
197
|
//Obter certificado
|
@@ -217,12 +206,11 @@ class Tools {
|
|
217
206
|
if (!chNFe || chNFe.length !== 44) {
|
218
207
|
return reject("consultarNFe(chNFe) -> chave inválida!");
|
219
208
|
}
|
220
|
-
|
221
|
-
|
209
|
+
let cUF = `${chNFe}`.substring(0, 2);
|
210
|
+
let UF = cUF2UF[cUF];
|
211
|
+
let mod = `${chNFe}`.substring(20, 22);
|
222
212
|
if (typeof __classPrivateFieldGet(this, _Tools_config, "f").tpAmb === "undefined")
|
223
213
|
throw "consultarNFe({...tpAmb}) -> não definido!";
|
224
|
-
if (typeof __classPrivateFieldGet(this, _Tools_config, "f").mod === "undefined")
|
225
|
-
throw "consultarNFe({...mod}) -> não definido!";
|
226
214
|
let consSitNFe = {
|
227
215
|
"@xmlns": "http://www.portalfiscal.inf.br/nfe",
|
228
216
|
"@versao": "4.00",
|
@@ -247,10 +235,11 @@ class Tools {
|
|
247
235
|
attributeNamePrefix: "@"
|
248
236
|
});
|
249
237
|
// Validação do XML interno (opcional)
|
250
|
-
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, builder.build({ consSitNFe }), `consSitNFe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
|
238
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, builder.build({ consSitNFe }), `consSitNFe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).catch(reject);
|
239
|
+
;
|
251
240
|
const xml = builder.build(xmlObj);
|
252
|
-
let tempUF = urlEventos(
|
253
|
-
const url = tempUF[`mod${
|
241
|
+
let tempUF = urlEventos(UF, __classPrivateFieldGet(this, _Tools_config, "f").versao);
|
242
|
+
const url = tempUF[`mod${mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeConsultaProtocolo;
|
254
243
|
const req = https.request(url, {
|
255
244
|
method: 'POST',
|
256
245
|
headers: {
|
@@ -315,7 +304,7 @@ class Tools {
|
|
315
304
|
attributeNamePrefix: "@"
|
316
305
|
});
|
317
306
|
//Validação
|
318
|
-
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, tempBuild.build({ consStatServ }), `consStatServ_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
|
307
|
+
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, tempBuild.build({ consStatServ }), `consStatServ_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).catch(reject);
|
319
308
|
let tempUF = urlEventos(__classPrivateFieldGet(this, _Tools_config, "f").UF, __classPrivateFieldGet(this, _Tools_config, "f").versao);
|
320
309
|
let xml = tempBuild.build(xmlObj);
|
321
310
|
const req = https.request(tempUF[`mod${__classPrivateFieldGet(this, _Tools_config, "f").mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeStatusServico, {
|
@@ -355,8 +344,13 @@ class Tools {
|
|
355
344
|
}
|
356
345
|
});
|
357
346
|
}
|
347
|
+
async validarNFe(xml) {
|
348
|
+
return new Promise((resolve, reject) => {
|
349
|
+
__classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xml, `nfe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`).then(resolve).catch(reject);
|
350
|
+
});
|
351
|
+
}
|
358
352
|
}
|
359
|
-
_Tools_cert = new WeakMap(),
|
353
|
+
_Tools_cert = new WeakMap(), _Tools_pem = new WeakMap(), _Tools_config = new WeakMap(), _Tools_instances = new WeakSet(), _Tools_gerarQRCodeNFCe = function _Tools_gerarQRCodeNFCe(NFe, versaoQRCode = "2", idCSC, CSC) {
|
360
354
|
let s = '|', concat, hash;
|
361
355
|
if (NFe.infNFe.ide.tpEmis == 1) {
|
362
356
|
concat = [NFe.infNFe['@Id'].replace("NFe", ""), versaoQRCode, NFe.infNFe.ide.tpAmb, Number(idCSC)].join(s);
|
@@ -370,26 +364,32 @@ _Tools_cert = new WeakMap(), _Tools_xmlTools = new WeakMap(), _Tools_pem = new W
|
|
370
364
|
}, _Tools_xmlValido =
|
371
365
|
//Validar XML da NFe, somente apos assinar
|
372
366
|
async function _Tools_xmlValido(xml, xsd) {
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
367
|
+
return new Promise((resolve, reject) => {
|
368
|
+
const xmlFile = tmp.fileSync({ mode: 0o644, prefix: 'xml-', postfix: '.xml' });
|
369
|
+
fs.writeFileSync(xmlFile.name, xml, { encoding: 'utf8' });
|
370
|
+
const schemaPath = path.resolve(__dirname, `../../schemas/${xsd}.xsd`);
|
371
|
+
const verif = spawnSync(__classPrivateFieldGet(this, _Tools_config, "f").xmllint, ['--noout', '--schema', schemaPath, xmlFile.name], { encoding: 'utf8' });
|
372
|
+
xmlFile.removeCallback();
|
373
|
+
// Aqui, usamos o operador de encadeamento opcional (?.)
|
374
|
+
if (verif.error) {
|
375
|
+
return reject("Biblioteca xmllint não encontrada!");
|
376
|
+
}
|
377
|
+
else if (!verif.stderr.includes(".xml validates")) {
|
378
|
+
return reject(verif.stderr);
|
379
|
+
}
|
380
|
+
else {
|
381
|
+
resolve(true);
|
382
|
+
}
|
383
|
+
});
|
386
384
|
}, _Tools_certTools = function _Tools_certTools() {
|
387
385
|
return new Promise(async (resvol, reject) => {
|
388
386
|
if (__classPrivateFieldGet(this, _Tools_pem, "f").key != "")
|
389
387
|
resvol(__classPrivateFieldGet(this, _Tools_pem, "f"));
|
390
|
-
|
391
|
-
|
392
|
-
|
388
|
+
if (__classPrivateFieldGet(this, _Tools_config, "f").openssl != null) {
|
389
|
+
pem.config({
|
390
|
+
pathOpenSSL: __classPrivateFieldGet(this, _Tools_config, "f").openssl
|
391
|
+
});
|
392
|
+
}
|
393
393
|
pem.readPkcs12(__classPrivateFieldGet(this, _Tools_cert, "f").pfx, { p12Password: __classPrivateFieldGet(this, _Tools_cert, "f").senha }, (err, myPem) => {
|
394
394
|
if (err)
|
395
395
|
return reject(err); // <-- importante!
|