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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -8
  3. data/.github/dependabot.yml +19 -0
  4. data/.rubocop.yml +24 -11
  5. data/Gemfile.lock +41 -35
  6. data/Guardfile +3 -1
  7. data/bin/_guard-core +29 -0
  8. data/bin/guard +29 -0
  9. data/br_danfe.gemspec +7 -6
  10. data/lib/br_danfe/danfe_lib/nfce.rb +11 -9
  11. data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +1 -1
  12. data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +2 -2
  13. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +30 -16
  14. data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +3 -3
  15. data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +3 -3
  16. data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +44 -53
  17. data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
  18. data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +16 -15
  19. data/lib/br_danfe/danfe_lib/nfe.rb +11 -9
  20. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -2
  21. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +6 -7
  22. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +2 -1
  23. data/lib/br_danfe/helper.rb +1 -1
  24. data/lib/br_danfe/mdfe.rb +1 -1
  25. data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +1 -1
  26. data/lib/br_danfe/mdfe_lib/fisco_control.rb +6 -25
  27. data/lib/br_danfe/mdfe_lib/header.rb +7 -8
  28. data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +1 -1
  29. data/lib/br_danfe/mdfe_lib/notes.rb +1 -1
  30. data/lib/br_danfe/qr_code.rb +1 -2
  31. data/lib/br_danfe/version.rb +1 -1
  32. data/lib/br_danfe.rb +2 -2
  33. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +3 -2
  34. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +6 -4
  35. data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +2 -2
  36. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +2 -2
  37. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +2 -2
  38. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +10 -10
  39. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +12 -12
  40. data/spec/br_danfe/danfe_lib/nfce_spec.rb +2 -1
  41. data/spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb +4 -4
  42. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +178 -178
  43. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +274 -274
  44. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +77 -77
  45. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +23 -23
  46. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +55 -37
  47. data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +34 -34
  48. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +19 -19
  49. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +237 -237
  50. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +3 -2
  51. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +16 -16
  52. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +13 -13
  53. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +76 -76
  54. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +40 -40
  55. data/spec/br_danfe/danfe_lib/nfe_lib/xprod_spec.rb +118 -118
  56. data/spec/br_danfe/danfe_spec.rb +2 -2
  57. data/spec/br_danfe/helper_spec.rb +15 -15
  58. data/spec/br_danfe/mdfe_lib/document_spec.rb +2 -2
  59. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +21 -7
  60. data/spec/br_danfe/mdfe_lib/header_spec.rb +27 -18
  61. data/spec/br_danfe/mdfe_lib/notes_spec.rb +5 -5
  62. data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +1 -1
  63. data/spec/br_danfe/mdfe_spec.rb +4 -5
  64. data/spec/br_danfe/qr_code_spec.rb +4 -13
  65. data/spec/br_danfe/xml_spec.rb +6 -6
  66. data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
  67. data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
  68. data/spec/fixtures/nfce/lib/document#render.pdf +12 -23
  69. data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
  70. data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
  71. data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
  72. data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
  73. data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
  74. data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
  75. data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
  76. data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
  77. data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
  78. data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
  79. data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
  80. data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
  81. data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
  82. data/spec/fixtures/nfce/lib/product_list_with_many_products_and_long_names.xml +2 -2
  83. data/spec/fixtures/nfce/lib/product_list_with_single_product_and_long_name.xml +1 -1
  84. data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
  85. data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
  86. data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
  87. data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
  88. data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
  89. data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
  90. data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
  91. data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
  92. data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
  93. data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
  94. data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +568 -447
  95. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
  96. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
  97. data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
  98. data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
  99. data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +945 -0
  100. data/spec/spec_helper.rb +1 -1
  101. metadata +38 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 447b593d2df30cc919fbc59e6453d794c1a60319a256357f650023e51bc6f369
4
- data.tar.gz: a1d696214eeb03ef958c001870427cada4d826fabeb09cb24b1174a3ff19107e
3
+ metadata.gz: 9422c6311288f920310c6d6dc1313fd62667eb3644c0dca44500bb148e0cb4cd
4
+ data.tar.gz: 4434509d64bf704a654d21cc1c2fbb93c601df5258ab5aab1e5d21458ea089f2
5
5
  SHA512:
6
- metadata.gz: b7ca6b73178f85c69d8e40334cfdffe2a1840de6c4910c1a40d09f97df05624226a1c5e8e285b5774fcceac78646e32194ce372456a038a66f52f67cb6202f83
7
- data.tar.gz: 480fbe9dedac710566471b56a87ec05598bde90232b49fce063462739f249be6084944f397b8424661a2201ce086c77b8ae76c0ceb3315c2b7bf12c0757dfd30
6
+ metadata.gz: c8ab664601de128f3d3adfb099bd71757658e6c73c94d5cde76a504aaa6dd4272523ab607aab488c4eab5dc95ee1a0167c55d5b449768fecb5cdc95b7ed90e12
7
+ data.tar.gz: 203578edef3075dd8971c4288bdd4caae857d33d73e2181452fb51941f2e721d7fb211c353d1d9faec54518fcc5e38e1509303d918a933d8c4c025c8208aa175
data/.circleci/config.yml CHANGED
@@ -2,28 +2,37 @@ version: 2
2
2
  jobs:
3
3
  build:
4
4
  docker:
5
- - image: circleci/ruby:2.5.1
5
+ - image: circleci/ruby:2.7.4
6
6
  steps:
7
7
  - checkout
8
8
  - restore_cache:
9
- key: brdanfe-cache-v1-{{ checksum "Gemfile.lock" }}
9
+ key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
10
10
  - run: bundle check || bundle install
11
11
  - save_cache:
12
- key: brdanfe-cache-v1-{{ .Environment.CIRCLE_SHA1 }}
12
+ key: brdanfe-cache-v2-{{ .Environment.CIRCLE_SHA1 }}
13
13
  paths:
14
14
  - .
15
15
  - save_cache:
16
- key: brdanfe-cache-v1-{{ checksum "Gemfile.lock" }}
16
+ key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
17
17
  paths:
18
18
  - ./vendor/bundle
19
+ linter:
20
+ docker:
21
+ - image: circleci/ruby:2.7.4
22
+ steps:
23
+ - restore_cache:
24
+ key: brdanfe-cache-v2-{{ .Environment.CIRCLE_SHA1 }}
25
+ - restore_cache:
26
+ key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
27
+ - run: bundle exec rubocop --display-cop-names --parallel
19
28
  rspec:
20
29
  docker:
21
- - image: circleci/ruby:2.5.1
30
+ - image: circleci/ruby:2.7.4
22
31
  steps:
23
32
  - restore_cache:
24
- key: brdanfe-cache-v1-{{ .Environment.CIRCLE_SHA1 }}
33
+ key: brdanfe-cache-v2-{{ .Environment.CIRCLE_SHA1 }}
25
34
  - restore_cache:
26
- key: brdanfe-cache-v1-{{ checksum "Gemfile.lock" }}
35
+ key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
27
36
  - run:
28
37
  name: Install Test Coverage for CodeClimate
29
38
  command: |
@@ -37,6 +46,9 @@ workflows:
37
46
  main:
38
47
  jobs:
39
48
  - build
40
- - rspec:
49
+ - linter:
41
50
  requires:
42
51
  - build
52
+ - rspec:
53
+ requires:
54
+ - linter
@@ -0,0 +1,19 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ day: "wednesday"
13
+ time: "09:00"
14
+ timezone: "America/Sao_Paulo"
15
+ open-pull-requests-limit: 10
16
+ allow:
17
+ - dependency-type: "direct"
18
+ pull-request-branch-name:
19
+ separator: "-"
data/.rubocop.yml CHANGED
@@ -1,29 +1,36 @@
1
- require: rubocop-performance
1
+ require:
2
+ - rubocop-performance
2
3
 
3
4
  AllCops:
4
- TargetRubyVersion: 2.5.1
5
+ TargetRubyVersion: 2.6
5
6
  Exclude:
6
- - 'config/**/*'
7
- - 'spec/spec_helper.rb'
7
+ - bin/**/*
8
+ - vendor/bundle/**/*
9
+ - config/**/*
10
+ - spec/spec_helper.rb
8
11
  - !ruby/regexp /old_and_unused\.rb$/
9
12
  DisplayCopNames: true
10
13
  DisplayStyleGuide: true
14
+ NewCops: enable
11
15
 
12
16
  Bundler/OrderedGems:
13
17
  Enabled: false
14
18
 
15
- Layout/AlignHash:
19
+ Layout/HashAlignment:
16
20
  Enabled: false
17
21
 
18
- Layout/AlignParameters:
22
+ Layout/ParameterAlignment:
19
23
  Enabled: false
20
24
 
21
- Layout/IndentArray:
25
+ Layout/FirstArrayElementIndentation:
22
26
  EnforcedStyle: consistent
23
27
 
24
28
  Layout/SpaceBeforeBlockBraces:
25
29
  EnforcedStyleForEmptyBraces: space
26
30
 
31
+ Layout/LineLength:
32
+ Max: 200
33
+
27
34
  Metrics/ClassLength:
28
35
  Max: 230
29
36
 
@@ -57,8 +64,14 @@ Style/IfUnlessModifier:
57
64
  Style/SymbolArray:
58
65
  EnforcedStyle: brackets
59
66
 
60
- Metrics/LineLength:
61
- Max: 200
67
+ Style/HashEachMethods:
68
+ Enabled: false
69
+
70
+ Style/HashTransformKeys:
71
+ Enabled: false
72
+
73
+ Style/HashTransformValues:
74
+ Enabled: false
62
75
 
63
76
  Lint/AmbiguousBlockAssociation:
64
77
  Exclude:
@@ -87,7 +100,7 @@ Naming/HeredocDelimiterNaming:
87
100
  Naming/HeredocDelimiterCase:
88
101
  Enabled: false
89
102
 
90
- Naming/UncommunicativeMethodParamName:
103
+ Naming/MethodParameterName:
91
104
  Enabled: false
92
105
 
93
106
  Naming/MethodName:
@@ -99,5 +112,5 @@ Naming/VariableName:
99
112
  Metrics/ParameterLists:
100
113
  Enabled: false
101
114
 
102
- Naming/UncommunicativeBlockParamName:
115
+ Naming/BlockParameterName:
103
116
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_danfe (0.16.0)
4
+ br_danfe (0.17.3)
5
5
  barby (= 0.6.8)
6
6
  br_documents (>= 0.1.3)
7
7
  i18n (>= 0.8.6)
8
8
  nokogiri (>= 1.8)
9
9
  prawn (~> 2.4.0)
10
10
  prawn-table (= 0.2.2)
11
- rqrcode (~> 1.1.1)
11
+ rqrcode (~> 2.1.0)
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
16
  Ascii85 (1.1.0)
17
- activemodel (6.1.4)
18
- activesupport (= 6.1.4)
19
- activesupport (6.1.4)
17
+ activemodel (6.1.4.1)
18
+ activesupport (= 6.1.4.1)
19
+ activesupport (6.1.4.1)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
@@ -25,7 +25,7 @@ GEM
25
25
  afm (0.2.2)
26
26
  ast (2.4.2)
27
27
  barby (0.6.8)
28
- br_documents (0.2.0)
28
+ br_documents (0.2.1)
29
29
  activemodel (>= 4.0.0)
30
30
  i18n (>= 0.6.5)
31
31
  byebug (11.1.3)
@@ -36,13 +36,13 @@ GEM
36
36
  docile (1.4.0)
37
37
  ffi (1.15.3)
38
38
  formatador (0.3.0)
39
- guard (2.16.2)
39
+ guard (2.18.0)
40
40
  formatador (>= 0.2.4)
41
41
  listen (>= 2.7, < 4.0)
42
42
  lumberjack (>= 1.0.12, < 2.0)
43
43
  nenv (~> 0.1)
