formatos-febraban 0.3.16 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f429b930eb75a6140bf2549f525a7b611a1c6f9c
|
4
|
+
data.tar.gz: ef8bf6a24cdb3b1cc648c1c7a9b5f36a4bde383b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bca6404e3c6e6da68a4754e867e259644293dbfddd53667cba408b220d7f5d2d8ba8b0f2ae39ab6ef85512e3a9d11cc85b01c3e9886157def13c07aa61126d72
|
7
|
+
data.tar.gz: 7006d4919af33b864fad60b86d752a61039b4e504a14e16e94bb8c16e10921c53073b43f883cbcfb375700ae659c2db2c149ef171c92a809281accf81e1cfc46
|
@@ -6,26 +6,78 @@ class Febraban150F < FormatSection
|
|
6
6
|
def initialize(master, versao = Febraban150::VERSAO)
|
7
7
|
super(master, true, false)
|
8
8
|
|
9
|
+
@versao = versao
|
10
|
+
|
11
|
+
case @versao
|
12
|
+
when '04'
|
13
|
+
self.monta_versao_04
|
14
|
+
when '05'
|
15
|
+
self.monta_versao_05
|
16
|
+
else
|
17
|
+
raise "Seção F: Versão não suportada: #{@versao}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
def monta_versao_04
|
9
23
|
@section = Section.new({
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
0 => Position.new(1, 1, false, 'F', true), # Código do Registro
|
25
|
+
1 => Position.new(2, 25, false), # Identificação do Cliente Empresa
|
26
|
+
2 => Position.new(3, 4, false), # Agência para Débito
|
27
|
+
3 => Position.new(4, 14, false), # Identificação Cliente Banco
|
28
|
+
4 => Position.new(5, 8, true), # Data Vencimento/Débito
|
29
|
+
5 => Position.new(6, 15, true), # Valor Original/Debitado
|
30
|
+
6 => Position.new(7, 2, false), # Código de Retorno
|
31
|
+
7 => Position.new(8, 60, false), # Uso da Empresa (Seção E)
|
32
|
+
10 => Position.new(11, 20, false), # Reservado pelo Sistema
|
33
|
+
11 => Position.new(12, 1, true) # Código de movimento (Seção E)
|
34
|
+
})
|
35
|
+
end
|
36
|
+
|
37
|
+
def monta_versao_05
|
38
|
+
@section = Section.new({
|
39
|
+
0 => Position.new(1, 1, false, 'F', true), # Código do Registro
|
40
|
+
1 => Position.new(2, 25, false), # Identificação do Cliente Empresa
|
41
|
+
2 => Position.new(3, 4, false), # Agência para Débito
|
42
|
+
3 => Position.new(4, 14, false), # Identificação Cliente Banco
|
43
|
+
4 => Position.new(5, 8, true), # Data Vencimento/Débito
|
44
|
+
5 => Position.new(6, 15, true), # Valor Original/Debitado
|
45
|
+
6 => Position.new(7, 2, false), # Código de Retorno
|
46
|
+
7 => Position.new(8, 60, false), # Uso da Empresa (Seção E)
|
47
|
+
8 => Position.new(9, 1, true), # Tipo de Identificação (1-CPF, 2-CNPJ)
|
48
|
+
9 => Position.new(10, 15, true), # Identificação
|
49
|
+
10 => Position.new(11, 4, false), # Reservado pelo Sistema
|
50
|
+
11 => Position.new(12, 1, true) # Código de movimento (Seção E)
|
22
51
|
})
|
23
52
|
end
|
24
53
|
|
25
54
|
#-------------------------------------------------------------------
|
26
55
|
#-------------------------------------------------------------------
|
27
56
|
# Gerais
|
28
|
-
|
57
|
+
public
|
58
|
+
def process_section(file)
|
59
|
+
case @versao
|
60
|
+
when '04'
|
61
|
+
self.processa_arquivo_04(file)
|
62
|
+
when '05'
|
63
|
+
self.processa_arquivo_05(file)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
protected
|
68
|
+
def processa_arquivo_04(file)
|
69
|
+
self.set_id_cliente_empresa file[1..25]
|
70
|
+
self.set_agencia_debito file[26..29]
|
71
|
+
self.set_id_cliente_banco file[30..43]
|
72
|
+
self.set_data_vencimento file[44..51]
|
73
|
+
self.set_valor_debito file[52..66]
|
74
|
+
self.set_codigo_moeda file[67..68]
|
75
|
+
self.set_obs_empresa file[69..128]
|
76
|
+
self.set_reservado file[129..148]
|
77
|
+
self.set_cod_movimento file[149..149]
|
78
|
+
end
|
79
|
+
|
80
|
+
def processa_arquivo_05(file)
|
29
81
|
self.set_id_cliente_empresa file[1..25]
|
30
82
|
self.set_agencia_debito file[26..29]
|
31
83
|
self.set_id_cliente_banco file[30..43]
|
@@ -42,25 +94,44 @@ class Febraban150F < FormatSection
|
|
42
94
|
#-------------------------------------------------------------------
|
43
95
|
#-------------------------------------------------------------------
|
44
96
|
# Validações
|
97
|
+
public
|
45
98
|
def is_valid?
|
99
|
+
case @versao
|
100
|
+
when '04'
|
101
|
+
self.is_valid_04?
|
102
|
+
when '05'
|
103
|
+
self.is_valid_05?
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
protected
|
108
|
+
def is_valid_04?
|
109
|
+
result = (self.get_id_cliente_empresa.length > 0 and
|
110
|
+
self.get_id_cliente_banco.length > 0 and
|
111
|
+
!self.get_data_vencimento.nil? and
|
112
|
+
self.get_valor_debito > 0 and
|
113
|
+
self.get_codigo_moeda.length > 0 and
|
114
|
+
(self.get_cod_movimento == 0 or
|
115
|
+
self.get_cod_movimento == 1))
|
116
|
+
end
|
117
|
+
|
118
|
+
def is_valid_05?
|
46
119
|
result = (self.get_id_cliente_empresa.length > 0 and
|
47
120
|
self.get_id_cliente_banco.length > 0 and
|
48
|
-
self.
|
49
|
-
|
50
|
-
self.
|
51
|
-
(self.get_codigo_retorno >= 0 or
|
52
|
-
self.get_codigo_retorno <= 99) and
|
53
|
-
self.get_obs_empresa.length > 0 and
|
121
|
+
!self.get_data_vencimento.nil? and
|
122
|
+
self.get_valor_debito > 0 and
|
123
|
+
self.get_codigo_moeda.length > 0 and
|
54
124
|
(self.get_tipo_id_cliente == 1 or
|
55
|
-
|
56
|
-
self.get_id_cliente.
|
125
|
+
self.get_tipo_id_cliente == 2) and
|
126
|
+
self.get_id_cliente.length == 15 and
|
57
127
|
(self.get_cod_movimento == 0 or
|
58
|
-
|
128
|
+
self.get_cod_movimento == 1))
|
59
129
|
end
|
60
130
|
|
61
131
|
#-------------------------------------------------------------------
|
62
132
|
#-------------------------------------------------------------------
|
63
133
|
# Getters
|
134
|
+
public
|
64
135
|
def get_id_cliente_empresa
|
65
136
|
self.get_section_value(1)
|
66
137
|
end
|
@@ -99,7 +170,12 @@ class Febraban150F < FormatSection
|
|
99
170
|
end
|
100
171
|
|
101
172
|
def get_cod_movimento
|
102
|
-
|
173
|
+
case @versao
|
174
|
+
when '04'
|
175
|
+
self.get_section_value(9).to_i
|
176
|
+
when '05'
|
177
|
+
self.get_section_value(11).to_i
|
178
|
+
end
|
103
179
|
end
|
104
180
|
|
105
181
|
def get_mensagem_retorno
|
@@ -148,6 +224,7 @@ class Febraban150F < FormatSection
|
|
148
224
|
#-------------------------------------------------------------------
|
149
225
|
#-------------------------------------------------------------------
|
150
226
|
# Setters
|
227
|
+
public
|
151
228
|
def set_id_cliente_empresa id_cliente_empresa
|
152
229
|
id_cliente_empresa = id_cliente_empresa.to_s
|
153
230
|
|
@@ -102,6 +102,7 @@ class Febraban150Z < FormatSection
|
|
102
102
|
#-------------------------------------------------------------------
|
103
103
|
#-------------------------------------------------------------------
|
104
104
|
# Setters
|
105
|
+
public
|
105
106
|
def set_total_registros registros
|
106
107
|
registros = registros.to_i
|
107
108
|
|