br_danfe 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -25
  3. data/Gemfile.lock +1 -1
  4. data/README.md +5 -5
  5. data/lib/br_danfe.rb +0 -1
  6. data/lib/br_danfe/danfe.rb +6 -90
  7. data/lib/br_danfe/danfe_lib/base.rb +33 -0
  8. data/lib/br_danfe/danfe_lib/nfce.rb +49 -0
  9. data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +37 -0
  10. data/lib/br_danfe/danfe_lib/nfce_lib/footer.rb +22 -0
  11. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +69 -0
  12. data/lib/br_danfe/danfe_lib/nfce_lib/helper.rb +11 -0
  13. data/lib/br_danfe/danfe_lib/nfce_lib/key.rb +20 -0
  14. data/lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb +22 -0
  15. data/lib/br_danfe/danfe_lib/nfce_lib/product_list.rb +102 -0
  16. data/lib/br_danfe/danfe_lib/nfce_lib/qr_code.rb +25 -0
  17. data/lib/br_danfe/danfe_lib/nfce_lib/recipient.rb +75 -0
  18. data/lib/br_danfe/danfe_lib/nfce_lib/total_list.rb +81 -0
  19. data/lib/br_danfe/danfe_lib/nfe.rb +83 -0
  20. data/lib/br_danfe/danfe_lib/nfe_lib/cep.rb +11 -0
  21. data/lib/br_danfe/danfe_lib/nfe_lib/consts.rb +8 -0
  22. data/lib/br_danfe/danfe_lib/nfe_lib/cst.rb +34 -0
  23. data/lib/br_danfe/danfe_lib/nfe_lib/dest.rb +96 -0
  24. data/lib/br_danfe/danfe_lib/nfe_lib/det_body.rb +137 -0
  25. data/lib/br_danfe/danfe_lib/nfe_lib/document.rb +142 -0
  26. data/lib/br_danfe/danfe_lib/nfe_lib/dup.rb +55 -0
  27. data/lib/br_danfe/danfe_lib/nfe_lib/emit_header.rb +117 -0
  28. data/lib/br_danfe/danfe_lib/nfe_lib/helper.rb +55 -0
  29. data/lib/br_danfe/danfe_lib/nfe_lib/icmstot.rb +35 -0
  30. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +109 -0
  31. data/lib/br_danfe/danfe_lib/nfe_lib/infadic_vol.rb +103 -0
  32. data/lib/br_danfe/danfe_lib/nfe_lib/issqn.rb +37 -0
  33. data/lib/br_danfe/danfe_lib/nfe_lib/phone.rb +15 -0
  34. data/lib/br_danfe/danfe_lib/nfe_lib/plate.rb +11 -0
  35. data/lib/br_danfe/danfe_lib/nfe_lib/ticket.rb +21 -0
  36. data/lib/br_danfe/danfe_lib/nfe_lib/transp.rb +58 -0
  37. data/lib/br_danfe/danfe_lib/nfe_lib/vol.rb +44 -0
  38. data/lib/br_danfe/danfe_lib/nfe_lib/xprod.rb +109 -0
  39. data/lib/br_danfe/helper.rb +8 -0
  40. data/lib/br_danfe/version.rb +1 -1
  41. data/spec/{lib → br_danfe}/cce_lib/barcode_spec.rb +0 -0
  42. data/spec/{lib → br_danfe}/cce_lib/correction_spec.rb +0 -0
  43. data/spec/{lib → br_danfe}/cce_lib/document_spec.rb +0 -0
  44. data/spec/{lib → br_danfe}/cce_lib/footer_spec.rb +0 -0
  45. data/spec/{lib → br_danfe}/cce_lib/header_spec.rb +0 -0
  46. data/spec/{lib → br_danfe}/cce_lib/nfe_key_spec.rb +0 -0
  47. data/spec/{lib → br_danfe}/cce_lib/protocol_spec.rb +0 -0
  48. data/spec/{features → br_danfe}/cce_spec.rb +0 -0
  49. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/document_spec.rb +2 -2
  50. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/footer_spec.rb +2 -2
  51. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/header_spec.rb +2 -2
  52. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/helper_spec.rb +1 -1
  53. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/key_spec.rb +2 -2
  54. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/nfce_identification_spec.rb +2 -2
  55. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/product_list_spec.rb +2 -2
  56. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/qr_code_spec.rb +2 -2
  57. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/recipient_spec.rb +7 -7
  58. data/spec/{lib/danfe_nfce_lib → br_danfe/danfe_lib/nfce_lib}/total_list_spec.rb +4 -4
  59. data/spec/br_danfe/danfe_lib/nfce_spec.rb +57 -0
  60. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/cep_spec.rb +2 -2
  61. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/cst_spec.rb +3 -3
  62. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/dest_spec.rb +2 -2
  63. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/det_body_spec.rb +2 -2
  64. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/document_spec.rb +1 -1
  65. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/dup_spec.rb +2 -2
  66. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/emit_header_spec.rb +3 -3
  67. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/helper_spec.rb +13 -87
  68. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/icmstot_spec.rb +2 -2
  69. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/infadic_spec.rb +2 -2
  70. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/infadic_vol_spec.rb +2 -2
  71. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/issqn_spec.rb +2 -2
  72. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/phone_spec.rb +3 -3
  73. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/plate_spec.rb +3 -3
  74. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/ticket_spec.rb +2 -2
  75. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/transp_spec.rb +2 -2
  76. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/vol_spec.rb +2 -2
  77. data/spec/{lib/danfe_lib → br_danfe/danfe_lib/nfe_lib}/xprod_spec.rb +9 -9
  78. data/spec/{features/danfe_spec.rb → br_danfe/danfe_lib/nfe_spec.rb} +55 -47
  79. data/spec/br_danfe/danfe_spec.rb +35 -0
  80. data/spec/{lib → br_danfe}/helper_spec.rb +114 -0
  81. data/spec/{lib → br_danfe}/logo_config_spec.rb +1 -1
  82. data/spec/{lib → br_danfe}/logo_options_spec.rb +7 -7
  83. data/spec/{lib → br_danfe}/uf_spec.rb +0 -0
  84. data/spec/{lib → br_danfe}/xml_spec.rb +0 -0
  85. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
  86. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.xml +358 -0
  87. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
  88. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.xml +358 -0
  89. data/spec/fixtures/nfce/v4.00/nfce.xml +2 -2
  90. data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
  91. data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
  92. metadata +82 -75
  93. data/lib/br_danfe/danfe_lib/cep.rb +0 -9
  94. data/lib/br_danfe/danfe_lib/consts.rb +0 -6
  95. data/lib/br_danfe/danfe_lib/cst.rb +0 -32
  96. data/lib/br_danfe/danfe_lib/dest.rb +0 -94
  97. data/lib/br_danfe/danfe_lib/det_body.rb +0 -135
  98. data/lib/br_danfe/danfe_lib/document.rb +0 -140
  99. data/lib/br_danfe/danfe_lib/dup.rb +0 -53
  100. data/lib/br_danfe/danfe_lib/emit_header.rb +0 -115
  101. data/lib/br_danfe/danfe_lib/helper.rb +0 -61
  102. data/lib/br_danfe/danfe_lib/icmstot.rb +0 -33
  103. data/lib/br_danfe/danfe_lib/infadic.rb +0 -107
  104. data/lib/br_danfe/danfe_lib/infadic_vol.rb +0 -101
  105. data/lib/br_danfe/danfe_lib/issqn.rb +0 -35
  106. data/lib/br_danfe/danfe_lib/phone.rb +0 -13
  107. data/lib/br_danfe/danfe_lib/plate.rb +0 -9
  108. data/lib/br_danfe/danfe_lib/ticket.rb +0 -19
  109. data/lib/br_danfe/danfe_lib/transp.rb +0 -56
  110. data/lib/br_danfe/danfe_lib/vol.rb +0 -42
  111. data/lib/br_danfe/danfe_lib/xprod.rb +0 -107
  112. data/lib/br_danfe/danfe_nfce.rb +0 -43
  113. data/lib/br_danfe/danfe_nfce_lib/document.rb +0 -35
  114. data/lib/br_danfe/danfe_nfce_lib/footer.rb +0 -20
  115. data/lib/br_danfe/danfe_nfce_lib/header.rb +0 -67
  116. data/lib/br_danfe/danfe_nfce_lib/helper.rb +0 -9
  117. data/lib/br_danfe/danfe_nfce_lib/key.rb +0 -18
  118. data/lib/br_danfe/danfe_nfce_lib/nfce_identification.rb +0 -20
  119. data/lib/br_danfe/danfe_nfce_lib/product_list.rb +0 -100
  120. data/lib/br_danfe/danfe_nfce_lib/qr_code.rb +0 -23
  121. data/lib/br_danfe/danfe_nfce_lib/recipient.rb +0 -72
  122. data/lib/br_danfe/danfe_nfce_lib/total_list.rb +0 -78
  123. data/spec/features/danfe_nfce_spec.rb +0 -31
