br_nfe 1.0.0 → 1.0.1
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/Gemfile.lock +4 -1
- data/README.markdown +263 -1
- data/br_nfe.gemspec +14 -5
- data/lib/br_nfe/base.rb +6 -1
- data/lib/br_nfe/helper/cpf_cnpj.rb +0 -5
- data/lib/br_nfe/helper/have_address.rb +1 -5
- data/lib/br_nfe/helper/have_rps.rb +7 -0
- data/lib/br_nfe/servico/betha/base.rb +52 -41
- data/lib/br_nfe/servico/betha/build_response.rb +141 -0
- data/lib/br_nfe/servico/betha/v1/build_response.rb +4 -102
- data/lib/br_nfe/servico/betha/v1/consulta_lote_rps.rb +3 -1
- data/lib/br_nfe/servico/betha/v1/consulta_nfs_por_rps.rb +5 -2
- data/lib/br_nfe/servico/betha/v1/consulta_nfse.rb +2 -1
- data/lib/br_nfe/servico/betha/v1/gateway.rb +66 -56
- data/lib/br_nfe/servico/betha/v1/recepcao_lote_rps.rb +16 -8
- data/lib/br_nfe/servico/betha/v2/build_response.rb +159 -0
- data/lib/br_nfe/servico/betha/v2/cancelamento_nfs.rb +8 -3
- data/lib/br_nfe/servico/betha/v2/consulta_lote_rps.rb +7 -4
- data/lib/br_nfe/servico/betha/v2/consulta_nfse_por_rps.rb +5 -5
- data/lib/br_nfe/servico/betha/v2/envio_lote_rps_sincrono.rb +7 -3
- data/lib/br_nfe/servico/betha/v2/gateway.rb +79 -56
- data/lib/br_nfe/servico/betha/v2/gera_nfse.rb +8 -3
- data/lib/br_nfe/servico/betha/v2/recepcao_lote_rps.rb +9 -4
- data/lib/br_nfe/servico/betha/v2/substituicao_nfse.rb +8 -4
- data/lib/br_nfe/servico/response/nota_fiscal.rb +13 -4
- data/lib/br_nfe/servico/rps.rb +2 -2
- data/lib/br_nfe/version.rb +1 -1
- data/lib/br_nfe.rb +2 -1
- data/test/br_nfe/base_test.rb +55 -1
- data/test/br_nfe/destinatario_test.rb +19 -0
- data/test/br_nfe/emitente_test.rb +20 -0
- data/test/br_nfe/endereco_test.rb +9 -0
- data/test/br_nfe/helper/cpf_cnpj_test.rb +61 -0
- data/test/br_nfe/servico/base_test.rb +28 -0
- data/test/br_nfe/servico/betha/base_test.rb +61 -32
- data/test/br_nfe/servico/betha/v1/build_response_test.rb +6 -7
- data/test/br_nfe/servico/betha/v1/cancelamento_nfs_test.rb +6 -0
- data/test/br_nfe/servico/betha/v1/consulta_lote_rps_test.rb +4 -0
- data/test/br_nfe/servico/betha/v1/consulta_nfse_test.rb +17 -0
- data/test/br_nfe/servico/betha/v1/gateway_test.rb +17 -40
- data/test/br_nfe/servico/betha/v1/recepcao_lote_rps_test.rb +12 -2
- data/test/br_nfe/servico/betha/v2/cancelamento_nfs_test.rb +40 -0
- data/test/br_nfe/servico/betha/v2/consulta_lote_rps_test.rb +38 -0
- data/test/br_nfe/servico/betha/v2/consulta_nfse_por_rps_test.rb +36 -0
- data/test/br_nfe/servico/betha/v2/envio_lote_rps_sincrono_test.rb +46 -0
- data/test/br_nfe/servico/betha/v2/gateway_test.rb +372 -0
- data/test/br_nfe/servico/betha/v2/gera_nfse_test.rb +58 -0
- data/test/br_nfe/servico/betha/v2/recepcao_lote_rps_test.rb +103 -0
- data/test/br_nfe/servico/betha/v2/substituicao_nfse_test.rb +80 -0
- data/test/br_nfe/servico/intermediario_test.rb +16 -0
- data/test/br_nfe/servico/rps_test.rb +141 -0
- data/test/factories/servico/betha/v1/gateway.rb +1 -1
- data/test/factories/servico/betha/v2/cancelamento_nfs.rb +7 -0
- data/test/factories/servico/betha/v2/consulta_lote_rps.rb +6 -0
- data/test/factories/servico/betha/v2/consulta_nfse_por_rps.rb +6 -0
- data/test/factories/servico/betha/v2/envio_lote_rps_sincrono.rb +5 -0
- data/test/factories/servico/betha/v2/gateway.rb +5 -0
- data/test/factories/servico/betha/v2/gera_nfse.rb +6 -0
- data/test/factories/servico/betha/v2/recepcao_lote_rps.rb +5 -0
- data/test/factories/servico/betha/v2/substituicao_nfse.rb +8 -0
- metadata +50 -17
- data/Gemfile +0 -15
- data/Rakefile +0 -13
- data/lib/br_nfe/seed.rb +0 -195
- data/lib/br_nfe/servico/betha/v2/response.rb +0 -23
- data/test/certificado.rb +0 -12
- data/test/test_helper.rb +0 -39
| @@ -2,65 +2,18 @@ module BrNfe | |
| 2 2 | 
             
            	module Servico
         | 
| 3 3 | 
             
            		module Betha
         | 
| 4 4 | 
             
            			module V1
         | 
| 5 | 
            -
            				class BuildResponse  < BrNfe:: | 
| 6 | 
            -
             | 
| 5 | 
            +
            				class BuildResponse  < BrNfe::Servico::Betha::BuildResponse
         | 
| 7 6 | 
             
            					attr_accessor :hash
         | 
