br_danfe 0.15.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) 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/.tool-versions +1 -0
  6. data/Gemfile.lock +69 -50
  7. data/Guardfile +4 -2
  8. data/README.md +23 -0
  9. data/bin/_guard-core +29 -0
  10. data/bin/guard +29 -0
  11. data/br_danfe.gemspec +9 -7
  12. data/lib/br_danfe/danfe_lib/nfce.rb +11 -9
  13. data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +1 -1
  14. data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +2 -2
  15. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +30 -16
  16. data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +3 -3
  17. data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +3 -3
  18. data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +44 -53
  19. data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +1 -1
  20. data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +16 -15
  21. data/lib/br_danfe/danfe_lib/nfe.rb +11 -9
  22. data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +1 -1
  23. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +1 -2
  24. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +5 -6
  25. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +2 -1
  26. data/lib/br_danfe/document_builder.rb +1 -1
  27. data/lib/br_danfe/helper.rb +8 -10
  28. data/lib/br_danfe/mdfe.rb +55 -0
  29. data/lib/br_danfe/mdfe_lib/authorization_protocol.rb +24 -0
  30. data/lib/br_danfe/mdfe_lib/document.rb +26 -0
  31. data/lib/br_danfe/mdfe_lib/drivers.rb +70 -0
  32. data/lib/br_danfe/mdfe_lib/fisco_control.rb +21 -0
  33. data/lib/br_danfe/mdfe_lib/header.rb +77 -0
  34. data/lib/br_danfe/mdfe_lib/mdfe_identification.rb +69 -0
  35. data/lib/br_danfe/mdfe_lib/notes.rb +94 -0
  36. data/lib/br_danfe/mdfe_lib/totalizer.rb +57 -0
  37. data/lib/br_danfe/mdfe_lib/vehicles.rb +80 -0
  38. data/lib/br_danfe/qr_code.rb +21 -0
  39. data/lib/br_danfe/version.rb +1 -1
  40. data/lib/br_danfe.rb +2 -2
  41. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +3 -2
  42. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +6 -4
  43. data/spec/br_danfe/danfe_lib/nfce_lib/helper_spec.rb +2 -2
  44. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +2 -2
  45. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +2 -2
  46. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +10 -10
  47. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +12 -12
  48. data/spec/br_danfe/danfe_lib/nfce_spec.rb +2 -1
  49. data/spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb +4 -4
  50. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +178 -178
  51. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +274 -274
  52. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +77 -77
  53. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +23 -23
  54. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +37 -37
  55. data/spec/br_danfe/danfe_lib/nfe_lib/helper_spec.rb +34 -34
  56. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +19 -19
  57. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +240 -240
  58. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +3 -2
  59. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +16 -16
  60. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +13 -13
  61. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +76 -76
  62. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +40 -40
  63. data/spec/br_danfe/danfe_lib/nfe_lib/xprod_spec.rb +118 -118
  64. data/spec/br_danfe/danfe_spec.rb +2 -2
  65. data/spec/br_danfe/helper_spec.rb +26 -14
  66. data/spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb +35 -0
  67. data/spec/br_danfe/mdfe_lib/document_spec.rb +20 -0
  68. data/spec/br_danfe/mdfe_lib/drivers_spec.rb +88 -0
  69. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +69 -0
  70. data/spec/br_danfe/mdfe_lib/header_spec.rb +135 -0
  71. data/spec/br_danfe/mdfe_lib/mdfe_identification_spec.rb +104 -0
  72. data/spec/br_danfe/mdfe_lib/notes_spec.rb +97 -0
  73. data/spec/br_danfe/mdfe_lib/totalizer_spec.rb +63 -0
  74. data/spec/br_danfe/mdfe_lib/vehicles_spec.rb +66 -0
  75. data/spec/br_danfe/mdfe_spec.rb +45 -0
  76. data/spec/br_danfe/qr_code_spec.rb +31 -0
  77. data/spec/br_danfe/xml_spec.rb +6 -6
  78. data/spec/fixtures/mdfe/lib/document#render.pdf +0 -0
  79. data/spec/fixtures/mdfe/lib/document#text.align.pdf +0 -0
  80. data/spec/fixtures/mdfe/lib/document#text.pad.pdf +0 -0
  81. data/spec/fixtures/mdfe/lib/document#text.simple.pdf +0 -0
  82. data/spec/fixtures/mdfe/lib/document#text.size.pdf +0 -0
  83. data/spec/fixtures/mdfe/lib/document#text.style.pdf +0 -0
  84. data/spec/fixtures/mdfe/lib/fisco_control#barcode.pdf +0 -0
  85. data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
  86. data/spec/fixtures/mdfe/lib/header#render-qr-code.pdf +0 -0
  87. data/spec/fixtures/mdfe/lib/header#render-with_logo.pdf +0 -0
  88. data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
  89. data/spec/fixtures/mdfe/lib/header#render-without_logo.pdf +0 -0
  90. data/spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf +1945 -0
  91. data/spec/fixtures/mdfe/lib/mdfe.fixture.pdf +1286 -0
  92. data/spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf +1943 -0
  93. data/spec/fixtures/mdfe/lib/xml-mdfe-multiples-pages.xml +116 -0
  94. data/spec/fixtures/mdfe/lib/xml-mdfe.xml +250 -0
  95. data/spec/fixtures/nfce/lib/document#render.pdf +12 -23
  96. data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
  97. data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
  98. data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
  99. data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
  100. data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
  101. data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
  102. data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
  103. data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
  104. data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
  105. data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
  106. data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
  107. data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
  108. data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
  109. data/spec/fixtures/nfce/lib/product_list_with_many_products_and_long_names.xml +2 -2
  110. data/spec/fixtures/nfce/lib/product_list_with_single_product_and_long_name.xml +1 -1
  111. data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
  112. data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
  113. data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
  114. data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
  115. data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
  116. data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
  117. data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
  118. data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
  119. data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
  120. data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
  121. data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +568 -447
  122. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
  123. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
  124. data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
  125. data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
  126. data/spec/fixtures/qr_code/qr_code#render.pdf +0 -0
  127. data/spec/spec_helper.rb +1 -1
  128. metadata +118 -48
  129. data/lib/br_danfe/danfe_lib/nfce_lib/qr_code.rb +0 -25
  130. data/lib/br_danfe/danfe_lib/nfe_lib/cep.rb +0 -11
  131. data/spec/br_danfe/danfe_lib/nfce_lib/qr_code_spec.rb +0 -35
  132. data/spec/br_danfe/danfe_lib/nfe_lib/cep_spec.rb +0 -10
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'simplecov'
2
- SimpleCov.start
2
+ SimpleCov.start unless ENV["NO_COVERAGE"]
3
3
 
