br_danfe 0.13.3 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0544f7af7f044b2795ac8bffa0b15d8354bd114250efaef45f9486798343d5c0
4
- data.tar.gz: ac59e385e05de63e529f9f238e693ee5411efce67691cf6cf98d6688d3748c3c
3
+ metadata.gz: 07b849c45a1e7d926c43d77ce6e3460a35157e015393f76ebc5b37c736b9b679
4
+ data.tar.gz: 134cf5bf664dd4695aa4d895bd11d035850501045d36db501652d9cb06b5d3cc
5
5
  SHA512:
6
- metadata.gz: a3a974dbf58d1d117d861b76bf76ec74547e61ee78eb2a10c055058a2d0e90443c03b0122c6adacfe50d0f48805f327872f88c665dd54e54197e54e28940ad9f
7
- data.tar.gz: af3bb1d7261aabc28e5349c595bd270999a9d9b337570c38fe62275271a4621edf2eebedfb9219d7f99d55fcff483c45843604105f09c50bc36b537b4df9c467
6
+ metadata.gz: 50dcef75a540af68ba9b9830880cff94a175a28c9eca51a02157a7cff07a73bdaa704deed374ab9e5005a45de2390bd7e8f75a2691dc1d5ee5efed13443455eb
7
+ data.tar.gz: 06e6fecd59fd4624e061efa637799f2e61bedc2a83d909e62a12709926946eb1f1fc30ed14ee5458b8d6cd4c1c82f3e88f15130bbbc830e8aedfda7354f77474
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_danfe (0.13.3)
4
+ br_danfe (0.14.0)
5
5
  barby (= 0.5.1)
6
6
  br_documents (>= 0.1.3)
7
7
  i18n (>= 0.8.6)
@@ -28,17 +28,43 @@ GEM
28
28
  i18n (>= 0.6.5)
29
29
  byebug (11.1.3)
30
30
  chunky_png (1.3.12)
31
+ coderay (1.1.3)
31
32
  concurrent-ruby (1.1.7)
32
33
  diff-lcs (1.3)
33
34
  docile (1.3.2)
35
+ ffi (1.13.1)
36
+ formatador (0.2.5)
37
+ guard (2.16.2)
38
+ formatador (>= 0.2.4)
39
+ listen (>= 2.7, < 4.0)
40
+ lumberjack (>= 1.0.12, < 2.0)
41
+ nenv (~> 0.1)
42
+ notiffany (~> 0.0)
43
+ pry (>= 0.9.12)
44
+ shellany (~> 0.0)
45
+ thor (>= 0.18.1)
46
+ guard-compat (1.2.1)
47
+ guard-rspec (4.7.3)
48
+ guard (~> 2.1)
49
+ guard-compat (~> 1.1)
50
+ rspec (>= 2.99.0, < 4.0)
34
51
  i18n (1.8.5)
35
52
  concurrent-ruby (~> 1.0)
36
53
  jaro_winkler (1.5.4)
37
54
  json (2.3.0)
55
+ listen (3.2.1)
56
+ rb-fsevent (~> 0.10, >= 0.10.3)
57
+ rb-inotify (~> 0.9, >= 0.9.10)
58
+ lumberjack (1.2.8)
59
+ method_source (1.0.0)
38
60
  mini_portile2 (2.4.0)
39
61
  minitest (5.14.1)
62
+ nenv (0.3.0)
40
63
  nokogiri (1.10.10)
41
64
  mini_portile2 (~> 2.4.0)
65
+ notiffany (0.1.3)
66
+ nenv (~> 0.1)
67
+ shellany (~> 0.0)
42
68
  parallel (1.19.1)
43
69
  parser (2.7.0.4)
44
70
  ast (~> 2.4.0)
@@ -48,9 +74,15 @@ GEM
48
74
  ttfunk (~> 1.6)
49
75
  prawn-table (0.2.2)
50
76
  prawn (>= 1.3.0, < 3.0.0)
77
+ pry (0.13.1)
78
+ coderay (~> 1.1)
79
+ method_source (~> 1.0)
51
80
  psych (3.1.0)
52
81
  rainbow (3.0.0)
53
82
  rake (13.0.1)
83
+ rb-fsevent (0.10.4)
84
+ rb-inotify (0.10.1)
85
+ ffi (~> 1.0)
54
86
  rqrcode (1.1.2)
55
87
  chunky_png (~> 1.0)
56
88
  rqrcode_core (~> 0.1)
