rnfse 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +7 -6
  4. data/lib/provedores.yml +8 -0
  5. data/lib/rnfse.rb +5 -1
  6. data/lib/rnfse/api.rb +44 -22
  7. data/lib/rnfse/api/abrasf_1_0.rb +100 -17
  8. data/lib/rnfse/api/abrasf_1_0/#definitions.json# +413 -0
  9. data/lib/rnfse/api/abrasf_1_0/cancelar_nfse.json +13 -0
  10. data/lib/rnfse/api/abrasf_1_0/consultar_nfse.json +17 -0
  11. data/lib/rnfse/api/abrasf_1_0/consultar_nfse_por_rps.json +13 -0
  12. data/lib/rnfse/api/abrasf_1_0/definitions.json +27 -3
  13. data/lib/rnfse/api/abrasf_1_0/recepcionar_lote_rps.json +1 -1
  14. data/lib/rnfse/api/iss_net_1_0.rb +46 -2
  15. data/lib/rnfse/api/speed_gov_1_0.rb +115 -0
  16. data/lib/rnfse/call_chain.rb +4 -4
  17. data/lib/rnfse/error.rb +15 -0
  18. data/lib/rnfse/hash.rb +24 -11
  19. data/lib/rnfse/string.rb +16 -2
  20. data/lib/rnfse/version.rb +1 -1
  21. data/lib/rnfse/xml_builder/abrasf_1_0.rb +103 -13
  22. data/lib/rnfse/xml_builder/iss_net_1_0.rb +34 -4
  23. data/lib/rnfse/xml_builder/speed_gov_1_0.rb +158 -0
  24. data/spec/api/abrasf_1_0/cancelar_nfse_json_spec.rb +25 -0
  25. data/spec/api/abrasf_1_0/consultar_lote_rps_json_spec.rb +23 -0
  26. data/spec/api/abrasf_1_0/consultar_nfse_json_spec.rb +45 -0
  27. data/spec/api/abrasf_1_0/consultar_nfse_por_rps_json_spec.rb +23 -0
  28. data/spec/api/abrasf_1_0/consultar_situacao_lote_rps_json_spec.rb +23 -0
  29. data/spec/api/abrasf_1_0_spec.rb +185 -6
  30. data/spec/api/iss_net_1_0_spec.rb +89 -9
  31. data/spec/api/speed_gov_1_0_spec.rb +243 -0
  32. data/spec/api_spec.rb +43 -28
  33. data/spec/error_spec.rb +10 -0
  34. data/spec/fixtures/abrasf_1_0/cancelar_nfse_envio.xml +16 -0
  35. data/spec/fixtures/abrasf_1_0/consultar_nfse.xml +23 -0
  36. data/spec/fixtures/abrasf_1_0/consultar_nfse_por_rps.xml +14 -0
  37. data/spec/fixtures/iss_net_1_0/cancelar_nfse_envio.xml +17 -0
  38. data/spec/fixtures/iss_net_1_0/consultar_nfse.xml +29 -0
  39. data/spec/fixtures/iss_net_1_0/consultar_nfse_por_rps.xml +17 -0
  40. data/spec/fixtures/speed_gov_1_0/consultar_nfse_envio.xml +29 -0
  41. data/spec/fixtures/speed_gov_1_0/consultar_nfse_rps_envio.xml +16 -0
  42. data/spec/fixtures/speed_gov_1_0/consultar_situacao_lote_rps_envio.xml +12 -0
  43. data/spec/fixtures/speed_gov_1_0/enviar_lote_rps_envio.xml +82 -0
  44. data/spec/fixtures/speed_gov_1_0/header.xml +9 -0
  45. data/spec/fixtures/vcr_cassettes/iss_net_1_0_cancelar_nfse.yml +107 -0
  46. data/spec/fixtures/vcr_cassettes/iss_net_1_0_consultar_nfse.yml +7937 -0
  47. data/spec/fixtures/vcr_cassettes/iss_net_1_0_consultar_nfse_por_rps.yml +242 -0
  48. data/spec/fixtures/vcr_cassettes/speed_gov_1_0_consultar_nfse.yml +60 -0
  49. data/spec/fixtures/vcr_cassettes/speed_gov_1_0_consultar_nfse_por_rps.yml +80 -0
  50. data/spec/fixtures/vcr_cassettes/speed_gov_1_0_consultar_situacao_lote_rps.yml +77 -0
  51. data/spec/fixtures/vcr_cassettes/speed_gov_1_0_recepcionar_lote_rps.yml +171 -0
  52. data/spec/fixtures/vcr_cassettes/speed_gov_1_0_recepcionar_lote_rps_ascii.yml +171 -0
  53. data/spec/hash_spec.rb +21 -0
  54. data/spec/spec_helper.rb +2 -0
  55. data/spec/string_spec.rb +31 -5
  56. data/spec/xml_builder/abrasf_1_0_spec.rb +110 -43
  57. data/spec/xml_builder/iss_net_1_0_spec.rb +111 -44
  58. data/spec/xml_builder/speed_gov_1_0_spec.rb +173 -0
  59. metadata +86 -37
  60. data/.gitignore +0 -25
  61. data/.rspec +0 -1
  62. data/.travis.yml +0 -14
  63. data/Gemfile +0 -3
  64. data/Guardfile +0 -15
  65. data/Procfile +0 -1
  66. data/Rakefile +0 -12
  67. data/rnfse.gemspec +0 -61
  68. data/spec/fixtures/abrasf_1_0/teste.xml +0 -8
  69. data/spec/support/.keep +0 -0