| 8 | 
            -
            					attr_accessor :nfe_method
         | 
| 9 7 |  | 
| 10 8 | 
             
            					def messages
         | 
| 11 9 | 
             
            						hash["#{nfe_method.to_s}_resposta".to_sym]
         | 
| 12 10 | 
             
            					end
         | 
| 13 11 |  | 
| 14 | 
            -
            					 | 
| 15 | 
            -
            						messages[:lista_mensagem_retorno].blank?
         | 
| 16 | 
            -
            					end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            					def response
         | 
| 19 | 
            -
            						@response ||= BrNfe::Servico::Response::Default.new do |resp|
         | 
| 20 | 
            -
            							resp.success          = success?
         | 
| 21 | 
            -
            							resp.error_messages   = error_messages
         | 
| 22 | 
            -
            							resp.notas_fiscais    = get_notas_fiscais
         | 
| 23 | 
            -
            							resp.protocolo        = messages[:protocolo]
         | 
| 24 | 
            -
            							resp.data_recebimento = messages[:data_recebimento]
         | 
| 25 | 
            -
            							resp.numero_lote      = messages[:numero_lote]
         | 
| 26 | 
            -
            						end
         | 
| 27 | 
            -
            					end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            					def error_messages
         | 
| 30 | 
            -
            						@error_messages ||= []
         | 
| 31 | 
            -
            						return @error_messages if success? || !@error_messages.blank?
         | 
| 32 | 
            -
            						msgs = messages[:lista_mensagem_retorno][:mensagem_retorno]
         | 
| 33 | 
            -
            						if msgs.is_a?(Hash)
         | 
| 34 | 
            -
            							@error_messages << get_message(msgs)
         | 
| 35 | 
            -
            						else #Array
         | 
| 36 | 
            -
            							msgs.each do |msg|
         | 
| 37 | 
            -
            								@error_messages << get_message(msg)
         | 
| 38 | 
            -
            							end
         | 
| 39 | 
            -
            						end
         | 
| 40 | 
            -
            						@error_messages
         | 
| 41 | 
            -
            					end
         | 
| 42 | 
            -
             | 
| 12 | 
            +
            					
         | 
| 43 13 | 
             
            				private
         | 
| 44 14 |  | 
| 45 | 
            -
            					def  | 
| 46 | 
            -
            						 | 
| 47 | 
            -
            							codigo:   hash[:codigo],
         | 
| 48 | 
            -
            							mensagem: hash[:mensagem],
         | 
| 49 | 
            -
            							correcao: hash[:correcao]
         | 
| 50 | 
            -
            						}
         | 
| 51 | 
            -
            					end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
            					def get_notas_fiscais
         | 
| 54 | 
            -
            						@notas_fiscais = []
         | 
| 55 | 
            -
            						return @notas_fiscais if messages[:lista_nfse].blank? || messages[:lista_nfse][:compl_nfse].blank?
         | 
| 56 | 
            -
            						compl_nfse = messages[:lista_nfse][:compl_nfse]
         | 
| 57 | 
            -
            						
         | 
| 58 | 
            -
            						if compl_nfse.is_a?(Hash)
         | 
| 59 | 
            -
            							@notas_fiscais << new_nota_fiscal(compl_nfse)
         | 
| 60 | 
            -
            						elsif compl_nfse.is_a?(Array)
         | 
| 61 | 
            -
            							compl_nfse.map{|p| @notas_fiscais << new_nota_fiscal(p) }
         | 
| 62 | 
            -
            						end
         | 
| 63 | 
            -
            						@notas_fiscais		
         | 
| 15 | 
            +
            					def key_complemento_nfse
         | 
| 16 | 
            +
            						:compl_nfse
         | 
| 64 17 | 
             
            					end
         | 
| 65 18 |  | 
| 66 19 | 
             
            					def new_nota_fiscal(params)
         | 
| @@ -103,13 +56,6 @@ module BrNfe | |
| 103 56 | 
             
            						end						
         | 
| 104 57 | 
             
            					end
         | 
| 105 58 |  | 
| 106 | 
            -
            					def get_info_substituicao(nfse, params)
         | 
| 107 | 
            -
            						params ||= {}
         | 
| 108 | 
            -
            						params = params[:substituicao_nfse] || {}
         | 
| 109 | 
            -
             | 
| 110 | 
            -
            						nfse.nfe_substituidora = params[:nfse_substituidora]
         | 
| 111 | 
            -
            					end
         | 
| 112 | 
            -
             | 
| 113 59 | 
             
            					def get_info_cancelamento(nfse, params)
         | 
| 114 60 | 
             
            						params ||= {}
         | 
| 115 61 | 
             
            						params = params[:confirmacao] || {}
         | 
| @@ -128,18 +74,6 @@ module BrNfe | |
| 128 74 | 
             
            						nfse.cancelamento_data_hora           = confirmacao_cancelamento[:data_hora]						
         | 
| 129 75 | 
             
            					end
         | 
| 130 76 |  | 
| 131 | 
            -
            					def get_construcao_civil(nfse, params)
         | 
| 132 | 
            -
            						params ||= {}
         | 
| 133 | 
            -
            						nfse.codigo_obra = params[:codigo_obra]
         | 
| 134 | 
            -
            						nfse.codigo_art  = params[:art]
         | 
| 135 | 
            -
            					end
         | 
| 136 | 
            -
             | 
| 137 | 
            -
            					def get_orgao_gerador(nfse, params)
         | 
| 138 | 
            -
            						params ||= {}
         | 
| 139 | 
            -
            						nfse.orgao_gerador_municipio = params[:codigo_municipio]
         | 
| 140 | 
            -
            						nfse.orgao_gerador_uf        = params[:uf]
         | 
| 141 | 
            -
            					end
         | 
| 142 | 
            -
             | 
| 143 77 | 
             
            					def get_emitente_servico(nfse, dados_emitente)
         | 