@@ -79,11 +111,13 @@ GEM
79
111
  rubocop-performance (1.1.0)
80
112
  rubocop (>= 0.67.0)
81
113
  ruby-progressbar (1.10.1)
114
+ shellany (0.0.1)
82
115
  simplecov (0.17.1)
83
116
  docile (~> 1.1)
84
117
  json (>= 1.8, < 3)
85
118
  simplecov-html (~> 0.10.0)
86
119
  simplecov-html (0.10.2)
120
+ thor (1.0.1)
87
121
  thread_safe (0.3.6)
88
122
  ttfunk (1.6.2.1)
89
123
  tzinfo (1.2.7)
@@ -97,6 +131,8 @@ PLATFORMS
97
131
  DEPENDENCIES
98
132
  br_danfe!
99
133
  byebug (= 11.1.3)
134
+ guard (~> 2.16.2)
135
+ guard-rspec
100
136
  rake (= 13.0.1)
101
137
  rspec (= 3.9.0)
102
138
  rubocop (= 0.67.0)
@@ -0,0 +1,14 @@
1
+ guard :rspec, cmd: "bundle exec rspec" do
2
+ require "guard/rspec/dsl"
3
+ dsl = Guard::RSpec::Dsl.new(self)
4
+
5
+ # RSpec files
6
+ rspec = dsl.rspec
7
+ watch(rspec.spec_helper) { rspec.spec_dir }
8
+ watch(rspec.spec_support) { rspec.spec_dir }
9
+ watch(rspec.spec_files)
10
+
11
+ # Ruby files
12
+ ruby = dsl.ruby
13
+ dsl.watch_spec_files_for(ruby.lib_files)
14
+ end
@@ -31,4 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
32
32
  spec.add_development_dependency 'simplecov', '0.17.1'
33
33
  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'
34
36
  end
@@ -44,6 +44,7 @@ module BrDanfe
44
44
  additional_data.push(address_content) if address?
45
45
  additional_data.push(difal_content) if difal?
46
46
  additional_data.push(fisco_content) if fisco?
47
+ additional_data.push(address_shipment) if shipment?
47
48
  additional_data.join(' * ')
48
49
  end
49
50
 
@@ -76,6 +77,21 @@ module BrDanfe
76
77
  BrDanfe::Helper.numerify(value) if value != ''
77
78
  end
78
79
 
80
+ def shipment?
81
+ @xml['entrega'].present?
82
+ end
83
+
84
+ def address_shipment
85
+ street = @xml['entrega/xLgr'].to_s
86
+ number = @xml['entrega/nro'].to_s
87
+ complement = @xml['entrega/xCpl'].to_s
88
+ neighborhood = @xml['entrega/xBairro'].to_s
89
+ city = @xml['entrega/xMun'].to_s
90
+ uf = @xml['entrega/UF'].to_s
91
+
92
+ "Endereço de entrega: #{street}, nº #{number} - #{neighborhood} - #{city} - #{uf} - #{complement}"
93
+ end
94
+
79
95
  def difal?
80
96
  @xml['ICMSTot/vICMSUFDest'].to_f != 0
81
97
  end
@@ -97,7 +113,7 @@ module BrDanfe
97
113
  end
98
114
 
99
115
  def additional_data?
100
- complementary? || address? || difal? || fisco?
116
+ complementary? || address? || difal? || fisco? || shipment?
101
117
  end
102
118
 
103
119
  def render_reserved_fisco
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = '0.13.3'.freeze
2
+ VERSION = '0.14.0'.freeze
3
3
  end
@@ -231,8 +231,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
231
231
  EOS
232
232
  end
233
233
 
234
- it 'renders title with box, subtitle, fisco box and complementary ' \
235
- 'information on the pdf' do
234
+ it 'renders title with box, subtitle, fisco box and complementary information on the pdf' do
236
235
  expect(File.exist?(output_pdf)).to be_falsey
237
236
 
238
237
  pdf.render_file output_pdf
@@ -340,6 +339,36 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
340
339
  end
341
340
  end
342
341
 