44
44
  notiffany (~> 0.0)
45
- pry (>= 0.9.12)
45
+ pry (>= 0.13.0)
46
46
  shellany (~> 0.0)
47
47
  thor (>= 0.18.1)
48
48
  guard-compat (1.2.1)
@@ -51,25 +51,22 @@ GEM
51
51
  guard-compat (~> 1.1)
52
52
  rspec (>= 2.99.0, < 4.0)
53
53
  hashery (2.1.2)
54
- i18n (1.8.10)
54
+ i18n (1.8.11)
55
55
  concurrent-ruby (~> 1.0)
56
- jaro_winkler (1.5.4)
57
56
  json (2.5.1)
58
- listen (3.5.1)
57
+ listen (3.6.0)
59
58
  rb-fsevent (~> 0.10, >= 0.10.3)
60
59
  rb-inotify (~> 0.9, >= 0.9.10)
61
60
  lumberjack (1.2.8)
62
61
  method_source (1.0.0)
63
- mini_portile2 (2.5.3)
64
62
  minitest (5.14.4)
65
63
  nenv (0.3.0)
66
- nokogiri (1.11.7)
67
- mini_portile2 (~> 2.5.0)
64
+ nokogiri (1.12.5-x86_64-darwin)
68
65
  racc (~> 1.4)
69
66
  notiffany (0.1.3)
70
67
  nenv (~> 0.1)
71
68
  shellany (~> 0.0)
72
- parallel (1.20.1)
69
+ parallel (1.21.0)
73
70
  parser (3.0.2.0)
74
71
  ast (~> 2.4.1)
75
72
  pdf-core (0.9.0)
@@ -89,17 +86,18 @@ GEM
89
86
  pry (0.14.1)
90
87
  coderay (~> 1.1)
91
88
  method_source (~> 1.0)
92
- psych (4.0.1)
93
- racc (1.5.2)
89
+ racc (1.6.0)
94
90
  rainbow (3.0.0)
95
- rake (13.0.1)
91
+ rake (13.0.6)
96
92
  rb-fsevent (0.11.0)
97
93
  rb-inotify (0.10.1)
98
94
  ffi (~> 1.0)
99
- rqrcode (1.1.2)
95
+ regexp_parser (2.1.1)
96
+ rexml (3.2.5)
97
+ rqrcode (2.1.0)
100
98
  chunky_png (~> 1.0)
101
- rqrcode_core (~> 0.1)
102
- rqrcode_core (0.2.0)
99
+ rqrcode_core (~> 1.0)
100
+ rqrcode_core (1.2.0)
103
101
  rspec (3.10.0)
104
102
  rspec-core (~> 3.10.0)
105
103
  rspec-expectations (~> 3.10.0)
@@ -113,16 +111,23 @@ GEM
113
111
  diff-lcs (>= 1.2.0, < 2.0)
114
112
  rspec-support (~> 3.10.0)
115
113
  rspec-support (3.10.2)
116
- rubocop (0.67.0)
117
- jaro_winkler (~> 1.5.1)
114
+ rubocop (0.93.1)
118
115
  parallel (~> 1.10)
119
- parser (>= 2.5, != 2.5.1.1)
120
- psych (>= 3.1.0)
116
+ parser (>= 2.7.1.5)
121
117
  rainbow (>= 2.2.2, < 4.0)
118
+ regexp_parser (>= 1.8)
119
+ rexml
120
+ rubocop-ast (>= 0.6.0)
122
121
  ruby-progressbar (~> 1.7)
123
- unicode-display_width (>= 1.4.0, < 1.6)
124
- rubocop-performance (1.1.0)
125
- rubocop (>= 0.67.0)
122
+ unicode-display_width (>= 1.4.0, < 2.0)
123
+ rubocop-ast (1.13.0)
124
+ parser (>= 3.0.1.1)
125
+ rubocop-performance (1.10.2)
126
+ rubocop (>= 0.90.0, < 2.0)
127
+ rubocop-ast (>= 0.4.0)
128
+ rubocop-rspec (1.44.1)
129
+ rubocop (~> 0.87)
130
+ rubocop-ast (>= 0.7.1)
126
131
  ruby-progressbar (1.11.0)