4
4
  require "bundler/setup"
5
5
  require "br_danfe"
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.15.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ASSEINFO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-19 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: barby
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.1.1
103
+ version: 2.1.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.1.1
110
+ version: 2.1.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: byebug
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -123,134 +123,168 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: 11.1.3
125
125
  - !ruby/object:Gem::Dependency
126
- name: rake
126
+ name: guard
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '='
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 13.0.1
131
+ version: 2.18.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '='
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 13.0.1
138
+ version: 2.18.0
139
139
  - !ruby/object:Gem::Dependency
140
- name: rspec
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pdf-inspector
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.3.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.3.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: rake
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
171
  - - '='
144
172
  - !ruby/object:Gem::Version
145
- version: 3.10.0
173
+ version: 13.0.6
146
174
  type: :development
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
178
  - - '='
151
179
  - !ruby/object:Gem::Version
152
- version: 3.10.0
180
+ version: 13.0.6
153
181
  - !ruby/object:Gem::Dependency
154
- name: rubocop
182
+ name: rspec
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
185
  - - '='
158
186
  - !ruby/object:Gem::Version
159
- version: 0.67.0
187
+ version: 3.10.0
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
192
  - - '='
165
193
  - !ruby/object:Gem::Version
166
- version: 0.67.0
194
+ version: 3.10.0
167
195
  - !ruby/object:Gem::Dependency
168
- name: rubocop-performance
196
+ name: rubocop
169
197
  requirement: !ruby/object:Gem::Requirement
170
198
  requirements:
171
199
  - - "~>"
172
200
  - !ruby/object:Gem::Version
173
- version: 1.1.0
201
+ version: 0.93.1
174
202
  type: :development
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
206
  - - "~>"
179
207
  - !ruby/object:Gem::Version
180
- version: 1.1.0
208
+ version: 0.93.1
181
209
  - !ruby/object:Gem::Dependency