342
+ context 'when has address shipment' do
343
+ let(:xml_as_string) do
344
+ <<-EOS
345
+ <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
346
+ <infNFe Id="NFe25111012345678901234550020000134151000134151" versao="2.00">
347
+ <entrega>
348
+ <CNPJ>32301321907894</CNPJ>
349
+ <CPF></CPF>
350
+ <xLgr>Rua dos bobos</xLgr>
351
+ <nro>0</nro>
352
+ <xCpl>Na casa não tem parede</xCpl>
353
+ <xBairro>Centro</xBairro>
354
+ <cMun>4218004</cMun>
355
+ <xMun>TIJUCAS</xMun>
356
+ <UF>SC</UF>
357
+ </entrega>
358
+ </infNFe>
359
+ </NFe>
360
+ EOS
361
+ end
362
+
363
+ it 'renders title with box, subtitle, fisco box and address shipment information on the pdf' do
364
+ expect(File.exist?(output_pdf)).to be_falsey
365
+
366
+ pdf.render_file output_pdf
367
+
368
+ expect("#{base_dir}infadic#address-shipment.pdf").to have_same_content_of file: output_pdf
369
+ end
370
+ end
371
+
343
372
  context 'when has all the informations' do
344
373
  let(:xml_as_string) do
345
374
  <<-EOS
@@ -389,6 +418,17 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
389
418
  <pesoB>3300.000</pesoB>
390
419
  </vol>
391
420
  </transp>
421
+ <entrega>
422
+ <CNPJ>32301321907894</CNPJ>
423
+ <CPF></CPF>
424
+ <xLgr>Rua dos bobos</xLgr>
425
+ <nro>0</nro>
426
+ <xCpl>Na casa não tem parede</xCpl>
427
+ <xBairro>Centro</xBairro>
428
+ <cMun>4218004</cMun>
429
+ <xMun>TIJUCAS</xMun>
430
+ <UF>SC</UF>
431
+ </entrega>
392
432
  <infAdic>
393
433
  <infCpl>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec congue in dolor sed sagittis.</infCpl>
394
434
  <infAdFisco>Total de FCP-ST: 348,96</infAdFisco>
@@ -409,6 +449,7 @@ describe BrDanfe::DanfeLib::NfeLib::Infadic do
409
449
  'complementary information, address and difal on the pdf' do
410
450
  expect(File.exist?(output_pdf)).to be_falsey
411
451
 
452
+ pdf.render_file "#{base_dir}infadic#render-all_the_informations.pdf"
412
453
  pdf.render_file output_pdf
413
454
 
414
455
  expect("#{base_dir}infadic#render-all_the_informations.pdf").to have_same_content_of file: output_pdf
@@ -0,0 +1,108 @@
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 624
21
+ >>
22
+ stream
23
+ q
24
+ 0.3 w
25
+
26
+ BT
27
+ 21.2598 98.8195 Td
28
+ /F2.0 8 Tf
29
+ [<44> 35 <41444f532041444943494f4e> 20 <414953>] TJ
30
+ ET
31
+
32
+ 21.2598 21.5433 352.9134 75.1181 re
33
+ S
34
+
35
+ BT
36
+ 23.2598 90.5634 Td
37
+ /F1.0 6 Tf
38
+ [<494e464f524d41> 40 <c7d5455320434f4d504c454d454e54> 93 <41524553>] TJ
39
+ ET
40
+
41
+
42
+ BT
43
+ 23.2598 80.0595 Td
44
+ /F1.0 6 Tf
45
+ [<456e64657265e76f20646520656e747265> 15 <67> 5 <613a2052756120646f7320626f626f732c206eba2030202d2043656e74726f202d2054494a55434153202d205343202d204e612063617361206ee36f2074656d20706172656465>] TJ
46
+ ET
47
+
48
+ 374.1732 21.5433 202.6772 75.1181 re
49
+ S
50
+
51
+ BT
52
+ 376.1732 90.5634 Td
53
+ /F1.0 6 Tf
54
+ [<5245534552> 80 <56> 135 <41444f2041> 55 <4f20464953434f>] TJ
55
+ ET
56
+
57
+ Q
58
+
59
+ endstream
60
+ endobj
61
+ 5 0 obj
62
+ << /Type /Page
63
+ /Parent 3 0 R
64
+ /MediaBox [0 0 595.28 841.89]
65
+ /CropBox [0 0 595.28 841.89]
66
+ /BleedBox [0 0 595.28 841.89]
67
+ /TrimBox [0 0 595.28 841.89]
68
+ /ArtBox [0 0 595.28 841.89]
69
+ /Contents 4 0 R
70
+ /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
71
+ /Font << /F2.0 6 0 R
72
+ /F1.0 7 0 R
73
+ >>
74
+ >>
75
+ >>
76
+ endobj
77
+ 6 0 obj
78
+ << /Type /Font
79
+ /Subtype /Type1
80
+ /BaseFont /Times-Bold
81
+ /Encoding /WinAnsiEncoding
82
+ >>
83
+ endobj
84
+ 7 0 obj
85
+ << /Type /Font
86
+ /Subtype /Type1
87
+ /BaseFont /Times-Roman
88
+ /Encoding /WinAnsiEncoding
89
+ >>
90
+ endobj
91
+ xref
92
+ 0 8
93
+ 0000000000 65535 f
94
+ 0000000015 00000 n
95
+ 0000000109 00000 n
96
+ 0000000158 00000 n
97
+ 0000000215 00000 n
98
+ 0000000890 00000 n
99
+ 0000001198 00000 n
100
+ 0000001296 00000 n
101
+ trailer
102
+ << /Size 8
103
+ /Root 2 0 R
104
+ /Info 1 0 R
105
+ >>
106
+ startxref
107
+ 1395
108
+ %%EOF
@@ -17,7 +17,7 @@ endobj
17
17
  >>