| 144 78 | 
             
            						dados_emitente ||= {}
         | 
| 145 79 | 
             
            						nfse.emitente do |em|
         | 
| @@ -153,38 +87,6 @@ module BrNfe | |
| 153 87 | 
             
            						end
         | 
| 154 88 | 
             
            					end
         | 
| 155 89 |  | 
| 156 | 
            -
            					def get_destinatario_servico(nfse, dados_destinatario)
         | 
| 157 | 
            -
            						dados_destinatario ||= {}
         | 
| 158 | 
            -
            						identificacao_tomador = dados_destinatario[:identificacao_tomador] || {}
         | 
| 159 | 
            -
            						nfse.destinatario do |em|
         | 
| 160 | 
            -
            							em.cpf_cnpj            = identificacao_tomador[:cpf_cnpj][:cnpj] || identificacao_tomador[:cpf_cnpj][:cpf] if identificacao_tomador[:cpf_cnpj]
         | 
| 161 | 
            -
            							em.inscricao_municipal = identificacao_tomador[:inscricao_municipal]
         | 
| 162 | 
            -
            							em.inscricao_estadual  = identificacao_tomador[:inscricao_estadual]
         | 
| 163 | 
            -
            							em.razao_social        = dados_destinatario[:razao_social]
         | 
| 164 | 
            -
            							em.nome_fantasia       = dados_destinatario[:nome_fantasia]
         | 
| 165 | 
            -
            							em.telefone            = dados_destinatario[:contato][:telefone] if dados_destinatario[:contato]
         | 
| 166 | 
            -
            							em.email               = dados_destinatario[:contato][:email]    if dados_destinatario[:contato]
         | 
| 167 | 
            -
            							em.endereco            = get_endereco(dados_destinatario[:endereco])
         | 
| 168 | 
            -
            						end
         | 
| 169 | 
            -
            					end
         | 
| 170 | 
            -
             | 
| 171 | 
            -
            					def get_endereco(params)
         | 
| 172 | 
            -
            						params ||= {}
         | 
| 173 | 
            -
            						BrNfe::Endereco.new do |e|
         | 
| 174 | 
            -
            							e.logradouro       = params[:endereco]
         | 
| 175 | 
            -
            							e.numero           = params[:numero]
         | 
| 176 | 
            -
            							e.complemento      = params[:complemento]
         | 
| 177 | 
            -
            							e.bairro           = params[:bairro]
         | 
| 178 | 
            -
            							e.nome_municipio   = params[:nome_municipio]
         | 
| 179 | 
            -
            							e.codigo_municipio = params[:codigo_municipio]
         | 
| 180 | 
            -
            							e.uf               = params[:uf]
         | 
| 181 | 
            -
            							e.cep              = params[:cep]
         | 
| 182 | 
            -
            							e.codigo_pais      = params[:codigo_pais] if params[:codigo_pais]
         | 
| 183 | 
            -
            							e.nome_pais        = params[:nome_pais]   if params[:nome_pais]
         | 
| 184 | 
            -
            						end
         | 
| 185 | 
            -
            					end
         | 
| 186 | 
            -
             | 
| 187 | 
            -
            					
         | 
| 188 90 | 
             
            					def get_dados_servico(nfse, dados_servico)
         | 
| 189 91 | 
             
            						nfse.item_lista_servico     = dados_servico[:item_lista_servico]
         | 
| 190 92 | 
             
            						nfse.codigo_cnae            = dados_servico[:codigo_cnae]
         | 
| @@ -19,7 +19,9 @@ module BrNfe | |
| 19 19 | 
             
            					def xml_builder
         | 
| 20 20 | 
             
            						Nokogiri::XML::Builder.new do |xml|
         | 
| 21 21 | 
             
            							xml.Temp {
         | 
| 22 | 
            -
            								 | 
| 22 | 
            +
            								# Pestador / Emitente
         | 
| 23 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_prestador.doc.root.to_s )
         | 
| 24 | 
            +
            														
         | 
| 23 25 | 
             
            								xml.Protocolo "#{protocolo}".max_size(50)
         | 
| 24 26 | 
             
            							}
         | 
| 25 27 | 
             
            						end.doc.root
         | 
| @@ -18,8 +18,11 @@ module BrNfe | |
| 18 18 | 
             
            					def xml_builder
         | 
| 19 19 | 
             
            						Nokogiri::XML::Builder.new do |xml|
         | 
| 20 20 | 
             
            							xml.Temp {
         | 
| 21 | 
            -
            								 | 
| 22 | 
            -
            								 | 
| 21 | 
            +
            								# Identificação RPS
         | 
| 22 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_identificacao_rps(rps).doc.root.to_s )
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            								# Pestador / Emitente
         | 
| 25 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_prestador.doc.root.to_s )
         | 
| 23 26 | 
             
            							}
         | 
| 24 27 | 
             
            						end.doc.root
         | 
| 25 28 | 
             
            					end
         | 
| @@ -32,7 +32,8 @@ module BrNfe | |
| 32 32 | 
             
            						Nokogiri::XML::Builder.new do |xml|
         | 
| 33 33 | 
             
            							xml.Temp {
         | 
| 34 34 |  | 
| 35 | 
            -
            								 | 
| 35 | 
            +
            								# Pestador / Emitente
         | 
| 36 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_prestador.doc.root.to_s )
         | 
| 36 37 |  | 
| 37 38 | 
             
            								xml.NumeroNfse BrNfe::Helper.only_number(numero_nfse).max_size(15) if !numero_nfse.blank?
         | 