127
132
  ruby-rc4 (0.1.5)
128
133
  shellany (0.0.1)
@@ -135,8 +140,8 @@ GEM
135
140
  ttfunk (1.7.0)
136
141
  tzinfo (2.0.4)
137
142
  concurrent-ruby (~> 1.0)
138
- unicode-display_width (1.5.0)
139
- zeitwerk (2.4.2)
143
+ unicode-display_width (1.8.0)
144
+ zeitwerk (2.5.1)
140
145
 
141
146
  PLATFORMS
142
147
  ruby
@@ -144,15 +149,16 @@ PLATFORMS
144
149
  DEPENDENCIES
145
150
  br_danfe!
146
151
  byebug (= 11.1.3)
147
- guard (~> 2.16.2)
152
+ guard (~> 2.18.0)
148
153
  guard-rspec
149
154
  pdf-inspector (~> 1.3.0)
150
- rake (= 13.0.1)
155
+ rake (= 13.0.6)
151
156
  rspec (= 3.10.0)
152
- rubocop (= 0.67.0)
153
- rubocop-performance (~> 1.1.0)
157
+ rubocop (~> 0.93.1)
158
+ rubocop-performance (~> 1.10.2)
159
+ rubocop-rspec (~> 1.44.1)
154
160
  simplecov (= 0.17.1)
155
161
  simplecov-html (= 0.10.2)
156
162
 
157
163
  BUNDLED WITH
158
- 1.17.3
164
+ 2.1.4
data/Guardfile CHANGED
@@ -1,4 +1,6 @@
1
- guard :rspec, cmd: 'bundle exec rspec' do
1
+ directories %w[lib spec]
2
+
3
+ guard :rspec, cmd: 'NO_COVERAGE=true bundle exec rspec' do
2
4
  require 'guard/rspec/dsl'
3
5
  dsl = Guard::RSpec::Dsl.new(self)
4
6
 
data/bin/_guard-core ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application '_guard-core' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("guard", "_guard-core")
data/bin/guard ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'guard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("guard", "guard")
data/br_danfe.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.test_files = `git ls-files -- { test,spec,features }/*`.split("\n")
15
15
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
16
  spec.require_paths = ['lib']
17
- spec.required_ruby_version = '>= 2.5.1'
17
+ spec.required_ruby_version = '>= 2.6'
18
18
 
19
19
  spec.add_dependency 'barby', '0.6.8'
20
20
  spec.add_dependency 'br_documents', '>= 0.1.3'
@@ -22,16 +22,17 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'nokogiri', '>= 1.8'
23
23
  spec.add_dependency 'prawn', '~> 2.4.0'
24
24
  spec.add_dependency 'prawn-table', '0.2.2'
25
- spec.add_dependency 'rqrcode', '~> 1.1.1'
25
+ spec.add_dependency 'rqrcode', '~> 2.1.0'
26
26
 
27
27
  spec.add_development_dependency 'byebug', '11.1.3'
28
- spec.add_development_dependency 'guard', '~> 2.16.2'
28
+ spec.add_development_dependency 'guard', '~> 2.18.0'
29
29
  spec.add_development_dependency 'guard-rspec'
30
30
  spec.add_development_dependency 'pdf-inspector', '~> 1.3.0'
31
- spec.add_development_dependency 'rake', '13.0.1'
31
+ spec.add_development_dependency 'rake', '13.0.6'
32
32
  spec.add_development_dependency 'rspec', '3.10.0'
33
- spec.add_development_dependency 'rubocop', '0.67.0'
34
- spec.add_development_dependency 'rubocop-performance', '~> 1.1.0'
33
+ spec.add_development_dependency 'rubocop', '~> 0.93.1'
34
+ spec.add_development_dependency 'rubocop-performance', '~> 1.10.2'
35
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.44.1'
35
36
  spec.add_development_dependency 'simplecov', '0.17.1'