182
- name: simplecov
210
+ name: rubocop-performance
183
211
  requirement: !ruby/object:Gem::Requirement
184
212
  requirements:
185
- - - '='
213
+ - - "~>"
186
214
  - !ruby/object:Gem::Version
187
- version: 0.17.1
215
+ version: 1.10.2
188
216
  type: :development
189
217
  prerelease: false
190
218
  version_requirements: !ruby/object:Gem::Requirement
191
219
  requirements:
192
- - - '='
220
+ - - "~>"
193
221
  - !ruby/object:Gem::Version
194
- version: 0.17.1
222
+ version: 1.10.2
195
223
  - !ruby/object:Gem::Dependency
196
- name: simplecov-html
224
+ name: rubocop-rspec
197
225
  requirement: !ruby/object:Gem::Requirement
198
226
  requirements:
199
- - - '='
227
+ - - "~>"
200
228
  - !ruby/object:Gem::Version
201
- version: 0.10.2
229
+ version: 1.44.1
202
230
  type: :development
203
231
  prerelease: false
204
232
  version_requirements: !ruby/object:Gem::Requirement
205
233
  requirements:
206
- - - '='
234
+ - - "~>"
207
235
  - !ruby/object:Gem::Version
208
- version: 0.10.2
236
+ version: 1.44.1
209
237
  - !ruby/object:Gem::Dependency
210
- name: guard
238
+ name: simplecov
211
239
  requirement: !ruby/object:Gem::Requirement
212
240
  requirements:
213
- - - "~>"
241
+ - - '='
214
242
  - !ruby/object:Gem::Version
215
- version: 2.16.2
243
+ version: 0.17.1
216
244
  type: :development
217
245
  prerelease: false
218
246
  version_requirements: !ruby/object:Gem::Requirement
219
247
  requirements:
220
- - - "~>"
248
+ - - '='
221
249
  - !ruby/object:Gem::Version
222
- version: 2.16.2
250
+ version: 0.17.1
223
251
  - !ruby/object:Gem::Dependency
224
- name: guard-rspec
252
+ name: simplecov-html
225
253
  requirement: !ruby/object:Gem::Requirement
226
254
  requirements:
227
- - - ">="
255
+ - - '='
228
256
  - !ruby/object:Gem::Version
229
- version: '0'
257
+ version: 0.10.2
230
258
  type: :development
231
259
  prerelease: false
232
260
  version_requirements: !ruby/object:Gem::Requirement
233
261
  requirements:
234
- - - ">="
262
+ - - '='
235
263
  - !ruby/object:Gem::Version
236
- version: '0'
237
- description:
264
+ version: 0.10.2
265
+ description:
238
266
  email: asseinfo@asseinfo.com.br
239
- executables: []
267
+ executables:
268
+ - _guard-core
269
+ - guard
240
270
  extensions: []
241
271
  extra_rdoc_files: []
242
272
  files:
243
273
  - ".circleci/config.yml"
244
274
  - ".codeclimate.yml"
275
+ - ".github/dependabot.yml"
245
276
  - ".gitignore"
246
277
  - ".rspec"
247
278
  - ".rubocop.yml"
279
+ - ".tool-versions"
248
280
  - Dockerfile
249
281
  - Gemfile
250
282
  - Gemfile.lock
251
283
  - Guardfile
252
284
  - README.md
253
285
  - Rakefile
286
+ - bin/_guard-core
287
+ - bin/guard
254
288
  - br_danfe.gemspec
255
289
  - config/locales/pt-BR.yml
256
290
  - docker-compose.yml
@@ -278,11 +312,9 @@ files:
278
312
  - lib/br_danfe/danfe_lib/nfce_lib/key.rb
279
313
  - lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb
280
314
  - lib/br_danfe/danfe_lib/nfce_lib/product_list.rb
281
- - lib/br_danfe/danfe_lib/nfce_lib/qr_code.rb
282
315
  - lib/br_danfe/danfe_lib/nfce_lib/recipient.rb
283
316
  - lib/br_danfe/danfe_lib/nfce_lib/total_list.rb
284
317
  - lib/br_danfe/danfe_lib/nfe.rb
285
- - lib/br_danfe/danfe_lib/nfe_lib/cep.rb
286
318
  - lib/br_danfe/danfe_lib/nfe_lib/consts.rb
287
319
  - lib/br_danfe/danfe_lib/nfe_lib/cst.rb