| 38 39 | 
             
            								xml.PeriodoEmissao {
         | 
| @@ -28,7 +28,9 @@ module BrNfe | |
| 28 28 |  | 
| 29 29 | 
             
            					def set_response(resp)
         | 
| 30 30 | 
             
            						method_response = (method_wsdl.to_s + "_envio_response").to_sym
         | 
| 31 | 
            -
            						@ | 
| 31 | 
            +
            						@builder =  BrNfe::Servico::Betha::V1::BuildResponse.new(hash: resp.hash[:envelope][:body][method_response], nfe_method: method_wsdl)
         | 
| 32 | 
            +
            						@original_response = @builder.messages
         | 
| 33 | 
            +
            						@response          = @builder.response
         | 
| 32 34 | 
             
            					end
         | 
| 33 35 |  | 
| 34 36 | 
             
            					def content_xml
         | 
| @@ -37,71 +39,79 @@ module BrNfe | |
| 37 39 |  | 
| 38 40 | 
             
            				private
         | 
| 39 41 |  | 
| 40 | 
            -
            					def  | 
| 41 | 
            -
            						 | 
| 42 | 
            -
            							xml. | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 42 | 
            +
            					def xml_dados_servico(rps)
         | 
| 43 | 
            +
            						Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
         | 
| 44 | 
            +
            							xml.Servico {
         | 
| 45 | 
            +
            								xml.ItemListaServico          BrNfe::Helper.only_number(rps.item_lista_servico).rjust(4,'0').max_size(4)
         | 
| 46 | 
            +
            								xml.CodigoCnae                BrNfe::Helper.only_number(rps.codigo_cnae).max_size(7) unless rps.codigo_cnae.blank?
         | 
| 47 | 
            +
            								xml.CodigoTributacaoMunicipio rps.codigo_tributacao_municipio unless rps.codigo_tributacao_municipio.blank?
         | 
| 48 | 
            +
            								xml.Discriminacao             "#{rps.discriminacao}".max_size(2_000).remove_accents
         | 
| 49 | 
            +
            								xml.CodigoMunicipio           "#{rps.codigo_municipio}".max_size(7)
         | 
| 47 50 |  | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 51 | 
            +
            								xml.Valores {
         | 
| 52 | 
            +
            									xml.ValorServicos    value_monetary(rps.valor_servicos,   4) # Valores obrigatórios
         | 
| 53 | 
            +
            									xml.IssRetido        value_true_false(rps.iss_retido?)       # Valores obrigatórios
         | 
| 54 | 
            +
            									xml.BaseCalculo      value_monetary(rps.base_calculo,     4) # Valores obrigatórios								
         | 
| 55 | 
            +
            									xml.ValorDeducoes    value_monetary(rps.valor_deducoes,   4) unless rps.valor_deducoes.blank?
         | 
| 56 | 
            +
            									xml.ValorPis         value_monetary(rps.valor_pis,        4) unless rps.valor_pis.blank?
         | 
| 57 | 
            +
            									xml.ValorCofins      value_monetary(rps.valor_cofins,     4) unless rps.valor_cofins.blank?
         | 
| 58 | 
            +
            									xml.ValorInss        value_monetary(rps.valor_inss,       4) unless rps.valor_inss.blank?
         | 
| 59 | 
            +
            									xml.ValorIr          value_monetary(rps.valor_ir,         4) unless rps.valor_ir.blank?
         | 
| 60 | 
            +
            									xml.ValorCsll        value_monetary(rps.valor_csll,       4) unless rps.valor_csll.blank?
         | 
| 61 | 
            +
            									xml.ValorIss         value_monetary(rps.valor_iss,        4) unless rps.valor_iss.blank?
         | 
| 62 | 
            +
            									xml.OutrasRetencoes  value_monetary(rps.outras_retencoes, 4) unless rps.outras_retencoes.blank?
         | 
| 63 | 
            +
            									xml.Aliquota         value_monetary(rps.aliquota,         4) unless rps.aliquota.blank?
         | 
| 64 | 
            +
            								}
         | 
| 61 65 | 
             
            							}
         | 
| 62 | 
            -
            						 | 
| 66 | 
            +
            						end
         | 
| 63 67 | 
             
            					end
         | 
| 64 68 |  | 
| 65 | 
            -
            					def  | 
| 66 | 
            -
            						 | 
| 67 | 
            -
            							 | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 69 | 
            +
            					def xml_prestador
         | 
| 70 | 
            +
            						Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
         | 
| 71 | 
            +
            							xml.Prestador { 
         | 
| 72 | 
            +
            								tag_cpf_cnpj(xml, emitente.cnpj)
         | 
| 73 | 
            +
            								xml.InscricaoMunicipal "#{emitente.inscricao_municipal}".max_size(15) if !emitente.inscricao_municipal.blank? && env == :production
         | 
| 74 | 
            +
            							}
         | 
| 75 | 
            +
            						end
         | 
| 70 76 | 
             
            					end
         | 
| 71 77 |  | 
| 72 | 
            -
            					def  | 
| 73 | 
            -
            						return unless intermediario
         | 
| 74 | 
            -
            						xml | 
| 75 | 
            -
            							xml. | 
| 76 | 
            -
             | 
| 77 | 
            -
            								 | 
| 78 | 
            +
            					def xml_intermediario_servico(intermediario)
         | 
| 79 | 
            +
            						return Nokogiri::XML::Builder.new unless intermediario
         | 
| 80 | 
            +
            						Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
         | 
| 81 | 
            +
            							xml.IntermediarioServico{
         | 
| 82 | 
            +
            								xml.RazaoSocial "#{intermediario.razao_social}".max_size(115)
         | 
| 83 | 
            +
            								xml.CpfCnpj{
         | 
| 84 | 
            +
            									tag_cpf_cnpj(xml, intermediario.cpf_cnpj)
         | 
| 85 | 
            +
            								}
         | 
| 86 | 
            +
            								xml.InscricaoMunicipal "#{intermediario.inscricao_municipal}".max_size(15) unless intermediario.inscricao_municipal.blank?
         | 
| 78 87 | 
             
            							}
         | 
| 79 | 
            -
             | 
| 80 | 
            -
            						}
         | 
| 88 | 
            +
            						end
         | 