36
37
  spec.add_development_dependency 'simplecov-html', '0.10.2'
37
38
  end
@@ -1,7 +1,7 @@
1
1
  module BrDanfe
2
2
  module DanfeLib
3
3
  class Nfce < Base
4
- PAGE_WIDTH = 8.cm
4
+ PAGE_WIDTH = 7.cm
5
5
  PAGE_HEIGHT = 100.cm
6
6
 
7
7
  private
@@ -13,13 +13,15 @@ module BrDanfe
13
13
  def create_watermark
14
14
  @document.create_stamp('has_no_fiscal_value') do
15
15
  @document.fill_color '7d7d7d'
16
- @document.text_box I18n.t('danfe.others.has_no_fiscal_value'),
17
- size: 0.8.cm,
18
- width: 10.cm,
19
- height: 1.2.cm,
20
- at: [0, PAGE_HEIGHT - 3.8.cm],
21
- rotate: 45,
22
- rotate_around: :center
16
+ @document.text_box(
17
+ I18n.t('danfe.others.has_no_fiscal_value'),
18
+ size: 0.8.cm,
19
+ width: 10.cm,
20
+ height: 1.2.cm,
21
+ at: [0, PAGE_HEIGHT - 3.8.cm],
22
+ rotate: 45,
23
+ rotate_around: :center
24
+ )
23
25
  end
24
26
  end
25
27
 
@@ -31,7 +33,7 @@ module BrDanfe
31
33
  NfceLib::Key.new(@document, xml).render
32
34
  NfceLib::Recipient.new(@document, xml).render
33
35
  NfceLib::NfceIdentification.new(@document, xml).render
34
- BrDanfe::QrCode.new(pdf: @document, xml: xml, qr_code_tag: xml['qrCode'], box_size: 3.cm).render
36
+ BrDanfe::QrCode.new(pdf: @document, qr_code_tag: xml['qrCode'], box_size: 4.5.cm).render
35
37
  NfceLib::Footer.new(@document, xml).render(footer_info)
36
38
 
37
39
  render_no_fiscal_value(xml)
@@ -12,7 +12,7 @@ module BrDanfe
12
12
  botton_margin: 0
13
13
  )
14
14
 
15
- @document.font 'Courier'
15
+ @document.font 'tinos'
16
16
  @document.line_width = 0.3
17
17
  end
18
18
 
@@ -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: 5, align: :center
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: 5, align: :center
16
+ @pdf.text info, size: 8, align: :center
17
17
  end
18
18
  end
19
19
  end
@@ -12,38 +12,40 @@ module BrDanfe
12
12
  def render
13
13
  cursor = @pdf.cursor
14
14
 
15
- render_company_info(cursor)
15
+ render_company_info
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
20
21
 
21
22
  private
22
23
 
23
- def render_company_info(cursor)
24
+ def render_company_info
24
25
  one_line = 1
25
26
 
26
- @pdf.bounding_box([x_position, cursor], width: width_box, height: 45) do
27
- @pdf.text (@xml['emit/xNome']).to_s, size: 7, align: :left, style: :bold
28
- @pdf.text cnpj(@xml['emit/CNPJ']), size: 6, align: :left
29
- @pdf.text BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), size: 6, align: :left
30
- @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
- end
27
+ @pdf.text_box (@xml['emit/xNome']).to_s, at: [x_position, @pdf.cursor], height: 36, size: 9, align: :left, style: :bold, overflow: :shrink_to_fit
28
+ @pdf.move_down 36
29
+
30
+ @pdf.text_box cnpj(@xml['emit/CNPJ']), at: [x_position, @pdf.cursor], height: 9, size: 9, align: :left, overflow: :shrink_to_fit
31
+ @pdf.move_down 9
32
+
33
+ @pdf.text_box BrDanfe::DanfeLib::NfceLib::Helper.address(@xml.css('enderEmit')), at: [x_position, @pdf.cursor], height: 20, size: 9, align: :left, overflow: :shrink_to_fit
34
+ @pdf.move_down 20
35
+ @pdf.render_blank_line if count_name_lines(@xml['emit/xNome']) == one_line
33
36
  end
