cnab240 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/README.md +50 -4
  2. data/docs/vendor/febraban/subcpadr12_layout_padrao_V86.pdf +0 -0
  3. data/lib/cnab240/arquivo/arquivo.rb +10 -1
  4. data/lib/cnab240/arquivo/v40/header.rb +14 -14
  5. data/lib/cnab240/arquivo/v40/trailer.rb +5 -4
  6. data/lib/cnab240/arquivo/v86/header.rb +12 -12
  7. data/lib/cnab240/arquivo/v86/trailer.rb +3 -3
  8. data/lib/cnab240/ext/bindata.rb +1 -1
  9. data/lib/cnab240/ext/default_mixin.rb +2 -0
  10. data/lib/cnab240/ext/filler.rb +13 -0
  11. data/lib/cnab240/ext/lstring.rb +102 -0
  12. data/lib/cnab240/helper/pagamento_itau.rb +60 -0
  13. data/lib/cnab240/pagamentos/v40/header.rb +18 -18
  14. data/lib/cnab240/pagamentos/v40/trailer.rb +7 -7
  15. data/lib/cnab240/pagamentos/v86/header.rb +14 -14
  16. data/lib/cnab240/pagamentos/v86/titulos/header.rb +13 -13
  17. data/lib/cnab240/pagamentos/v86/titulos/trailer.rb +8 -8
  18. data/lib/cnab240/pagamentos/v86/trailer.rb +8 -8
  19. data/lib/cnab240/pagamentos/v86/tributos/header.rb +14 -14
  20. data/lib/cnab240/pagamentos/v86/tributos/trailer.rb +6 -6
  21. data/lib/cnab240/segmentos/v40/segmento_a.rb +28 -25
  22. data/lib/cnab240/segmentos/v86/segmento_a.rb +15 -15
  23. data/lib/cnab240/segmentos/v86/segmento_b.rb +16 -16
  24. data/lib/cnab240/segmentos/v86/segmento_c.rb +11 -11
  25. data/lib/cnab240/segmentos/v86/segmento_j.rb +14 -14
  26. data/lib/cnab240/segmentos/v86/segmento_j52.rb +11 -11
  27. data/lib/cnab240/segmentos/v86/segmento_n.rb +7 -7
  28. data/lib/cnab240/segmentos/v86/segmento_n1.rb +6 -6
  29. data/lib/cnab240/segmentos/v86/segmento_n2.rb +8 -8
  30. data/lib/cnab240/segmentos/v86/segmento_n3.rb +8 -8
  31. data/lib/cnab240/segmentos/v86/segmento_n4.rb +10 -10
  32. data/lib/cnab240/segmentos/v86/segmento_n5.rb +5 -5
  33. data/lib/cnab240/segmentos/v86/segmento_n6.rb +5 -5
  34. data/lib/cnab240/segmentos/v86/segmento_n7.rb +5 -5
  35. data/lib/cnab240/segmentos/v86/segmento_n8.rb +5 -5
  36. data/lib/cnab240/segmentos/v86/segmento_o.rb +9 -9
  37. data/lib/cnab240/segmentos/v86/segmento_w.rb +4 -4
  38. data/lib/cnab240/segmentos/v86/segmento_z.rb +3 -3
  39. data/lib/cnab240/version.rb +1 -1
  40. data/lib/cnab240.rb +7 -1
  41. data/spec/arquivo/arquivo_spec.rb +10 -0
  42. data/spec/bindata/bindata_spec.rb +17 -2
  43. data/spec/helper/pagamento_itau_spec.rb +55 -0
  44. data/spec/segmentos/v40/segmento_a_spec.rb +18 -13
  45. metadata +10 -5
  46. data/lib/cnab240/helper/remessa.rb +0 -29
data/README.md CHANGED
@@ -35,7 +35,8 @@ Ou adicione no seu chiqueiro:
35
35
 
36
36
  ## Como usar
37
37
 
38
- Por enquanto sem muita documentação (veja os testes).
38
+ Por enquanto sem muita documentação (veja os testes). Voce vai precisar ler os documentos da pasta docs para se situar, sao muitos campos com nomes bem parecidos. Utilize a documentação dos bancos/febraban como referência.
39
+
39
40
 
40
41
  Em algum lugar voce pode criar um arquivo de inicialização (não é obrigatório):
41
42
 
