nfse_sjc 0.1.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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +22 -0
  8. data/README.md +130 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +7 -0
  11. data/bin/setup +7 -0
  12. data/etc/codegen/_signature.xml.erb +22 -0
  13. data/etc/codegen/cabecalho_v3.xml.erb +6 -0
  14. data/etc/codegen/cancelar_nfse_v3.xml.erb +21 -0
  15. data/etc/codegen/consultar_lote_rps_v3.xml.erb +15 -0
  16. data/etc/codegen/consultar_nfse_rps_v3.xml.erb +18 -0
  17. data/etc/codegen/consultar_nfse_v3.xml.erb +58 -0
  18. data/etc/codegen/consultar_situacao_lote_rps_v3.xml.erb +15 -0
  19. data/etc/codegen/recepcionar_lote_rps_v3.xml.erb +188 -0
  20. data/etc/schemas/cabecalho_v03.xsd +16 -0
  21. data/etc/schemas/servico_cancelar_nfse_envio_v03.xsd +19 -0
  22. data/etc/schemas/servico_cancelar_nfse_resposta_v03.xsd +13 -0
  23. data/etc/schemas/servico_consultar_lote_rps_envio_v03.xsd +23 -0
  24. data/etc/schemas/servico_consultar_lote_rps_resposta_v03.xsd +18 -0
  25. data/etc/schemas/servico_consultar_nfse_envio_v03.xsd +26 -0
  26. data/etc/schemas/servico_consultar_nfse_resposta_v03.xsd +19 -0
  27. data/etc/schemas/servico_consultar_nfse_rps_envio_v03.xsd +23 -0
  28. data/etc/schemas/servico_consultar_nfse_rps_resposta_v03.xsd +13 -0
  29. data/etc/schemas/servico_consultar_situacao_lote_rps_envio_v03.xsd +17 -0
  30. data/etc/schemas/servico_consultar_situacao_lote_rps_resposta_v03.xsd +16 -0
  31. data/etc/schemas/servico_enviar_lote_rps_envio_v03.xsd +14 -0
  32. data/etc/schemas/servico_enviar_lote_rps_resposta_v03.xsd +25 -0
  33. data/etc/schemas/tipos_v03.xsd +545 -0
  34. data/etc/schemas/xmldsig-core-schema20020212_v03.xsd +316 -0
  35. data/lib/nfse_sjc.rb +22 -0
  36. data/lib/nfse_sjc/client.rb +49 -0
  37. data/lib/nfse_sjc/config.rb +31 -0
  38. data/lib/nfse_sjc/dirs.rb +23 -0
  39. data/lib/nfse_sjc/document.rb +67 -0
  40. data/lib/nfse_sjc/errors/validation_error.rb +6 -0
  41. data/lib/nfse_sjc/parser.rb +15 -0
  42. data/lib/nfse_sjc/response_hash.rb +24 -0
  43. data/lib/nfse_sjc/schemas.rb +17 -0
  44. data/lib/nfse_sjc/version.rb +3 -0
  45. data/nfse_sjc.gemspec +32 -0
  46. metadata +175 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f5ef35910f0961211cda900d1896e36c0fa3a554