| 81 89 | 
             
            					end
         | 
| 82 90 |  | 
| 83 | 
            -
            					def  | 
| 84 | 
            -
            						return unless rps.condicao_pagamento
         | 
| 85 | 
            -
            						xml | 
| 86 | 
            -
            							xml. | 
| 87 | 
            -
             | 
| 88 | 
            -
            								 | 
| 89 | 
            -
             | 
| 90 | 
            -
            									 | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
            										xml. | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 91 | 
            +
            					def xml_condicao_pagamento(rps)
         | 
| 92 | 
            +
            						return Nokogiri::XML::Builder.new unless rps.condicao_pagamento
         | 
| 93 | 
            +
            						Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
         | 
| 94 | 
            +
            							xml.CondicaoPagamento{
         | 
| 95 | 
            +
            								xml.Condicao   rps.condicao_pagamento.condicao
         | 
| 96 | 
            +
            								if rps.condicao_pagamento.parcelas.size > 0
         | 
| 97 | 
            +
            									xml.QtdParcela rps.condicao_pagamento.parcelas.size 
         | 
| 98 | 
            +
            									rps.condicao_pagamento.parcelas.each_with_index do |parcela, i|
         | 
| 99 | 
            +
            										#
         | 
| 100 | 
            +
            										# Aqui há uma ressalva:
         | 
| 101 | 
            +
            										# Na documentação diz que a DataVencimento deve ser do tipo DateTime
         | 
| 102 | 
            +
            										# Porém não é nem do tipo DateTime e nem do tipo Date, mas sim uma String
         | 
| 103 | 
            +
            										# no formato DD/MM/YYYY <- by bethagambis.com
         | 
| 104 | 
            +
            										#
         | 
| 105 | 
            +
            										vencimento = get_date(parcela[:vencimento])
         | 
| 106 | 
            +
            										xml.Parcelas{
         | 
| 107 | 
            +
            											xml.Parcela        i+1
         | 
| 108 | 
            +
            											xml.DataVencimento "#{vencimento.day.to_s.rjust(2, '0')}/#{vencimento.month.to_s.rjust(2, '0')}/#{vencimento.year}" if vencimento
         | 
| 109 | 
            +
            											xml.Valor          value_monetary(parcela[:valor], 4)
         | 
| 110 | 
            +
            										}
         | 
| 111 | 
            +
            									end
         | 
| 102 112 | 
             
            								end
         | 
| 103 | 
            -
            							 | 
| 104 | 
            -
            						 | 
| 113 | 
            +
            							}
         | 
| 114 | 
            +
            						end
         | 
| 105 115 | 
             
            					end
         | 
| 106 116 |  | 
| 107 117 | 
             
            					def get_date(value)
         | 
| @@ -55,7 +55,8 @@ module BrNfe | |
| 55 55 | 
             
            						Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
         | 
| 56 56 | 
             
            							xml.InfRps('Id' => "rps#{rps.numero}") {
         | 
| 57 57 |  | 
| 58 | 
            -
            								 | 
| 58 | 
            +
            								# Identificação RPS
         | 
| 59 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_identificacao_rps(rps).doc.root.to_s )
         | 
| 59 60 |  | 
| 60 61 | 
             
            								xml.DataEmissao              value_date_time(rps.data_emissao)
         | 
| 61 62 | 
             
            								xml.NaturezaOperacao         "#{emitente.natureza_operacao}".max_size(2)
         | 
| @@ -64,21 +65,28 @@ module BrNfe | |
| 64 65 | 
             
            								xml.IncentivadorCultural     value_true_false(emitente.incentivo_fiscal?)           # (1)sim ----- (2)não -----
         | 
| 65 66 | 
             
            								xml.Status                   "#{rps.status}".max_size(1)
         | 
| 66 67 |  | 
| 67 | 
            -
            								 | 
| 68 | 
            +
            								# RPS subistituido
         | 
| 69 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_rps_substituido(rps).doc.root.to_s )
         | 
| 68 70 |  | 
| 69 | 
            -
            								 | 
| 71 | 
            +
            								# Dados do(s) serviço(s)
         | 
| 72 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_dados_servico(rps).doc.root.to_s )
         | 
| 70 73 |  | 
| 71 | 
            -
            								 | 
| 74 | 
            +
            								# Pestador / Emitente
         | 
| 75 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_prestador.doc.root.to_s )
         | 
| 72 76 |  | 
| 73 | 
            -
            								 | 
| 77 | 
            +
            								# Tomador / Destinatário
         | 
| 78 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_dados_tomador(rps.destinatario).doc.root.to_s )
         | 
| 74 79 |  | 
| 75 | 
            -
            								 | 
| 80 | 
            +
            								# Intermediario
         | 
| 81 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_intermediario_servico(rps.intermediario).doc.root.to_s )
         | 
| 76 82 |  | 
| 77 | 
            -
            								 | 
| 83 | 
            +
            								# Dados Construção Civil
         | 
| 84 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_dados_construcao_civil(rps).doc.root.to_s )
         | 
| 78 85 |  | 
| 79 86 | 
             
            								xml.OutrasInformacoes "#{rps.outras_informacoes}".max_size(255) unless rps.outras_informacoes.blank?
         | 
| 80 87 |  | 
| 81 | 
            -
            								 | 
| 88 | 
            +
            								# Condição de pagamento
         | 
| 89 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_condicao_pagamento(rps).doc.root.to_s )
         | 
| 82 90 | 
             
            							}
         | 
| 83 91 | 
             
            						end
         | 
| 84 92 | 
             
            					end
         | 
| @@ -0,0 +1,159 @@ | |
| 1 | 
            +
            module BrNfe
         | 
| 2 | 
            +
            	module Servico
         | 
| 3 | 
            +
            		module Betha
         | 
| 4 | 
            +
            			module V2
         | 
