br_danfe 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +25 -25
  3. data/lib/br_danfe/danfe.rb +52 -25
  4. data/lib/br_danfe/danfe_lib/det_body.rb +105 -46
  5. data/lib/br_danfe/danfe_lib/document.rb +3 -7
  6. data/lib/br_danfe/danfe_lib/emit_header.rb +36 -20
  7. data/lib/br_danfe/danfe_lib/infadic.rb +12 -12
  8. data/lib/br_danfe/danfe_lib/issqn.rb +19 -8
  9. data/lib/br_danfe/version.rb +1 -1
  10. data/spec/features/danfe_spec.rb +45 -0
  11. data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +1932 -332
  12. data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +1182 -138
  13. data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +809 -43
  14. data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +809 -43
  15. data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +807 -41
  16. data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +22414 -0
  17. data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +21442 -0
  18. data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +807 -41
  19. data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +1012 -0
  20. data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +10124 -0
  21. data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +10124 -0
  22. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +792 -0
  23. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +88 -8
  24. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +85 -5
  25. data/spec/fixtures/nfe/lib/infadic#render-footer_information.pdf +111 -0
  26. data/spec/fixtures/nfe/lib/{issqn#render.pdf → issqn#render-with_issqn.pdf} +0 -0
  27. data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +129 -0
  28. data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +54 -0
  29. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +2190 -1067
  30. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +2183 -1059
  31. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +8803 -3208
  32. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +1825 -1258
  33. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +8609 -3014
  34. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +2664 -1541
  35. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +4701 -1909
  36. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +8660 -0
  37. data/spec/fixtures/nfe/v3.10/with_footer.xml +621 -0
  38. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +8646 -0
  39. data/spec/fixtures/nfe/v3.10/with_issqn.xml +621 -0
  40. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +25420 -0
  41. data/spec/fixtures/nfe/v3.10/with_three_pages.xml +1281 -0
  42. data/spec/fixtures/nfe/v3.10/withot_issqn.fixture.pdf +10338 -0
  43. data/spec/fixtures/nfe/v3.10/withot_issqn.xml +688 -0
  44. data/spec/lib/danfe_lib/det_body_spec.rb +350 -264
  45. data/spec/lib/danfe_lib/emit_header_spec.rb +42 -18
  46. data/spec/lib/danfe_lib/issqn_spec.rb +39 -7
  47. metadata +38 -14
  48. data/lib/br_danfe/danfe_lib/det_header.rb +0 -40
  49. data/lib/br_danfe/danfe_lib/emit.rb +0 -23
  50. data/spec/fixtures/nfe/lib/det_header#render.pdf +0 -207
  51. data/spec/fixtures/nfe/lib/emit#render.pdf +0 -143
  52. data/spec/lib/danfe_lib/det_header_spec.rb +0 -26
  53. data/spec/lib/danfe_lib/emit_spec.rb +0 -60
@@ -1,143 +0,0 @@
1
- %PDF-1.3
2
- %����
3
- 1 0 obj
4
- << /Creator <feff0050007200610077006e>
5
- /Producer <feff0050007200610077006e>
6
- >>
7
- endobj
8
- 2 0 obj
9
- << /Type /Catalog
10
- /Pages 3 0 R
11
- >>
12
- endobj
13
- 3 0 obj
14
- << /Type /Pages
15
- /Count 1
16
- /Kids [5 0 R]
17
- >>
18
- endobj
19
- 4 0 obj
20
- << /Length 1262
21
- >>
22
- stream
23
- q
24
- 0.3 w
25
- 21.2598 631.8425 284.5984 22.6772 re
26
- S
27
-
28
- BT
29
- 23.2598 648.4217 Td
30
- /F1.0 6 Tf
31
- [<4e> 35 <41> 111 <545552455a412044> 40 <41204f50455241> 40 <c7c3> 55 <4f>] TJ
32
- ET
33
-
34
-
35
- BT
36
- 23.2598 634.6897 Td
37
- /F1.0 10 Tf
38
- [<56> 111 <656e6461732064652070726f647563616f20646f206573746162656c6563696d656e746f>] TJ
39
- ET
40
-
41
- 305.8583 631.8425 269.8583 22.6772 re
42
- S
43
-
44
- BT
45
- 307.8583 648.4217 Td
46
- /F1.0 6 Tf
47
- [<5052> 40 <4f> 40 <54> 18 <4f434f4c4f2044452041> 55 <5554> 18 <4f52495a41> 40 <c7c3> 55 <4f2044452055534f>] TJ
48
- ET
49
-
50
-
51
- BT
52
- 360.2274 634.6897 Td
53
- /F1.0 10 Tf
54
- [<3332353131303031323836363332302032392f31302f323031312031343a33373a3039>] TJ
55
- ET
56
-
57
- 21.2598 609.1654 180.2835 22.6772 re
58
- S
59
-
60
- BT
61
- 23.2598 625.7445 Td
62
- /F1.0 6 Tf
63
- [<494e53435249c7c3> 55 <4f20455354> 93 <414455> 40 <414c>] TJ
64
- ET
65
-
66
-
67
- BT
68
- 23.2598 612.0125 Td
69
- /F1.0 10 Tf
70
- [<3532362e3932362e3331332e353533>] TJ
71
- ET
72
-
73
- 201.5433 609.1654 194.4567 22.6772 re
74
- S
75
-
76
- BT
77
- 203.5433 625.7445 Td
78
- /F1.0 6 Tf
79
- [<494e53432e455354> 93 <414455> 40 <414c20444f205355425354> 74 <2e2054524942> 10 <5554> 93 <c152494f>] TJ
80
- ET
81
-
82
-
83
- BT
84
- 203.5433 612.0125 Td
85
- /F1.0 10 Tf
86
- [<3631312e3732342e3039322e303339>] TJ
87
- ET
88
-
89
- 396.0 609.1654 179.7165 22.6772 re
90
- S
91
-
92
- BT
93
- 398.0 625.7445 Td
94
- /F1.0 6 Tf
95
- [<434e504a>] TJ
96
- ET
97
-
98
-
99
- BT
100
- 398.0 612.0125 Td
101
- /F1.0 10 Tf
102
- [<36322e3031332e3239342f303030312d3433>] TJ
103
- ET
104
-
105
- Q
106
-
107
- endstream
108
- endobj
109
- 5 0 obj
110
- << /Type /Page
111
- /Parent 3 0 R
112
- /MediaBox [0 0 595.28 841.89]
113
- /Contents 4 0 R
114
- /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
115
- /Font << /F1.0 6 0 R
116
- >>
117
- >>
118
- >>
119
- endobj
120
- 6 0 obj
121
- << /Type /Font
122
- /Subtype /Type1
123
- /BaseFont /Times-Roman
124
- /Encoding /WinAnsiEncoding
125
- >>
126
- endobj
127
- xref
128
- 0 7
129
- 0000000000 65535 f
130
- 0000000015 00000 n
131
- 0000000109 00000 n
132
- 0000000158 00000 n
133
- 0000000215 00000 n
134
- 0000001529 00000 n
135
- 0000001709 00000 n
136
- trailer
137
- << /Size 7
138
- /Root 2 0 R
139
- /Info 1 0 R
140
- >>
141
- startxref
142
- 1808
143
- %%EOF
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe BrDanfe::DanfeLib::DetHeader do
4
- let(:base_dir) { "./spec/fixtures/nfe/lib/"}
5
- let(:output_pdf) { "#{base_dir}output.pdf" }
6
-
7
- let(:pdf) { BrDanfe::DanfeLib::Document.new }
8
- let(:xml) { BrDanfe::DanfeLib::XML.new(xml_as_string) }
9
-
10
- subject { described_class.new(pdf) }
11
-
12
- describe "#render" do
13
- before do
14
- subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
16
- end
17
-
18
- it "renders xml to the pdf" do
19
- expect(File.exist?(output_pdf)).to be_falsey
20
-
21
- pdf.render_file output_pdf
22
-
23
- expect("#{base_dir}det_header#render.pdf").to have_same_content_of file: output_pdf
24
- end
25
- end
26
- end
@@ -1,60 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe BrDanfe::DanfeLib::Emit do
4
- let(:base_dir) { "./spec/fixtures/nfe/lib/"}
5
- let(:output_pdf) { "#{base_dir}output.pdf" }
6
-
7
- let(:pdf) { BrDanfe::DanfeLib::Document.new }
8
- let(:xml) { BrDanfe::DanfeLib::XML.new(xml_as_string) }
9
-
10
- subject { described_class.new(pdf, xml) }
11
-
12
- describe "#render" do
13
- let(:xml_as_string) do
14
- <<-eos
15
- <nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
16
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
17
- <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
18
- <ide>
19
- <natOp>Vendas de producao do estabelecimento</natOp>
20
- </ide>
21
- <emit>
22
- <CNPJ>62013294000143</CNPJ>
23
- <enderEmit>
24
- <UF>SP</UF>
25
- </enderEmit>
26
- <IE>526926313553</IE>
27
- <IEST>611724092039</IEST>
28
- </emit>
29
- <dest>
30
- <CNPJ>08143375000112</CNPJ>
31
- <enderDest>
32
- <UF>SP</UF>
33
- </enderDest>
34
- </dest>
35
- </infNFe>
36
- </NFe>
37
- <protNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
38
- <infProt Id="ID325110012866320">
39
- <dhRecbto>2011-10-29T14:37:09</dhRecbto>
40
- <nProt>325110012866320</nProt>
41
- </infProt>
42
- </protNFe>
43
- </nfeProc>
44
- eos
45
- end
46
-
47
- before do
48
- subject.render
49
- File.delete(output_pdf) if File.exist?(output_pdf)
50
- end
51
-
52
- it "renders xml to the pdf" do
53
- expect(File.exist?(output_pdf)).to be_falsey
54
-
55
- pdf.render_file output_pdf
56
-
57
- expect("#{base_dir}emit#render.pdf").to have_same_content_of file: output_pdf
58
- end
59
- end
60
- end