br_danfe 0.16.0 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +20 -8
- data/.github/dependabot.yml +19 -0
- data/.rubocop.yml +24 -11
- data/Gemfile.lock +41 -35
- data/Guardfile +3 -1
- data/bin/_guard-core +29 -0
- data/bin/guard +29 -0
- data/br_danfe.gemspec +7 -6
- data/lib/br_danfe/danfe_lib/nfce.rb +11 -9
- data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +30 -16
- data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +3 -3
- data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +44 -53
- data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +16 -15
- data/lib/br_danfe/danfe_lib/nfe.rb +11 -9
- data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -2
- data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +6 -7
- data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +2 -1
- data/lib/br_danfe/helper.rb +1 -1
- data/lib/br_danfe/mdfe.rb +1 -1
- data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +1 -1
- data/lib/br_danfe/mdfe_lib/fisco_control.rb +6 -25
- data/lib/br_danfe/mdfe_lib/header.rb +7 -8
- data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +1 -1
- data/lib/br_danfe/mdfe_lib/notes.rb +1 -1
- data/lib/br_danfe/qr_code.rb +1 -2
- data/lib/br_danfe/version.rb +1 -1
- data/lib/br_danfe.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +3 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +6 -4
- data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +10 -10
- data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +12 -12
- data/spec/br_danfe/danfe_lib/nfce_spec.rb +2 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb +4 -4
- data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +178 -178
- data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +274 -274
- data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +77 -77
- data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +23 -23
- data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +55 -37
- data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +34 -34
- data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +19 -19
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +237 -237
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +3 -2
- data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +16 -16
- data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +13 -13
- data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +76 -76
- data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +40 -40
- data/spec/br_danfe/danfe_lib/nfe_lib/xprod_spec.rb +118 -118
- data/spec/br_danfe/danfe_spec.rb +2 -2
- data/spec/br_danfe/helper_spec.rb +15 -15
- data/spec/br_danfe/mdfe_lib/document_spec.rb +2 -2
- data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +21 -7
- data/spec/br_danfe/mdfe_lib/header_spec.rb +27 -18
- data/spec/br_danfe/mdfe_lib/notes_spec.rb +5 -5
- data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +1 -1
- data/spec/br_danfe/mdfe_spec.rb +4 -5
- data/spec/br_danfe/qr_code_spec.rb +4 -13
- data/spec/br_danfe/xml_spec.rb +6 -6
- data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
- data/spec/fixtures/nfce/lib/document#render.pdf +12 -23
- data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
- data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
- data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
- data/spec/fixtures/nfce/lib/product_list_with_many_products_and_long_names.xml +2 -2
- data/spec/fixtures/nfce/lib/product_list_with_single_product_and_long_name.xml +1 -1
- data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
- data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
- data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +568 -447
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
- data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +945 -0
- data/spec/spec_helper.rb +1 -1
- metadata +38 -16
@@ -11,19 +11,19 @@ describe BrDanfe::DanfeLib::NfeLib::Ticket do
|
|
11
11
|
|
12
12
|
describe '#render' do
|
13
13
|
let(:xml_as_string) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
<<~XML
|
15
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
16
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
17
|
+
<ide>
|
18
|
+
<nNF>1</nNF>
|
19
|
+
<serie>1</serie>
|
20
|
+
</ide>
|
21
|
+
<emit>
|
22
|
+
<xNome>Nome do Remetente Ltda</xNome>
|
23
|
+
</emit>
|
24
|
+
</infNFe>
|
25
|
+
</NFe>
|
26
|
+
XML
|
27
27
|
end
|
28
28
|
|
29
29
|
before do
|
@@ -11,28 +11,28 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
11
11
|
|
12
12
|
describe '#render' do
|
13
13
|
let(:xml_as_string) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
14
|
+
<<~XML
|
15
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
16
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
17
|
+
<transp>
|
18
|
+
<modFrete>0</modFrete>
|
19
|
+
<transporta>
|
20
|
+
<CNPJ>71434064000149</CNPJ>
|
21
|
+
<xNome>Nome do Transportador Ltda</xNome>
|
22
|
+
<IE>964508990089</IE>
|
23
|
+
<xEnder>Rua do Transportador, 456</xEnder>
|
24
|
+
<xMun>Votorantim</xMun>
|
25
|
+
<UF>SP</UF>
|
26
|
+
</transporta>
|
27
|
+
<veicTransp>
|
28
|
+
<placa>ABC-1234</placa>
|
29
|
+
<UF>SP</UF>
|
30
|
+
<RNTC>123456</RNTC>
|
31
|
+
</veicTransp>
|
32
|
+
</transp>
|
33
|
+
</infNFe>
|
34
|
+
</NFe>
|
35
|
+
XML
|
36
36
|
end
|
37
37
|
|
38
38
|
before do
|
@@ -50,15 +50,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
50
50
|
|
51
51
|
context 'when modFrete is 0' do
|
52
52
|
let(:xml_as_string) do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
53
|
+
<<~XML
|
54
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
55
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
56
|
+
<transp>
|
57
|
+
<modFrete>0</modFrete>
|
58
|
+
</transp>
|
59
|
+
</infNFe>
|
60
|
+
</NFe>
|
61
|
+
XML
|
62
62
|
end
|
63
63
|
|
64
64
|
it "renders '0-Emitente' to the pdf" do
|
@@ -72,15 +72,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
72
72
|
|
73
73
|
context 'when modFrete is 1' do
|
74
74
|
let(:xml_as_string) do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
<<~XML
|
76
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
77
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
78
|
+
<transp>
|
79
|
+
<modFrete>1</modFrete>
|
80
|
+
</transp>
|
81
|
+
</infNFe>
|
82
|
+
</NFe>
|
83
|
+
XML
|
84
84
|
end
|
85
85
|
|
86
86
|
it "renders '1-Destinatário' to the pdf" do
|
@@ -94,15 +94,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
94
94
|
|
95
95
|
context 'when modFrete is 2' do
|
96
96
|
let(:xml_as_string) do
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
<<~XML
|
98
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
99
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
100
|
+
<transp>
|
101
|
+
<modFrete>2</modFrete>
|
102
|
+
</transp>
|
103
|
+
</infNFe>
|
104
|
+
</NFe>
|
105
|
+
XML
|
106
106
|
end
|
107
107
|
|
108
108
|
it "renders '2-Terceiros' to the pdf" do
|
@@ -116,15 +116,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
116
116
|
|
117
117
|
context 'when modFrete is 3' do
|
118
118
|
let(:xml_as_string) do
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
119
|
+
<<~XML
|
120
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
121
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
122
|
+
<transp>
|
123
|
+
<modFrete>3</modFrete>
|
124
|
+
</transp>
|
125
|
+
</infNFe>
|
126
|
+
</NFe>
|
127
|
+
XML
|
128
128
|
end
|
129
129
|
|
130
130
|
it "renders '3-Prop/Rem' to the pdf" do
|
@@ -138,15 +138,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
138
138
|
|
139
139
|
context 'when modFrete is 4' do
|
140
140
|
let(:xml_as_string) do
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
141
|
+
<<~XML
|
142
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
143
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
144
|
+
<transp>
|
145
|
+
<modFrete>4</modFrete>
|
146
|
+
</transp>
|
147
|
+
</infNFe>
|
148
|
+
</NFe>
|
149
|
+
XML
|
150
150
|
end
|
151
151
|
|
152
152
|
it "renders '4-Prop/Dest' to the pdf" do
|
@@ -160,15 +160,15 @@ describe BrDanfe::DanfeLib::NfeLib::Transp do
|
|
160
160
|
|
161
161
|
context 'when modFrete is 9' do
|
162
162
|
let(:xml_as_string) do
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
163
|
+
<<~XML
|
164
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
165
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
166
|
+
<transp>
|
167
|
+
<modFrete>9</modFrete>
|
168
|
+
</transp>
|
169
|
+
</infNFe>
|
170
|
+
</NFe>
|
171
|
+
XML
|
172
172
|
end
|
173
173
|
|
174
174
|
it "renders '9-Sem Frete' to the pdf" do
|
@@ -11,38 +11,38 @@ describe BrDanfe::DanfeLib::NfeLib::Vol do
|
|
11
11
|
|
12
12
|
describe '#render' do
|
13
13
|
let(:xml_as_string) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
14
|
+
<<~XML
|
15
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
16
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
17
|
+
<transp>
|
18
|
+
<vol>
|
19
|
+
<qVol>1</qVol>
|
20
|
+
<esp>VOLUMES 1</esp>
|
21
|
+
<marca>DIVERSOS 1</marca>
|
22
|
+
<nVol>1</nVol>
|
23
|
+
<pesoL>1000.000</pesoL>
|
24
|
+
<pesoB>1100.000</pesoB>
|
25
|
+
</vol>
|
26
|
+
<vol>
|
27
|
+
<qVol>2</qVol>
|
28
|
+
<esp>VOLUMES 2</esp>
|
29
|
+
<marca>DIVERSOS 2</marca>
|
30
|
+
<nVol>2</nVol>
|
31
|
+
<pesoL>2000.000</pesoL>
|
32
|
+
<pesoB>2200.000</pesoB>
|
33
|
+
</vol>
|
34
|
+
<vol>
|
35
|
+
<qVol>3</qVol>
|
36
|
+
<esp>VOLUMES 3</esp>
|
37
|
+
<marca>DIVERSOS 3</marca>
|
38
|
+
<nVol>3</nVol>
|
39
|
+
<pesoL>3000.000</pesoL>
|
40
|
+
<pesoB>3300.000</pesoB>
|
41
|
+
</vol>
|
42
|
+
</transp>
|
43
|
+
</infNFe>
|
44
|
+
</NFe>
|
45
|
+
XML
|
46
46
|
end
|
47
47
|
|
48
48
|
before do
|
@@ -64,14 +64,14 @@ describe BrDanfe::DanfeLib::NfeLib::Vol do
|
|
64
64
|
|
65
65
|
context 'when any <vol> tag is found' do
|
66
66
|
let(:xml_as_string) do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
<<~XML
|
68
|
+
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
|
69
|
+
<infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
|
70
|
+
<transp>
|
71
|
+
</transp>
|
72
|
+
</infNFe>
|
73
|
+
</NFe>
|
74
|
+
XML
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'renders blank boxes' do
|
@@ -4,19 +4,19 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
4
4
|
describe '#render' do
|
5
5
|
context 'when has FCI' do
|
6
6
|
let(:xml_fci) do
|
7
|
-
xml =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
xml = <<~XML
|
8
|
+
<det nItem="1">
|
9
|
+
<prod>
|
10
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
11
|
+
<nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
|
12
|
+
</prod>
|
13
|
+
</det>
|
14
|
+
XML
|
15
15
|
|
16
16
|
Nokogiri::XML(xml)
|
17
17
|
end
|
18
18
|
|
19
|
-
subject {
|
19
|
+
subject { described_class.new(xml_fci) }
|
20
20
|
|
21
21
|
it 'returns product + FCI' do
|
22
22
|
expected = 'MONITOR DE ARCO ELETRICO'
|
@@ -32,7 +32,7 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
32
32
|
let(:pST) { 0.00 }
|
33
33
|
let(:vICMSSTRet) { 0.00 }
|
34
34
|
let(:xml) do
|
35
|
-
xml =
|
35
|
+
xml = <<~XML
|
36
36
|
<det nItem="1">
|
37
37
|
<prod>
|
38
38
|
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
@@ -61,12 +61,12 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
61
61
|
</COFINS>
|
62
62
|
</imposto>
|
63
63
|
</det>
|
64
|
-
|
64
|
+
XML
|
65
65
|
|
66
66
|
Nokogiri::XML(xml)
|
67
67
|
end
|
68
68
|
|
69
|
-
subject {
|
69
|
+
subject { described_class.new(xml) }
|
70
70
|
|
71
71
|
context 'when has vBCSTRet' do
|
72
72
|
let(:vBCSTRet) { 50.00 }
|
@@ -115,29 +115,29 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
115
115
|
|
116
116
|
context "when isn't Retido" do
|
117
117
|
let(:xml_st) do
|
118
|
-
xml =
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
118
|
+
xml = <<~XML
|
119
|
+
<det nItem="1">
|
120
|
+
<prod>
|
121
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
122
|
+
</prod>
|
123
|
+
<imposto>
|
124
|
+
<vTotTrib>96.73</vTotTrib>
|
125
|
+
<ICMS>
|
126
|
+
<ICMSSN202>
|
127
|
+
<pMVAST>56.00</pMVAST>
|
128
|
+
<vBCST>479.82</vBCST>
|
129
|
+
<pICMSST>17.00</pICMSST>
|
130
|
+
<vICMSST>29.28</vICMSST>
|
131
|
+
</ICMSSN202>
|
132
|
+
</ICMS>
|
133
|
+
</imposto>
|
134
|
+
</det>
|
135
|
+
XML
|
136
136
|
|
137
137
|
Nokogiri::XML(xml)
|
138
138
|
end
|
139
139
|
|
140
|
-
subject {
|
140
|
+
subject { described_class.new(xml_st) }
|
141
141
|
|
142
142
|
it 'returns product + ST' do
|
143
143
|
expected = 'MONITOR DE ARCO ELETRICO'
|
@@ -151,19 +151,19 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
151
151
|
|
152
152
|
context 'when has infAdProd' do
|
153
153
|
let(:xml_infAdProd) do
|
154
|
-
xml =
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
154
|
+
xml = <<~XML
|
155
|
+
<det nItem="1">
|
156
|
+
<prod>
|
157
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
158
|
+
</prod>
|
159
|
+
<infAdProd>Informações adicionais do produto</infAdProd>
|
160
|
+
</det>
|
161
|
+
XML
|
162
162
|
|
163
163
|
Nokogiri::XML(xml)
|
164
164
|
end
|
165
165
|
|
166
|
-
subject {
|
166
|
+
subject { described_class.new(xml_infAdProd) }
|
167
167
|
|
168
168
|
it 'returns product + infAdProd' do
|
169
169
|
expected = 'MONITOR DE ARCO ELETRICO'
|
@@ -176,27 +176,27 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
176
176
|
|
177
177
|
context 'when has FCP on ICMS00 tag' do
|
178
178
|
let(:xml_fcp) do
|
179
|
-
xml =
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
179
|
+
xml = <<~XML
|
180
|
+
<det nItem="1">
|
181
|
+
<prod>
|
182
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
183
|
+
</prod>
|
184
|
+
<imposto>
|
185
|
+
<vTotTrib>23.56</vTotTrib>
|
186
|
+
<ICMS>
|
187
|
+
<ICMS00>
|
188
|
+
<vFCP>4.71</vFCP>
|
189
|
+
<pFCP>2.00</pFCP>
|
190
|
+
</ICMS00>
|
191
|
+
</ICMS>
|
192
|
+
</imposto>
|
193
|
+
</det>
|
194
|
+
XML
|
195
195
|
|
196
196
|
Nokogiri::XML(xml)
|
197
197
|
end
|
198
198
|
|
199
|
-
subject {
|
199
|
+
subject { described_class.new(xml_fcp) }
|
200
200
|
|
201
201
|
it 'returns product + FCP' do
|
202
202
|
expected = 'MONITOR DE ARCO ELETRICO'
|
@@ -209,35 +209,35 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
209
209
|
|
210
210
|
context 'when has FCI + ST + infAdProd + FCP' do
|
211
211
|
let(:xml_IFC_ST_infAdProd) do
|
212
|
-
xml =
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
212
|
+
xml = <<~XML
|
213
|
+
<det nItem="1">
|
214
|
+
<prod>
|
215
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
216
|
+
<nFCI>12232531-74B2-4FDD-87A6-CF0AD3E55386</nFCI>
|
217
|
+
</prod>
|
218
|
+
<imposto>
|
219
|
+
<vTotTrib>96.73</vTotTrib>
|
220
|
+
<ICMS>
|
221
|
+
<ICMSSN202>
|
222
|
+
<pMVAST>56.00</pMVAST>
|
223
|
+
<vBCST>479.82</vBCST>
|
224
|
+
<pICMSST>17.00</pICMSST>
|
225
|
+
<vICMSST>29.28</vICMSST>
|
226
|
+
</ICMSSN202>
|
227
|
+
<ICMS00>
|
228
|
+
<vFCP>4.71</vFCP>
|
229
|
+
<pFCP>2.00</pFCP>
|
230
|
+
</ICMS00>
|
231
|
+
</ICMS>
|
232
|
+
</imposto>
|
233
|
+
<infAdProd>Informações adicionais do produto</infAdProd>
|
234
|
+
</det>
|
235
|
+
XML
|
236
236
|
|
237
237
|
Nokogiri::XML(xml)
|
238
238
|
end
|
239
239
|
|
240
|
-
subject {
|
240
|
+
subject { described_class.new(xml_IFC_ST_infAdProd) }
|
241
241
|
|
242
242
|
it 'returns product + FCI + ST + infAdProd' do
|
243
243
|
expected = 'MONITOR DE ARCO ELETRICO'
|
@@ -256,28 +256,28 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
256
256
|
|
257
257
|
context 'when FCP is not in a ICMS00 tag' do
|
258
258
|
let(:xml_fcp) do
|
259
|
-
xml =
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
259
|
+
xml = <<~XML
|
260
|
+
<det nItem="1">
|
261
|
+
<prod>
|
262
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
263
|
+
</prod>
|
264
|
+
<imposto>
|
265
|
+
<vTotTrib>23.56</vTotTrib>
|
266
|
+
<ICMS>
|
267
|
+
<ICMS10>
|
268
|
+
<vBCFCP>235.50</vBCFCP>
|
269
|
+
<vFCP>4.71</vFCP>
|
270
|
+
<pFCP>2.00</pFCP>
|
271
|
+
</ICMS10>
|
272
|
+
</ICMS>
|
273
|
+
</imposto>
|
274
|
+
</det>
|
275
|
+
XML
|
276
276
|
|
277
277
|
Nokogiri::XML(xml)
|
278
278
|
end
|
279
279
|
|
280
|
-
subject {
|
280
|
+
subject { described_class.new(xml_fcp) }
|
281
281
|
|
282
282
|
it 'returns product + FCP' do
|
283
283
|
expected = 'MONITOR DE ARCO ELETRICO'
|
@@ -290,28 +290,28 @@ describe BrDanfe::DanfeLib::NfeLib::Xprod do
|
|
290
290
|
|
291
291
|
context 'when has FCP ST' do
|
292
292
|
let(:xml_fcp) do
|
293
|
-
xml =
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
293
|
+
xml = <<~XML
|
294
|
+
<det nItem="1">
|
295
|
+
<prod>
|
296
|
+
<xProd>MONITOR DE ARCO ELETRICO</xProd>
|
297
|
+
</prod>
|
298
|
+
<imposto>
|
299
|
+
<vTotTrib>23.56</vTotTrib>
|
300
|
+
<ICMS>
|
301
|
+
<ICMS30>
|
302
|
+
<vBCFCPST>235.50</vBCFCPST>
|
303
|
+
<vFCPST>0.71</vFCPST>
|
304
|
+
<pFCPST>2.00</pFCPST>
|
305
|
+
</ICMS30>
|
306
|
+
</ICMS>
|
307
|
+
</imposto>
|
308
|
+
</det>
|
309
|
+
XML
|
310
310
|
|
311
311
|
Nokogiri::XML(xml)
|
312
312
|
end
|
313
313
|
|
314
|
-
subject {
|
314
|
+
subject { described_class.new(xml_fcp) }
|
315
315
|
|
316
316
|
it 'returns product + FCP' do
|
317
317
|
expected = 'MONITOR DE ARCO ELETRICO'
|