| 5 | 
            +
            				class BuildResponse  < BrNfe::Servico::Betha::BuildResponse
         | 
| 6 | 
            +
            					attr_accessor :xml
         | 
| 7 | 
            +
            										
         | 
| 8 | 
            +
            					def messages
         | 
| 9 | 
            +
            						@messages ||= Nori.new(:convert_tags_to => lambda { |tag| tag.snakecase.to_sym }).parse(xml.to_s)["#{nfe_method.to_s}_resposta".to_sym]
         | 
| 10 | 
            +
            					end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            				private
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            					def key_complemento_nfse
         | 
| 15 | 
            +
            						:comp_nfse
         | 
| 16 | 
            +
            					end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            					def new_nota_fiscal(params)
         | 
| 19 | 
            +
            						info_nfse         = params[:nfse] ? params[:nfse][:inf_nfse] : {}
         | 
| 20 | 
            +
            						
         | 
| 21 | 
            +
            						BrNfe::Servico::Response::NotaFiscal.new do |nfse|
         | 
| 22 | 
            +
            							nfse.numero_nf                = info_nfse[:numero]
         | 
| 23 | 
            +
            							nfse.codigo_verificacao       = info_nfse[:codigo_verificacao]
         | 
| 24 | 
            +
            							nfse.data_emissao             = info_nfse[:data_emissao]
         | 
| 25 | 
            +
            							nfse.outras_informacoes       = info_nfse[:outras_informacoes]
         | 
| 26 | 
            +
            							nfse.url_nf                   = info_nfse[:outras_informacoes]							
         | 
| 27 | 
            +
            							
         | 
| 28 | 
            +
            							get_emitente_servico     nfse, info_nfse[:prestador_servico]
         | 
| 29 | 
            +
            							get_info_cancelamento(   nfse, params[:nfse_cancelamento]) if params[:nfse_cancelamento]
         | 
| 30 | 
            +
            							get_info_substituicao(   nfse, params[:nfse_substituicao]) if params[:nfse_substituicao]
         | 
| 31 | 
            +
            							get_orgao_gerador        nfse, info_nfse[:orgao_gerador]
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            							if info_nfse[:valores_nfse]
         | 
| 34 | 
            +
            								nfse.base_calculo  = info_nfse[:valores_nfse][:base_calculo]
         | 
| 35 | 
            +
            								nfse.aliquota      = info_nfse[:valores_nfse][:aliquota]
         | 
| 36 | 
            +
            								nfse.valor_iss     = info_nfse[:valores_nfse][:valor_iss]
         | 
| 37 | 
            +
            								nfse.valor_liquido = info_nfse[:valores_nfse][:valor_liquido_nfse]
         | 
| 38 | 
            +
            							end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            							get_declaracao_prestacao_servico(nfse, info_nfse[:declaracao_prestacao_servico]) if info_nfse[:declaracao_prestacao_servico]
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            						end
         | 
| 43 | 
            +
            					end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            					def get_emitente_servico(nfse, dados_emitente)
         | 
| 46 | 
            +
            						dados_emitente ||= {}
         | 
| 47 | 
            +
            						nfse.emitente do |em|
         | 
| 48 | 
            +
            							if dados_emitente[:identificacao_prestador]
         | 
| 49 | 
            +
            								em.cnpj = dados_emitente[:identificacao_prestador][:cpf_cnpj][:cnpj] if dados_emitente[:identificacao_prestador][:cpf_cnpj]
         | 
| 50 | 
            +
            								em.inscricao_municipal = dados_emitente[:identificacao_prestador][:inscricao_municipal]
         | 
| 51 | 
            +
            							end
         | 
| 52 | 
            +
            							em.razao_social  = dados_emitente[:razao_social]
         | 
| 53 | 
            +
            							em.nome_fantasia = dados_emitente[:nome_fantasia]
         | 
| 54 | 
            +
            							if dados_emitente[:contato]
         | 
| 55 | 
            +
            								em.telefone   = dados_emitente[:contato][:telefone]
         | 
| 56 | 
            +
            								em.email      = dados_emitente[:contato][:email]
         | 
| 57 | 
            +
            							end
         | 
| 58 | 
            +
            							em.endereco      = get_endereco(dados_emitente[:endereco])
         | 
| 59 | 
            +
            						end
         | 
| 60 | 
            +
            					end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            					def get_info_cancelamento(nfse, params)
         | 
| 63 | 
            +
            						params ||= {}
         | 
| 64 | 
            +
            						params = params[:confirmacao] || {}
         | 
| 65 | 
            +
             | 
| 66 | 
            +
            						info_pedido_cancelamento = params[:pedido][:inf_pedido_cancelamento] if params[:pedido]
         | 
| 67 | 
            +
            						info_pedido_cancelamento ||= {}
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            						confirmacao_cancelamento = params[:inf_confirmacao_cancelamento] || {}
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            						nfse.cancelamento_codigo              = info_pedido_cancelamento[:codigo_cancelamento]
         | 
| 72 | 
            +
            						if info_pedido_cancelamento[:identificacao_nfse]
         | 
| 73 | 
            +
            							nfse.cancelamento_numero_nf           = info_pedido_cancelamento[:identificacao_nfse][:numero]              
         | 
| 74 | 
            +
            							nfse.cancelamento_cnpj                = info_pedido_cancelamento[:identificacao_nfse][:cpf_cnpj][:cnpj]     if info_pedido_cancelamento[:identificacao_nfse][:cpf_cnpj]
         | 
| 75 | 
            +
            							nfse.cancelamento_inscricao_municipal = info_pedido_cancelamento[:identificacao_nfse][:inscricao_municipal]
         | 
| 76 | 
            +
            							nfse.cancelamento_municipio           = info_pedido_cancelamento[:identificacao_nfse][:codigo_municipio]   
         | 
| 77 | 
            +
            						end
         | 
| 78 | 
            +
            						nfse.cancelamento_sucesso             = confirmacao_cancelamento[:sucesso]
         | 