34
37
 
35
38
  def x_position
36
- @logo.present? ? 1.7.cm : 0
39
+ @logo.present? ? 2.2.cm : 0
37
40
  end
38
41
 
39
42
  def width_box
40
- @logo.present? ? 5.7.cm : 7.4.cm
43
+ @logo.present? ? 4.5.cm : 6.7.cm
41
44
  end
42
45
 
43
46
  def cnpj(info)
44
47
  cnpj = BrDocuments::CnpjCpf::Cnpj.new info
45
- data = "CNPJ: #{cnpj.valid? ? cnpj.formatted : ''}"
46
- data
48
+ "CNPJ: #{cnpj.valid? ? cnpj.formatted : ''}"
47
49
  end
48
50
 
49
51
  def count_name_lines(company_name)
@@ -51,7 +53,7 @@ module BrDanfe
51
53
  end
52
54
 
53
55
  def render_logo(cursor)
54
- box_size = 45
56
+ box_size = 60
55
57
  logo_options = BrDanfe::Logo::Options.new(box_size, @logo_dimensions).options
56
58
 
57
59
  @pdf.bounding_box([0, cursor], width: box_size, height: box_size) do
@@ -59,9 +61,21 @@ module BrDanfe
59
61
  end
60
62
  end
61
63
 
62
- def render_homologation
64
+ def render_doc
63
65
  @pdf.render_blank_line
64
- @pdf.text 'EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO – SEM VALOR FISCAL', size: 7, align: :center, style: :bold
66
+
67
+ @pdf.bounding_box([0, @pdf.cursor], width: 6.7.cm, height: 20) do
68
+ @pdf.text 'Documento Auxiliar da Nota Fiscal de Consumidor Eletrônica', size: 9, align: :center
69
+ end
70
+ end
71
+
72
+ def render_homologation
73
+ 2.times { @pdf.render_blank_line }
74
+
75
+ @pdf.bounding_box([0, @pdf.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
@@ -10,9 +10,9 @@ module BrDanfe
10
10
  def render
11
11
  @pdf.render_blank_line
12
12
 
13
- @pdf.text 'Consulte pela Chave de Acesso em', size: 7, align: :center, style: :bold
14
- @pdf.text @xml['urlChave'], size: 7, align: :center
15
- @pdf.text @xml['chNFe'].gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, '\\1 '), size: 6, align: :center
13
+ @pdf.text 'Consulte pela Chave de Acesso em', size: 9, align: :center, style: :bold
14
+ @pdf.text @xml['urlChave'], size: 9, align: :center
15
+ @pdf.text @xml['chNFe'].gsub(/(\d)(?=(\d\d\d\d)+(?!\d))/, '\\1 '), size: 8, align: :center
16
16
  end
17
17
  end
18
18
  end
@@ -12,9 +12,9 @@ module BrDanfe
12
12
  identification = "NFC-e nº #{@xml['ide/nNF']} Série #{@xml['ide/serie']} #{emitted_at}"
13
13
 
14
14
  @pdf.render_blank_line
15
- @pdf.text identification, size: 7, align: :center, style: :bold
16
- @pdf.text "<b>Protocolo de autorização:</b> #{@xml['infProt/nProt']}", size: 7, align: :center, inline_format: true
17
- @pdf.text "<b>Data de autorização: </b> #{BrDanfe::Helper.format_datetime(@xml['infProt/dhRecbto'])}", size: 7, align: :center, inline_format: true
15
+ @pdf.text identification, size: 9, align: :center, style: :bold
16
+ @pdf.text "<b>Protocolo de autorização:</b> #{@xml['infProt/nProt']}", size: 9, align: :center, inline_format: true
17
+ @pdf.text "<b>Data de autorização: </b> #{BrDanfe::Helper.format_datetime(@xml['infProt/dhRecbto'])}", size: 9, align: :center, inline_format: true
18
18
  end
19
19
  end
20
20
  end