4
+ data.tar.gz: 37ed1c8b85aaed78c2cc4449f3a70cdea972ff6e
5
+ SHA512:
6
+ metadata.gz: ec02041fb78a3bda8e226bb6a6616590ee6b083bfb82b0fcc964fe6fa4824032f0505ab05754a60aaa8fe9f524cdfd8e2d319d8d4ea56f44854ea89fad483085
7
+ data.tar.gz: 83697923ee4a7b44c70ac7cb7f08a7c71072094a104161f7263162cfeb0e8b3adfe7866cff3658f40cfa609d333b61ce7c5a82f4562e262119d10f43b9ca4d4b
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /cert/*
11
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1 @@
1
+ 2.2.3
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nfse-sjc.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 RedeAlumni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,130 @@
1
+ # nfse-sjc
2
+
3
+ Gem para comunicação via API com o sistema de NFS-e da prefeitura de São José dos Campos
4
+
5
+ ## Instalação
6
+
7
+ Adicione essa linha no Gemfile de sua aplicação:
8
+
9
+ ```ruby
10
+ gem 'nfse_sjc', '~> 0.1'
11
+ ```
12
+
13
+ Em seguida, execute:
14
+
15
+ $ bundle install
16
+
17
+ Ou instale você mesmo utilizando o seguinte comando:
18
+
19
+ $ gem install nfse_sjc
20
+
21
+ Além disso, é necessário que o `xmlsec` esteja instalado em seu sistema e que seja compatível com a API da versão 1.2.18.
22
+
23
+ ## Como usar a gem
24
+
25
+ ```ruby
26
+ # configuração
27
+ NfseSjc.config do |c|
28
+ c.wsdl = 'https://homologacao.ginfes.com.br/ServiceGinfesImpl?wsdl'
29
+ c.ssl_cert_file = 'CAMINHO_PARA_SEU_CERTIFICADO'
30
+ c.ssl_cert_key_file = 'CAMINHO_PARA_SUA_CHAVE_PRIVADA'
31
+ c.ssl_cert_key_password = 'SENHA_CHAVE_PRIVADA'
32
+ c.log = true
33
+ c.pretty_print_xml = true
34
+ c.xmlsec_binary_path = `which xmlsec1`.chomp
35
+ end
36
+
37
+ # chamada de api
38
+ ginfes = NfseSjc::Client.new
39
+
40
+ # enviar lote RPS
41
+ client.recepcionar_lote_rps_v3({
42
+ 'LoteRps' => {
43
+ 'Id' => '1234',
44
+ 'NumeroLote' => '26',
45
+ 'Cnpj' => 'CNPJ_VALIDO',
46
+ 'InscricaoMunicipal' => 'IM_VALIDA',
47
+ 'ListaRps' => [
48
+ {
49
+ 'Id' => '1234',
50
+ 'InfRps' => {
51
+ 'IdentificacaoRps' => {
52
+ 'Numero' => '2345',
53
+ 'Serie' => '3456',
54
+ 'Tipo' => '1'
55
+ },
56
+ 'DataEmissao' => Time.now.strftime('%Y-%m-%dT%H:%M:%S'),
57
+ 'NaturezaOperacao' => '1',
58
+ 'OptanteSimplesNacional' => '2',
59
+ 'IncentivadorCultural' => '2',
60
+ 'Status' => '1', # normal
61
+ 'Servico' => {
62
+ 'Valores' => {
63
+ 'ValorServicos' => '1',
64
+ 'IssRetido' => '2'
65
+ },
66
+ 'ItemListaServico' => '1.03',
67
+ 'CodigoTributacaoMunicipio' => '20103001',
68
+ 'Discriminacao' => 'Discriminação do serviço',
69
+ 'CodigoMunicipio' => '3549904'
70
+ },
71
+ 'Prestador' => {
72
+ 'Cnpj' => 'CNPJ_VALIDO',
73
+ 'InscricaoMunicipal' => 'IM_VALIDA'
74
+ },
75
+ 'Tomador' => {
76
+ 'CpfCnpj' => {
77
+ 'Cpf' => 'CPF_VALIDO'
78
+ },
79
+ 'RazaoSocial' => 'João da Silva'
80
+ }
81
+ }
82
+ }
83
+ ]
84
+ }
85
+ })
86
+
87
+ # consultar situação do lote
88
+ ginfes.consultar_situacao_lote_rps_v3({
89
+ 'Prestador' => {
90
+ 'Cnpj' => 'CNPJ_VALIDO',
91
+ 'InscricaoMunicipal' => 'IM_VALIDA'
92
+ },
93
+ 'Protocolo' => '5901581'
94
+ })
95
+
96
+ # consultar lote
97
+ ginfes.consultar_lote_rps_v3({
98
+ 'Prestador' => {
99
+ 'Cnpj' => 'CNPJ_VALIDO',
100
+ 'InscricaoMunicipal' => 'IM_VALIDA'
101
+ },
102
+ 'Protocolo' => '5901581'
103
+ })
104
+ ```
105
+
106
+ ## Certificado e chave
107
+
108
+ ### Extraindo certificado e chave privada .pem a partir do certificado .pfx
109
+
110
+ Para utilizar a gem, é necessário extrair a chave privada e o certificado (ambos em formato .pem) a partir do certificado .pfx, _caso você tenha acesso somente à senha e ao .pfx_.
111
+
112
+ Para extrair a chave privada:
113
+
114
+ ```bash
115
+ openssl pkcs12 -in certificado.pfx -nocerts -out chave-privada.pem
116
+ ```
117
+
118
+ Para extrair o certificado em formato .pem:
119
+
120
+ ```bash
121
+ openssl pkcs12 -in certificado.pfx -clcerts -nokeys -out certificado.pem
122
+ ```
123
+
124
+ ## TODO
125
+
126
+ * Ao invés de referenciar o wsdl correto, referenciar se é ambiente de homologação ou produção
127
+ * Permitir configuração de CNPJ e Inscrição Municipal
128
+ * API mais high level (classes para resposta, etc)
129
+ * Tentar substituir o xmlsec por uma solução mais PORO possível
130
+ * Testes
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nfse_sjc"
5
+
6
+ require "pry"
7
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,22 @@
1
+ <ds:Signature>
2
+ <ds:SignedInfo>
3
+ <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
4
+ <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1">
5
+ </ds:SignatureMethod>
6
+ <ds:Reference URI="">
7
+ <ds:Transforms>
8
+ <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
9
+ <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></ds:Transform>
10
+ </ds:Transforms>
11
+ <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
12
+ <ds:DigestValue></ds:DigestValue>
13
+ </ds:Reference>
14
+ </ds:SignedInfo>
15
+ <ds:SignatureValue></ds:SignatureValue>
16
+ <ds:KeyInfo>
17
+ <ds:X509Data>
18
+ <ds:X509Certificate>
19
+ </ds:X509Certificate>
20
+ </ds:X509Data>
21
+ </ds:KeyInfo>
22
+ </ds:Signature>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:cabecalho versao="3"
3
+ xmlns:p="http://www.ginfes.com.br/cabecalho_v03.xsd"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5
+ <versaoDados>3</versaoDados>
6
+ </p:cabecalho>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:CancelarNfseEnvio
3
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
+ xmlns:p="http://www.ginfes.com.br/servico_cancelar_nfse_envio_v03.xsd"
5
+ xmlns:p1="http://www.ginfes.com.br/tipos_v03.xsd"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <Pedido>
8
+ <p1:InfPedidoCancelamento <%= if_param('PedidoCancelamento', 'Id') { |val| "Id='#{ val }'" } %>>
9
+ <p1:IdentificacaoNfse>
10
+ <p1:Numero><%= param('PedidoCancelamento', 'IdentificacaoNfse', 'Numero')%></p1:Numero>
11
+ <p1:Cnpj><%= param('PedidoCancelamento', 'IdentificacaoNfse', 'Cnpj')%></p1:Cnpj>
12
+ <% if_param('PedidoCancelamento', 'IdentificacaoNfse', 'InscricaoMunicipal') do |val| %>
13
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
14
+ <% end %>
15
+ <p1:CodigoMunicipio><%= param('PedidoCancelamento', 'IdentificacaoNfse', 'CodigoMunicipio') %></p1:CodigoMunicipio>
16
+ </p1:IdentificacaoNfse>
17
+ <p1:CodigoCancelamento><%= param('PedidoCancelamento', 'CodigoCancelamento') %></p1:CodigoCancelamento>
18
+ </p1:InfPedidoCancelamento>
19
+ </Pedido>
20
+ <%= render '_signature.xml.erb' %>
21
+ </p:CancelarNfseEnvio>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:ConsultarLoteRpsEnvio <%= if_param('Id') { |val| "Id=#{ val }" } %>
3
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
+ xmlns:p="http://www.ginfes.com.br/servico_consultar_lote_rps_envio_v03.xsd"
5
+ xmlns:p1="http://www.ginfes.com.br/tipos_v03.xsd"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <p:Prestador>
8
+ <p1:Cnpj><%= param('Prestador', 'Cnpj') %></p1:Cnpj>
9
+ <% if_param('Prestador', 'InscricaoMunicipal') do |val| %>
10
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
11
+ <% end %>
12
+ </p:Prestador>
13
+ <p:Protocolo><%= param('Protocolo') %></p:Protocolo>
14
+ <%= render '_signature.xml.erb' %>
15
+ </p:ConsultarLoteRpsEnvio>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:ConsultarNfseRpsEnvio
3
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
+ xmlns:p="http://www.ginfes.com.br/servico_consultar_nfse_rps_envio_v03.xsd"
5
+ xmlns:p1="http://www.ginfes.com.br/tipos_v03.xsd"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <p:IdentificacaoRps>
8
+ <p1:Numero><%= params('IdentificacaoRps', 'Numero') %></p1:Numero>
9
+ <p1:Serie><%= params('IdentificacaoRps', 'Serie') %></p1:Serie>
10
+ <p1:Tipo><%= params('IdentificacaoRps', 'Tipo') %></p1:Tipo>
11
+ </p:IdentificacaoRps>
12
+ <p:Prestador>
13
+ <p1:Cnpj><%= param('Prestador', 'Cnpj') %></p1:Cnpj>
14
+ <% if_param('Prestador', 'InscricaoMunicipal') do |val| %>
15
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
16
+ <% end %>
17
+ </p:Prestador>
18
+ </p:ConsultarNfseRpsEnvio>
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:ConsultarNfseEnvio <%= if_param('Id') { |val| "Id=#{ val }" } %>
3
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
+ xmlns:p="http://www.ginfes.com.br/servico_consultar_nfse_envio_v03.xsd"
5
+ xmlns:p1="http://www.ginfes.com.br/tipos_v03.xsd"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <p:Prestador>
8
+ <p1:Cnpj><%= param('Prestador', 'Cnpj') %></p1:Cnpj>
9
+ <% if_param('Prestador', 'InscricaoMunicipal') do |val| %>
10
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
11
+ <% end %>
12
+ </p:Prestador>
13
+ <% if_param('NumeroNfse') do |val| %>
14
+ <p:NumeroNfse><%= val %></p:NumeroNfse>
15
+ <% end %>
16
+ <% if_param('PeriodoEmissao') do |val| %>
17
+ <p:PeriodoEmissao>
18
+ <p:DataInicial><%= param('PeriodoEmissao', 'DataInicial') %></p:DataInicial>
19
+ <p:DataFinal><%= param('PeriodoEmissao', 'DataFinal') %></p:DataFinal>
20
+ </p:PeriodoEmissao>
21
+ <% end %>
22
+ <% if_param('Tomador') do |val| %>
23
+ <p:Tomador>
24
+ <% if_param('Tomador', 'CpfCnpj') do |val| %>
25
+ <p1:CpfCnpj>
26
+ <% if_param('Cnpj', with: val) do |cnpj| %>
27
+ <p1:Cnpj><%= cnpj %></p1:Cnpj>
28
+ <% end %>
29
+ <% if_param('Cpf', with: val) do |cpf| %>
30
+ <p1:Cpf><%= cpf %></p1:Cpf>
31
+ <% end %>
32
+ </p1:CpfCnpj>
33
+ <% end %>
34
+ <% if_param('Tomador', 'InscricaoMunicipal') do |val| %>
35
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
36
+ <% end %>
37
+ </p:Tomador>
38
+ <% end %>
39
+ <% if_param('IntermediarioServico') do |val| %>
40
+ <p:IntermediarioServico>
41
+ <p1:RazaoSocial><%= param('IntermediarioServico', 'RazaoSocial') %></p1:RazaoSocial>
42
+ <% if_param('IntermediarioServico', 'CpfCnpj') do |val| %>
43
+ <p1:CpfCnpj>
44
+ <% if_param('Cnpj', with: val) do |cnpj| %>
45
+ <p1:Cnpj><%= cnpj %></p1:Cnpj>
46
+ <% end %>
47
+ <% if_param('Cpf', with: val) do |cpf| %>
48
+ <p1:Cpf><%= cpf %></p1:Cpf>
49
+ <% end %>
50
+ </p1:CpfCnpj>
51
+ <% end %>
52
+ <% if_param('IntermediarioServico', 'InscricaoMunicipal') do |val| %>
53
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
54
+ <% end %>
55
+ </p:IntermediarioServico>
56
+ <% end %>
57
+ <%= render '_signature.xml.erb' %>
58
+ </p:ConsultarNfseEnvio>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:ConsultarSituacaoLoteRpsEnvio <%= if_param('Id') { |val| "Id=#{ val }" } %>
3
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
+ xmlns:p="http://www.ginfes.com.br/servico_consultar_situacao_lote_rps_envio_v03.xsd"
5
+ xmlns:p1="http://www.ginfes.com.br/tipos_v03.xsd"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <p:Prestador>
8
+ <p1:Cnpj><%= param('Prestador', 'Cnpj') %></p1:Cnpj>
9
+ <% if_param('Prestador', 'InscricaoMunicipal') do |val| %>
10
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
11
+ <% end %>
12
+ </p:Prestador>
13
+ <p:Protocolo><%= param('Protocolo') %></p:Protocolo>
14
+ <%= render '_signature.xml.erb' %>
15
+ </p:ConsultarSituacaoLoteRpsEnvio>
@@ -0,0 +1,188 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <p:EnviarLoteRpsEnvio
3
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
4
+ xmlns:p="http://www.ginfes.com.br/servico_enviar_lote_rps_envio_v03.xsd"
5
+ xmlns:p1="http://www.ginfes.com.br/tipos_v03.xsd"
6
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
+ <p:LoteRps <%= if_param('LoteRps', 'Id') { |val| "Id='#{ val }'" } %>>
8
+ <p1:NumeroLote><%= param('LoteRps', 'NumeroLote') %></p1:NumeroLote>
9
+ <p1:Cnpj><%= param('LoteRps', 'Cnpj') %></p1:Cnpj>
10
+ <p1:InscricaoMunicipal><%= param('LoteRps', 'InscricaoMunicipal') %></p1:InscricaoMunicipal>
11
+ <p1:QuantidadeRps><%= param('LoteRps', 'ListaRps').size %></p1:QuantidadeRps>
12
+ <p1:ListaRps>
13
+ <% param('LoteRps', 'ListaRps').each do |rps| %>
14
+ <p1:Rps>
15
+ <p1:InfRps <%= if_param('Id', with: rps) { |val| "Id='#{ val }'" } %>>
16
+ <p1:IdentificacaoRps>
17
+ <p1:Numero><%= param('InfRps', 'IdentificacaoRps', 'Numero', with: rps) %></p1:Numero>
18
+ <p1:Serie><%= param('InfRps', 'IdentificacaoRps', 'Serie', with: rps) %></p1:Serie>
19
+ <p1:Tipo><%= param('InfRps', 'IdentificacaoRps', 'Tipo', with: rps) %></p1:Tipo>
20
+ </p1:IdentificacaoRps>
21
+ <p1:DataEmissao><%= param('InfRps', 'DataEmissao', with: rps) %></p1:DataEmissao>
22
+ <p1:NaturezaOperacao><%= param('InfRps', 'NaturezaOperacao', with: rps) %></p1:NaturezaOperacao>
23
+ <% if_param('InfRps', 'RegimeEspecialTributacao', with: rps) do |val| %>
24
+ <p1:RegimeEspecialTributacao><%= val %></p1:RegimeEspecialTributacao>
25
+ <% end %>
26
+ <p1:OptanteSimplesNacional><%= param('InfRps', 'OptanteSimplesNacional', with: rps) %></p1:OptanteSimplesNacional>
27
+ <p1:IncentivadorCultural><%= param('InfRps', 'IncentivadorCultural', with: rps) %></p1:IncentivadorCultural>
28
+ <p1:Status><%= param('InfRps', 'Status', with: rps) %></p1:Status>
29
+ <% if_param('InfRps', 'RpsSubstituido', with: rps) do |sub| %>
30
+ <p1:RpsSubstituido>
31
+ <p1:Numero><%= param('Numero', with: sub) %></p1:Numero>
32
+ <p1:Serie><%= param('Serie', with: sub) %></p1:Serie>
33
+ <p1:Tipo><%= param('Tipo', with: sub) %></p1:Tipo>
34
+ </p1:RpsSubstituido>
35
+ <% end %>
36
+ <p1:Servico>
37
+ <p1:Valores>
38
+ <% param('InfRps', 'Servico', 'Valores', with: rps).tap do |values| %>
39
+ <p1:ValorServicos><%= param('ValorServicos', with: values) %></p1:ValorServicos>
40
+ <p1:IssRetido><%= param('IssRetido', with: values) %></p1:IssRetido>
41
+ <% if_param('ValorDeducoes', with: values) do |val| %>
42
+ <p1:ValorDeducoes><%= val %></p1:ValorDeducoes>
43
+ <% end %>
44
+ <% if_param('ValorPis', with: values) do |val| %>
45
+ <p1:ValorPis><%= val %></p1:ValorPis>
46
+ <% end %>
47
+ <% if_param('ValorCofins', with: values) do |val| %>
48
+ <p1:ValorCofins><%= val %></p1:ValorCofins>
49
+ <% end %>
50
+ <% if_param('ValorInss', with: values) do |val| %>
51
+ <p1:ValorInss><%= val %></p1:ValorInss>
52
+ <% end %>
53
+ <% if_param('ValorIr', with: values) do |val| %>
54
+ <p1:ValorIr><%= val %></p1:ValorIr>
55
+ <% end %>
56
+ <% if_param('ValorCsll', with: values) do |val| %>
57
+ <p1:ValorCsll><%= val %></p1:ValorCsll>
58
+ <% end %>
59
+ <% if_param('ValorIss', with: values) do |val| %>
60
+ <p1:ValorIss><%= val %></p1:ValorIss>
61
+ <% end %>
62
+ <% if_param('ValorIssRetido', with: values) do |val| %>
63
+ <p1:ValorIssRetido><%= val %></p1:ValorIssRetido>
64
+ <% end %>
65
+ <% if_param('OutrasRetencoes', with: values) do |val| %>
66
+ <p1:OutrasRetencoes><%= val %></p1:OutrasRetencoes>
67
+ <% end %>
68
+ <% if_param('BaseCalculo', with: values) do |val| %>
69
+ <p1:BaseCalculo><%= val %></p1:BaseCalculo>
70
+ <% end %>
71
+ <% if_param('Aliquota', with: values) do |val| %>
72
+ <p1:Aliquota><%= val %></p1:Aliquota>
73
+ <% end %>
74
+ <% if_param('ValorLiquidoNfse', with: values) do |val| %>
75
+ <p1:ValorLiquidoNfse><%= val %></p1:ValorLiquidoNfse>
76
+ <% end %>
77
+ <% if_param('DescontoIncondicionado', with: values) do |val| %>
78
+ <p1:DescontoIncondicionado><%= val %></p1:DescontoIncondicionado>
79
+ <% end %>
80
+ <% if_param('DescontoCondicionado', with: values) do |val| %>
81
+ <p1:DescontoCondicionado><%= val %></p1:DescontoCondicionado>
82
+ <% end %>
83
+ <% end %>
84
+ </p1:Valores>
85
+ <p1:ItemListaServico><%= param('InfRps', 'Servico', 'ItemListaServico', with: rps) %></p1:ItemListaServico>
86
+ <% if_param('InfRps', 'Servico', 'CodigoCnae', with: rps) do |val| %>
87
+ <p1:CodigoCnae><%= val %></p1:CodigoCnae>
88
+ <% end %>
89
+ <% if_param('InfRps', 'Servico', 'CodigoTributacaoMunicipio', with: rps) do |val| %>
90
+ <p1:CodigoTributacaoMunicipio><%= val %></p1:CodigoTributacaoMunicipio>
91
+ <% end %>
92
+ <p1:Discriminacao><%= param('InfRps', 'Servico', 'Discriminacao', with: rps) %></p1:Discriminacao>
93
+ <p1:CodigoMunicipio><%= param('InfRps', 'Servico', 'CodigoMunicipio', with: rps) %></p1:CodigoMunicipio>
94
+ </p1:Servico>
95
+ <p1:Prestador>
96
+ <p1:Cnpj><%= param('InfRps', 'Prestador', 'Cnpj', with: rps) %></p1:Cnpj>
97
+ <% if_param('InfRps', 'Prestador', 'InscricaoMunicipal', with: rps) do |val| %>
98
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
99
+ <% end %>
100
+ </p1:Prestador>
101
+ <p1:Tomador>
102
+ <p1:IdentificacaoTomador>
103
+ <% if_param('InfRps', 'Tomador', 'CpfCnpj', with: rps) do |val| %>
104
+ <p1:CpfCnpj>
105
+ <% if_param('Cnpj', with: val) do |cnpj| %>
106
+ <p1:Cnpj><%= cnpj %></p1:Cnpj>
107
+ <% end %>
108
+ <% if_param('Cpf', with: val) do |cpf| %>
109
+ <p1:Cpf><%= cpf %></p1:Cpf>
110
+ <% end %>
111
+ </p1:CpfCnpj>
112
+ <% end %>
113
+ <% if_param('InfRps', 'Tomador', 'InscricaoMunicipal', with: rps) do |val| %>
114
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
115
+ <% end %>
116
+ </p1:IdentificacaoTomador>
117
+ <% if_param('InfRps', 'Tomador', 'RazaoSocial', with: rps) do |val| %>
118
+ <p1:RazaoSocial><%= val %></p1:RazaoSocial>
119
+ <% end %>
120
+ <% if_param('InfRps', 'Tomador', 'Endereco', with: rps) do |endr| %>
121
+ <p1:Endereco>
122
+ <% if_param('Endereco', with: endr) do |val| %>
123
+ <p1:Endereco><%= val %></p1:Endereco>
124
+ <% end %>
125
+ <% if_param('NumeroLote', with: endr) do |val| %>
126
+ <p1:NumeroLote><%= val %></p1:NumeroLote>
127
+ <% end %>
128
+ <% if_param('Complemento', with: endr) do |val| %>
129
+ <p1:Complemento><%= val %></p1:Complemento>
130
+ <% end %>
131
+ <% if_param('Bairro', with: endr) do |val| %>
132
+ <p1:Bairro><%= val %></p1:Bairro>
133
+ <% end %>
134
+ <% if_param('CodigoMunicipio', with: endr) do |val| %>
135
+ <p1:CodigoMunicipio><%= val %></p1:CodigoMunicipio>
136
+ <% end %>
137
+ <% if_param('Uf', with: endr) do |val| %>
138
+ <p1:Uf><%= val %></p1:Uf>
139
+ <% end %>
140
+ <% if_param('Cep', with: endr) do |val| %>
141
+ <p1:Cep><%= val %></p1:Cep>
142
+ <% end %>
143
+ </p1:Endereco>
144
+ <% end %>
145
+ <% if_param('InfRps', 'Tomador', 'Contato', with: rps) do |cnt| %>
146
+ <p1:Contato>
147
+ <% if_param('Telefone', with: cnt) do |val| %>
148
+ <p1:Telefone><%= val %></p1:Telefone>
149
+ <% end %>
150
+ <% if_param('Email', with: cnt) do |val| %>
151
+ <p1:Email><%= val %></p1:Email>
152
+ <% end %>
153
+ </p1:Contato>
154
+ <% end %>
155
+ </p1:Tomador>
156
+ <% if_param('InfRps', 'IntermediarioServico', with: rps) do |is| %>
157
+ <p1:IntermediarioServico>
158
+ <% if_param('CpfCnpj', with: is) do |val| %>
159
+ <p1:CpfCnpj>
160
+ <% if_param('Cnpj', with: val) do |cnpj| %>
161
+ <p1:Cnpj><%= cnpj %></p1:Cnpj>
162
+ <% end %>
163
+ <% if_param('Cpf', with: val) do |cpf| %>
164
+ <p1:Cpf><%= cpf %></p1:Cpf>
165
+ <% end %>
166
+ </p1:CpfCnpj>
167
+ <% end %>
168
+ <% if_param('InscricaoMunicipal', with: is) do |val| %>
169
+ <p1:InscricaoMunicipal><%= val %></p1:InscricaoMunicipal>
170
+ <% end %>
171
+ <% if_param('RazaoSocial', with: is) do |val| %>
172
+ <p1:RazaoSocial><%= val %></p1:RazaoSocial>
173
+ <% end %>
174
+ </p1:IntermediarioServico>
175
+ <% end %>
176
+ <% if_param('InfRps', 'ConstrucaoCivil', with: rps) do |cc| %>
177
+ <p1:ConstrucaoCivil>
178
+ <p1:CodigoObra><%= param('CodigoObra', with: cc) %></p1:CodigoObra>
179
+ <p1:Art><%= param('Art', with: cc) %></p1:Art>
180
+ </p1:ConstrucaoCivil>
181
+ <% end %>
182
+ </p1:InfRps>
183
+ </p1:Rps>
184
+ <% end %>
185
+ </p1:ListaRps>
186
+ </p:LoteRps>
187
+ <%= render '_signature.xml.erb' %>
188
+ </p:EnviarLoteRpsEnvio>