| 79 | 
            +
            						nfse.cancelamento_data_hora           = confirmacao_cancelamento[:data_hora]						
         | 
| 80 | 
            +
            					end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            					def get_declaracao_prestacao_servico(nfse, params)
         | 
| 83 | 
            +
            						params = params[:inf_declaracao_prestacao_servico] || {}
         | 
| 84 | 
            +
            						
         | 
| 85 | 
            +
            						nfse.competencia = params[:competencia]
         | 
| 86 | 
            +
            						nfse.emitente.optante_simples_nacional = params[:optante_simples_nacional]
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            						get_informacoes_rps      nfse, params[:rps]
         | 
| 89 | 
            +
            						get_dados_servico        nfse, params[:servico]
         | 
| 90 | 
            +
            						get_destinatario_servico nfse, params[:tomador]
         | 
| 91 | 
            +
            						get_intermediario        nfse, params[:intermediario] if params[:intermediario]
         | 
| 92 | 
            +
            						get_construcao_civil     nfse, params[:construcao_civil]
         | 
| 93 | 
            +
            					end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            					def get_informacoes_rps(nfse, params)
         | 
| 96 | 
            +
            						params ||= {}
         | 
| 97 | 
            +
            						if params[:identificacao_rps]
         | 
| 98 | 
            +
            							nfse.rps_numero   = params[:identificacao_rps][:numero]
         | 
| 99 | 
            +
            							nfse.rps_serie    = params[:identificacao_rps][:serie]
         | 
| 100 | 
            +
            							nfse.rps_tipo     = params[:identificacao_rps][:tipo]
         | 
| 101 | 
            +
            						end
         | 
| 102 | 
            +
            						nfse.rps_situacao     = params[:situacao]
         | 
| 103 | 
            +
            						nfse.data_emissao_rps = params[:data_emissao]
         | 
| 104 | 
            +
            						if params[:rps_substituido]
         | 
| 105 | 
            +
            							nfse.rps_substituido_numero   = params[:rps_substituido][:numero]
         | 
| 106 | 
            +
            							nfse.rps_substituido_serie    = params[:rps_substituido][:serie]
         | 
| 107 | 
            +
            							nfse.rps_substituido_tipo     = params[:rps_substituido][:tipo]
         | 
| 108 | 
            +
            						end
         | 
| 109 | 
            +
            					end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            					def get_dados_servico(nfse, params)
         | 
| 112 | 
            +
            						if valores = params[:valores]
         | 
| 113 | 
            +
            							nfse.valor_servicos          = valores[:valor_servicos]
         | 
| 114 | 
            +
            							nfse.valor_deducoes          = valores[:valor_deducoes]
         | 
| 115 | 
            +
            							nfse.valor_pis               = valores[:valor_pis]
         | 
| 116 | 
            +
            							nfse.valor_cofins            = valores[:valor_cofins]
         | 
| 117 | 
            +
            							nfse.valor_inss              = valores[:valor_inss]
         | 
| 118 | 
            +
            							nfse.valor_ir                = valores[:valor_ir]
         | 
| 119 | 
            +
            							nfse.valor_csll              = valores[:valor_csll]
         | 
| 120 | 
            +
            							nfse.outras_retencoes        = valores[:outras_retencoes]
         | 
| 121 | 
            +
            							# nfse.valor_iss               = valores[:valor_iss]
         | 
| 122 | 
            +
            							nfse.desconto_condicionado   = valores[:desconto_condicionado]
         | 
| 123 | 
            +
            							nfse.desconto_incondicionado = valores[:desconto_incondicionado]
         | 
| 124 | 
            +
            						end
         | 
| 125 | 
            +
             | 
| 126 | 
            +
            						nfse.iss_retido                 = params[:iss_retido]
         | 
| 127 | 
            +
            						nfse.responsavel_retencao       = params[:responsavel_retencao]
         | 
| 128 | 
            +
            						nfse.item_lista_servico         = params[:item_lista_servico]
         | 
| 129 | 
            +
            						nfse.codigo_cnae                = params[:codigo_cnae]
         | 
| 130 | 
            +
            						nfse.discriminacao              = params[:discriminacao]
         | 
| 131 | 
            +
            						nfse.codigo_municipio           = params[:codigo_municipio]
         | 
| 132 | 
            +
            						nfse.emitente.natureza_operacao = params[:exigibilidade_iss]
         | 
| 133 | 
            +
            						nfse.numero_processo            = params[:numero_processo]
         | 
| 134 | 
            +
            						nfse.municipio_incidencia       = params[:municipio_incidencia]
         | 
| 135 | 
            +
            					end
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            					def get_destinatario_servico(nfse, params)
         | 
| 138 | 
            +
            						params ||= {}
         | 
| 139 | 
            +
            						nfse.destinatario do |dest|
         | 
| 140 | 
            +
            							if identificacao = params[:identificacao_tomador]
         | 
| 141 | 
            +
            								dest.cpf_cnpj            = identificacao[:cpf_cnpj][:cnpj] || identificacao[:cpf_cnpj][:cpf] if identificacao[:cpf_cnpj]
         | 
| 142 | 
            +
            								dest.inscricao_municipal = identificacao[:inscricao_municipal]
         | 
| 143 | 
            +
            							end
         | 
| 144 | 
            +
            							dest.razao_social     = params[:razao_social]
         | 
| 145 | 
            +
            							dest.nome_fantasia    = params[:nome_fantasia]
         | 
| 146 | 
            +
            							if params[:contato]
         | 
| 147 | 
            +
            								dest.telefone      = params[:contato][:telefone] 
         | 
| 148 | 
            +
            								dest.email         = params[:contato][:email]
         | 
| 149 | 
            +
            							end
         | 
| 150 | 
            +
            							dest.endereco         = get_endereco(params[:endereco])
         | 