@@ -0,0 +1,15 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Phone
5
+ def self.format(phone)
6
+ if phone.length == 10
7
+ phone.sub(/(\d{2})(\d{4})(\d{4})/, '(\\1) \\2-\\3')
8
+ else
9
+ phone.sub(/(\d{2})(\d{5})(\d{4})/, '(\\1) \\2-\\3')
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Plate
5
+ def self.format(plate)
6
+ plate.delete('-').sub(/([A-Za-z]{3})/, '\\1-')
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Ticket
5
+ def initialize(pdf, xml)
6
+ @pdf = pdf
7
+ @xml = xml
8
+ end
9
+
10
+ def render
11
+ @pdf.ibox 0.85, 15.60, 0.75, 1.85, I18n.t('danfe.ticket.xNome', xNome: @xml['emit/xNome'])
12
+ @pdf.ibox 0.85, 3.85, 0.75, 2.7, I18n.t('danfe.ticket.received_at')
13
+ @pdf.ibox 0.85, 11.75, 4.60, 2.7, I18n.t('danfe.ticket.receiver')
14
+ @pdf.ibox 1.70, 4.00, 16.35, 1.85, '',
15
+ I18n.t('danfe.ticket.document', nNF: @xml['ide/nNF'], serie: @xml['ide/serie']),
16
+ align: :center, valign: :center
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,58 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Transp
5
+ Y = 15.89 + SPACE_BETWEEN_GROUPS
6
+
7
+ def initialize(pdf, xml)
8
+ @pdf = pdf
9
+ @xml = xml
10
+
11
+ @ltitle = Y - 0.42
12
+ @l1 = Y
13
+ @l2 = Y + LINE_HEIGHT
14
+ end
15
+
16
+ def render
17
+ @pdf.ititle 0.42, 10.00, 0.75, @ltitle, 'transporta.title'
18
+
19
+ @pdf.lbox LINE_HEIGHT, 8.52, 0.75, @l1, @xml, 'transporta/xNome'
20
+ @pdf.i18n_lbox LINE_HEIGHT, 2.79, 9.27, @l1, 'transp.modFrete.title', mod_frete
21
+ @pdf.lbox LINE_HEIGHT, 1.78, 12.06, @l1, @xml, 'veicTransp/RNTC'
22
+ @pdf.i18n_lbox LINE_HEIGHT, 2.29, 13.84, @l1, 'veicTransp.placa', plate
23
+ @pdf.lbox LINE_HEIGHT, 0.76, 16.13, @l1, @xml, 'veicTransp/UF'
24
+ @pdf.lcnpj LINE_HEIGHT, 3.44, 16.89, @l1, @xml, 'transporta/CNPJ'
25
+ @pdf.lbox LINE_HEIGHT, 8.52, 0.75, @l2, @xml, 'transporta/xEnder'
26
+ @pdf.lbox LINE_HEIGHT, 6.86, 9.27, @l2, @xml, 'transporta/xMun'
27
+ @pdf.lbox LINE_HEIGHT, 0.76, 16.13, @l2, @xml, 'transporta/UF'
28
+ @pdf.lie LINE_HEIGHT, 3.44, 16.89, @l2, @xml, 'transporta/UF', 'transporta/IE'
29
+ end
30
+
31
+ private
32
+
33
+ def plate
34
+ Plate.format(@xml['veicTransp/placa'])
35
+ end
36
+
37
+ def mod_frete
38
+ case @xml['transp/modFrete']
39
+ when '0'
40
+ modality = 'emitter'
41
+ when '1'
42
+ modality = 'recipient'
43
+ when '2'
44
+ modality = 'third_party'
45
+ when '3'
46
+ modality = 'own_emitter'
47
+ when '4'
48
+ modality = 'own_recipient'
49
+ when '9'
50
+ modality = 'no_freight'
51
+ end
52
+
53
+ I18n.t("danfe.transp.modFrete.#{modality}")
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,44 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Vol
5
+ Y = 18.01
6
+
7
+ def initialize(pdf, xml)
8
+ @pdf = pdf
9
+ @xml = xml
10
+
11
+ @l1 = Y
12
+ end
13
+
14
+ def render
15
+ nVol = 0
16
+
17
+ @xml.collect('xmlns', 'vol') do |det|
18
+ nVol += 1
19
+ render_vol(det) if nVol < 2
20
+ end
21
+
22
+ render_blank_boxes if nVol.zero?
23
+
24
+ nVol
25
+ end
26
+
27
+ private
28
+
29
+ def render_vol(det)
30
+ @pdf.ibox 0.85, 2.42, 0.75, @l1, I18n.t('danfe.vol.qVol'), det.css('qVol').text
31
+ @pdf.ibox 0.85, 3.05, 3.17, @l1, I18n.t('danfe.vol.esp'), det.css('esp').text
32
+ @pdf.ibox 0.85, 3.05, 6.22, @l1, I18n.t('danfe.vol.marca'), det.css('marca').text
33
+ @pdf.ibox 0.85, 4.83, 9.27, @l1, I18n.t('danfe.vol.nVol')
34
+ @pdf.inumeric 0.85, 3.43, 14.10, @l1, 'vol.pesoB', det.css('pesoB').text, decimals: 3
35
+ @pdf.inumeric 0.85, 2.80, 17.53, @l1, 'vol.pesoL', det.css('pesoL').text, decimals: 3
36
+ end
37
+
38
+ def render_blank_boxes
39
+ render_vol(@xml)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,109 @@
1
+ module BrDanfe
2
+ module DanfeLib
3
+ module NfeLib
4
+ class Xprod
5
+ def initialize(det)
6
+ @det = det
7
+ end
8
+
9
+ def render
10
+ xprod = @det.css('prod/xProd').text.to_s
11
+
12
+ xprod += infAdProd if infAdProd?
13
+ xprod += fci if fci?
14
+ xprod += icms_st if icms_st?
15
+ xprod += fcp if fcp?
16
+ xprod += fcp_st if fcp_st?
17
+ xprod += add_icms_st_ret_to_product
18
+
19
+ xprod
20
+ end
21
+
22
+ private
23
+
24
+ def infAdProd
25
+ "\n#{@det.css('infAdProd').text}"
26
+ end
27
+
28
+ def infAdProd?
29
+ !@det.css('infAdProd').text.empty?
30
+ end
31
+
32
+ def fci
33
+ "\n#{I18n.t('danfe.det.prod.xProdFCI',
34
+ nFCI: @det.css('prod/nFCI').text)}"
35
+ end
36
+
37
+ def fci?
38
+ !@det.css('prod/nFCI').text.empty?
39
+ end
40
+
41
+ def icms_st
42
+ "\n#{I18n.t('danfe.det.prod.xProdST',
43
+ pMVAST: BrDanfe::Helper.numerify(@det.css('ICMS/*/pMVAST').text),
44
+ pICMSST: BrDanfe::Helper.numerify(@det.css('ICMS/*/pICMSST').text),
45
+ vBCST: BrDanfe::Helper.numerify(@det.css('ICMS/*/vBCST').text),
46
+ vICMSST: BrDanfe::Helper.numerify(@det.css('ICMS/*/vICMSST').text))}"
47
+ end
48
+
49
+ def icms_st?
50
+ @det.css('ICMS/*/vBCST').text.to_i.positive?
51
+ end
52
+
53
+ def fcp?
54
+ @det.css('ICMS/*/vFCP').text.to_i.positive?
55
+ end
56
+
57
+ def fcp
58
+ icms00? ? fcp_for_icms00 : fcp_complete
59
+ end
60
+
61
+ def icms00?
62
+ @det.at_css('ICMS00')
63
+ end
64
+
65
+ def fcp_for_icms00
66
+ "\n#{I18n.t('danfe.det.prod.xProdFCPICMS00',
67
+ vFCP: BrDanfe::Helper.numerify(@det.css('ICMS00/vFCP').text),
68
+ pFCP: BrDanfe::Helper.numerify(@det.css('ICMS00/pFCP').text))}"
69
+ end
70
+
71
+ def fcp_complete
72
+ "\n#{I18n.t('danfe.det.prod.xProdFCP',
73
+ vBCFCP: BrDanfe::Helper.numerify(@det.css('ICMS/*/vBCFCP').text),
74
+ vFCP: BrDanfe::Helper.numerify(@det.css('ICMS/*/vFCP').text),
75
+ pFCP: BrDanfe::Helper.numerify(@det.css('ICMS/*/pFCP').text))}"
76
+ end
77
+
78
+ def fcp_st?
79
+ @det.css('ICMS/*/vFCPST').text.to_i.positive?
80
+ end
81
+
82
+ def fcp_st
83
+ "\n#{I18n.t('danfe.det.prod.xProdFCPST',
84
+ vBCFCPST: BrDanfe::Helper.numerify(@det.css('ICMS/*/vBCFCPST').text),
85
+ pFCPST: BrDanfe::Helper.numerify(@det.css('ICMS/*/pFCPST').text),
86
+ vFCPST: BrDanfe::Helper.numerify(@det.css('ICMS/*/vFCPST').text))}"
87
+ end
88
+
89
+ def add_icms_st_ret_to_product
90
+ icms_st_ret? ? icms_st_ret : ''
91
+ end
92
+
93
+ def icms_st_ret?
94
+ @det.css('ICMS/*/vBCSTRet').text.to_i.positive? || @det.css('ICMS/*/vICMSSTRet').text.to_i.positive? ||
95
+ @det.css('ICMS/*/pST').text.to_i.positive?
96
+ end
97
+
98
+ def icms_st_ret
99
+ "\n#{I18n.t(
100
+ 'danfe.det.prod.xProdSTRet',
101
+ vBCSTRet: BrDanfe::Helper.numerify(@det.css('ICMS/*/vBCSTRet').text),
102
+ vICMSSTRet: BrDanfe::Helper.numerify(@det.css('ICMS/*/vICMSSTRet').text),
103
+ pST: BrDanfe::Helper.numerify(@det.css('ICMS/*/pST').text)
104
+ )}"
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -1,9 +1,17 @@
1
1
  module BrDanfe