@@ -9,11 +9,13 @@ module Rnfse::XMLBuilder::IssNet10
9
9
  def prepare_hash(hash)
10
10
  hash = camelize_hash(hash)
11
11
  hash = wrap_rps(hash)
12
+ hash = wrap_periodo_emissao(hash)
13
+ hash = wrap_identificacao_nfse(hash)
12
14
  hash = add_tc_namespace(hash)
13
15
  hash = clean_numerics(hash)
14
16
  hash = date_to_utc(hash)
15
17
  hash = fix_booleans(hash)
16
- hash = wrap_cpf_cnpj(hash)
18
+ hash = wrap_cpf_cnpj(hash)
17
19
  hash = add_municipio_prestacao_servico(hash)
18
20
  hash = add_estado(hash)
19
21
  hash = add_cidade(hash)
@@ -53,9 +55,12 @@ module Rnfse::XMLBuilder::IssNet10
53
55
 
54
56
  # encapsula as tags cpf ou cnpj em uma tag cpfcnpj
55
57
  def wrap_cpf_cnpj(hash)
56
- regex = /(Cpf|Cnpj)\Z/
57
- Rnfse::Hash.replace_key_values(hash, regex) do |key, value|
58
- { :'tc:CpfCnpj' => { key => value } }
58
+ if hash[:Pedido].nil?
59
+ Rnfse::Hash.replace_key_values(hash, /tc:(Cpf|Cnpj)/) do |key, value|
60
+ { :'tc:CpfCnpj' => { key => value } }
61
+ end
62
+ else
63
+ hash
59
64
  end
60
65
  end
61
66
 
@@ -94,4 +99,29 @@ module Rnfse::XMLBuilder::IssNet10
94
99
  }
95
100
  end
96
101
 
102
+ # namespaces do xml consultar_nfse_por_xml
103
+ def build_consultar_nfse_por_rps_xmlns
104
+ {
105
+ 'xmlns' => 'http://www.issnetonline.com.br/webserviceabrasf/vsd/servico_consultar_nfse_rps_envio.xsd',
106
+ 'xmlns:tc' => xmlns_tc,
107
+ 'xmlns:ts' => xmlns_ts
108
+ }
109
+ end
110
+
111
+ # namespaces do xml consultar_nfse
112
+ def build_consultar_nfse_xmlns
113
+ {
114
+ 'xmlns' => 'http://www.issnetonline.com.br/webserviceabrasf/vsd/servico_consultar_nfse_envio.xsd',
115
+ 'xmlns:tc' => xmlns_tc
116
+ }
117
+ end
118
+
119
+ # namespaces do xml cancelar_nfse
120
+ def build_cancelar_nfse_xmlns
121
+ {
122
+ 'xmlns' => 'http://www.issnetonline.com.br/webserviceabrasf/vsd/servico_cancelar_nfse_envio.xsd',
123
+ 'xmlns:tc' => xmlns_tc
124
+ }
125
+ end
126
+
97
127
  end
