sefaz 0.2.0 → 1.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +115 -0
- data/Gemfile.lock +31 -17
- data/README.md +449 -17
- data/Rakefile +1 -0
- data/docs/CFe-SAT/Especificacao_SAT_v_ER_2_30_03.pdf +0 -0
- data/docs/CFe-SAT/Manual_Orientacao_SAT_v_MO_2_19_04.pdf +0 -0
- data/docs/CFe-SAT/Manual_do_Emulador_SAT-CF-e_Offline_2015_09_10.pdf +0 -0
- data/docs/CFe-SAT/_CANCEL_dataset.md +14 -0
- data/docs/CFe-SAT/_SALE_dataset.md +171 -0
- data/docs/CFe-SAT/emulador_off_line_v2_9_4.zip +0 -0
- data/docs/NFe-NFCe/ANEXO I - Leiaute e Regra de Valida/303/247/303/243o - NF-e e NFC-e.pdf +0 -0
- data/docs/NFe-NFCe/ANEXO II -Manual Especifica/303/247/303/265esT/303/251cnicas - Danfe-C/303/263digo-Barras.pdf +0 -0
- data/docs/NFe-NFCe/Anexo III - Manual de Conting/303/252ncia - NF-e.pdf +0 -0
- data/docs/NFe-NFCe/Anexo IV - Manual de Conting/303/252ncia - NFC-e.pdf +0 -0
- data/docs/NFe-NFCe/Manual de Orienta/303/247/303/243o ao Contribuinte - MOC - vers/303/243o 7.0 - NF-e e NFC-e.pdf +0 -0
- data/docs/NFe-NFCe/_dataset.md +819 -0
- data/lib/sefaz/base.rb +11 -0
- data/lib/sefaz/configuration.rb +58 -0
- data/lib/sefaz/exception.rb +14 -0
- data/lib/sefaz/refinement.rb +91 -0
- data/lib/sefaz/utils/connection.rb +35 -0
- data/lib/sefaz/utils/prawn_helper.rb +47 -0
- data/lib/sefaz/utils/signer.rb +122 -0
- data/lib/sefaz/version.rb +1 -1
- data/lib/sefaz/webservice/base.rb +13 -0
- data/lib/sefaz/webservice/nfe/auditor.rb +35 -0
- data/lib/sefaz/webservice/nfe/client.rb +426 -0
- data/lib/sefaz/webservice/nfe/connection.rb +17 -0
- data/lib/sefaz/webservice/nfe/dataset.rb +451 -0
- data/lib/sefaz/webservice/nfe/validator.rb +63 -0
- data/lib/sefaz/webservice/nfe/wsdl.rb +117 -0
- data/lib/sefaz/webservice/sat/client.rb +44 -0
- data/lib/sefaz/webservice/sat/dataset/cancel.rb +34 -0
- data/lib/sefaz/webservice/sat/dataset/sale.rb +176 -0
- data/lib/sefaz/webservice/sat/templates/base.rb +54 -0
- data/lib/sefaz/webservice/sat/templates/cupom_fiscal_55mm.rb +307 -0
- data/lib/sefaz/webservice/sat/templates/cupom_fiscal_80mm.rb +307 -0
- data/lib/sefaz.rb +45 -3
- data/sefaz.gemspec +5 -3
- metadata +80 -6
@@ -0,0 +1,451 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SEFAZ
|
4
|
+
module Webservice
|
5
|
+
module NFE
|
6
|
+
# Principal classe de elaboração do XML para o módulo NF-e/NFC-e
|
7
|
+
class Dataset
|
8
|
+
|
9
|
+
attr_accessor :ide, :NFref, :emit, :avulsa, :dest, :retirada, :entrega, :autXML, :det, :DI, :adi, :detExport, :rastro, :arma, :total, :transp, :reboque, :vol, :lacres, :cobr, :dup, :detPag, :infIntermed, :infAdic, :obscont, :obsfisco, :procref, :exporta, :compra, :cana, :forDia, :deduc, :infRespTec, :infNFeSupl
|
10
|
+
|
11
|
+
IDE = Struct.new("IDE", :cUF, :cNF, :natOp, :mod, :serie, :nNF, :dhEmi, :dhSaiEnt, :tpNF, :idDest, :cMunFG, :tpImp, :tpEmis, :cDV, :tpAmb, :finNFe, :indFinal, :indPres, :indIntermed, :procEmi, :verProc, :dhCont, :xJust, :NFref)
|
12
|
+
NFREF = Struct.new("NFREF", :refNFe, :cUF, :AAMM, :CNPJ, :CPF, :IE, :mod, :serie, :nNF, :refCTe, :nECF, :nCOO)
|
13
|
+
EMIT = Struct.new("EMIT", :CNPJ, :CPF, :xNome, :xFant, :enderEmit, :IE, :IEST, :IM, :CNAE, :CRT)
|
14
|
+
ENDEREMIT = Struct.new("ENDEREMIT", :xLgr, :nro, :xCpl, :xBairro, :cMun, :xMun, :UF, :CEP, :cPais, :xPais, :fone)
|
15
|
+
AVULSA = Struct.new("AVULSA", :CNPJ, :xOrgao, :matr, :xAgente, :fone, :UF, :nDAR, :dEmi, :vDAR, :repEmi, :dPag)
|
16
|
+
DEST = Struct.new("DEST", :CNPJ, :CPF, :idEstrangeiro, :xNome, :enderDest, :indIEDest, :IE, :ISUF, :IM, :email)
|
17
|
+
ENDERDEST = Struct.new("ENDERDEST", :xLgr, :nro, :xCpl, :xBairro, :cMun, :xMun, :UF, :CEP, :cPais, :xPais, :fone)
|
18
|
+
RETIRADA = Struct.new("RETIRADA", :CNPJ, :CPF, :xNome, :xLgr, :nro, :xCpl, :xBairro, :cMun, :xMun, :UF, :CEP, :cPais, :xPais, :fone, :email, :IE)
|
19
|
+
ENTREGA = Struct.new("ENTREGA", :CNPJ, :CPF, :xNome, :xLgr, :nro, :xCpl, :xBairro, :cMun, :xMun, :UF, :CEP, :cPais, :xPais, :fone, :email, :IE)
|
20
|
+
AUTXML = Struct.new("AUTXML", :CNPJ, :CPF)
|
21
|
+
DET = Struct.new("DET", :@nItem, :prod, :imposto, :impostoDevol, :infAdProd)
|
22
|
+
PROD = Struct.new("PROD", :cProd, :cEAN, :xProd, :NCM, :NVE, :CEST, :indEscala, :CNPJFab, :cBenef, :EXTIPI, :CFOP, :uCom, :qCom, :vUnCom, :vProd, :cEANTrib, :uTrib, :qTrib, :vUnTrib, :vFrete, :vSeg, :vDesc, :vOutro, :indTot, :DI, :detExport, :xPed, :nItemPed, :nFCI, :rastro, :veicProd, :med, :arma, :comb, :nRECOPI)
|
23
|
+
DI = Struct.new("DI", :nDI, :dDI, :xLocDesemb, :UFDesemb, :dDesemb, :tpViaTransp, :vAFRMM, :tpIntermedio, :CNPJ, :UFTerceiro, :cExportador, :adi)
|
24
|
+
ADI = Struct.new("ADI", :nAdicao, :nSeqAdic, :cFabricante, :vDescDI, :nDraw)
|
25
|
+
DETEXPORT = Struct.new("DETEXPORT", :nDraw, :exportInd)
|
26
|
+
EXPORTIND = Struct.new("EXPORTIND", :nRE, :chNFe, :qExport)
|
27
|
+
RASTRO = Struct.new("RASTRO", :nLote, :qLote, :dFab, :dVal, :cAgreg)
|
28
|
+
VEICPROD = Struct.new("VEICPROD", :tpOp, :chassi, :cCor, :xCor, :pot, :cilin, :pesoL, :pesoB, :nSerie, :tpComb, :nMotor, :CMT, :dist, :anoMod, :anoFab, :tpPint, :tpVeic, :espVeic, :VIN, :condVeic, :cMod, :cCorDENATRAN, :lota, :tpRest)
|
29
|
+
MED = Struct.new("MED", :cProdANVISA, :xMotivoIsencao, :vPMC)
|
30
|
+
ARMA = Struct.new("ARMA", :tpArma, :nSerie, :nCano, :descr)
|
31
|
+
COMB = Struct.new("COMB", :cProdANP, :descANP, :pGLP, :pGNn, :pGNi, :vPart, :CODIF, :qTemp, :UFCons, :CIDE, :encerrante)
|
32
|
+
CIDE = Struct.new("CIDE", :qBCProd, :vAliqProd, :vCIDE)
|
33
|
+
ENCERRANTE = Struct.new("ENCERRANTE", :nBico, :nBomba, :nTanque, :vEncIni, :vEncFin)
|
34
|
+
IMPOSTO = Struct.new("IMPOSTO", :vTotTrib, :ICMS, :ICMSUFDest, :IPI, :II, :PIS, :PISST, :COFINS, :COFINSST, :ISSQN)
|
35
|
+
ICMS = Struct.new("ICMS", :ICMS00, :ICMS10, :ICMS20, :ICMS30, :ICMS40, :ICMS51, :ICMS60, :ICMS70, :ICMS90, :ICMSPart, :ICMSST, :ICMSSN101, :ICMSSN102, :ICMSSN201, :ICMSSN202, :ICMSSN500, :ICMSSN900)
|
36
|
+
ICMS00 = Struct.new("ICMS00", :orig, :CST, :modBC, :vBC, :pICMS, :vICMS, :pFCP, :vFCP)
|
37
|
+
ICMS10 = Struct.new("ICMS10", :orig, :CST, :modBC, :vBC, :pICMS, :vICMS, :vBCFCP, :pFCP, :vFCP, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST)
|
38
|
+
ICMS20 = Struct.new("ICMS20", :orig, :CST, :modBC, :pRedBC, :vBC, :pICMS, :vICMS, :vBCFCP, :pFCP, :vFCP, :vICMSDeson, :motDesICMS)
|
39
|
+
ICMS30 = Struct.new("ICMS30", :orig, :CST, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST, :vICMSDeson, :motDesICMS)
|
40
|
+
ICMS40 = Struct.new("ICMS40", :orig, :CST, :vICMSDeson, :motDesICMS)
|
41
|
+
ICMS51 = Struct.new("ICMS51", :orig, :CST, :modBC, :pRedBC, :vBC, :pICMS, :vICMSOp, :pDif, :vICMSDif, :vICMS, :vBCFCP, :pFCP, :vFCP)
|
42
|
+
ICMS60 = Struct.new("ICMS60", :orig, :CST, :vBCSTRet, :pST, :vICMSSubstituto, :vICMSSTRet, :vBCFCPSTRet, :pFCPSTRet, :vFCPSTRet, :pRedBCEfet, :vBCEfet, :pICMSEfet, :vICMSEfet)
|
43
|
+
ICMS70 = Struct.new("ICMS70", :orig, :CST, :modBC, :pRedBC, :vBC, :pICMS, :vICMS, :vBCFCP, :pFCP, :vFCP, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST, :vICMSDeson, :motDesICMS)
|
44
|
+
ICMS90 = Struct.new("ICMS90", :orig, :CST, :modBC, :vBC, :pRedBC, :pICMS, :vICMS, :vBCFCP, :pFCP, :vFCP, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST, :vICMSDeson, :motDesICMS)
|
45
|
+
ICMSPart = Struct.new("ICMSPart", :orig, :CST, :modBC, :vBC, :pRedBC, :pICMS, :vICMS, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :pBCOp, :UFST)
|
46
|
+
ICMSST = Struct.new("ICMSST", :orig, :CST, :vBCSTRet, :pST, :vICMSSubstituto, :vICMSSTRet, :vBCFCPSTRet, :pFCPSTRet, :vFCPSTRet, :vBCSTDest, :vICMSSTDest, :pRedBCEfet, :vBCEfet, :pICMSEfet, :vICMSEfet)
|
47
|
+
ICMSSN101 = Struct.new("ICMSSN101", :orig, :CSOSN, :pCredSN, :vCredICMSSN)
|
48
|
+
ICMSSN102 = Struct.new("ICMSSN102", :orig, :CSOSN)
|
49
|
+
ICMSSN201 = Struct.new("ICMSSN201", :orig, :CSOSN, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST, :pCredSN, :vCredICMSSN)
|
50
|
+
ICMSSN202 = Struct.new("ICMSSN202", :orig, :CSOSN, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST)
|
51
|
+
ICMSSN500 = Struct.new("ICMSSN500", :orig, :CSOSN, :vBCSTRet, :pST, :vICMSSubstituto, :vICMSSTRet, :vBCFCPSTRet, :pFCPSTRet, :vFCPSTRet, :pRedBCEfet, :vBCEfet, :pICMSEfet, :vICMSEfet)
|
52
|
+
ICMSSN900 = Struct.new("ICMSSN900", :orig, :CSOSN, :modBC, :vBC, :pRedBC, :pICMS, :vICMS, :modBCST, :pMVAST, :pRedBCST, :vBCST, :pICMSST, :vICMSST, :vBCFCPST, :pFCPST, :vFCPST, :pCredSN, :vCredICMSSN)
|
53
|
+
ICMSUFDest = Struct.new("ICMSUFDest", :vBCUFDest, :vBCFCPUFDest, :pFCPUFDest, :pICMSUFDest, :pICMSInter, :pICMSInterPart, :vFCPUFDest, :vICMSUFDest, :vICMSUFRemet)
|
54
|
+
IPI = Struct.new("IPI", :CNPJProd, :cSelo, :qSelo, :cEnq, :IPITrib, :IPINT)
|
55
|
+
IPITrib = Struct.new("IPITrib", :CST, :vBC, :qUnid, :vUnid, :vIPI)
|
56
|
+
IPINT = Struct.new("IPINT", :CST)
|
57
|
+
II = Struct.new("II", :vBC, :vDespAdu, :vII, :vIOF)
|
58
|
+
PIS = Struct.new("PIS", :PISAliq, :PISQtde, :PISNT, :PISOutr)
|
59
|
+
PISAliq = Struct.new("PISAliq", :CST, :vBC, :pPIS, :vPIS)
|
60
|
+
PISQtde = Struct.new("PISQtde", :CST, :qBCProd, :vAliqProd, :vPIS)
|
61
|
+
PISNT = Struct.new("PISNT", :CST)
|
62
|
+
PISOutr = Struct.new("PISOutr", :CST, :vBC, :pPIS, :qBCProd, :vAliqProd, :vPIS)
|
63
|
+
PISST = Struct.new("PISST", :vBC, :pPIS, :qBCProd, :vAliqProd, :vPIS)
|
64
|
+
COFINS = Struct.new("COFINS", :COFINSAliq, :COFINSQtde, :COFINSNT, :COFINSOutr)
|
65
|
+
COFINSAliq = Struct.new("COFINSAliq", :CST, :vBC, :pCOFINS, :vCOFINS)
|
66
|
+
COFINSQtde = Struct.new("COFINSQtde", :CST, :qBCProd, :vAliqProd, :vCOFINS)
|
67
|
+
COFINSNT = Struct.new("COFINSNT", :CST)
|
68
|
+
COFINSOutr = Struct.new("COFINSOutr", :CST, :vBC, :pCOFINS, :qBCProd, :vAliqProd, :vCOFINS)
|
69
|
+
COFINSST = Struct.new("COFINSST", :vBC, :pCOFINS, :qBCProd, :vAliqProd, :vCOFINS)
|
70
|
+
ISSQN = Struct.new("ISSQN", :vBC, :vAliq, :vISSQN, :cMunFG, :cListServ, :vDeducao, :vOutro, :vDescIncond, :vDescCond, :vISSRet, :indISS, :cServico, :cMun, :cPais, :nProcesso, :indIncentivo)
|
71
|
+
IMPOSTODEVOL = Struct.new("IMPOSTODEVOL", :pDevol, :IPI)
|
72
|
+
IPIDEVOL = Struct.new("IPIDEVOL", :vIPIDevol)
|
73
|
+
TOTAL = Struct.new("TOTAL", :ICMSTot, :ISSQNtot, :retTrib)
|
74
|
+
ICMSTot = Struct.new("ICMSTot", :vBC, :vICMS, :vICMSDeson, :vFCPUFDest, :vICMSUFDest, :vICMSUFRemet, :vFCP, :vBCST, :vST, :vFCPST, :vFCPSTRet, :vProd, :vFrete, :vSeg, :vDesc, :vII, :vIPI, :vIPIDevol, :vPIS, :vCOFINS, :vOutro, :vNF, :vTotTrib)
|
75
|
+
ISSQNtot = Struct.new("ISSQNtot", :vServ, :vBC, :vISS, :vPIS, :vCOFINS, :dCompet, :vDeducao, :vOutro, :vDescIncond, :vDescCond, :vISSRet, :cRegTrib)
|
76
|
+
RETTrib = Struct.new("RETTrib", :vRetPIS, :vRetCOFINS, :vRetCSLL, :vBCIRRF, :vIRRF, :vBCRetPrev, :vRetPrev)
|
77
|
+
TRANSP = Struct.new("TRANSP", :modFrete, :transporta, :retTransp, :veicTransp, :reboque, :vagao, :balsa, :vol)
|
78
|
+
TRANSPORTA = Struct.new("TRANSPORTA", :CNPJ, :CPF, :xNome, :IE, :xEnder, :xMun, :UF)
|
79
|
+
RETTRANSP = Struct.new("RETTRANSP", :vServ, :vBCRet, :pICMSRet, :vICMSRet, :CFOP, :cMunFG)
|
80
|
+
VEICTRANSP = Struct.new("VEICTRANSP", :placa, :UF, :RNTC)
|
81
|
+
REBOQUE = Struct.new("REBOQUE", :placa, :UF, :RNTC)
|
82
|
+
VOL = Struct.new("VOL", :qVol, :esp, :marca, :nVol, :pesoL, :pesoB, :lacres)
|
83
|
+
LACRES = Struct.new("LACRES", :nLacre)
|
84
|
+
COBR = Struct.new("COBR", :fat, :dup)
|
85
|
+
FAT = Struct.new("FAT", :nFat, :vOrig, :vDesc, :vLiq)
|
86
|
+
DUP = Struct.new("DUP", :nDup, :dVenc, :vDup)
|
87
|
+
PAG = Struct.new("PAG", :detPag)
|
88
|
+
DETPAG = Struct.new("DETPAG", :indPag, :tPag, :vPag, :card, :vTroco)
|
89
|
+
CARD = Struct.new("CARD", :tpIntegra, :CNPJ, :tBand, :cAut)
|
90
|
+
INFINTERMED = Struct.new("INFINTERMED", :CNPJ, :idCadIntTran)
|
91
|
+
INFADIC = Struct.new("INFADIC", :infAdFisco, :infCpl, :obsCont, :obsFisco, :procRef)
|
92
|
+
OBSCONT = Struct.new("OBSCONT", :xCampo, :xTexto)
|
93
|
+
OBSFISCO = Struct.new("OBSFISCO", :xCampo, :xTexto)
|
94
|
+
PROCREF = Struct.new("PROCREF", :nProc, :indProc)
|
95
|
+
EXPORTA = Struct.new("EXPORTA", :UFSaidaPais, :xLocExporta, :xLocDespacho)
|
96
|
+
COMPRA = Struct.new("COMPRA", :xNEmp, :xPed, :xCont)
|
97
|
+
CANA = Struct.new("CANA", :safra, :ref, :forDia, :qTotMes, :qTotAnt, :qTotGer, :deduc, :vFor, :vTotDed, :vLiqFor)
|
98
|
+
FORDIA = Struct.new("FORDIA", :dia, :qtde)
|
99
|
+
DEDUC = Struct.new("DEDUC", :xDed, :vDed)
|
100
|
+
INFRESPTEC = Struct.new("INFRESPTEC", :CNPJ, :xContato, :email, :fone, :idCSRT, :hashCSRT)
|
101
|
+
INFNFESUPL = Struct.new("INFNFESUPL", :qrCode, :urlChave)
|
102
|
+
|
103
|
+
def initialize(chaveNF)
|
104
|
+
@versao = "4.00"
|
105
|
+
@chaveNF = chaveNF
|
106
|
+
|
107
|
+
@ide = IDE.new
|
108
|
+
@ide.NFref = []
|
109
|
+
@emit = EMIT.new
|
110
|
+
@emit.enderEmit = ENDEREMIT.new
|
111
|
+
@avulsa = AVULSA.new
|
112
|
+
@dest = DEST.new
|
113
|
+
@dest.enderDest = ENDERDEST.new
|
114
|
+
@retirada = RETIRADA.new
|
115
|
+
@entrega = ENTREGA.new
|
116
|
+
@total = TOTAL.new
|
117
|
+
@total.ICMSTot = ICMSTot.new
|
118
|
+
@total.ISSQNtot = ISSQNtot.new
|
119
|
+
@total.retTrib = RETTrib.new
|
120
|
+
@transp = TRANSP.new
|
121
|
+
@transp.transporta = TRANSPORTA.new
|
122
|
+
@transp.retTransp = RETTRANSP.new
|
123
|
+
@transp.veicTransp = VEICTRANSP.new
|
124
|
+
@transp.reboque = []
|
125
|
+
@transp.vol = []
|
126
|
+
@cobr = COBR.new
|
127
|
+
@cobr.fat = FAT.new
|
128
|
+
@cobr.dup = []
|
129
|
+
@pag = PAG.new
|
130
|
+
@pag.detPag = []
|
131
|
+
@infIntermed = INFINTERMED.new
|
132
|
+
@infAdic = INFADIC.new
|
133
|
+
@infAdic.obsCont = []
|
134
|
+
@infAdic.obsFisco = []
|
135
|
+
@infAdic.procRef = []
|
136
|
+
@exporta = EXPORTA.new
|
137
|
+
@compra = COMPRA.new
|
138
|
+
@cana = CANA.new
|
139
|
+
@cana.forDia = []
|
140
|
+
@cana.deduc = []
|
141
|
+
@infRespTec = INFRESPTEC.new
|
142
|
+
@infNFeSupl = INFNFESUPL.new
|
143
|
+
|
144
|
+
@listas = {}
|
145
|
+
@listas[:autXML] = []
|
146
|
+
@listas[:det] = []
|
147
|
+
end
|
148
|
+
|
149
|
+
def gerarNF
|
150
|
+
# Raiz = NFe
|
151
|
+
# A01 = infNFe
|
152
|
+
# H01 = det
|
153
|
+
# I01 = prod
|
154
|
+
# M01 = imposto
|
155
|
+
# N01 = ICMS
|
156
|
+
hash = { NFe: { :@xmlns => "http://www.portalfiscal.inf.br/nfe", infNFe: { :@Id => ("NFe" + @chaveNF.to_s), :@versao => @versao } } }
|
157
|
+
hash[:NFe][:infNFe][:ide] = @ide.to_h
|
158
|
+
hash[:NFe][:infNFe][:emit] = @emit.to_h
|
159
|
+
hash[:NFe][:infNFe][:emit][:enderEmit] = @emit.enderEmit.to_h
|
160
|
+
hash[:NFe][:infNFe][:avulsa] = @avulsa.to_h
|
161
|
+
hash[:NFe][:infNFe][:dest] = @dest.to_h
|
162
|
+
hash[:NFe][:infNFe][:dest][:enderDest] = @dest.enderDest.to_h
|
163
|
+
hash[:NFe][:infNFe][:retirada] = @retirada.to_h
|
164
|
+
hash[:NFe][:infNFe][:entrega] = @entrega.to_h
|
165
|
+
hash[:NFe][:infNFe][:autXML] = @listas[:autXML]
|
166
|
+
hash[:NFe][:infNFe][:det] = @listas[:det]
|
167
|
+
hash[:NFe][:infNFe][:total] = @total.to_h
|
168
|
+
hash[:NFe][:infNFe][:total][:ICMSTot] = @total.ICMSTot.to_h
|
169
|
+
hash[:NFe][:infNFe][:total][:ISSQNtot] = @total.ISSQNtot.to_h
|
170
|
+
hash[:NFe][:infNFe][:total][:retTrib] = @total.retTrib.to_h
|
171
|
+
hash[:NFe][:infNFe][:transp] = @transp.to_h
|
172
|
+
hash[:NFe][:infNFe][:transp][:transporta] = @transp.transporta.to_h
|
173
|
+
hash[:NFe][:infNFe][:transp][:retTransp] = @transp.retTransp.to_h
|
174
|
+
hash[:NFe][:infNFe][:transp][:veicTransp] = @transp.veicTransp.to_h
|
175
|
+
hash[:NFe][:infNFe][:cobr] = @cobr.to_h
|
176
|
+
hash[:NFe][:infNFe][:cobr][:fat] = @cobr.fat.to_h
|
177
|
+
hash[:NFe][:infNFe][:pag] = @pag.to_h
|
178
|
+
hash[:NFe][:infNFe][:infIntermed] = @infIntermed.to_h
|
179
|
+
hash[:NFe][:infNFe][:infAdic] = @infAdic.to_h
|
180
|
+
hash[:NFe][:infNFe][:exporta] = @exporta.to_h
|
181
|
+
hash[:NFe][:infNFe][:compra] = @compra.to_h
|
182
|
+
hash[:NFe][:infNFe][:cana] = @cana.to_h
|
183
|
+
hash[:NFe][:infNFe][:infRespTec] = @infRespTec.to_h
|
184
|
+
hash[:NFe][:infNFeSupl] = @infNFeSupl.to_h
|
185
|
+
compressed = hash.compress!
|
186
|
+
|
187
|
+
return [compressed.to_xml!, compressed]
|
188
|
+
end
|
189
|
+
|
190
|
+
def add(part_name)
|
191
|
+
part_object = case part_name
|
192
|
+
when "NFREF"
|
193
|
+
@NFref = NFREF.new
|
194
|
+
@NFref
|
195
|
+
when "AUTXML"
|
196
|
+
@autXML = AUTXML.new
|
197
|
+
@autXML
|
198
|
+
when "DET"
|
199
|
+
@det = DET.new
|
200
|
+
@det.prod = PROD.new
|
201
|
+
@det.prod.veicProd = VEICPROD.new
|
202
|
+
@det.prod.med = MED.new
|
203
|
+
@det.prod.comb = COMB.new
|
204
|
+
@det.prod.comb.CIDE = CIDE.new
|
205
|
+
@det.prod.comb.encerrante = ENCERRANTE.new
|
206
|
+
@det.prod.DI = []
|
207
|
+
@det.prod.detExport = []
|
208
|
+
@det.prod.rastro = []
|
209
|
+
@det.prod.arma = []
|
210
|
+
@det.imposto = IMPOSTO.new
|
211
|
+
@det.imposto.ICMS = ICMS.new
|
212
|
+
@det.imposto.ICMS.ICMS00 = ICMS00.new
|
213
|
+
@det.imposto.ICMS.ICMS10 = ICMS10.new
|
214
|
+
@det.imposto.ICMS.ICMS20 = ICMS20.new
|
215
|
+
@det.imposto.ICMS.ICMS30 = ICMS30.new
|
216
|
+
@det.imposto.ICMS.ICMS40 = ICMS40.new
|
217
|
+
@det.imposto.ICMS.ICMS51 = ICMS51.new
|
218
|
+
@det.imposto.ICMS.ICMS60 = ICMS60.new
|
219
|
+
@det.imposto.ICMS.ICMS70 = ICMS70.new
|
220
|
+
@det.imposto.ICMS.ICMS90 = ICMS90.new
|
221
|
+
@det.imposto.ICMS.ICMSPart = ICMSPart.new
|
222
|
+
@det.imposto.ICMS.ICMSST = ICMSST.new
|
223
|
+
@det.imposto.ICMS.ICMSSN101 = ICMSSN101.new
|
224
|
+
@det.imposto.ICMS.ICMSSN102 = ICMSSN102.new
|
225
|
+
@det.imposto.ICMS.ICMSSN201 = ICMSSN201.new
|
226
|
+
@det.imposto.ICMS.ICMSSN202 = ICMSSN202.new
|
227
|
+
@det.imposto.ICMS.ICMSSN500 = ICMSSN500.new
|
228
|
+
@det.imposto.ICMS.ICMSSN900 = ICMSSN900.new
|
229
|
+
@det.imposto.ICMSUFDest = ICMSUFDest.new
|
230
|
+
@det.imposto.IPI = IPI.new
|
231
|
+
@det.imposto.IPI.IPITrib = IPITrib.new
|
232
|
+
@det.imposto.IPI.IPINT = IPINT.new
|
233
|
+
@det.imposto.II = II.new
|
234
|
+
@det.imposto.PIS = PIS.new
|
235
|
+
@det.imposto.PIS.PISAliq = PISAliq.new
|
236
|
+
@det.imposto.PIS.PISQtde = PISQtde.new
|
237
|
+
@det.imposto.PIS.PISNT = PISNT.new
|
238
|
+
@det.imposto.PIS.PISOutr = PISOutr.new
|
239
|
+
@det.imposto.PISST = PISST.new
|
240
|
+
@det.imposto.COFINS = COFINS.new
|
241
|
+
@det.imposto.COFINS.COFINSAliq = COFINSAliq.new
|
242
|
+
@det.imposto.COFINS.COFINSQtde = COFINSQtde.new
|
243
|
+
@det.imposto.COFINS.COFINSNT = COFINSNT.new
|
244
|
+
@det.imposto.COFINS.COFINSOutr = COFINSOutr.new
|
245
|
+
@det.imposto.COFINSST = COFINSST.new
|
246
|
+
@det.imposto.ISSQN = ISSQN.new
|
247
|
+
@det.impostoDevol = IMPOSTODEVOL.new
|
248
|
+
@det.impostoDevol.IPI = IPIDEVOL.new
|
249
|
+
@det
|
250
|
+
when "DI"
|
251
|
+
@DI = DI.new
|
252
|
+
@DI.adi = []
|
253
|
+
@DI
|
254
|
+
when "ADI"
|
255
|
+
@adi = ADI.new
|
256
|
+
@adi
|
257
|
+
when "DETEXPORT"
|
258
|
+
@detExport = DETEXPORT.new
|
259
|
+
@detExport.exportInd = EXPORTIND.new
|
260
|
+
@detExport
|
261
|
+
when "RASTRO"
|
262
|
+
@rastro = RASTRO.new
|
263
|
+
@rastro
|
264
|
+
when "ARMA"
|
265
|
+
@arma = ARMA.new
|
266
|
+
@arma
|
267
|
+
when "REBOQUE"
|
268
|
+
@reboque = REBOQUE.new
|
269
|
+
@reboque
|
270
|
+
when "VOL"
|
271
|
+
@vol = VOL.new
|
272
|
+
@vol.lacres = []
|
273
|
+
@vol
|
274
|
+
when "LACRES"
|
275
|
+
@lacres = LACRES.new
|
276
|
+
@lacres
|
277
|
+
when "DUP"
|
278
|
+
@dup = DUP.new
|
279
|
+
@dup
|
280
|
+
when "DETPAG"
|
281
|
+
@detPag = DETPAG.new
|
282
|
+
@detPag.card = CARD.new
|
283
|
+
@detPag
|
284
|
+
when "OBSCONT"
|
285
|
+
@obscont = OBSCONT.new
|
286
|
+
@obscont
|
287
|
+
when "OBSFISCO"
|
288
|
+
@obsfisco = OBSFISCO.new
|
289
|
+
@obsfisco
|
290
|
+
when "PROCREF"
|
291
|
+
@procref = PROCREF.new
|
292
|
+
@procref
|
293
|
+
when "FORDIA"
|
294
|
+
@forDia = FORDIA.new
|
295
|
+
@forDia
|
296
|
+
when "DEDUC"
|
297
|
+
@deduc = DEDUC.new
|
298
|
+
@deduc
|
299
|
+
end
|
300
|
+
|
301
|
+
if block_given?
|
302
|
+
yield(part_object)
|
303
|
+
save(part_name)
|
304
|
+
end
|
305
|
+
|
306
|
+
nil
|
307
|
+
end
|
308
|
+
|
309
|
+
def save(part_name)
|
310
|
+
case part_name
|
311
|
+
when "NFREF"
|
312
|
+
if @ide.is_a?(Struct::IDE) && @NFref.is_a?(Struct::NFREF)
|
313
|
+
case @NFref.mod
|
314
|
+
when "01", "02"
|
315
|
+
@ide.NFref.push({ refNF: { cUF: @NFref.cUF, AAMM: @NFref.AAMM, CNPJ: @NFref.CNPJ, mod: @NFref.mod, serie: @NFref.serie, nNF: @NFref.nNF } })
|
316
|
+
when "04"
|
317
|
+
@ide.NFref.push({ refNFP: { cUF: @NFref.cUF, AAMM: @NFref.AAMM, CNPJ: @NFref.CNPJ, CPF: @NFref.CPF, IE: @NFref.IE, mod: @NFref.mod, serie: @NFref.serie, nNF: @NFref.nNF, refCTe: @NFref.refCTe } })
|
318
|
+
when "2B", "2C", "2D"
|
319
|
+
@ide.NFref.push({ refECF: { mod: @NFref.mod, nECF: @NFref.nECF, nCOO: @NFref.nCOO } })
|
320
|
+
else
|
321
|
+
@ide.NFref.push({ refNFe: @NFref.refNFe })
|
322
|
+
end
|
323
|
+
end
|
324
|
+
when "AUTXML"
|
325
|
+
if @autXML.is_a?(Struct::AUTXML)
|
326
|
+
@listas[:autXML].push(@autXML.to_h)
|
327
|
+
end
|
328
|
+
when "DET"
|
329
|
+
if @det.is_a?(Struct::DET)
|
330
|
+
item = @det
|
331
|
+
item.prod.veicProd = item.prod.veicProd.to_h
|
332
|
+
item.prod.med = item.prod.med.to_h
|
333
|
+
item.prod.comb.encerrante = item.prod.comb.encerrante.to_h
|
334
|
+
item.prod.comb.CIDE = item.prod.comb.CIDE.to_h
|
335
|
+
item.prod.comb = item.prod.comb.to_h
|
336
|
+
item.prod = item.prod.to_h
|
337
|
+
item.imposto.ICMS.ICMS00 = item.imposto.ICMS.ICMS00.to_h
|
338
|
+
item.imposto.ICMS.ICMS10 = item.imposto.ICMS.ICMS10.to_h
|
339
|
+
item.imposto.ICMS.ICMS20 = item.imposto.ICMS.ICMS20.to_h
|
340
|
+
item.imposto.ICMS.ICMS30 = item.imposto.ICMS.ICMS30.to_h
|
341
|
+
item.imposto.ICMS.ICMS40 = item.imposto.ICMS.ICMS40.to_h
|
342
|
+
item.imposto.ICMS.ICMS51 = item.imposto.ICMS.ICMS51.to_h
|
343
|
+
item.imposto.ICMS.ICMS60 = item.imposto.ICMS.ICMS60.to_h
|
344
|
+
item.imposto.ICMS.ICMS70 = item.imposto.ICMS.ICMS70.to_h
|
345
|
+
item.imposto.ICMS.ICMS90 = item.imposto.ICMS.ICMS90.to_h
|
346
|
+
item.imposto.ICMS.ICMSPart = item.imposto.ICMS.ICMSPart.to_h
|
347
|
+
item.imposto.ICMS.ICMSST = item.imposto.ICMS.ICMSST.to_h
|
348
|
+
item.imposto.ICMS.ICMSSN101 = item.imposto.ICMS.ICMSSN101.to_h
|
349
|
+
item.imposto.ICMS.ICMSSN102 = item.imposto.ICMS.ICMSSN102.to_h
|
350
|
+
item.imposto.ICMS.ICMSSN201 = item.imposto.ICMS.ICMSSN201.to_h
|
351
|
+
item.imposto.ICMS.ICMSSN202 = item.imposto.ICMS.ICMSSN202.to_h
|
352
|
+
item.imposto.ICMS.ICMSSN500 = item.imposto.ICMS.ICMSSN500.to_h
|
353
|
+
item.imposto.ICMS.ICMSSN900 = item.imposto.ICMS.ICMSSN900.to_h
|
354
|
+
item.imposto.ICMS = item.imposto.ICMS.to_h
|
355
|
+
item.imposto.ICMSUFDest = item.imposto.ICMSUFDest.to_h
|
356
|
+
item.imposto.IPI.IPITrib = item.imposto.IPI.IPITrib.to_h
|
357
|
+
item.imposto.IPI.IPINT = item.imposto.IPI.IPINT.to_h
|
358
|
+
item.imposto.IPI = item.imposto.IPI.to_h
|
359
|
+
item.imposto.II = item.imposto.II.to_h
|
360
|
+
item.imposto.PIS.PISAliq = item.imposto.PIS.PISAliq.to_h
|
361
|
+
item.imposto.PIS.PISQtde = item.imposto.PIS.PISQtde.to_h
|
362
|
+
item.imposto.PIS.PISNT = item.imposto.PIS.PISNT.to_h
|
363
|
+
item.imposto.PIS.PISOutr = item.imposto.PIS.PISOutr.to_h
|
364
|
+
item.imposto.PIS = item.imposto.PIS.to_h
|
365
|
+
item.imposto.PISST = item.imposto.PISST.to_h
|
366
|
+
item.imposto.COFINS.COFINSAliq = item.imposto.COFINS.COFINSAliq.to_h
|
367
|
+
item.imposto.COFINS.COFINSQtde = item.imposto.COFINS.COFINSQtde.to_h
|
368
|
+
item.imposto.COFINS.COFINSNT = item.imposto.COFINS.COFINSNT.to_h
|
369
|
+
item.imposto.COFINS.COFINSOutr = item.imposto.COFINS.COFINSOutr.to_h
|
370
|
+
item.imposto.COFINS = item.imposto.COFINS.to_h
|
371
|
+
item.imposto.COFINSST = item.imposto.COFINSST.to_h
|
372
|
+
item.imposto.ISSQN = item.imposto.ISSQN.to_h
|
373
|
+
item.imposto = item.imposto.to_h
|
374
|
+
item.impostoDevol.IPI = item.impostoDevol.IPI.to_h
|
375
|
+
item.impostoDevol = item.impostoDevol.to_h
|
376
|
+
item[:@nItem] = (@listas[:det].length + 1)
|
377
|
+
@listas[:det].push(item.to_h)
|
378
|
+
end
|
379
|
+
when "DI"
|
380
|
+
if @det.is_a?(Struct::DET) && @DI.is_a?(Struct::DI)
|
381
|
+
@det.prod.DI.push(@DI.to_h)
|
382
|
+
end
|
383
|
+
when "ADI"
|
384
|
+
if @DI.is_a?(Struct::DI) && @adi.is_a?(Struct::ADI)
|
385
|
+
@DI.adi.push(@adi.to_h)
|
386
|
+
end
|
387
|
+
when "DETEXPORT"
|
388
|
+
if @det.is_a?(Struct::DET) && @detExport.is_a?(Struct::DETEXPORT)
|
389
|
+
item = @detExport
|
390
|
+
item.exportInd = item.exportInd.to_h
|
391
|
+
@det.prod.detExport.push(item.to_h)
|
392
|
+
end
|
393
|
+
when "RASTRO"
|
394
|
+
if @det.is_a?(Struct::DET) && @rastro.is_a?(Struct::RASTRO)
|
395
|
+
@det.prod.rastro.push(@rastro.to_h)
|
396
|
+
end
|
397
|
+
when "ARMA"
|
398
|
+
if @det.is_a?(Struct::DET) && @arma.is_a?(Struct::ARMA)
|
399
|
+
@det.prod.arma.push(@arma.to_h)
|
400
|
+
end
|
401
|
+
when "REBOQUE"
|
402
|
+
if @transp.is_a?(Struct::TRANSP) && @reboque.is_a?(Struct::REBOQUE)
|
403
|
+
@transp.reboque.push(@reboque.to_h)
|
404
|
+
end
|
405
|
+
when "VOL"
|
406
|
+
if @transp.is_a?(Struct::TRANSP) && @vol.is_a?(Struct::VOL)
|
407
|
+
@transp.vol.push(@vol.to_h)
|
408
|
+
end
|
409
|
+
when "LACRES"
|
410
|
+
if @vol.is_a?(Struct::VOL) && @lacres.is_a?(Struct::LACRES)
|
411
|
+
@vol.lacres.push(@lacres.to_h)
|
412
|
+
end
|
413
|
+
when "DUP"
|
414
|
+
if @cobr.is_a?(Struct::COBR) && @dup.is_a?(Struct::DUP)
|
415
|
+
@cobr.dup.push(@dup.to_h)
|
416
|
+
end
|
417
|
+
when "DETPAG"
|
418
|
+
if @pag.is_a?(Struct::PAG) && @detPag.is_a?(Struct::DETPAG)
|
419
|
+
item = @detPag
|
420
|
+
item.card = item.card.to_h
|
421
|
+
@pag.detPag.push(item.to_h)
|
422
|
+
end
|
423
|
+
when "OBSCONT"
|
424
|
+
if @infAdic.is_a?(Struct::INFADIC) && @obscont.is_a?(Struct::OBSCONT)
|
425
|
+
@infAdic.obsCont.push(@obscont.to_h)
|
426
|
+
end
|
427
|
+
when "OBSFISCO"
|
428
|
+
if @infAdic.is_a?(Struct::INFADIC) && @obsfisco.is_a?(Struct::OBSFISCO)
|
429
|
+
@infAdic.obsFisco.push(@obsfisco.to_h)
|
430
|
+
end
|
431
|
+
when "PROCREF"
|
432
|
+
if @infAdic.is_a?(Struct::INFADIC) && @procref.is_a?(Struct::PROCREF)
|
433
|
+
@infAdic.procRef.push(@procref.to_h)
|
434
|
+
end
|
435
|
+
when "FORDIA"
|
436
|
+
if @cana.is_a?(Struct::CANA) && @forDia.is_a?(Struct::FORDIA)
|
437
|
+
@cana.forDia.push(@forDia.to_h)
|
438
|
+
end
|
439
|
+
when "DEDUC"
|
440
|
+
if @cana.is_a?(Struct::CANA) && @deduc.is_a?(Struct::DEDUC)
|
441
|
+
@cana.deduc.push(@deduc.to_h)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
nil
|
446
|
+
end
|
447
|
+
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SEFAZ
|
4
|
+
module Webservice
|
5
|
+
module NFE
|
6
|
+
# Validador de XML pelo validador público da SEFAZ-RS
|
7
|
+
class Validator
|
8
|
+
|
9
|
+
def initialize(xml)
|
10
|
+
@xml = xml
|
11
|
+
end
|
12
|
+
|
13
|
+
def exec(openTimeout, readTimeout)
|
14
|
+
uri = URI("https://www.sefaz.rs.gov.br/NFE/NFE-VAL.aspx")
|
15
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
16
|
+
http.use_ssl = true
|
17
|
+
http.open_timeout = openTimeout
|
18
|
+
http.read_timeout = readTimeout
|
19
|
+
content = Net::HTTP::Post.new(uri.request_uri)
|
20
|
+
content.set_form_data(txtxml: @xml)
|
21
|
+
response = http.request(content)
|
22
|
+
if response.code == "200"
|
23
|
+
nodes = Nokogiri::HTML(response.body.force_encoding('utf-8')).css('.tabela_resultado li').to_a
|
24
|
+
mensagens = {}
|
25
|
+
falhas = {}
|
26
|
+
nodes[0..2].each do |node|
|
27
|
+
k = get_key(node)
|
28
|
+
v = get_message(node)
|
29
|
+
mensagens[k] = v
|
30
|
+
falhas[k] = v if node.to_s.include?('../Imagens/erro.png')
|
31
|
+
end
|
32
|
+
return [:ok, mensagens, falhas]
|
33
|
+
end
|
34
|
+
return [:error, {}, {}]
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def get_key(node)
|
40
|
+
if node.elements[0].to_s.include?('<a href=')
|
41
|
+
"Schema XML"
|
42
|
+
else
|
43
|
+
node.elements[1].text.to_s.delete(':').strip
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_message(node)
|
48
|
+
if node.elements[0].to_s.include?('<a href=')
|
49
|
+
contents = []
|
50
|
+
node.elements[1].elements.each do |el|
|
51
|
+
contents.push(el.text.to_s.strip)
|
52
|
+
end
|
53
|
+
return contents
|
54
|
+
else
|
55
|
+
key = node.elements[1].text.to_s
|
56
|
+
return [node.text.to_s.sub(key, '').strip]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SEFAZ
|
4
|
+
module Webservice
|
5
|
+
module NFE
|
6
|
+
# Módulo que contém todos os WSDL do módulo NF-e/NFC-e
|
7
|
+
module WSDL
|
8
|
+
|
9
|
+
# Ambiente: 1=Produção; 2=Homologação
|
10
|
+
# Operações:
|
11
|
+
# - :NfeInutilizacao - OK (enviarInutilizarNF)
|
12
|
+
# - :NfeConsultaProtocolo - OK (consultarNF)
|
13
|
+
# - :NfeStatusServico - OK (statusDoServico)
|
14
|
+
# - :NfeConsultaCadastro - OK (consultarCadastro)
|
15
|
+
# - :RecepcaoEvento - OK (enviarLoteDeEvento)
|
16
|
+
# - :NFeAutorizacao - OK (enviarLoteNF)
|
17
|
+
# - :NFeRetAutorizacao - OK (consultarRecibo)
|
18
|
+
# UF: código IBGE do Estado
|
19
|
+
|
20
|
+
# Método retorna a URL wsdl da SEFAZ, exemplo de consumo:
|
21
|
+
# @wsdl = SEFAZ::Webservice::NFE::WSDL.get(:NfeStatusServico, "1", "35")
|
22
|
+
|
23
|
+
def self.get(operacao, ambiente, uf)
|
24
|
+
case uf.to_s
|
25
|
+
when "13"; SEFAZ::Webservice::NFE::WSDL.wsdl_am(ambiente.to_s)[operacao.to_sym] # Sefaz Amazonas - (AM)
|
26
|
+
when "29"; SEFAZ::Webservice::NFE::WSDL.wsdl_ba(ambiente.to_s)[operacao.to_sym] # Sefaz Bahia - (BA)
|
27
|
+
# when "52"; SEFAZ::Webservice::NFE::WSDL.wsdl_go(ambiente.to_s)[operacao.to_sym] # Sefaz Goias - (GO)
|
28
|
+
# when "31"; SEFAZ::Webservice::NFE::WSDL.wsdl_mg(ambiente.to_s)[operacao.to_sym] # Sefaz Minas Gerais - (MG)
|
29
|
+
# when "50"; SEFAZ::Webservice::NFE::WSDL.wsdl_ms(ambiente.to_s)[operacao.to_sym] # Sefaz Mato Grosso do Sul - (MS)
|
30
|
+
# when "51"; SEFAZ::Webservice::NFE::WSDL.wsdl_mt(ambiente.to_s)[operacao.to_sym] # Sefaz Mato Grosso - (MT)
|
31
|
+
# when "26"; SEFAZ::Webservice::NFE::WSDL.wsdl_pe(ambiente.to_s)[operacao.to_sym] # Sefaz Pernambuco - (PE)
|
32
|
+
# when "41"; SEFAZ::Webservice::NFE::WSDL.wsdl_pr(ambiente.to_s)[operacao.to_sym] # Sefaz Paraná - (PR)
|
33
|
+
# when "43"; SEFAZ::Webservice::NFE::WSDL.wsdl_rs(ambiente.to_s)[operacao.to_sym] # Sefaz Rio Grande do Sul - (RS)
|
34
|
+
when "35"; SEFAZ::Webservice::NFE::WSDL.wsdl_sp(ambiente.to_s)[operacao.to_sym] # Sefaz São Paulo - (SP)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Sefaz Amazonas - (AM)
|
39
|
+
def self.wsdl_am(ambiente)
|
40
|
+
case ambiente
|
41
|
+
when "1"
|
42
|
+
{
|
43
|
+
NfeInutilizacao: "https://nfe.sefaz.am.gov.br/services2/services/NfeInutilizacao4?wsdl",
|
44
|
+
NfeConsultaProtocolo: "https://nfe.sefaz.am.gov.br/services2/services/NfeConsulta4?wsdl",
|
45
|
+
NfeStatusServico: "https://nfe.sefaz.am.gov.br/services2/services/NfeStatusServico4?wsdl",
|
46
|
+
RecepcaoEvento: "https://nfe.sefaz.am.gov.br/services2/services/RecepcaoEvento4?wsdl",
|
47
|
+
NFeAutorizacao: "https://nfe.sefaz.am.gov.br/services2/services/NfeAutorizacao4?wsdl",
|
48
|
+
NFeRetAutorizacao: "https://nfe.sefaz.am.gov.br/services2/services/NfeRetAutorizacao4?wsdl"
|
49
|
+
}
|
50
|
+
when "2"
|
51
|
+
{
|
52
|
+
NfeInutilizacao: "https://homnfe.sefaz.am.gov.br/services2/services/NfeInutilizacao4?wsdl",
|
53
|
+
NfeConsultaProtocolo: "https://homnfe.sefaz.am.gov.br/services2/services/NfeConsulta4?wsdl",
|
54
|
+
NfeStatusServico: "https://homnfe.sefaz.am.gov.br/services2/services/NfeStatusServico4?wsdl",
|
55
|
+
RecepcaoEvento: "https://homnfe.sefaz.am.gov.br/services2/services/RecepcaoEvento4?wsdl",
|
56
|
+
NFeAutorizacao: "https://homnfe.sefaz.am.gov.br/services2/services/NfeAutorizacao4?wsdl",
|
57
|
+
NFeRetAutorizacao: "https://homnfe.sefaz.am.gov.br/services2/services/NfeRetAutorizacao4?wsdl"
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Sefaz Bahia - (BA)
|
63
|
+
def self.wsdl_ba(ambiente)
|
64
|
+
case ambiente
|
65
|
+
when "1"
|
66
|
+
{
|
67
|
+
NfeInutilizacao: "https://nfe.sefaz.ba.gov.br/webservices/NFeInutilizacao4/NFeInutilizacao4.asmx?wsdl",
|
68
|
+
NfeConsultaProtocolo: "https://nfe.sefaz.ba.gov.br/webservices/NFeConsultaProtocolo4/NFeConsultaProtocolo4.asmx?wsdl",
|
69
|
+
NfeStatusServico: "https://nfe.sefaz.ba.gov.br/webservices/NFeStatusServico4/NFeStatusServico4.asmx?wsdl",
|
70
|
+
NfeConsultaCadastro: "https://nfe.sefaz.ba.gov.br/webservices/CadConsultaCadastro4/CadConsultaCadastro4.asmx?wsdl",
|
71
|
+
RecepcaoEvento: "https://nfe.sefaz.ba.gov.br/webservices/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx?wsdl",
|
72
|
+
NFeAutorizacao: "https://nfe.sefaz.ba.gov.br/webservices/NFeAutorizacao4/NFeAutorizacao4.asmx?wsdl",
|
73
|
+
NFeRetAutorizacao: "https://nfe.sefaz.ba.gov.br/webservices/NFeRetAutorizacao4/NFeRetAutorizacao4.asmx?wsdl"
|
74
|
+
}
|
75
|
+
when "2"
|
76
|
+
{
|
77
|
+
NfeInutilizacao: "https://hnfe.sefaz.ba.gov.br/webservices/NFeInutilizacao4/NFeInutilizacao4.asmx?wsdl",
|
78
|
+
NfeConsultaProtocolo: "https://hnfe.sefaz.ba.gov.br/webservices/NFeConsultaProtocolo4/NFeConsultaProtocolo4.asmx?wsdl",
|
79
|
+
NfeStatusServico: "https://hnfe.sefaz.ba.gov.br/webservices/NFeStatusServico4/NFeStatusServico4.asmx?wsdl",
|
80
|
+
NfeConsultaCadastro: "https://hnfe.sefaz.ba.gov.br/webservices/CadConsultaCadastro4/CadConsultaCadastro4.asmx?wsdl",
|
81
|
+
RecepcaoEvento: "https://hnfe.sefaz.ba.gov.br/webservices/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx?wsdl",
|
82
|
+
NFeAutorizacao: "https://hnfe.sefaz.ba.gov.br/webservices/NFeAutorizacao4/NFeAutorizacao4.asmx?wsdl",
|
83
|
+
NFeRetAutorizacao: "https://hnfe.sefaz.ba.gov.br/webservices/NFeRetAutorizacao4/NFeRetAutorizacao4.asmx?wsdl"
|
84
|
+
}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Sefaz São Paulo - (SP)
|
89
|
+
def self.wsdl_sp(ambiente)
|
90
|
+
case ambiente
|
91
|
+
when "1"
|
92
|
+
{
|
93
|
+
NfeInutilizacao: "https://nfe.fazenda.sp.gov.br/ws/nfeinutilizacao4.asmx?wsdl",
|
94
|
+
NfeConsultaProtocolo: "https://nfe.fazenda.sp.gov.br/ws/nfeconsultaprotocolo4.asmx?wsdl",
|
95
|
+
NfeStatusServico: "https://nfe.fazenda.sp.gov.br/ws/nfestatusservico4.asmx?wsdl",
|
96
|
+
NfeConsultaCadastro: "https://nfe.fazenda.sp.gov.br/ws/cadconsultacadastro4.asmx?wsdl",
|
97
|
+
RecepcaoEvento: "https://nfe.fazenda.sp.gov.br/ws/nferecepcaoevento4.asmx?wsdl",
|
98
|
+
NFeAutorizacao: "https://nfe.fazenda.sp.gov.br/ws/nfeautorizacao4.asmx?wsdl",
|
99
|
+
NFeRetAutorizacao: "https://nfe.fazenda.sp.gov.br/ws/nferetautorizacao4.asmx?wsdl"
|
100
|
+
}
|
101
|
+
when "2"
|
102
|
+
{
|
103
|
+
NfeInutilizacao: "https://homologacao.nfe.fazenda.sp.gov.br/ws/nfeinutilizacao4.asmx?wsdl",
|
104
|
+
NfeConsultaProtocolo: "https://homologacao.nfe.fazenda.sp.gov.br/ws/nfeconsultaprotocolo4.asmx?wsdl",
|
105
|
+
NfeStatusServico: "https://homologacao.nfe.fazenda.sp.gov.br/ws/nfestatusservico4.asmx?wsdl",
|
106
|
+
NfeConsultaCadastro: "https://homologacao.nfe.fazenda.sp.gov.br/ws/cadconsultacadastro4.asmx?wsdl",
|
107
|
+
RecepcaoEvento: "https://homologacao.nfe.fazenda.sp.gov.br/ws/nferecepcaoevento4.asmx?wsdl",
|
108
|
+
NFeAutorizacao: "https://homologacao.nfe.fazenda.sp.gov.br/ws/nfeautorizacao4.asmx?wsdl",
|
109
|
+
NFeRetAutorizacao: "https://homologacao.nfe.fazenda.sp.gov.br/ws/nferetautorizacao4.asmx?wsdl"
|
110
|
+
}
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|