2
2
  class Helper
3
+ def self.no_fiscal_value?(xml)
4
+ homologation?(xml) || unauthorized?(xml)
5
+ end
6
+
3
7
  def self.homologation?(xml)
4
8
  xml.css('nfeProc/NFe/infNFe/ide/tpAmb').text == '2'
5
9
  end
6
10
 
11
+ def self.unauthorized?(xml)
12
+ xml.css('nfeProc/protNFe/infProt/dhRecbto').empty?
13
+ end
14
+
7
15
  def self.numerify(number)
8
16
  return '' if !number || number == ''
9
17
 
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = '0.12.1'.freeze
2
+ VERSION = '0.13.0'.freeze
3
3
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::ProductList do
3
+ describe BrDanfe::DanfeLib::NfceLib::ProductList do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
- let(:subject) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 1.8.cm) }
7
+ let(:subject) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 1.8.cm) }
8
8
 
9
9
  before { File.delete(output_pdf) if File.exist?(output_pdf) }
10
10
 
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::Footer do
3
+ describe BrDanfe::DanfeLib::NfceLib::Footer do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
7
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
8
8
 
9
9
  let(:xml_footer) do
10
10
  xml = <<-eos
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::Header do
3
+ describe BrDanfe::DanfeLib::NfceLib::Header do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
  let(:logo) { './spec/fixtures/logo.png' }