@@ -0,0 +1,158 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ module Rnfse::XMLBuilder::SpeedGov10
4
+ include Rnfse::XMLBuilder::Abrasf10
5
+
6
+ def build_recepcionar_lote_rps_xml(hash = {})
7
+ hash = prepare_hash(hash)
8
+ hash = add_p_namespace(hash, /LoteRps/)
9
+ inner_xml = ::Gyoku.xml(hash, key_converter: :none)
10
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
11
+ xml.send('p:EnviarLoteRpsEnvio'.to_sym, build_parameters_xmlns) do
12
+ xml << inner_xml
13
+ end
14
+ end.doc
15
+ end
16
+
17
+ def build_consultar_situacao_lote_rps_envio_xml(hash = {})
18
+ hash = prepare_hash(hash)
19
+ hash = add_p_namespace(hash, /(Prestador|Protocolo)/)
20
+ inner_xml = ::Gyoku.xml(hash, key_converter: :none)
21
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
22
+ xml.send('p:ConsultarSituacaoLoteRpsEnvio'.to_sym, build_parameters_xmlns) do
23
+ xml << inner_xml
24
+ end
25
+ end.doc
26
+ end
27
+
28
+ def build_consultar_situacao_lote_rps_envio_xmlns()
29
+ {
30
+ 'xmlns:p' => "http://ws.speedgov.com.br/consultar_situacao_lote_rps_envio_v1.xsd",
31
+ 'xsi:schemaLocation' => "http://ws.speedgov.com.br/consultar_situacao_lote_rps_envio_v1.xsd"
32
+ }
33
+ end
34
+
35
+ def build_recepcionar_lote_rps_xmlns()
36
+ {
37
+ 'xmlns:p' => "http://ws.speedgov.com.br/enviar_lote_rps_envio_v1.xsd",
38
+ 'xsi:schemaLocation' => "http://ws.speedgov.com.br/enviar_lote_rps_envio_v1.xsd"
39
+ }
40
+ end
41
+
42
+ def build_consultar_nfse_envio_xml(hash = {})
43
+ hash = prepare_hash(hash)
44
+ hash = add_p_namespace(hash, %r{
45
+ (Prestador|
46
+ NumeroNfse|
47
+ DataInicial|
48
+ DataFinal|
49
+ PeriodoEmissao|
50
+ Tomador|
51
+ IntermediarioServico)
52
+ }x)
53
+ inner_xml = ::Gyoku.xml(hash, key_converter: :none)
54
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
55
+ xml.send('p:ConsultarNfseEnvio'.to_sym, build_parameters_xmlns) do
56
+ xml << inner_xml
57
+ end
58
+ end.doc
59
+ end
60
+
61
+ def build_consultar_nfse_envio_xmlns()
62
+ {
63
+ 'xmlns:p' => "http://ws.speedgov.com.br/consultar_nfse_envio_v1.xsd",
64
+ 'xsi:schemaLocation' => "http://ws.speedgov.com.br/consultar_nfse_envio_v1.xsd"
65
+ }
66
+ end
67
+
68
+ def build_consultar_nfse_rps_envio_xml(hash = {})
69
+ hash = prepare_hash(hash)
70
+ hash = add_p_namespace(hash, /(Prestador|IdentificacaoRps)/)
71
+ inner_xml = ::Gyoku.xml(hash, key_converter: :none)
72
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
73
+ xml.send('p:ConsultarNfseRpsEnvio'.to_sym, build_parameters_xmlns) do
74
+ xml << inner_xml
75
+ end
76
+ end.doc
77
+ end
78
+
79
+ def build_consultar_nfse_rps_envio_xmlns()
80
+ {
81
+ 'xmlns:p' => "http://ws.speedgov.com.br/consultar_nfse_rps_envio_v1.xsd",
82
+ 'xsi:schemaLocation' => "http://ws.speedgov.com.br/consultar_nfse_rps_envio_v1.xsd"
83
+ }
84
+ end
85
+
86
+ def build_parameters_xmlns
87
+ {
88
+ 'xmlns:ds' => "http://www.w3.org/2000/09/xmldsig#",
89
+ 'xmlns:p1' => "http://ws.speedgov.com.br/tipos_v1.xsd",
90
+ 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance"
91
+ }.merge(self.send("#{Rnfse::CallChain.caller_method()}ns"))
92
+ end
93
+
94
+ def build_header_xml
95
+ Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
96
+ xml.cabecalho('versao' => '1',
97
+ 'xmlns:p' => 'http://ws.speedgov.com.br/cabecalho_v1.xsd',
98
+ 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
99
+ 'xmlns:p1' => 'http://ws.speedgov.com.br/tipos_v1.xsd',
100
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
101
+ 'xsi:schemaLocation' => 'http://ws.speedgov.com.br/cabecalho_v1.xsd') do
102
+ xml.versaoDados('1')
103
+ xml.parent.namespace = xml.parent.namespace_definitions.first
104
+ end
105
+ end.doc
106
+ end
107
+
108
+ private
109
+
110
+ def prepare_hash(hash)
111
+ hash = camelize_hash(hash)
112
+ hash = wrap_rps(hash)
113
+ hash = clean_numerics(hash)
114
+ hash = alter_aliquota(hash)
115
+ hash = wrap_cpf_cnpj(hash)
116
+ hash = wrap_data_inicial_data_final(hash)
117
+ hash = fix_booleans(hash)
118
+ hash = add_p1_namespace(hash)
119
+ hash
120
+ end
121
+
122
+ # encapsula as tags cpf ou cnpj em uma tag cpfcnpj
123
+ def wrap_cpf_cnpj(hash)
124
+ match = '(IdentificacaoTomador|IntermediarioServico|Tomador)/(Cnpj|Cpf)'
125
+ Rnfse::Hash.replace_key_values(hash, match) do |key, value|
126
+ { :'CpfCnpj' => { key => value } }
127
+ end
128
+ end
129
+
130
+ # encapsula as tags data inicial e data final em periodo emissao
131
+ def wrap_data_inicial_data_final(hash)
132
+ if hash[:'DataFinal'] and hash[:'DataInicial']
133
+ hash[:'PeriodoEmissao'] = {
134
+ :'DataInicial' => hash.delete(:'DataInicial'),
135
+ :'DataFinal' => hash.delete(:'DataFinal')
136
+ }
137
+ end
138
+ hash
139
+ end
140
+
141
+ # alterar o formato da aliquota de 0 a 1 para 0 a 100
142
+ def alter_aliquota(hash)
143
+ Rnfse::Hash.transform_values(hash, 'Aliquota') do |val|
144
+ "%.1f" % (val * 100)
145
+ end
146
+ end
147
+
148
+ def add_p_namespace(hash, regex)
149
+ Rnfse::Hash.transform_keys(hash, regex) do |key|
150
+ "p:#{key.to_s.gsub(/^[^:]+:/, '')}"
151
+ end
152
+ end
153
+
154
+ def add_p1_namespace(hash)
155
+ Rnfse::Hash.transform_keys(hash) { |key| "p1:#{key}".to_sym }
156
+ end
157
+
158
+ end
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe "abrasf_1_0/cancelar_nfse.json" do
5
+ let(:file) do
6
+ File.join($ROOT, 'lib', 'rnfse', 'api', 'abrasf_1_0',
7
+ 'cancelar_nfse.json')
8
+ end
9
+
10
+ describe '#/' do
11
+ it 'deveria validar' do
12
+ expect(JSON::Validator.fully_validate(file, <<-'JSON')).to be_empty
13
+ {
14
+ "identificacaoNfse": {
15
+ "numero": 201400000000001,
16
+ "cnpj": "02.956.773/0001-71",
17
+ "inscricaoMunicipal": "1998010",
18
+ "codigoMunicipio": 5300108
19
+ },
20
+ "codigoCancelamento": "5"
21
+ }
22
+ JSON
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe "abrasf_1_0/consultar_lote_rps.json" do
5
+ let(:file) do
6
+ File.join($ROOT, 'lib', 'rnfse', 'api', 'abrasf_1_0',
7
+ 'consultar_lote_rps.json')
8
+ end
9
+
10
+ describe "#/" do
11
+ it 'deveria validar' do
12
+ expect(JSON::Validator.fully_validate(file, <<-'JSON')).to be_empty
13
+ {
14
+ "prestador": {
15
+ "cnpj": "44.141.526/0001-67",
16
+ "inscricaoMunicipal": "12345678"
17
+ },
18
+ "protocolo": "db1c3e91-6aea-4450-a3fc-5b6a7fba7dc7"
19
+ }
20
+ JSON
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe "abrasf_1_0/consultar_nfse.json" do
5
+ let(:file) do
6
+ File.join($ROOT, 'lib', 'rnfse', 'api', 'abrasf_1_0',
7
+ 'consultar_nfse.json')
8
+ end
9
+
10
+ describe "#/" do
11
+ it 'deveria validar os parametros mínimos' do
12
+ expect(JSON::Validator.fully_validate(file, <<-'JSON')).to be_empty
13
+ {
14
+ "prestador": {
15
+ "cnpj": "12.552.510/0001-50",
16
+ "inscricaoMunicipal": "68"
17
+ }
18
+ }
19
+ JSON
20
+ end
21
+
22
+ it 'deveria validar os parametros completos' do
23
+ expect(JSON::Validator.fully_validate(file, <<-'JSON')).to be_empty
24
+ {
25
+ "prestador": {
26
+ "cnpj": "12.552.510/0001-50",
27
+ "inscricaoMunicipal": "68"
28
+ },
29
+ "numeroNfse": 201400000000001,
30
+ "dataInicial": "2013-04-21T21:42:42-03:00",
31
+ "dataFinal": "2014-04-21T21:42:42-03:00",
32
+ "tomador": {
33
+ "cnpj": "38.421.846/0001-78",
34
+ "inscricaoMunicipal": "12345679"
35
+ },
36
+ "intermediarioServico": {
37
+ "razaoSocial": "Black Mesa Research Facility",
38
+ "cnpj": "62.894.995/0001-39",
39
+ "inscricaoMunicipal": "12345670"
40
+ }
41
+ }
42
+ JSON
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe "abrasf_1_0/consultar_nfse_por_rps.json" do
5
+ let(:file) do
6
+ File.join($ROOT, 'lib', 'rnfse', 'api', 'abrasf_1_0',
7
+ 'consultar_nfse_por_rps.json')
8
+ end
9
+
10
+ describe "#/" do
11
+ it 'deveria validar os parametros mínimos' do
12
+ expect(JSON::Validator.fully_validate(file, <<-'JSON')).to be_empty
13
+ {
14
+ "identificacaoRps": { "numero": 1, "serie": "00000", "tipo": 1 },
15
+ "prestador": {
16
+ "cnpj": "12.552.510/0001-50",
17
+ "inscricaoMunicipal": "68"
18
+ }
19
+ }
20
+ JSON
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe "abrasf_1_0/consultar_situacao_lote_rps.json" do
5
+ let(:file) do
6
+ File.join($ROOT, 'lib', 'rnfse', 'api', 'abrasf_1_0',
7
+ 'consultar_situacao_lote_rps.json')
8
+ end
9
+
10
+ describe "#/" do
11
+ it 'deveria validar' do
12
+ expect(JSON::Validator.fully_validate(file, <<-'JSON')).to be_empty
13
+ {
14
+ "prestador": {
15
+ "cnpj": "44.141.526/0001-67",
16
+ "inscricaoMunicipal": "12345678"
17
+ },
18
+ "protocolo": "db1c3e91-6aea-4450-a3fc-5b6a7fba7dc7"
19
+ }
20
+ JSON
21
+ end
22
+ end
23
+ end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
  describe Rnfse::API::Abrasf10 do