@@ -74,14 +75,59 @@ Ler do arquivo:
74
75
  arquivos = Arquivo::Arquivo.load_from_file("spec/tmp/arquivo.test") # array de objetos Arquivo
75
76
  puts arquivos[0].header
76
77
  ```
78
+
79
+ ### Usando Helpers
80
+
81
+ Voce pode usar os helpers que vao preencher os campos automaticamente, se possivel:
82
+
83
+ ```ruby
84
+ pagamento = PagamentoItau.new({
85
+ # header de arquivo
86
+ :empresa_tipo => '1',
87
+ :empresa_convenio => '1234',
88
+ :empresa_tipo => '2',
89
+ :empresa_numero => '01234567891234',
90
+ :empresa_nome => 'EMPRESA FULANA',
91
+ :empresa_agencia_codigo => '',
92
+ :empresa_conta_numero => '',
93
+ :empresa_agencia_conta_dv => '',
94
+ :arquivo_sequencia => '1'
95
+ })
96
+
97
+ pagamento.add({
98
+ # header do lote
99
+ :empresa_tipo => '2', # tipo empresa creditada
100
+ :empresa_numero => '999999999999', # cpf cnpj creditado
101
+ :empresa_convenio => '12345', # convenio junto ao banco
102
+ :empresa_agencia_codigo => '2290', # agencia creditada
103
+ :empresa_conta_numero => '33595', # conta creditada
104
+ :empresa_agencia_conta_dv => '9', # dv conta agencia
105
+ :empresa_nome => 'ZECA URUBU',
106
+ :endereco_logradouro => 'AV BRASIL',
107
+ :endereco_numero => '123',
108
+ :endereco_cidade => 'RIO DE JANEIRO',
109
+ :endereco_cep => '12123412',
110
+ :endereco_estado => 'RJ',
111
+ # segmento a
112
+ :favorecido_agencia_codigo => '1234', # agencia do debitado
113
+ :favorecido_conta_numero => '12345', # conta do debitado
114
+ :favorecido_agencia_conta_dv => '1', # dv agencia e conta
115
+ :favorecido_nome => 'EMPRESA X', # nome do debitado
116
+ :credito_seu_numero => '1234',
117
+ :data => '30122012',
118
+ :valor => '100',
119
+ :numero_inscricao => '12345678901234' # cpf ou cnpj do debitado
120
+ })
121
+
122
+ pagamento.save_to_file("spec/tmp/arquivo_itau.test")
123
+ ```
77
124
 
78
125
  ## Considerações
79
126
 
80
- - Tudo string. O arquivo é de strings, a implementação também.
127
+ - Tudo string. O arquivo é de strings, a implementação também;
128
+ - Padding é automático.
81
129
 
82
130
  ## Contribuindo
83
131
 
84
132
  Adicione testes, abra o pull request. Sem bikeshedding, wizardry ou craftismos pro meu lado!!! O código aqui deve ser de simples entendimento.
85
133
 
86
- Meta code coverage: 100% para layout e marshalling. O resto, só se for muito importante.
87
-
@@ -14,7 +14,8 @@ module Cnab240::Arquivo
14
14
  end
15
15
 
16
16
  def linhas
17
- a = Array.new
17
+ self.auto_fill if Cnab240.auto_fill_enabled
18
+ a = []
18
19
  a << @header.linha
19
20
  @lotes.each do |lote|
20
21
  lote.linhas.each do |linha|
@@ -46,6 +47,14 @@ module Cnab240::Arquivo
46
47
  Cnab240::Builder.new(filename).arquivos
47
48
  end
48
49
 
50
+ def auto_fill
51
+ trailer.totais_qtde_lotes = lotes.length.to_s
52
+ qtd_registros = lotes.length * 2 # header e trailer de cada lote
53
+ lotes.each { |l| qtd_registros += l.segmentos.length } # segmentos
54
+ qtd_registros += 2 # header e trailer de arquivo
55
+ trailer.totais_qtde_registros = qtd_registros.to_s
56
+ end
57
+
49
58
  end
50
59
 
51
60
  end
@@ -4,24 +4,24 @@ module Cnab240::V40::Arquivo
4
4
  include Cnab240::DefaultMixin
5
5
 
6
6
  string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
9
9
 
10
10
  string :cnab_g004_1, :length => 9, :initial_value => ' ', :pad_byte => ' '
11
11
 
12
- string :empresa_tipo, :length => 1, :pad_byte => '0'
13
- string :empresa_numero, :length => 14, :pad_byte => '0'
12
+ lstring :empresa_tipo, :length => 1, :pad_byte => '0'
13
+ lstring :empresa_numero, :length => 14, :pad_byte => '0'
14
14
  string :empresa_convenio, :length => 13, :pad_byte => ' '
15
15
 
16
16
  string :brancos_1, :length => 7, :pad_byte => ' '
17
- string :brancos_2, :length => 1, :pad_byte => '0'
17
+ lstring :brancos_2, :length => 1, :pad_byte => '0'
18
18
 
19
- string :empresa_agencia_codigo, :length => 4, :pad_byte => '0'
19
+ lstring :empresa_agencia_codigo, :length => 4, :pad_byte => '0'
20
20
 
21
21
  string :brancos_3, :length => 1, :pad_byte => ' '
22
- string :brancos_4, :length => 7, :pad_byte => '0'
22
+ lstring :brancos_4, :length => 7, :pad_byte => '0'
23
23
 
24
- string :empresa_conta_numero, :length => 5, :pad_byte => '0'
24
+ lstring :empresa_conta_numero, :length => 5, :pad_byte => '0'
25
25
  string :brancos_5, :length => 1, :pad_byte => ' '
26
26
 
27
27
  string :empresa_agencia_conta_dv, :length => 1, :pad_byte => ' '
@@ -31,12 +31,12 @@ module Cnab240::V40::Arquivo
31
31
 
32
32
  string :cnab_g004_2, :length => 10, :pad_byte => ' '
33
33
 
34
- string :arquivo_codigo, :length => 1, :pad_byte => '0'
35
- string :arquivo_data_geracao, :length => 8, :pad_byte => '0'
36
- string :arquivo_hora_geracao,:length => 6, :pad_byte => '0'
37
- string :arquivo_sequencia, :length => 6, :pad_byte => '0'
38
- string :arquivo_layout, :length => 3, :initial_value => '040'
39
- string :arquivo_densidade, :length => 5, :pad_byte => '0'
34
+ lstring :arquivo_codigo, :length => 1, :pad_byte => '0'
35
+ lstring :arquivo_data_geracao, :length => 8, :pad_byte => '0'
36
+ lstring :arquivo_hora_geracao,:length => 6, :pad_byte => '0'
37
+ lstring :arquivo_sequencia, :length => 6, :pad_byte => '0'
38
+ lstring :arquivo_layout, :length => 3, :initial_value => '040'
39
+ lstring :arquivo_densidade, :length => 5, :pad_byte => '0'
40
40
 
41
41
  string :reservado_banco, :length => 20, :pad_byte => ' '
42
42
 
@@ -4,14 +4,15 @@ module Cnab240::V40::Arquivo
4
4
  include Cnab240::DefaultMixin
5
5
 
6
6
  string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :initial_value => '9999', :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '9', :pad_byte => '0'
9
9
 
10
10
  string :cnab_g004_1, :length => 9, :pad_byte => ' '
11
11
 
12
- string :totais_qtde_lotes, :length => 6, :pad_byte => '0'
13
- string :totais_qtde_registros, :length => 6, :pad_byte => '0'
12
+ lstring :totais_qtde_lotes, :length => 6, :pad_byte => '0'
13
+ lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
14
14
 
15
15
  string :cnab_g004_2, :length => 211, :pad_byte => ' '
16
+
16
17
  end
17
18
  end
@@ -3,18 +3,18 @@ module Cnab240::V86::Arquivo
3
3
 
4
4
  include Cnab240::DefaultMixin
5
5
 
6
- string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
6
+ lstring :controle_banco, :length => 3, :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :initial_value => '0000', :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '0', :pad_byte => '0'
9
9
 
10
10
  string :cnab_g004_1, :length => 9, :initial_value => ' ', :pad_byte => ' '
11
11
 
12
- string :empresa_tipo, :length => 1, :pad_byte => '0'
13
- string :empresa_numero, :length => 14, :pad_byte => '0'
12
+ lstring :empresa_tipo, :length => 1, :pad_byte => '0'
13
+ lstring :empresa_numero, :length => 14, :pad_byte => '0'
14
14
  string :empresa_convenio, :length => 20, :pad_byte => ' '
15
- string :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
15
+ lstring :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
16
16
  string :empresa_agencia_dv, :length => 1, :pad_byte => ' '
17
- string :empresa_conta_numero, :length => 12, :pad_byte => '0'
17
+ lstring :empresa_conta_numero, :length => 12, :pad_byte => '0'
18
18
  string :empresa_conta_dv, :length => 1, :pad_byte => ' '
19
19
  string :empresa_agencia_conta_dv, :length => 1, :pad_byte => ' '
20
20
  string :empresa_nome, :length => 30, :pad_byte => ' '
@@ -23,12 +23,12 @@ module Cnab240::V86::Arquivo
23
23
 
24
24
  string :cnab_g004_2, :length => 10, :pad_byte => ' '
25
25
 
26
- string :arquivo_codigo, :length => 1, :pad_byte => '0'
27
- string :arquivo_data_geracao, :length => 8, :pad_byte => '0'
28
- string :arquivo_hora_geracao,:length => 6, :pad_byte => '0'
29
- string :arquivo_sequencia, :length => 6, :pad_byte => '0'
26
+ lstring :arquivo_codigo, :length => 1, :pad_byte => '0'
27
+ lstring :arquivo_data_geracao, :length => 8, :pad_byte => '0'
28
+ lstring :arquivo_hora_geracao,:length => 6, :pad_byte => '0'
29
+ lstring :arquivo_sequencia, :length => 6, :pad_byte => '0'
30
30
  string :arquivo_layout, :length => 3, :initial_value => '085'
31
- string :arquivo_densidade, :length => 5, :pad_byte => '0'
31
+ lstring :arquivo_densidade, :length => 5, :pad_byte => '0'
32
32
 
33
33
  string :reservado_banco, :length => 20, :pad_byte => ' '
34
34
  string :reservado_empresa, :length => 20, :pad_byte => ' '
@@ -9,9 +9,9 @@ module Cnab240::V86::Arquivo
9
9
 
10
10
  string :cnab_g004_1, :length => 9, :pad_byte => ' '
11
11
 
12
- string :totais_qtde_lotes, :length => 6, :pad_byte => '0'
13
- string :totais_qtde_registros, :length => 6, :pad_byte => '0'
14
- string :totais_qtde_contas_concil, :length => 6, :pad_byte => '0'
12
+ lstring :totais_qtde_lotes, :length => 6, :pad_byte => '0'
13
+ lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
14
+ lstring :totais_qtde_contas_concil, :length => 6, :pad_byte => '0'
15
15
 
16
16
  string :cnab_g004_2, :length => 205, :pad_byte => ' '
17
17
  end
@@ -1,7 +1,7 @@
1
1
  module BinData
2
2
  class Record < BinData::Struct
3
3
  def linha # lulz
4
- self.auto_fill if self.respond_to?(:auto_fill)
4
+ self.auto_fill if self.respond_to?(:auto_fill) && Cnab240.auto_fill_enabled
5
5
  s = StringIO.new
6
6
  self.write(s)
7
7
  raise "Invalid line length #{s.string.length}" unless (s.string.length == 240) || self.respond_to?(:lote)
@@ -9,5 +9,7 @@ module Cnab240
9
9
  end
10
10
  end
11
11
  end
12
+
13
+
12
14
  end
13
15
  end
@@ -0,0 +1,13 @@
1
+ module Cnab240
2
+ module Filler
3
+
4
+ def fill(hash, *objects)
5
+ objects.each do |object|
6
+ hash.each do |k,v|
7
+ object.send("#{k}=", v) if object.respond_to?("#{k}=")
8
+ end
9
+ end
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,102 @@
1
+ require "bindata/base_primitive"
2
+
3
+ module BinData
4
+
5
+ # I didn't want to monkey patch bindata's String primitive.
6
+ class Lstring < BinData::BasePrimitive
7
+
8
+ optional_parameters :read_length, :length, :trim_padding
9
+ default_parameters :pad_byte => "\0"
10
+ mutually_exclusive_parameters :read_length, :length
11
+ mutually_exclusive_parameters :length, :value
12
+
13
+ class << self
14
+
15
+ def sanitize_parameters!(params) #:nodoc:
16
+ params.warn_replacement_parameter(:initial_length, :read_length)
17
+
18
+ params.warn_renamed_parameter(:pad_char, :pad_byte) # Remove this line in the future
19
+
20
+ if params.has_parameter?(:pad_byte)
21
+ byte = params[:pad_byte]
22
+ params[:pad_byte] = sanitized_pad_byte(byte)
23
+ end
24
+ end
25
+
26
+ #-------------
27
+ private
28
+
29
+ def sanitized_pad_byte(byte)
30
+ result = byte.is_a?(Integer) ? byte.chr : byte_string(byte.to_s.dup)
31
+ if result.length > 1
32
+ raise ArgumentError, ":pad_byte must not contain more than 1 byte"
33
+ end
34
+ result
35
+ end
36
+
37
+ def byte_string(str)
38
+ if RUBY_VERSION >= "1.9"
39
+ str.force_encoding(Encoding::BINARY)
40
+ else
41
+ str
42
+ end
43
+ end
44
+ end
45
+
46
+ def assign(val)
47
+ super(byte_string(val.dup))
48
+ end
49
+
50
+ def snapshot
51
+ # override to trim padding
52
+ result = super
53
+ result = clamp_to_length(result)
54
+
55
+ if get_parameter(:trim_padding)
56
+ result = trim_padding(result)
57
+ end
58
+ result
59
+ end
60
+
61
+ #---------------
62
+ private
63
+
64
+ def byte_string(str)
65
+ if RUBY_VERSION >= "1.9"
66
+ str.force_encoding(Encoding::BINARY)
67
+ else
68
+ str
69
+ end
70
+ end
71
+
72
+ def clamp_to_length(str)
73
+ str = byte_string(str)
74
+
75
+ len = eval_parameter(:length) || str.length
76
+ if str.length == len
77
+ str
78
+ elsif str.length > len
79
+ str.slice(0, len)
80
+ else
81
+ (eval_parameter(:pad_byte) * (len - str.length)) + str
82
+ end
83
+ end
84
+
85
+ def trim_padding(str)
86
+ str.sub(/#{eval_parameter(:pad_byte)}*$/, "")
87
+ end
88
+
89
+ def value_to_binary_string(val)
90
+ clamp_to_length(val)
91
+ end
92
+
93
+ def read_and_return_value(io)
94
+ len = eval_parameter(:read_length) || eval_parameter(:length) || 0
95
+ io.readbytes(len)
96
+ end
97
+
98
+ def sensible_default
99
+ ""
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,60 @@
1
+ module Cnab240
2
+ class PagamentoItau
3
+
4
+ include Cnab240::Filler
5
+
6
+ attr_accessor :arquivo
7
+
8
+ def initialize(campos = {})
9
+ @arquivo = Cnab240::Arquivo::Arquivo.new('V40')
10
+ # header e trailer arquivo
11
+ campos[:controle_banco] = '341'
12
+ campos[:banco_nome] = 'BANCO ITAU'
13
+ campos[:arquivo_codigo] = '1'
14
+ campos[:arquivo_data_geracao] = Time.now.strftime("%d%m%Y")
15
+ campos[:arquivo_hora_geracao] = Time.now.strftime("%H%M")
16
+
17
+ fill campos, arquivo.header, arquivo.trailer
18
+ end
19
+
20
+
21
+ def add(campos = {})
22
+ @arquivo.lotes << lote = Cnab240::Lote.new(:operacao => :pagamento, :tipo => :remessa, :versao => 'V40')
23
+
24
+ # header e trailer lote
25
+ campos[:controle_banco] = '341'
26
+ campos[:servico_operacao] = 'D'
27
+ campos[:servico_tipo] = '05'
28
+ campos[:servico_forma] = '50'
29
+ campos[:servico_codigo_movimento] = '000'
30
+ campos[:servico_numero_registro] = '00001'
31
+ campos[:credito_moeda_tipo] = 'REA'
32
+ campos[:totais_qtde_registros] = '000003'
33
+ campos[:favorecido_banco] = '341'
34
+
35
+ campos[:controle_lote] = @arquivo.lotes.length.to_s
36
+
37
+ if campos[:valor]
38
+ campos[:credito_valor_pagamento] = campos[:valor]
39
+ campos[:credito_valor_real] = campos[:valor]
40
+ end
41
+
42
+ if campos[:data]
43
+ campos[:credito_data_pagamento] = campos[:data]
44
+ campos[:credito_data_real] = campos[:data]
45
+ end
46
+
47
+ fill campos, lote.header, lote.trailer, lote.segmento_a
48
+ end
49
+
50
+ def string
51
+ arquivo.string
52
+ end
53
+
54
+ def save_to_file(filename)
55
+ arquivo.save_to_file(filename)
56
+ end
57
+
58
+ end
59
+
60
+ end
@@ -3,31 +3,31 @@ module Cnab240::V40::Pagamentos
3
3
 
4
4
  include Cnab240::DefaultMixin
5
5
 
6
- string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '1', :pad_byte => '0'
9
-
10
- string :servico_operacao, :length => 1, :initial_value => 'C', :pad_byte => ' '
11
- string :servico_tipo, :length => 2 , :pad_byte => '0'
12
- string :servico_forma, :length => 2, :pad_byte => '0'
13
- string :servico_layout, :length => 3, :initial_value => '030', :pad_byte => '0'
6
+ lstring :controle_banco, :length => 3, :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '1', :pad_byte => '0'
9
+
10
+ string :servico_operacao, :length => 1, :initial_value => 'D', :pad_byte => ' '
11
+ lstring :servico_tipo, :length => 2 , :pad_byte => '0'
12
+ lstring :servico_forma, :length => 2, :pad_byte => '0'
13
+ lstring :servico_layout, :length => 3, :initial_value => '030', :pad_byte => '0'
14
14
  string :cnab_g004_1, :length => 1, :pad_byte => ' '
15
15
 
16
- string :empresa_tipo, :length => 1, :pad_byte => '0'
17
- string :empresa_numero, :length => 14, :pad_byte => '0'
16
+ lstring :empresa_tipo, :length => 1, :pad_byte => '0'
17
+ lstring :empresa_numero, :length => 14, :pad_byte => '0'
18
18
  string :empresa_convenio, :length => 13, :pad_byte => ' '
19
19
 
20
20
 
21
21
  string :brancos_1, :length => 7, :pad_byte => ' '
22
- string :brancos_2, :length => 1, :pad_byte => '0'
22
+ lstring :brancos_2, :length => 1, :pad_byte => '0'
23
23
 
24
24
 
25
- string :empresa_agencia_codigo, :length => 4, :pad_byte => '0'
25
+ lstring :empresa_agencia_codigo, :length => 4, :pad_byte => '0'
26
26
 
27
27
  string :brancos_3, :length => 1, :pad_byte => ' '
28
- string :brancos_4, :length => 7, :pad_byte => '0'
28
+ lstring :brancos_4, :length => 7, :pad_byte => '0'
29
29
 
30
- string :empresa_conta_numero, :length => 5, :pad_byte => '0'
30
+ lstring :empresa_conta_numero, :length => 5, :pad_byte => '0'
31
31
 
32
32
  string :brancos_5, :length => 1, :pad_byte => ' '
33
33
 
@@ -37,19 +37,19 @@ module Cnab240::V40::Pagamentos
37
37
  string :informacao_1, :length => 40, :pad_byte => ' '
38
38
 
39
39
  string :endereco_logradouro, :length => 30, :pad_byte => ' '
40
- string :endereco_numero, :length => 5, :pad_byte => '0'
40
+ lstring :endereco_numero, :length => 5, :pad_byte => '0'
41
41
  string :endereco_complemento, :length => 15, :pad_byte => ' '
42
42
  string :endereco_cidade, :length => 20, :pad_byte => ' '
43
- string :endereco_cep, :length => 8, :pad_byte => '0'
43
+ lstring :endereco_cep, :length => 8, :pad_byte => '0'
44
44
  string :endereco_estado, :length => 2, :pad_byte => ' '
45
45
 
46
46
  string :cnab_g004_2, :length => 8, :pad_byte => ' '
47
47
  string :ocorrencias, :length => 10, :pad_byte => ' '
48
48
 
49
- private
49
+ protected
50
50
 
51
51
  def auto_fill
52
-
52
+
53
53
  end
54
54
  end
55
55
  end
@@ -3,14 +3,14 @@ module Cnab240::V40::Pagamentos
3
3
 
4
4
  include Cnab240::DefaultMixin
5
5
 
6
- string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '5', :pad_byte => '0'
6
+ lstring :controle_banco, :length => 3, :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '5', :pad_byte => '0'
9
9
 
10
- string :cnab_g004_1, :length => 9, :pad_byte => '0'
11
- string :totais_qtde_registros, :length => 6, :pad_byte => '0'
12
- string :totais_valor, :length => 18, :pad_byte => '0'
13
- string :totais_qtde_moeda, :length => 18, :pad_byte => '0'
10
+ lstring :cnab_g004_1, :length => 9, :pad_byte => '0'
11
+ lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
12
+ lstring :totais_valor, :length => 18, :pad_byte => '0'
13
+ lstring :totais_qtde_moeda, :length => 18, :pad_byte => '0'
14
14
 
15
15
  string :cnab_g004_2, :length => 171, :pad_byte => ' '
16
16
  string :ocorrencias, :length => 10, :pad_byte => ' '
@@ -3,22 +3,22 @@ module Cnab240::V86::Pagamentos
3
3
 
4
4
  include Cnab240::DefaultMixin
5
5
 
6
- string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '1', :pad_byte => '0'
6
+ lstring :controle_banco, :length => 3, :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '1', :pad_byte => '0'
9
9
 
10
10
  string :servico_operacao, :length => 1, :initial_value => 'C', :pad_byte => ' '
11
- string :servico_tipo, :length => 2 , :pad_byte => '0'
12
- string :servico_forma, :length => 2, :pad_byte => '0'
13
- string :servico_layout, :length => 3, :initial_value => '044', :pad_byte => '0'
11
+ lstring :servico_tipo, :length => 2 , :pad_byte => '0'
12
+ lstring :servico_forma, :length => 2, :pad_byte => '0'
13
+ lstring :servico_layout, :length => 3, :initial_value => '044', :pad_byte => '0'
14
14
  string :cnab_g004_1, :length => 1, :pad_byte => ' '
15
15
 
16
- string :empresa_tipo, :length => 1, :pad_byte => '0'
17
- string :empresa_numero, :length => 14, :pad_byte => '0'
16
+ lstring :empresa_tipo, :length => 1, :pad_byte => '0'
17
+ lstring :empresa_numero, :length => 14, :pad_byte => '0'
18
18
  string :empresa_convenio, :length => 20, :pad_byte => ' '
19
- string :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
19
+ lstring :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
20
20
  string :empresa_agencia_dv, :length => 1, :pad_byte => ' '
21
- string :empresa_conta_numero, :length => 12, :pad_byte => '0'
21
+ lstring :empresa_conta_numero, :length => 12, :pad_byte => '0'
22
22
  string :empresa_conta_dv, :length => 1, :pad_byte => ' '
23
23
  string :empresa_agencia_conta_dv, :length => 1, :pad_byte => ' '
24
24
  string :empresa_nome, :length => 30, :pad_byte => ' '
@@ -26,14 +26,14 @@ module Cnab240::V86::Pagamentos
26
26
  string :informacao_1, :length => 40, :pad_byte => ' '
27
27
 
28
28
  string :endereco_logradouro, :length => 30, :pad_byte => ' '
29
- string :endereco_numero, :length => 5, :pad_byte => '0'
29
+ lstring :endereco_numero, :length => 5, :pad_byte => '0'
30
30
  string :endereco_complemento, :length => 15, :pad_byte => ' '
31
31
  string :endereco_cidade, :length => 20, :pad_byte => ' '
32
- string :endereco_cep, :length => 5, :pad_byte => '0'
33
- string :endereco_complemento_cep, :length => 3, :pad_byte => '0'
32
+ lstring :endereco_cep, :length => 5, :pad_byte => '0'
33
+ lstring :endereco_complemento_cep, :length => 3, :pad_byte => '0'
34
34
  string :endereco_estado, :length => 2, :pad_byte => ' '
35
35
 
36
- string :indicativo_forma_pagamento, :length => 2, :pad_byte => '0'
36
+ lstring :indicativo_forma_pagamento, :length => 2, :pad_byte => '0'
37
37
  string :cnab_g004_2, :length => 6, :pad_byte => ' '
38
38
  string :ocorrencias, :length => 10, :pad_byte => ' '
39
39
 
@@ -3,23 +3,23 @@ module Cnab240::V86::PagamentosTitulos
3
3
 
4
4
  include Cnab240::DefaultMixin
5
5
 
6
- string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '1', :pad_byte => '0'
6
+ lstring :controle_banco, :length => 3, :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '1', :pad_byte => '0'
9
9
 
10
10
  string :servico_operacao, :length => 1, :initial_value => 'C', :pad_byte => ' '
11
- string :servico_tipo, :length => 2 , :pad_byte => '0'
12
- string :servico_forma, :length => 2, :pad_byte => '0'
13
- string :servico_layout, :length => 3, :initial_value => '040', :pad_byte => '0'
11
+ lstring :servico_tipo, :length => 2 , :pad_byte => '0'
12
+ lstring :servico_forma, :length => 2, :pad_byte => '0'
13
+ lstring :servico_layout, :length => 3, :initial_value => '040', :pad_byte => '0'
14
14
 
15
15
  string :cnab_g004_1, :length => 1, :pad_byte => ' '
16
16
 
17
- string :empresa_tipo, :length => 1, :pad_byte => '0'
18
- string :empresa_numero, :length => 14, :pad_byte => '0'
17
+ lstring :empresa_tipo, :length => 1, :pad_byte => '0'
18
+ lstring :empresa_numero, :length => 14, :pad_byte => '0'
19
19
  string :empresa_convenio, :length => 20, :pad_byte => ' '
20
- string :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
20
+ lstring :empresa_agencia_codigo, :length => 5, :pad_byte => '0'
21
21
  string :empresa_agencia_dv, :length => 1, :pad_byte => ' '
22
- string :empresa_conta_numero, :length => 12, :pad_byte => '0'
22
+ lstring :empresa_conta_numero, :length => 12, :pad_byte => '0'
23
23
  string :empresa_conta_dv, :length => 1, :pad_byte => ' '
24
24
  string :empresa_agencia_conta_dv, :length => 1, :pad_byte => ' '
25
25
  string :empresa_nome, :length => 30, :pad_byte => ' '
@@ -27,11 +27,11 @@ module Cnab240::V86::PagamentosTitulos
27
27
  string :informacao_1, :length => 40, :pad_byte => ' '
28
28
 
29
29
  string :endereco_logradouro, :length => 30, :pad_byte => ' '
30
- string :endereco_numero, :length => 5, :pad_byte => '0'
30
+ lstring :endereco_numero, :length => 5, :pad_byte => '0'
31
31
  string :endereco_complemento, :length => 15, :pad_byte => ' '
32
32
  string :endereco_cidade, :length => 20, :pad_byte => ' '
33
- string :endereco_cep, :length => 5, :pad_byte => '0'
34
- string :endereco_complemento_cep, :length => 3, :pad_byte => '0'
33
+ lstring :endereco_cep, :length => 5, :pad_byte => '0'
34
+ lstring :endereco_complemento_cep, :length => 3, :pad_byte => '0'
35
35
  string :endereco_estado, :length => 2, :pad_byte => ' '
36
36
 
37
37
  string :cnab_g004_2, :length => 8, :pad_byte => ' '
@@ -3,15 +3,15 @@ module Cnab240::V86::PagamentosTitulos
3
3
 
4
4
  include Cnab240::DefaultMixin
5
5
 
6
- string :controle_banco, :length => 3, :pad_byte => '0'
7
- string :controle_lote, :length => 4, :pad_byte => '0'
8
- string :controle_registro, :length => 1, :initial_value => '5', :pad_byte => '0'
6
+ lstring :controle_banco, :length => 3, :pad_byte => '0'
7
+ lstring :controle_lote, :length => 4, :pad_byte => '0'
8
+ lstring :controle_registro, :length => 1, :initial_value => '5', :pad_byte => '0'
9
9
 
10
- string :cnab_g004_1, :length => 9, :pad_byte => '0'
11
- string :totais_qtde_registros, :length => 6, :pad_byte => '0'
12
- string :totais_valor, :length => 18, :pad_byte => '0'
13
- string :totais_qtde_moeda, :length => 18, :pad_byte => '0'
14
- string :numero_aviso_debito, :length => 6, :pad_byte => '0'
10
+ lstring :cnab_g004_1, :length => 9, :pad_byte => '0'
11
+ lstring :totais_qtde_registros, :length => 6, :pad_byte => '0'
12
+ lstring :totais_valor, :length => 18, :pad_byte => '0'
13
+ lstring :totais_qtde_moeda, :length => 18, :pad_byte => '0'
14
+ lstring :numero_aviso_debito, :length => 6, :pad_byte => '0'
15
15
  string :cnab_g004_2, :length => 165, :pad_byte => ' '
16
16
  string :ocorrencias, :length => 10, :pad_byte => ' '
17
17
  end