@@ -42,7 +42,7 @@ describe BrDanfe::DanfeNfceLib::Header do
42
42
  BrDanfe::XML.new(xml)
43
43
  end
44
44
 
45
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
45
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
46
46
 
47
47
  subject { described_class.new pdf, xml, logo, logo_options }
48
48
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::Helper do
3
+ describe BrDanfe::DanfeLib::NfceLib::Helper do
4
4
  let(:xml) do
5
5
  xml = <<-eos
6
6
  <enderDest>
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::Key do
3
+ describe BrDanfe::DanfeLib::NfceLib::Key do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
@@ -24,7 +24,7 @@ describe BrDanfe::DanfeNfceLib::Key do
24
24
  BrDanfe::XML.new(xml)
25
25
  end
26
26
 
27
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
27
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
28
28
 
29
29
  subject { described_class.new pdf, xml_key }
30
30
 
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::NfceIdentification do
3
+ describe BrDanfe::DanfeLib::NfceLib::NfceIdentification do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
7
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
8
8
 
9
9
  let(:xml) do
10
10
  xml = <<-eos
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::ProductList do
3
+ describe BrDanfe::DanfeLib::NfceLib::ProductList do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
  let(:xml) { BrDanfe::XML.new(File.read("#{base_dir}#{xml_name}.xml")) }