| 151 | 
            +
            						end
         | 
| 152 | 
            +
            					end
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            					
         | 
| 155 | 
            +
            				end
         | 
| 156 | 
            +
            			end
         | 
| 157 | 
            +
            		end
         | 
| 158 | 
            +
            	end
         | 
| 159 | 
            +
            end
         | 
| @@ -3,6 +3,13 @@ module BrNfe | |
| 3 3 | 
             
            		module Betha
         | 
| 4 4 | 
             
            			module V2
         | 
| 5 5 | 
             
            				class CancelamentoNfs < BrNfe::Servico::Betha::V2::Gateway
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            					validates :numero_nfse, :codigo_cancelamento, presence: true
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            					def certificado_obrigatorio?
         | 
| 10 | 
            +
            						true
         | 
| 11 | 
            +
            					end
         | 
| 12 | 
            +
             | 
| 6 13 | 
             
            					def method_wsdl
         | 
| 7 14 | 
             
            						:cancelar_nfse
         | 
| 8 15 | 
             
            					end
         | 
| @@ -12,9 +19,7 @@ module BrNfe | |
| 12 19 | 
             
            							xml.CancelarNfseEnvio(xmlns: "http://www.betha.com.br/e-nota-contribuinte-ws") {
         | 
| 13 20 | 
             
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_pedido_cancelamento_assinado.doc.root.to_s )
         | 
| 14 21 | 
             
            							}
         | 
| 15 | 
            -
            						end | 
| 16 | 
            -
             | 
| 17 | 
            -
            						canonicalize xml
         | 
| 22 | 
            +
            						end
         | 
| 18 23 | 
             
            					end
         | 
| 19 24 |  | 
| 20 25 |  | 
| @@ -6,6 +6,8 @@ module BrNfe | |
| 6 6 |  | 
| 7 7 | 
             
            					attr_accessor :protocolo
         | 
| 8 8 |  | 
| 9 | 
            +
            					validates :protocolo, presence: true
         | 
| 10 | 
            +
             | 
| 9 11 | 
             
            					def method_wsdl
         | 
| 10 12 | 
             
            						:consultar_lote_rps
         | 
| 11 13 | 
             
            					end
         | 
| @@ -13,12 +15,13 @@ module BrNfe | |
| 13 15 | 
             
            					def xml_builder
         | 
| 14 16 | 
             
            						xml = Nokogiri::XML::Builder.new do |xml|
         | 
| 15 17 | 
             
            							xml.ConsultarLoteRpsEnvio(xmlns: "http://www.betha.com.br/e-nota-contribuinte-ws") {
         | 
| 16 | 
            -
            								 | 
| 18 | 
            +
            								
         | 
| 19 | 
            +
            								# Pestador / Emitente
         | 
| 20 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_prestador.doc.root.to_s )
         | 
| 21 | 
            +
             | 
| 17 22 | 
             
            								xml.Protocolo "#{protocolo}".max_size(50)
         | 
| 18 23 | 
             
            							}
         | 
| 19 | 
            -
            						end | 
| 20 | 
            -
             | 
| 21 | 
            -
            						canonicalize xml
         | 
| 24 | 
            +
            						end
         | 
| 22 25 | 
             
            					end
         | 
| 23 26 | 
             
            				end
         | 
| 24 27 | 
             
            			end
         | 
| @@ -12,13 +12,13 @@ module BrNfe | |
| 12 12 | 
             
            					def xml_builder
         | 
| 13 13 | 
             
            						xml = Nokogiri::XML::Builder.new do |xml|
         | 
| 14 14 | 
             
            							xml.ConsultarNfseRpsEnvio(xmlns: "http://www.betha.com.br/e-nota-contribuinte-ws") {
         | 
| 15 | 
            -
            								 | 
| 15 | 
            +
            								# Identificação RPS
         | 
| 16 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_identificacao_rps(rps).doc.root.to_s )
         | 
| 16 17 |  | 
| 17 | 
            -
            								 | 
| 18 | 
            +
            								# Pestador / Emitente
         | 
| 19 | 
            +
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_prestador.doc.root.to_s )
         | 
| 18 20 | 
             
            							}
         | 
| 19 | 
            -
            						end | 
| 20 | 
            -
             | 
| 21 | 
            -
            						canonicalize xml
         | 
| 21 | 
            +
            						end
         | 
| 22 22 | 
             
            					end
         | 
| 23 23 | 
             
            				end
         | 
| 24 24 | 
             
            			end
         | 
| @@ -6,6 +6,12 @@ module BrNfe | |
| 6 6 | 
             
            					def method_wsdl
         | 
| 7 7 | 
             
            						:recepcionar_lote_rps_sincrono
         | 
| 8 8 | 
             
            					end
         | 
| 9 | 
            +
            					def certificado_obrigatorio?
         | 
| 10 | 
            +
            						true
         | 
| 11 | 
            +
            					end
         | 
| 12 | 
            +
            					
         | 
| 13 | 
            +
            					validates :numero_lote_rps, presence: true
         | 
| 14 | 
            +
            					validate :validar_lote_rps
         | 
| 9 15 |  | 
| 10 16 | 
             
            					def xml_builder
         | 
| 11 17 | 
             
            						xml = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
         | 
| @@ -15,9 +21,7 @@ module BrNfe | |
| 15 21 | 
             
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( xml_lote_rps.to_s )
         | 
| 16 22 | 
             
            								xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse( assinatura_xml(xml_lote_rps.to_s, "#lote#{numero_lote_rps}") )
         | 
| 17 23 | 
             
            							}
         | 
| 18 | 
            -
            						end | 
| 19 | 
            -
            						
         | 
| 20 | 
            -
            						canonicalize xml
         | 
| 24 | 
            +
            						end
         | 
| 21 25 | 
             
            					end
         | 
| 22 26 | 
             
            				end
         | 
| 23 27 | 
             
            			end
         |