5
5
  let(:certificate) { File.join($ROOT, 'spec', 'fixtures', 'certificate.pem') }
6
6
  let(:key) { File.join($ROOT, 'spec', 'fixtures', 'key.pem') }
7
-
8
7
  let(:client) do
9
8
  Rnfse::API.new(padrao: :abrasf_1_0,
10
9
  namespace: 'http://www.issnetonline.com.br/webservice/nfd',
@@ -12,15 +11,195 @@ describe Rnfse::API::Abrasf10 do
12
11
  certificate: certificate,
13
12
  key: key)
14
13
  end
14
+
15
+ before do
16
+ response = { success: true }
17
+ allow(response).to receive(:body) { response }
18
+ allow(client.soap_client).to receive(:call) { response }
19
+ end
15
20
 
21
+ describe '#operations' do
22
+ it { expect(client.operations).to eq([
23
+ :recepcionar_lote_rps, :consultar_situacao_lote_rps,
24
+ :consultar_nfse_por_rps, :consultar_nfse, :consultar_lote_rps,
25
+ :cancelar_nfse
26
+ ]) }
27
+ end
16
28
 
17
29
  describe '#recepcionar_lote_rps' do
30
+ context 'ao não passar opções certificate e key para assinatura do xml,' do
31
+ let(:client) do
32
+ Rnfse::API.new(padrao: :abrasf_1_0,
33
+ namespace: 'http://www.issnetonline.com.br/webservice/nfd',
34
+ endpoint: 'http://www.issnetonline.com.br/webserviceabrasf/homologacao/servicos.asmx')
35
+ end
36
+
37
+ it { expect { client.recepcionar_lote_rps() }.to raise_error(ArgumentError) }
38
+ end
39
+
40
+ context 'ao não passar opções certificate e key para assinatura do xml,' do
41
+ let(:client) do
42
+ Rnfse::API.new(padrao: :abrasf_1_0,
43
+ namespace: 'http://www.issnetonline.com.br/webservice/nfd',
44
+ endpoint: 'http://www.issnetonline.com.br/webserviceabrasf/homologacao/servicos.asmx')
45
+ end
46
+
47
+ it { expect { client.recepcionar_lote_rps() }.to raise_error(ArgumentError) }
48
+ end
49
+
18
50
  it { expect(client).to respond_to(:recepcionar_lote_rps) }