7
7
 
8
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
8
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
9
9
 
10
10
  subject { described_class.new pdf, xml }
11
11
 
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::QrCode do
3
+ describe BrDanfe::DanfeLib::NfceLib::QrCode do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
7
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
8
8
 
9
9
  let(:xml) do
10
10
  xml = <<-eos
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BrDanfe::DanfeNfceLib::Recipient do
3
+ describe BrDanfe::DanfeLib::NfceLib::Recipient do
4
4
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
5
5
  let(:output_pdf) { "#{base_dir}output.pdf" }
6
6
 
7
- let(:pdf) { BrDanfe::DanfeNfceLib::Document.new(8.cm, 5.cm) }
7
+ let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }
8
8
  let(:xml_recipient) { BrDanfe::XML.new(xml_as_string) }
9
9
 
10
10
  subject { described_class.new pdf, xml_recipient }
@@ -18,7 +18,7 @@ describe BrDanfe::DanfeNfceLib::Recipient do
18
18
  context 'when has identified recipient' do
19
19
  context 'when the recipient is a company' do
20
20
  let(:xml_as_string) do
21
- xml = <<-eos
21
+ <<-eos
22
22
  <nfeProc>
23
23
  <NFe>
24
24
  <dest>
@@ -47,7 +47,7 @@ describe BrDanfe::DanfeNfceLib::Recipient do
47
47
 