288
320
  - lib/br_danfe/danfe_lib/nfe_lib/dest.rb
@@ -305,6 +337,17 @@ files:
305
337
  - lib/br_danfe/helper.rb
306
338
  - lib/br_danfe/logo_config.rb
307
339
  - lib/br_danfe/logo_options.rb
340
+ - lib/br_danfe/mdfe.rb
341
+ - lib/br_danfe/mdfe_lib/authorization_protocol.rb
342
+ - lib/br_danfe/mdfe_lib/document.rb
343
+ - lib/br_danfe/mdfe_lib/drivers.rb
344
+ - lib/br_danfe/mdfe_lib/fisco_control.rb
345
+ - lib/br_danfe/mdfe_lib/header.rb
346
+ - lib/br_danfe/mdfe_lib/mdfe_identification.rb
347
+ - lib/br_danfe/mdfe_lib/notes.rb
348
+ - lib/br_danfe/mdfe_lib/totalizer.rb
349
+ - lib/br_danfe/mdfe_lib/vehicles.rb
350
+ - lib/br_danfe/qr_code.rb
308
351
  - lib/br_danfe/uf.rb
309
352
  - lib/br_danfe/version.rb
310
353
  - lib/br_danfe/xml.rb
@@ -325,11 +368,9 @@ files:
325
368
  - spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
326
369
  - spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb
327
370
  - spec/br_danfe/danfe_lib/nfce_lib/product_list_spec.rb
328
- - spec/br_danfe/danfe_lib/nfce_lib/qr_code_spec.rb
329
371
  - spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb
330
372
  - spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb
331
373
  - spec/br_danfe/danfe_lib/nfce_spec.rb
332
- - spec/br_danfe/danfe_lib/nfe_lib/cep_spec.rb
333
374
  - spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
334
375
  - spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb
335
376
  - spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb
@@ -352,6 +393,17 @@ files:
352
393
  - spec/br_danfe/helper_spec.rb
353
394
  - spec/br_danfe/logo_config_spec.rb
354
395
  - spec/br_danfe/logo_options_spec.rb
396
+ - spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
397
+ - spec/br_danfe/mdfe_lib/document_spec.rb
398
+ - spec/br_danfe/mdfe_lib/drivers_spec.rb
399
+ - spec/br_danfe/mdfe_lib/fisco_control_spec.rb
400
+ - spec/br_danfe/mdfe_lib/header_spec.rb
401
+ - spec/br_danfe/mdfe_lib/mdfe_identification_spec.rb
402
+ - spec/br_danfe/mdfe_lib/notes_spec.rb
403
+ - spec/br_danfe/mdfe_lib/totalizer_spec.rb
404
+ - spec/br_danfe/mdfe_lib/vehicles_spec.rb
405
+ - spec/br_danfe/mdfe_spec.rb
406
+ - spec/br_danfe/qr_code_spec.rb
355
407
  - spec/br_danfe/uf_spec.rb
356
408
  - spec/br_danfe/xml_spec.rb
357
409
  - spec/fixtures/cce/lib/barcode#render.pdf
@@ -370,6 +422,23 @@ files:
370
422
  - spec/fixtures/cce/v1.00/cce.fixture.pdf
371
423
  - spec/fixtures/cce/v1.00/cce.xml
372
424
  - spec/fixtures/logo.png
425
+ - spec/fixtures/mdfe/lib/document#render.pdf
426
+ - spec/fixtures/mdfe/lib/document#text.align.pdf
427
+ - spec/fixtures/mdfe/lib/document#text.pad.pdf
428
+ - spec/fixtures/mdfe/lib/document#text.simple.pdf
429
+ - spec/fixtures/mdfe/lib/document#text.size.pdf
430
+ - spec/fixtures/mdfe/lib/document#text.style.pdf
431
+ - spec/fixtures/mdfe/lib/fisco_control#barcode.pdf
432
+ - spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf
433
+ - spec/fixtures/mdfe/lib/header#render-qr-code.pdf
434
+ - spec/fixtures/mdfe/lib/header#render-with_logo.pdf
435
+ - spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf
436
+ - spec/fixtures/mdfe/lib/header#render-without_logo.pdf
437
+ - spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf
438
+ - spec/fixtures/mdfe/lib/mdfe.fixture.pdf
439
+ - spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf
440
+ - spec/fixtures/mdfe/lib/xml-mdfe-multiples-pages.xml
441
+ - spec/fixtures/mdfe/lib/xml-mdfe.xml
373
442
  - spec/fixtures/nfce/lib/document#render.pdf