51
+
52
+ subject do
53
+ client.recepcionar_lote_rps({
54
+ lote_rps: {
55
+ numero_lote: 1,
56
+ cnpj: "14.576.582/0001-63",
57
+ inscricao_municipal: "124762",
58
+ quantidade_rps: 1,
59
+ lista_rps: [
60
+ {
61
+ identificacao_rps: { numero: 15, serie: "8", tipo: 1 },
62
+ data_emissao: Date.parse("2014-06-24T10:00:00").rfc3339,
63
+ natureza_operacao: 1,
64
+ optante_simples_nacional: false,
65
+ incentivador_cultural: false,
66
+ status: 1,
67
+ regime_especial_tributacao: 1,
68
+ servico: {
69
+ valores: {
70
+ valor_servicos: 35,
71
+ valor_pis: 0,
72
+ valor_cofins: 0,
73
+ valor_inss: 0,
74
+ valor_ir: 0,
75
+ valor_csll: 0,
76
+ iss_retido: false,
77
+ valor_iss: 0,
78
+ base_calculo: 35,
79
+ aliquota: 0.05,
80
+ valor_liquido_nfse: 35,
81
+ desconto_incondicionado: 0,
82
+ desconto_condicionado: 0
83
+ },
84
+ item_lista_servico: "8",
85
+ codigo_cnae: "6399-2/00",
86
+ discriminacao: "Borealis",
87
+ codigo_tributacao_municipio: "50000024",
88
+ discriminacao: 'Discriminação da RPS',
89
+ codigo_municipio: 999
90
+ },
91
+ prestador: {
92
+ cnpj: "14.576.582/0001-63",
93
+ inscricao_municipal: "124762"
94
+ },
95
+ tomador: {
96
+ identificacao_tomador: {
97
+ cpf: "935.659.688-34",
98
+ },
99
+ razao_social: 'José Serra',
100
+ endereco: {
101
+ endereco: 'R dos Navegantes 123, 321',
102
+ numero: '123',
103
+ complemento: '321',
104
+ bairro: 'Boa Viagem',
105
+ codigo_municipio: 1,
106
+ uf: 'PE',
107
+ cep: '51021-010'
108
+ }
109
+ }
110
+ }
111
+ ]
112
+ }
113
+ })
114
+ end
115
+
116
+ it { is_expected.not_to be_nil }
117
+ it { is_expected.to be_kind_of(Hash) }
118
+ end
119
+
120
+ describe '#consultar_situacao_lote_rps' do
121
+ it { expect(client).to respond_to(:consultar_situacao_lote_rps) }
122
+
123
+ subject do
124
+ client.consultar_situacao_lote_rps({
125
+ prestador: {
126
+ cnpj: "14.576.582/0001-63",
127
+ inscricao_municipal: "124762"
128
+ },
129
+ protocolo: "79be6415-5562-4728-b6cf-e9388b804c76"
130
+ })
131
+ end
132
+
133
+ it { should_not be_nil }
134
+ it { should be_kind_of(Hash) }
135
+ end
136
+
137
+ describe '#consultar_nfse_por_rps' do
138
+ it { expect(client).to respond_to(:consultar_nfse_por_rps) }
139
+
140
+ subject do
141
+ client.consultar_nfse_por_rps({
142
+ identificacao_rps: { numero: 15, serie: "8", tipo: 1 },
143
+ prestador: {
144
+ cnpj: "14.576.582/0001-63",
145
+ inscricao_municipal: "124762"
146
+ }
147
+ })
148
+ end
149
+
150
+ it { should_not be_nil }
151
+ it { should be_kind_of(Hash) }
152
+ end
153
+
154
+ describe '#consultar_nfse' do
155
+ it { expect(client).to respond_to(:consultar_nfse) }
156
+
157
+ subject do
158
+ client.consultar_nfse({
159
+ prestador: {
160
+ cnpj: "14.576.582/0001-63",
161
+ inscricao_municipal: "124762"
162
+ }
163
+ })
164
+ end
165
+
166
+ it { should_not be_nil }
167
+ it { should be_kind_of(Hash) }
19
168
  end