18
18
  endobj
19
19
  4 0 obj
20
- << /Length 2884
20
+ << /Length 3079
21
21
  >>
22
22
  stream
23
23
  q
@@ -231,7 +231,7 @@ ET
231
231
  BT
232
232
  23.2598 48.2423 Td
233
233
  /F1.0 6 Tf
234
- [<4f726967656d20522437352e3339342c37382e202a2054> 80 <6f74616c206465204643502d5354> 50 <3a203334382c3936>] TJ
234
+ [<4f726967656d20522437352e3339342c37382e202a2054> 80 <6f74616c206465204643502d5354> 50 <3a203334382c3936202a20456e64657265e76f20646520656e747265> 15 <67> 5 <613a2052756120646f7320626f626f732c206eba2030202d2043656e74726f202d2054494a55434153202d205343202d204e612063617361206ee36f2074656d20706172656465>] TJ
235
235
  ET
236
236
 
237
237
  374.1732 21.5433 202.6772 75.1181 re
@@ -292,15 +292,15 @@ xref
292
292
  0000000109 00000 n
293
293
  0000000158 00000 n
294
294
  0000000215 00000 n
295
- 0000003151 00000 n
296
- 0000003471 00000 n
297
- 0000003569 00000 n
298
- 0000003668 00000 n
295
+ 0000003346 00000 n
296
+ 0000003666 00000 n
297
+ 0000003764 00000 n
298
+ 0000003863 00000 n
299
299
  trailer
300
300
  << /Size 9
301
301
  /Root 2 0 R
302
302
  /Info 1 0 R
303
303
  >>
304
304
  startxref
305
- 3768
305
+ 3963
306
306
  %%EOF
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: br_danfe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ASSEINFO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-08 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: barby
@@ -206,7 +206,35 @@ dependencies:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
208
  version: 0.10.2
209
- description:
209
+ - !ruby/object:Gem::Dependency
210
+ name: guard
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 2.16.2
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 2.16.2
223
+ - !ruby/object:Gem::Dependency
224
+ name: guard-rspec
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ description:
210
238
  email: asseinfo@asseinfo.com.br
211
239
  executables: []
212
240
  extensions: []
@@ -220,6 +248,7 @@ files:
220
248
  - Dockerfile
221
249
  - Gemfile
222
250
  - Gemfile.lock
251
+ - Guardfile
223
252
  - README.md
224
253
  - Rakefile
225
254
  - br_danfe.gemspec
@@ -400,6 +429,7 @@ files:
400
429
  - spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf
401
430
  - spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf
402
431
  - spec/fixtures/nfe/lib/icmstot#render.pdf
432
+ - spec/fixtures/nfe/lib/infadic#address-shipment.pdf
403
433
  - spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf
404
434
  - spec/fixtures/nfe/lib/infadic#render-difal.pdf
405
435
  - spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf
@@ -450,7 +480,7 @@ homepage: http://github.com/asseinfo/br_danfe
450
480
  licenses:
451
481
  - MIT
452
482
  metadata: {}
453
- post_install_message:
483
+ post_install_message:
454
484
  rdoc_options: []
455
485
  require_paths:
456
486
  - lib
@@ -465,9 +495,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
465
495
  - !ruby/object:Gem::Version
466
496
  version: '0'
467
497
  requirements: []
468
- rubyforge_project:
498
+ rubyforge_project:
469
499
  rubygems_version: 2.7.6
470
- signing_key:
500
+ signing_key:
471
501
  specification_version: 4
472
502
  summary: DANFE pdf generator for Brazilian invoices.
473
503
  test_files: []