374
443
  - spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf
375
444
  - spec/fixtures/nfce/lib/footer#render.pdf
@@ -484,13 +553,14 @@ files:
484
553
  - spec/fixtures/nfe/v3.10/with_three_pages.xml
485
554
  - spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf
486
555
  - spec/fixtures/nfe/v3.10/without_issqn.xml
556
+ - spec/fixtures/qr_code/qr_code#render.pdf
487
557
  - spec/spec_helper.rb
488
558
  - spec/support/have_same_content_of.rb
489
559
  homepage: http://github.com/asseinfo/br_danfe
490
560
  licenses:
491
561
  - MIT
492
562
  metadata: {}
493
- post_install_message:
563
+ post_install_message:
494
564
  rdoc_options: []
495
565
  require_paths:
496
566
  - lib
@@ -498,7 +568,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
498
568
  requirements:
499
569
  - - ">="
500
570
  - !ruby/object:Gem::Version
501
- version: 2.5.1
571
+ version: '2.6'
502
572
  required_rubygems_version: !ruby/object:Gem::Requirement
503
573
  requirements:
504
574
  - - ">="
@@ -506,7 +576,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
506
576
  version: '0'
507
577
  requirements: []
508
578
  rubygems_version: 3.1.6
509
- signing_key:
579
+ signing_key:
510
580
  specification_version: 4
511
581
  summary: DANFE pdf generator for Brazilian invoices.
512
582
  test_files: []
@@ -1,25 +0,0 @@
1
- module BrDanfe
2
- module DanfeLib
3
- module NfceLib
4
- class QrCode
5
- require 'rqrcode'
6
- require 'chunky_png'
7
- require 'tempfile'
8
-
9
- def initialize(pdf, xml)
10
- @pdf = pdf
11
- @xml = xml
12
- end
13
-
14
- def render
15
- qrcode = RQRCode::QRCode.new(@xml['qrCode'])
16
- image = Tempfile.new(%w[qrcode png], binmode: true)
17
- image.write(qrcode.as_png(module_px_size: 12).to_s)
18
-
19
- box_size = 3.cm
20
- @pdf.image image, width: box_size, height: box_size, position: :center
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,11 +0,0 @@
1
- module BrDanfe
2
- module DanfeLib
3
- module NfeLib
4
- class Cep
5
- def self.format(cep)
6
- cep.sub(/(\d{2})(\d{3})(\d{3})/, '\\1.\\2-\\3')
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe BrDanfe::DanfeLib::NfceLib::QrCode do
4
- let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
- let(:output_pdf) { "#{base_dir}output.pdf" }
6
-
7
- let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
8
-
9
- let(:xml) do
10
- xml = <<-eos
11
- <infNFeSupl>
12
- <qrCode><![CDATA[http://sistemas.sefaz.am.gov.br/nfceweb/consultarNFCe.jsp?p=13130901144012000152651231234567891123456786|2|2|1|A604FD51E40ED8465B787B3E9CF8C1D90E61DB13]]></qrCode>
13
- <urlChave>www.sefaz.am.gov.br/nfce/consulta</urlChave>
14
- </infNFeSupl>
15
- eos
16
-
17
- BrDanfe::XML.new(xml)
18
- end
19
-
20
- subject { described_class.new pdf, xml }
21
-
22
- describe '#render' do
23
- before do
24
- subject.render
25
- File.delete(output_pdf) if File.exist?(output_pdf)
26
- end
27
-
28
- it 'renders qr-code to the pdf' do
29
- expect(File.exist?(output_pdf)).to be_falsey
30
- pdf.render_file output_pdf
31
-
32
- expect("#{base_dir}qr_code#render.pdf").to have_same_content_of file: output_pdf
33
- end
34
- end
35
- end
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe BrDanfe::DanfeLib::NfeLib::Cep do
4
- describe '.format' do
5
- it 'returns a formated CEP' do
6
- cep = '12345678'
7
- expect(BrDanfe::DanfeLib::NfeLib::Cep.format(cep)).to eq '12.345-678'
8
- end
9
- end
10
- end