48
48
  context 'when the recipient is an individual person' do
49
49
  let(:xml_as_string) do
50
- xml = <<-eos
50
+ <<-eos
51
51
  <nfeProc>
52
52
  <NFe>
53
53
  <dest>
@@ -76,7 +76,7 @@ describe BrDanfe::DanfeNfceLib::Recipient do
76
76
 
77
77
  context 'when the recipient is a foreign' do
78
78
  let(:xml_as_string) do
79
- xml = <<-eos
79
+ <<-eos
80
80
  <nfeProc>
81
81
  <NFe>
82
82
  <dest>
@@ -105,7 +105,7 @@ describe BrDanfe::DanfeNfceLib::Recipient do
105
105
 
106
106
  context 'when the recipient does not have document' do
107
107
  let(:xml_as_string) do
108
- xml = <<-eos
108
+ <<-eos
109
109
  <nfeProc>
110
110
  <NFe>
111
111
  <dest>
@@ -134,7 +134,7 @@ describe BrDanfe::DanfeNfceLib::Recipient do
134
134
 
135
135
  context 'when does not have identified recipient' do
136
136
  let(:xml_as_string) do
137
- xml = <<-eos
137
+ <<-eos
138
138
  <nfeProc>
139
139
  <NFe>
140
140
  <dest>