br_danfe 0.14.5 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/Gemfile.lock +47 -36
- data/Guardfile +2 -2
- data/README.md +39 -0
- data/br_danfe.gemspec +6 -5
- data/lib/br_danfe/danfe.rb +8 -5
- data/lib/br_danfe/danfe_lib/base.rb +2 -2
- data/lib/br_danfe/danfe_lib/nfce.rb +15 -13
- 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 +24 -10
- 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 +39 -27
- data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +1 -1
- data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +5 -5
- data/lib/br_danfe/document_builder.rb +1 -1
- data/lib/br_danfe/helper.rb +11 -7
- data/lib/br_danfe/mdfe.rb +55 -0
- data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +24 -0
- data/lib/br_danfe/mdfe_lib/document.rb +26 -0
- data/lib/br_danfe/mdfe_lib/drivers.rb +70 -0
- data/lib/br_danfe/mdfe_lib/fisco_control.rb +40 -0
- data/lib/br_danfe/mdfe_lib/header.rb +78 -0
- data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +69 -0
- data/lib/br_danfe/mdfe_lib/notes.rb +94 -0
- data/lib/br_danfe/mdfe_lib/totalizer.rb +57 -0
- data/lib/br_danfe/mdfe_lib/vehicles.rb +80 -0
- data/lib/br_danfe/qr_code.rb +22 -0
- data/lib/br_danfe/version.rb +1 -1
- data/lib/br_danfe.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +1 -1
- data/spec/br_danfe/danfe_lib/nfce_spec.rb +12 -1
- data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +2 -2
- data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +3 -3
- data/spec/br_danfe/danfe_lib/nfe_spec.rb +17 -1
- data/spec/br_danfe/danfe_spec.rb +16 -0
- data/spec/br_danfe/helper_spec.rb +12 -0
- data/spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb +35 -0
- data/spec/br_danfe/mdfe_lib/document_spec.rb +20 -0
- data/spec/br_danfe/mdfe_lib/drivers_spec.rb +88 -0
- data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +55 -0
- data/spec/br_danfe/mdfe_lib/header_spec.rb +126 -0
- data/spec/br_danfe/mdfe_lib/mdfe_identification_spec.rb +104 -0
- data/spec/br_danfe/mdfe_lib/notes_spec.rb +97 -0
- data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +63 -0
- data/spec/br_danfe/mdfe_lib/vehicles_spec.rb +66 -0
- data/spec/br_danfe/mdfe_spec.rb +46 -0
- data/spec/br_danfe/{danfe_lib/nfce_lib/qr_code_spec.rb → qr_code_spec.rb} +10 -5
- data/spec/fixtures/cce/lib/barcode#render.pdf +5 -3
- data/spec/fixtures/cce/v1.00/cce.fixture.pdf +15 -13
- data/spec/fixtures/mdfe/lib/document#render.pdf +0 -0
- data/spec/fixtures/mdfe/lib/document#text.align.pdf +0 -0
- data/spec/fixtures/mdfe/lib/document#text.pad.pdf +0 -0
- data/spec/fixtures/mdfe/lib/document#text.simple.pdf +0 -0
- data/spec/fixtures/mdfe/lib/document#text.size.pdf +0 -0
- data/spec/fixtures/mdfe/lib/document#text.style.pdf +0 -0
- data/spec/fixtures/mdfe/lib/fisco_control#barcode.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-qr-code.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-with_logo.pdf +0 -0
- data/spec/fixtures/mdfe/lib/header#render-without_logo.pdf +0 -0
- data/spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf +1945 -0
- data/spec/fixtures/mdfe/lib/mdfe.fixture.pdf +1286 -0
- data/spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf +1943 -0
- data/spec/fixtures/mdfe/lib/xml-mdfe-multiples-pages.xml +116 -0
- data/spec/fixtures/mdfe/lib/xml-mdfe.xml +250 -0
- data/spec/fixtures/nfce/lib/document#render.pdf +22 -33
- 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/qr_code#render.pdf +0 -0
- 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 +1350 -0
- 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/dest#render-v2.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +0 -0
- data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +0 -0
- data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +662 -662
- data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +410 -410
- data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +272 -272
- data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +272 -272
- data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +270 -270
- data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +6213 -6213
- data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +6083 -6083
- data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +270 -270
- data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +272 -272
- data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +2859 -2859
- data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +2859 -2859
- data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-blank.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +0 -0
- data/spec/fixtures/nfe/lib/document#lie-valid.pdf +0 -0
- data/spec/fixtures/nfe/lib/dup#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +511 -509
- data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +510 -508
- data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +507 -505
- data/spec/fixtures/nfe/lib/icmstot#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#address-shipment.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +0 -0
- data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +0 -0
- data/spec/fixtures/nfe/lib/ticket#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +0 -0
- data/spec/fixtures/nfe/lib/transp#render.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +0 -0
- data/spec/fixtures/nfe/lib/vol#render.pdf +0 -0
- data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +733 -733
- data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +730 -730
- data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +3449 -3445
- data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +929 -927
- data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +3424 -3420
- data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +1178 -1176
- data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +11471 -0
- data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +1495 -1495
- data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +2444 -2444
- data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +2142 -2142
- data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +7096 -7096
- data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +2811 -2811
- data/spec/fixtures/qr_code/qr_code#render.pdf +0 -0
- metadata +92 -41
- data/lib/br_danfe/danfe_lib/nfce_lib/qr_code.rb +0 -25
- data/lib/br_danfe/danfe_lib/nfe_lib/cep.rb +0 -11
- data/spec/br_danfe/danfe_lib/nfe_lib/cep_spec.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ddb33657303d50b425d475e7c493dde5272ed1d4e4bd7d96f9eab45a8f5c600
|
4
|
+
data.tar.gz: 67ba29fde1351c27b7ff6479a6bfd5d803cc843b4a756f9594bc53c82f44a3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e99eb16d42eff7bf889afa5d697f75bdba24ebcc091b8713d55fa83e6950f5b2bc4269d7401292594dbcd5585b1698cd2fbfa3ec45fb96dadb94d0f117da4bfb
|
7
|
+
data.tar.gz: cf348dbad5f7117cda63a7e3d88226c35900a99cfe3ae3dca13e9fab3b093a195c0e7a5331877275b9580ade584422fcb9a63f6b120f7f279eaaf9b647b1ae79
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.4
|
data/Gemfile.lock
CHANGED
@@ -1,39 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
br_danfe (0.
|
5
|
-
barby (= 0.
|
4
|
+
br_danfe (0.17.0)
|
5
|
+
barby (= 0.6.8)
|
6
6
|
br_documents (>= 0.1.3)
|
7
7
|
i18n (>= 0.8.6)
|
8
8
|
nokogiri (>= 1.8)
|
9
|
-
prawn (~> 2.0)
|
9
|
+
prawn (~> 2.4.0)
|
10
10
|
prawn-table (= 0.2.2)
|
11
11
|
rqrcode (~> 1.1.1)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
Ascii85 (1.1.0)
|
17
|
+
activemodel (6.1.4)
|
18
|
+
activesupport (= 6.1.4)
|
19
|
+
activesupport (6.1.4)
|
19
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
21
|
i18n (>= 1.6, < 2)
|
21
22
|
minitest (>= 5.1)
|
22
23
|
tzinfo (~> 2.0)
|
23
24
|
zeitwerk (~> 2.3)
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
afm (0.2.2)
|
26
|
+
ast (2.4.2)
|
27
|
+
barby (0.6.8)
|
28
|
+
br_documents (0.2.1)
|
27
29
|
activemodel (>= 4.0.0)
|
28
30
|
i18n (>= 0.6.5)
|
29
31
|
byebug (11.1.3)
|
30
32
|
chunky_png (1.4.0)
|
31
33
|
coderay (1.1.3)
|
32
|
-
concurrent-ruby (1.1.
|
34
|
+
concurrent-ruby (1.1.9)
|
33
35
|
diff-lcs (1.4.4)
|
34
|
-
docile (1.
|
35
|
-
ffi (1.
|
36
|
-
formatador (0.
|
36
|
+
docile (1.4.0)
|
37
|
+
ffi (1.15.3)
|
38
|
+
formatador (0.3.0)
|
37
39
|
guard (2.16.2)
|
38
40
|
formatador (>= 0.2.4)
|
39
41
|
listen (>= 2.7, < 4.0)
|
@@ -48,41 +50,48 @@ GEM
|
|
48
50
|
guard (~> 2.1)
|
49
51
|
guard-compat (~> 1.1)
|
50
52
|
rspec (>= 2.99.0, < 4.0)
|
53
|
+
hashery (2.1.2)
|
51
54
|
i18n (1.8.10)
|
52
55
|
concurrent-ruby (~> 1.0)
|
53
56
|
jaro_winkler (1.5.4)
|
54
|
-
json (2.
|
55
|
-
listen (3.
|
57
|
+
json (2.5.1)
|
58
|
+
listen (3.5.1)
|
56
59
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
57
60
|
rb-inotify (~> 0.9, >= 0.9.10)
|
58
61
|
lumberjack (1.2.8)
|
59
62
|
method_source (1.0.0)
|
60
|
-
mini_portile2 (2.5.1)
|
61
63
|
minitest (5.14.4)
|
62
64
|
nenv (0.3.0)
|
63
|
-
nokogiri (1.11.
|
64
|
-
mini_portile2 (~> 2.5.0)
|
65
|
+
nokogiri (1.11.7-x86_64-linux)
|
65
66
|
racc (~> 1.4)
|
66
67
|
notiffany (0.1.3)
|
67
68
|
nenv (~> 0.1)
|
68
69
|
shellany (~> 0.0)
|
69
|
-
parallel (1.
|
70
|
-
parser (2.
|
71
|
-
ast (~> 2.4.
|
72
|
-
pdf-core (0.
|
73
|
-
|
74
|
-
pdf-
|
75
|
-
|
70
|
+
parallel (1.20.1)
|
71
|
+
parser (3.0.2.0)
|
72
|
+
ast (~> 2.4.1)
|
73
|
+
pdf-core (0.9.0)
|
74
|
+
pdf-inspector (1.3.0)
|
75
|
+
pdf-reader (>= 1.0, < 3.0.a)
|
76
|
+
pdf-reader (2.5.0)
|
77
|
+
Ascii85 (~> 1.0)
|
78
|
+
afm (~> 0.2.1)
|
79
|
+
hashery (~> 2.0)
|
80
|
+
ruby-rc4
|
81
|
+
ttfunk
|
82
|
+
prawn (2.4.0)
|
83
|
+
pdf-core (~> 0.9.0)
|
84
|
+
ttfunk (~> 1.7)
|
76
85
|
prawn-table (0.2.2)
|
77
86
|
prawn (>= 1.3.0, < 3.0.0)
|
78
|
-
pry (0.
|
87
|
+
pry (0.14.1)
|
79
88
|
coderay (~> 1.1)
|
80
89
|
method_source (~> 1.0)
|
81
|
-
psych (
|
90
|
+
psych (4.0.1)
|
82
91
|
racc (1.5.2)
|
83
92
|
rainbow (3.0.0)
|
84
|
-
rake (13.0.
|
85
|
-
rb-fsevent (0.
|
93
|
+
rake (13.0.6)
|
94
|
+
rb-fsevent (0.11.0)
|
86
95
|
rb-inotify (0.10.1)
|
87
96
|
ffi (~> 1.0)
|
88
97
|
rqrcode (1.1.2)
|
@@ -93,15 +102,15 @@ GEM
|
|
93
102
|
rspec-core (~> 3.10.0)
|
94
103
|
rspec-expectations (~> 3.10.0)
|
95
104
|
rspec-mocks (~> 3.10.0)
|
96
|
-
rspec-core (3.10.
|
105
|
+
rspec-core (3.10.1)
|
97
106
|
rspec-support (~> 3.10.0)
|
98
|
-
rspec-expectations (3.10.
|
107
|
+
rspec-expectations (3.10.1)
|
99
108
|
diff-lcs (>= 1.2.0, < 2.0)
|
100
109
|
rspec-support (~> 3.10.0)
|
101
|
-
rspec-mocks (3.10.
|
110
|
+
rspec-mocks (3.10.2)
|
102
111
|
diff-lcs (>= 1.2.0, < 2.0)
|
103
112
|
rspec-support (~> 3.10.0)
|
104
|
-
rspec-support (3.10.
|
113
|
+
rspec-support (3.10.2)
|
105
114
|
rubocop (0.67.0)
|
106
115
|
jaro_winkler (~> 1.5.1)
|
107
116
|
parallel (~> 1.10)
|
@@ -112,14 +121,15 @@ GEM
|
|
112
121
|
unicode-display_width (>= 1.4.0, < 1.6)
|
113
122
|
rubocop-performance (1.1.0)
|
114
123
|
rubocop (>= 0.67.0)
|
115
|
-
ruby-progressbar (1.
|
124
|
+
ruby-progressbar (1.11.0)
|
125
|
+
ruby-rc4 (0.1.5)
|
116
126
|
shellany (0.0.1)
|
117
127
|
simplecov (0.17.1)
|
118
128
|
docile (~> 1.1)
|
119
129
|
json (>= 1.8, < 3)
|
120
130
|
simplecov-html (~> 0.10.0)
|
121
131
|
simplecov-html (0.10.2)
|
122
|
-
thor (1.0
|
132
|
+
thor (1.1.0)
|
123
133
|
ttfunk (1.7.0)
|
124
134
|
tzinfo (2.0.4)
|
125
135
|
concurrent-ruby (~> 1.0)
|
@@ -134,7 +144,8 @@ DEPENDENCIES
|
|
134
144
|
byebug (= 11.1.3)
|
135
145
|
guard (~> 2.16.2)
|
136
146
|
guard-rspec
|
137
|
-
|
147
|
+
pdf-inspector (~> 1.3.0)
|
148
|
+
rake (= 13.0.6)
|
138
149
|
rspec (= 3.10.0)
|
139
150
|
rubocop (= 0.67.0)
|
140
151
|
rubocop-performance (~> 1.1.0)
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -45,6 +45,22 @@ XML version | Supported?
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
#### Usage in Rails Controller with more than one xml
|
49
|
+
class DanfeController < ApplicationController
|
50
|
+
def new
|
51
|
+
invoices = Invoice.where(ids: params[:ids])
|
52
|
+
xmls_as_string = []
|
53
|
+
|
54
|
+
invoices.each do |invoice|
|
55
|
+
xmls_as_string << invoice.generate_xml # your method that generates the NF-e's xml
|
56
|
+
end
|
57
|
+
|
58
|
+
danfe = BrDanfe::Danfe.new(xmls_as_string)
|
59
|
+
|
60
|
+
send_data danfe.render_pdf, filename: "danfe.pdf", type: "application/pdf"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
48
64
|
### Options
|
49
65
|
|
50
66
|
* `logo_path`: Path of sender's logo image.
|
@@ -72,6 +88,29 @@ XML version | Supported?
|
|
72
88
|
end
|
73
89
|
end
|
74
90
|
|
91
|
+
### DAMDFE - _Documento Auxiliar do Manifesto Eletrônico de Documentos Fiscais_
|
92
|
+
|
93
|
+
#### Usage in Ruby
|
94
|
+
|
95
|
+
xml = File.read("mdfe.xml")
|
96
|
+
|
97
|
+
mdfe = BrDanfe::Mdfe.new(xml)
|
98
|
+
mdfe.save_pdf("mdfe.pdf")
|
99
|
+
|
100
|
+
#### Usage in Rails Controller
|
101
|
+
|
102
|
+
class MdfeController < ApplicationController
|
103
|
+
def new
|
104
|
+
mdfe = Mdfe.find(params[:id])
|
105
|
+
xml_as_string = mdfe.generate_xml # your method that generates the MDF-e's xml
|
106
|
+
|
107
|
+
mdfe = BrDanfe::Mdfe.new(xml_as_string)
|
108
|
+
|
109
|
+
send_data mdfe.render_pdf, filename: "mdfe.pdf", type: "application/pdf"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
75
114
|
## I18n
|
76
115
|
|
77
116
|
By default, your rails application must be configured to `pt-Br`.
|
data/br_danfe.gemspec
CHANGED
@@ -16,21 +16,22 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
spec.required_ruby_version = '>= 2.5.1'
|
18
18
|
|
19
|
-
spec.add_dependency 'barby', '0.
|
19
|
+
spec.add_dependency 'barby', '0.6.8'
|
20
20
|
spec.add_dependency 'br_documents', '>= 0.1.3'
|
21
21
|
spec.add_dependency 'i18n', '>= 0.8.6'
|
22
22
|
spec.add_dependency 'nokogiri', '>= 1.8'
|
23
|
-
spec.add_dependency 'prawn', '~> 2.0'
|
23
|
+
spec.add_dependency 'prawn', '~> 2.4.0'
|
24
24
|
spec.add_dependency 'prawn-table', '0.2.2'
|
25
25
|
spec.add_dependency 'rqrcode', '~> 1.1.1'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'byebug', '11.1.3'
|
28
|
-
spec.add_development_dependency '
|
28
|
+
spec.add_development_dependency 'guard', '~> 2.16.2'
|
29
|
+
spec.add_development_dependency 'guard-rspec'
|
30
|
+
spec.add_development_dependency 'pdf-inspector', '~> 1.3.0'
|
31
|
+
spec.add_development_dependency 'rake', '13.0.6'
|
29
32
|
spec.add_development_dependency 'rspec', '3.10.0'
|
30
33
|
spec.add_development_dependency 'rubocop', '0.67.0'
|
31
34
|
spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
|
32
35
|
spec.add_development_dependency 'simplecov', '0.17.1'
|
33
36
|
spec.add_development_dependency 'simplecov-html', '0.10.2'
|
34
|
-
spec.add_development_dependency 'guard', '~> 2.16.2'
|
35
|
-
spec.add_development_dependency 'guard-rspec'
|
36
37
|
end
|
data/lib/br_danfe/danfe.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module BrDanfe
|
2
2
|
class Danfe
|
3
|
-
def self.new(
|
4
|
-
|
3
|
+
def self.new(xmls)
|
4
|
+
xmls = [xmls] unless xmls.is_a?(Array)
|
5
|
+
|
6
|
+
parsed_xmls = xmls.map { |xml| BrDanfe::XML.new(xml) }
|
7
|
+
|
8
|
+
create_danfe(parsed_xmls)
|
5
9
|
end
|
6
10
|
|
7
|
-
def self.create_danfe(
|
8
|
-
|
9
|
-
xml['ide > mod'] == nfe_code ? DanfeLib::Nfe.new(xml) : DanfeLib::Nfce.new(xml)
|
11
|
+
def self.create_danfe(xmls)
|
12
|
+
BrDanfe::Helper.nfe?(xmls.first) ? DanfeLib::Nfe.new(xmls) : DanfeLib::Nfce.new(xmls)
|
10
13
|
end
|
11
14
|
private_class_method :create_danfe
|
12
15
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BrDanfe
|
2
2
|
module DanfeLib
|
3
3
|
class Nfce < Base
|
4
|
-
PAGE_WIDTH =
|
4
|
+
PAGE_WIDTH = 7.cm
|
5
5
|
PAGE_HEIGHT = 100.cm
|
6
6
|
|
7
7
|
private
|
@@ -24,21 +24,23 @@ module BrDanfe
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def generate(footer_info)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
@xmls.each do |xml|
|
28
|
+
NfceLib::Header.new(@document, xml, @options.logo, @options.logo_dimensions).render
|
29
|
+
NfceLib::ProductList.new(@document, xml).render
|
30
|
+
NfceLib::TotalList.new(@document, xml).render
|
31
|
+
NfceLib::Key.new(@document, xml).render
|
32
|
+
NfceLib::Recipient.new(@document, xml).render
|
33
|
+
NfceLib::NfceIdentification.new(@document, xml).render
|
34
|
+
BrDanfe::QrCode.new(pdf: @document, xml: xml, qr_code_tag: xml['qrCode'], box_size: 4.5.cm).render
|
35
|
+
NfceLib::Footer.new(@document, xml).render(footer_info)
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
render_no_fiscal_value(xml)
|
38
|
+
resize_page_height
|
39
|
+
end
|
38
40
|
end
|
39
41
|
|
40
|
-
def render_no_fiscal_value
|
41
|
-
@document.stamp('has_no_fiscal_value') if BrDanfe::Helper.unauthorized?(
|
42
|
+
def render_no_fiscal_value(xml)
|
43
|
+
@document.stamp('has_no_fiscal_value') if BrDanfe::Helper.unauthorized?(xml)
|
42
44
|
end
|
43
45
|
|
44
46
|
def resize_page_height
|
@@ -9,11 +9,11 @@ module BrDanfe
|
|
9
9
|
|
10
10
|
def render(info = '')
|
11
11
|
tot_trib = @xml['ICMSTot/vTotTrib'].present? ? BrDanfe::Helper.numerify(@xml['ICMSTot/vTotTrib']) : '0,00'
|
12
|
-
@pdf.text "Tributos Totais Incidentes (Lei Federal 12.741/2012): R$ #{tot_trib}", size:
|
12
|
+
@pdf.text "Tributos Totais Incidentes (Lei Federal 12.741/2012): R$ #{tot_trib}", size: 8, align: :center
|
13
13
|
|
14
14
|
if info.present?
|
15
15
|
@pdf.render_blank_line
|
16
|
-
@pdf.text info, size:
|
16
|
+
@pdf.text info, size: 8, align: :center
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -14,6 +14,7 @@ module BrDanfe
|
|
14
14
|
|
15
15
|
render_company_info(cursor)
|
16
16
|
render_logo(cursor) if @logo.present?
|
17
|
+
render_doc
|
17
18
|
|
18
19
|
render_homologation if BrDanfe::Helper.homologation?(@xml)
|
19
20
|
end
|
@@ -23,21 +24,20 @@ module BrDanfe
|
|
23
24
|
def render_company_info(cursor)
|
24
25
|
one_line = 1
|
25
26
|
|
26
|
-
@pdf.bounding_box([x_position, cursor], width: width_box, height:
|
27
|
-
@pdf.text (@xml['emit/xNome']).to_s, size:
|
28
|
-
@pdf.text cnpj(@xml['emit/CNPJ']), size:
|
29
|
-
@pdf.text BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), size:
|
27
|
+
@pdf.bounding_box([x_position, cursor], width: width_box, height: 65) do
|
28
|
+
@pdf.text (@xml['emit/xNome']).to_s, size: 10, align: :left, style: :bold
|
29
|
+
@pdf.text cnpj(@xml['emit/CNPJ']), size: 9, align: :left
|
30
|
+
@pdf.text BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), size: 9, align: :left
|
30
31
|
@pdf.render_blank_line if count_name_lines(@xml['emit/xNome']) == one_line
|
31
|
-
@pdf.text 'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', size: 6, align: :left
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def x_position
|
36
|
-
@logo.present? ?
|
36
|
+
@logo.present? ? 2.2.cm : 0
|
37
37
|
end
|
38
38
|
|
39
39
|
def width_box
|
40
|
-
@logo.present? ? 5.
|
40
|
+
@logo.present? ? 4.5.cm : 6.7.cm
|
41
41
|
end
|
42
42
|
|
43
43
|
def cnpj(info)
|
@@ -51,7 +51,7 @@ module BrDanfe
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def render_logo(cursor)
|
54
|
-
box_size =
|
54
|
+
box_size = 60
|
55
55
|
logo_options = BrDanfe::Logo::Options.new(box_size, @logo_dimensions).options
|
56
56
|
|
57
57
|
@pdf.bounding_box([0, cursor], width: box_size, height: box_size) do
|
@@ -59,9 +59,23 @@ module BrDanfe
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def render_doc
|
63
63
|
@pdf.render_blank_line
|
64
|
-
@pdf.
|
64
|
+
cursor = @pdf.cursor
|
65
|
+
|
66
|
+
@pdf.bounding_box([0, cursor], width: 6.7.cm, height: 20) do
|
67
|
+
@pdf.text 'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', size: 9, align: :center
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def render_homologation
|
72
|
+
2.times { @pdf.render_blank_line }
|
73
|
+
|
74
|
+
cursor = @pdf.cursor
|
75
|
+
@pdf.bounding_box([0, cursor], width: 6.7.cm, height: 20) do
|
76
|
+
@pdf.text 'EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO', size: 8, align: :center, style: :bold
|
77
|
+
@pdf.text 'SEM VALOR FISCAL', size: 8, align: :center, style: :bold
|
78
|
+
end
|
65
79
|
end
|
66
80
|
end
|
67
81
|
end
|