20
169
 
21
- describe '#consulta_situacao_lote_rps'
22
- describe '#consultar_nfse_por_rps'
23
- describe '#consultar_nfse'
24
- describe '#consultar_lote_rps'
25
- describe '#cancelar_nfse'
170
+ describe '#consultar_lote_rps' do
171
+ it { expect(client).to respond_to(:consultar_lote_rps) }
172
+
173
+ subject do
174
+ client.consultar_lote_rps({
175
+ prestador: {
176
+ cpf: "301.463.748-35",
177
+ inscricao_municipal: "124762"
178
+ },
179
+ protocolo: "db1c3e91-6aea-4450-a3fc-5b6a7fba7dc7"
180
+ })
181
+ end
182
+
183
+ it { should_not be_nil }
184
+ it { should be_kind_of(Hash) }
185
+ end
186
+
187
+ describe '#cancelar_nfse' do
188
+ it { expect(client).to respond_to(:cancelar_nfse) }
189
+
190
+ subject do
191
+ client.cancelar_nfse({
192
+ identificacao_nfse: {
193
+ numero: 201400000000015,
194
+ cnpj: "14.576.582/0001-63",
195
+ inscricao_municipal: "124762",
196
+ codigo_municipio: 999
197
+ },
198
+ codigo_cancelamento: '5'
199
+ })
200
+ end
201
+
202
+ it { should_not be_nil }
203
+ it { should be_kind_of(Hash) }
204
+ end
26
205
  end