nfse_gyn 0.1.1 → 0.1.2
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/lib/nfse_gyn/consultar_nfse.rb +3 -7
- data/lib/nfse_gyn/gerar_nfse.rb +2 -6
- data/lib/nfse_gyn/response.rb +19 -0
- data/lib/nfse_gyn/version.rb +1 -1
- data/spec/lib/gerar_nfse_spec.rb +20 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c710d085d453641726363fae2c007fa433709101
|
4
|
+
data.tar.gz: fe99136b5678a938524376700d459e11afe99f8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ce801ccd98b3b7d0d597617a7c90bd455ac8ea8e19ef918b31833682cb0484763cbe7366dcfd7031c8dfe0558ac2597f076e0e448e60094003f568837a293b6
|
7
|
+
data.tar.gz: 533108f718d01033ba661f576cbf7b1f65f1efade0c8df96898cc105aae635a5037c049f58f52e6f888e94e966db451614cde270102da2537660bccb3703d0bb
|
@@ -46,16 +46,12 @@ module NfseGyn
|
|
46
46
|
@content ||= output['ConsultarNfseRpsResposta']
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
content['CompNfse']
|
51
|
-
end
|
52
|
-
|
53
|
-
def verification_code
|
54
|
-
content['CompNfse']['Nfse']['InfNfse']['CodigoVerificacao'] if successful?
|
49
|
+
def body
|
50
|
+
content['CompNfse']
|
55
51
|
end
|
56
52
|
|
57
53
|
def error?
|
58
|
-
!
|
54
|
+
!body || content['ListaMensagemRetorno']['MensagemRetorno']['Codigo'] != 'L000'
|
59
55
|
end
|
60
56
|
end
|
61
57
|
end
|
data/lib/nfse_gyn/gerar_nfse.rb
CHANGED
@@ -26,12 +26,8 @@ module NfseGyn
|
|
26
26
|
@content ||= output['GerarNfseResposta']
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
content['ListaNfse']['CompNfse']
|
31
|
-
end
|
32
|
-
|
33
|
-
def verification_code
|
34
|
-
content['ListaNfse']['CompNfse']['Nfse']['InfNfse']['CodigoVerificacao'] if successful?
|
29
|
+
def body
|
30
|
+
content['ListaNfse']['CompNfse']
|
35
31
|
end
|
36
32
|
|
37
33
|
def error?
|
data/lib/nfse_gyn/response.rb
CHANGED
@@ -12,6 +12,25 @@ module NfseGyn
|
|
12
12
|
!error?
|
13
13
|
end
|
14
14
|
|
15
|
+
def link
|
16
|
+
<<-URL.squish
|
17
|
+
https://www2.goiania.go.gov.br/sistemas/snfse/asp/snfse00200w0.asp?inscricao=#{municipal_registration}¬a=#{number}&verificador=#{verification_code}
|
18
|
+
URL
|
19
|
+
end
|
20
|
+
|
21
|
+
def municipal_registration
|
22
|
+
p = body['Nfse']['InfNfse']['DeclaracaoPrestacaoServico']['Prestador']
|
23
|
+
p['IdentificacaoPrestador']['InscricaoMunicipal'] if successful?
|
24
|
+
end
|
25
|
+
|
26
|
+
def number
|
27
|
+
body['Nfse']['InfNfse']['Numero'] if successful?
|
28
|
+
end
|
29
|
+
|
30
|
+
def verification_code
|
31
|
+
body['Nfse']['InfNfse']['CodigoVerificacao'] if successful?
|
32
|
+
end
|
33
|
+
|
15
34
|
def error?
|
16
35
|
content['ListaMensagemRetorno'].present?
|
17
36
|
end
|
data/lib/nfse_gyn/version.rb
CHANGED
data/spec/lib/gerar_nfse_spec.rb
CHANGED
@@ -19,7 +19,7 @@ RSpec.describe NfseGyn::GerarNfse do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#execute!' do
|
22
|
-
let(:response) { File.read(fixture_file_path('xmls/valid_gerar_nfse_response.xml'))}
|
22
|
+
let(:response) { File.read(fixture_file_path('xmls/valid_gerar_nfse_response.xml')) }
|
23
23
|
let(:xml_payload) { File.read(fixture_file_path('xmls/valid_gerar_nfse_request.xml')) }
|
24
24
|
let(:request_payload) { "<ArquivoXML><![CDATA[#{xml_payload}]]></ArquivoXML>" }
|
25
25
|
|
@@ -28,16 +28,31 @@ RSpec.describe NfseGyn::GerarNfse do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'valid request' do
|
31
|
-
|
32
31
|
before { savon.expects(:gerar_nfse).with(message: request_payload).returns(response) }
|
33
32
|
|
34
33
|
it 'returns a valid response' do
|
35
34
|
expect(subject.execute!).to be_successful
|
36
35
|
end
|
36
|
+
|
37
|
+
it 'response number is equals 370' do
|
38
|
+
expect(subject.execute!.number).to eq('370')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'response verification_code is equals MB94-C3ZA' do
|
42
|
+
expect(subject.execute!.verification_code).to eq('MB94-C3ZA')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'response municipal_registration is equals 1300687' do
|
46
|
+
expect(subject.execute!.municipal_registration).to eq('1300687')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'response link is equals nf link' do
|
50
|
+
expect(subject.execute!.link).to eq('https://www2.goiania.go.gov.br/sistemas/snfse/asp/snfse00200w0.asp?inscricao=1300687¬a=370&verificador=MB94-C3ZA')
|
51
|
+
end
|
37
52
|
end
|
38
53
|
|
39
54
|
context 'invalid request' do
|
40
|
-
let(:response) { File.read(fixture_file_path('xmls/invalid_gerar_nfse_response.xml'))}
|
55
|
+
let(:response) { File.read(fixture_file_path('xmls/invalid_gerar_nfse_response.xml')) }
|
41
56
|
|
42
57
|
before { savon.expects(:gerar_nfse).with(message: request_payload).returns(response) }
|
43
58
|
|
@@ -53,13 +68,13 @@ RSpec.describe NfseGyn::GerarNfse do
|
|
53
68
|
context 'when mock data' do
|
54
69
|
before do
|
55
70
|
NfseGyn.configuration.mock_mode = true
|
56
|
-
allow(NfseGyn::MockGerarNfseResponse).to receive(:new).and_return(
|
71
|
+
allow(NfseGyn::MockGerarNfseResponse).to receive(:new).and_return('mock response')
|
57
72
|
end
|
58
73
|
|
59
74
|
after { NfseGyn.configuration.mock_mode = false }
|
60
75
|
|
61
76
|
it 'should return a MockConsultarNfseResponse' do
|
62
|
-
expect(subject.execute!).to eq(
|
77
|
+
expect(subject.execute!).to eq('mock response')
|
63
78
|
end
|
64
79
|
end
|
65
80
|
end
|