formatos-febraban 0.2.20 → 0.2.21
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 +4 -4
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/formatos-febraban.iml +18 -0
- data/.idea/misc.xml +27 -0
- data/.idea/modules.xml +8 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +49 -0
- data/lib/formatos/cnab400/cnab_400.rb +136 -0
- data/lib/formatos/cnab400/cnab_400_0.rb +212 -0
- data/lib/formatos/cnab400/cnab_400_1.rb +0 -0
- data/lib/formatos/cnab400/cnab_400_2.rb +0 -0
- data/lib/formatos/cnab400/cnab_400_3.rb +0 -0
- data/lib/formatos/cnab400/cnab_400_7.rb +0 -0
- data/lib/formatos/cnab400/cnab_400_9.rb +0 -0
- data/lib/formatos/febraban/version.rb +1 -1
- data/lib/formatos/febraban150/febraban_150_a.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25bf282dc098733014bb51215dcf2d5bb4b8db8e
|
|
4
|
+
data.tar.gz: 48b1658b38d7a281ea933b1b700add9adef46d14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9e2885a776fc3ed0ea6dc3d747414ef4d115ad5a43aebe850bae01fc02aca53a20da619ef32ce419b72d38d3e1441d679e7a736ee28bab32575bd412cf47472
|
|
7
|
+
data.tar.gz: 31a6e03e73a6310a6c44eb055c619fecd3a578cd9467af6bc03ba11a10ebde74b7f644e094de624088b7c62630302bbdc1392cd8a4e39a0fcc2089f692f040cc
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build formatos-febraban-0.2.20.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install formatos-febraban-0.2.20.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.2.20 and build and push formatos-febraban-0.2.20.gem to Rubygems" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/encodings.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="gem" name="Ruby Gem">
|
|
5
|
+
<configuration>
|
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
|
9
|
+
</configuration>
|
|
10
|
+
</facet>
|
|
11
|
+
</component>
|
|
12
|
+
<component name="NewModuleRootManager">
|
|
13
|
+
<content url="file://$MODULE_DIR$" />
|
|
14
|
+
<orderEntry type="inheritedJdk" />
|
|
15
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, rbenv: 2.0.0-p643) [gem]" level="application" />
|
|
17
|
+
</component>
|
|
18
|
+
</module>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="DaemonCodeAnalyzer">
|
|
4
|
+
<disable_hints />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="DependencyValidationManager">
|
|
7
|
+
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
|
8
|
+
</component>
|
|
9
|
+
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
|
10
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
11
|
+
<OptionsSetting value="true" id="Add" />
|
|
12
|
+
<OptionsSetting value="true" id="Remove" />
|
|
13
|
+
<OptionsSetting value="true" id="Checkout" />
|
|
14
|
+
<OptionsSetting value="true" id="Update" />
|
|
15
|
+
<OptionsSetting value="true" id="Status" />
|
|
16
|
+
<OptionsSetting value="true" id="Edit" />
|
|
17
|
+
<ConfirmationsSetting value="0" id="Add" />
|
|
18
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
|
19
|
+
</component>
|
|
20
|
+
<component name="ProjectModuleManager">
|
|
21
|
+
<modules />
|
|
22
|
+
</component>
|
|
23
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.0.0-p643" project-jdk-type="RUBY_SDK" />
|
|
24
|
+
<component name="RunManager">
|
|
25
|
+
<list size="0" />
|
|
26
|
+
</component>
|
|
27
|
+
</project>
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/formatos-febraban.iml" filepath="$PROJECT_DIR$/.idea/formatos-febraban.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<option name="TRACKING_ENABLED" value="true" />
|
|
5
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
6
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
|
+
</component>
|
|
10
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
|
11
|
+
<component name="CreatePatchCommitExecutor">
|
|
12
|
+
<option name="PATCH_PATH" value="" />
|
|
13
|
+
</component>
|
|
14
|
+
<component name="DaemonCodeAnalyzer">
|
|
15
|
+
<disable_hints />
|
|
16
|
+
</component>
|
|
17
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
18
|
+
<OptionsSetting value="true" id="Add" />
|
|
19
|
+
<OptionsSetting value="true" id="Remove" />
|
|
20
|
+
<OptionsSetting value="true" id="Checkout" />
|
|
21
|
+
<OptionsSetting value="true" id="Update" />
|
|
22
|
+
<OptionsSetting value="true" id="Status" />
|
|
23
|
+
<OptionsSetting value="true" id="Edit" />
|
|
24
|
+
<ConfirmationsSetting value="0" id="Add" />
|
|
25
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
|
26
|
+
</component>
|
|
27
|
+
<component name="RunManager">
|
|
28
|
+
<list size="0" />
|
|
29
|
+
</component>
|
|
30
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
|
31
|
+
<component name="TaskManager">
|
|
32
|
+
<task active="true" id="Default" summary="Default task">
|
|
33
|
+
<option name="number" value="Default" />
|
|
34
|
+
</task>
|
|
35
|
+
<servers />
|
|
36
|
+
</component>
|
|
37
|
+
<component name="VcsContentAnnotationSettings">
|
|
38
|
+
<option name="myLimit" value="2678400000" />
|
|
39
|
+
</component>
|
|
40
|
+
<component name="VcsManagerConfiguration">
|
|
41
|
+
<option name="myTodoPanelSettings">
|
|
42
|
+
<TodoPanelSettings />
|
|
43
|
+
</option>
|
|
44
|
+
</component>
|
|
45
|
+
<component name="XDebuggerManager">
|
|
46
|
+
<breakpoint-manager />
|
|
47
|
+
<watches-manager />
|
|
48
|
+
</component>
|
|
49
|
+
</project>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
|
|
2
|
+
class Cnab400
|
|
3
|
+
require 'date'
|
|
4
|
+
|
|
5
|
+
VERSAO = "05"
|
|
6
|
+
|
|
7
|
+
# Carrega todas as dependências de Layout
|
|
8
|
+
Dir[File.join(File.dirname(__FILE__), '../..', 'base', '**/*.rb')].sort.each do |file|
|
|
9
|
+
require file
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Partes do Layout
|
|
13
|
+
require_relative 'cnab_400_0' # Header
|
|
14
|
+
require_relative 'cnab_400_1' # Transação
|
|
15
|
+
require_relative 'cnab_400_2' # Mensagem (Opcional)
|
|
16
|
+
require_relative 'cnab_400_3' # Rateio de Crétido (Opcional)
|
|
17
|
+
require_relative 'cnab_400_7' # Débito em Conta - Empresa
|
|
18
|
+
require_relative 'cnab_400_9' # Trailler
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------
|
|
21
|
+
#-------------------------------------------------------------------
|
|
22
|
+
# Construtor
|
|
23
|
+
def initialize file = ""
|
|
24
|
+
@sections = []
|
|
25
|
+
|
|
26
|
+
if file.length > 0
|
|
27
|
+
self.process_file file
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
#-------------------------------------------------------------------
|
|
32
|
+
#-------------------------------------------------------------------
|
|
33
|
+
# Geral
|
|
34
|
+
protected
|
|
35
|
+
def add_section section
|
|
36
|
+
if section.is_valid?
|
|
37
|
+
self.sections << section
|
|
38
|
+
else
|
|
39
|
+
raise "Seção #{section.get_id} está inválida:
|
|
40
|
+
#{section.errors.inspect}
|
|
41
|
+
#{section.to_s}"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def add_section_from_business section
|
|
46
|
+
if section.is_empresa?
|
|
47
|
+
self.add_section section
|
|
48
|
+
self
|
|
49
|
+
else
|
|
50
|
+
raise "Seção #{section.get_id} não pode ser criada pela Empresa"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#-------------------------------------------------------------------
|
|
55
|
+
#-------------------------------------------------------------------
|
|
56
|
+
# Criação das Partes
|
|
57
|
+
public
|
|
58
|
+
|
|
59
|
+
# Seção 0
|
|
60
|
+
def create_header(codigo_remessa, codigo_convenio, nome_empresa,
|
|
61
|
+
codigo_banco, nome_banco, numero_sequencial)
|
|
62
|
+
|
|
63
|
+
if self.get_header.nil?
|
|
64
|
+
section = self.get_new_section("0")
|
|
65
|
+
|
|
66
|
+
section.set_codigo_remessa codigo_remessa
|
|
67
|
+
section.set_codigo_convenio codigo_convenio
|
|
68
|
+
section.set_nome_empresa nome_empresa
|
|
69
|
+
section.set_codigo_banco codigo_banco
|
|
70
|
+
section.set_nome_banco nome_banco
|
|
71
|
+
section.set_data_geracao Time.new
|
|
72
|
+
section.set_numero_sequencial numero_sequencial
|
|
73
|
+
section.set_versao_layout Febraban150::VERSAO
|
|
74
|
+
section.set_identificacao_servico Febraban150A::ID_SERVICO
|
|
75
|
+
section.set_reservado ""
|
|
76
|
+
|
|
77
|
+
self.add_section_from_business section
|
|
78
|
+
|
|
79
|
+
else
|
|
80
|
+
raise "Header já declarado!"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
#-------------------------------------------------------------------
|
|
85
|
+
#-------------------------------------------------------------------
|
|
86
|
+
# Validações
|
|
87
|
+
protected
|
|
88
|
+
def valida_existe_header
|
|
89
|
+
raise "Header (Seção A) ainda não declarado" if self.get_header.nil?
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
public
|
|
93
|
+
def is_valid?
|
|
94
|
+
if self.layout_empresa?
|
|
95
|
+
raise "Layout de Empresa inválido!" unless self.is_empresa_valid?
|
|
96
|
+
|
|
97
|
+
elsif self.layout_banco?
|
|
98
|
+
raise "Layout de Banco inválido!" unless self.is_banco_valid?
|
|
99
|
+
|
|
100
|
+
else
|
|
101
|
+
raise "Código de Remessa desconhecido: #{codigo_remessa}"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
result = self.is_sections_valid?
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
#-------------------------------------------------------------------
|
|
108
|
+
#-------------------------------------------------------------------
|
|
109
|
+
# Getters
|
|
110
|
+
public
|
|
111
|
+
def get_nome_arquivo
|
|
112
|
+
data_geracao = Date.new
|
|
113
|
+
"CD#{data_geracao.day}#{data_geracao.month}00.REM"
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
#--------------------------------------------------------------------------------------
|
|
117
|
+
#--------------------------------------------------------------------------------------
|
|
118
|
+
# Carregamento de Arquivo
|
|
119
|
+
protected
|
|
120
|
+
def get_new_section section_type
|
|
121
|
+
case section_type
|
|
122
|
+
when "0"
|
|
123
|
+
Cnab4000.new(self)
|
|
124
|
+
when "1"
|
|
125
|
+
Cnab4001.new(self)
|
|
126
|
+
when "2"
|
|
127
|
+
Cnab4002.new(self)
|
|
128
|
+
when "3"
|
|
129
|
+
Cnab4003.new(self)
|
|
130
|
+
when "7"
|
|
131
|
+
Cnab4007.new(self)
|
|
132
|
+
when "9"
|
|
133
|
+
Cnab4009.new(self)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
|
|
2
|
+
#-------------------------------------------------------------------
|
|
3
|
+
#-------------------------------------------------------------------
|
|
4
|
+
# Header - Empresa e Banco
|
|
5
|
+
class Cnab4000 < FormatSection
|
|
6
|
+
require 'date'
|
|
7
|
+
|
|
8
|
+
ID_SERVICO = "DÉBITO AUTOMÁTICO"
|
|
9
|
+
|
|
10
|
+
def initialize master
|
|
11
|
+
super(master, true, true, false)
|
|
12
|
+
|
|
13
|
+
@section = Section.new({
|
|
14
|
+
0 => Position.new(1, 1, false, "A", true), # Código do Registro
|
|
15
|
+
1 => Position.new(2, 1, true), # Código Remessa (1-Remessa, 2-Retorno)
|
|
16
|
+
2 => Position.new(3, 20, false), # Código de ID enviado pelo Banco
|
|
17
|
+
3 => Position.new(4, 20, false), # Nome da Empresa
|
|
18
|
+
4 => Position.new(5, 3, true), # Código do Banco
|
|
19
|
+
5 => Position.new(6, 20, false), # Nome do Banco
|
|
20
|
+
6 => Position.new(7, 8, true), # Data de Geração de Arquivo
|
|
21
|
+
7 => Position.new(8, 6, true), # Número Sequencial do Arquivo
|
|
22
|
+
8 => Position.new(9, 2, true, 5), # Versão do Layout (5, desde 05.05.2008)
|
|
23
|
+
9 => Position.new(10, 17, false, Febraban150A::ID_SERVICO), # Identificação ("DÉBITO AUTOMÁTICO")
|
|
24
|
+
10 => Position.new(11, 52, false), # Reservado pelo Sistema
|
|
25
|
+
})
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#-------------------------------------------------------------------
|
|
29
|
+
#-------------------------------------------------------------------
|
|
30
|
+
# Gerais
|
|
31
|
+
def process_section file
|
|
32
|
+
self.set_codigo_remessa file[1..1]
|
|
33
|
+
self.set_codigo_convenio file[2..21]
|
|
34
|
+
self.set_nome_empresa file[22..41]
|
|
35
|
+
self.set_codigo_banco file[42..44]
|
|
36
|
+
self.set_nome_banco file[45..64]
|
|
37
|
+
self.set_data_geracao file[65..72]
|
|
38
|
+
self.set_numero_sequencial file[73..78]
|
|
39
|
+
self.set_versao_layout file[79..80]
|
|
40
|
+
self.set_identificacao_servico file[81..99]
|
|
41
|
+
self.set_reservado file[98..149]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
#-------------------------------------------------------------------
|
|
45
|
+
#-------------------------------------------------------------------
|
|
46
|
+
# Validações
|
|
47
|
+
def is_valid?
|
|
48
|
+
result = (self.get_codigo_remessa > 0 and
|
|
49
|
+
self.get_codigo_convenio.length > 0 and
|
|
50
|
+
self.get_nome_empresa.length > 0 and
|
|
51
|
+
self.get_codigo_banco > 0 and
|
|
52
|
+
self.get_nome_banco.length > 0 and
|
|
53
|
+
!self.get_data_geracao.nil? and
|
|
54
|
+
self.get_numero_sequencial > 0 and
|
|
55
|
+
self.get_versao_layout > 0 and
|
|
56
|
+
self.get_identificacao_servico.length > 0)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#-------------------------------------------------------------------
|
|
60
|
+
#-------------------------------------------------------------------
|
|
61
|
+
# Getters
|
|
62
|
+
def get_codigo_remessa
|
|
63
|
+
self.get_section_value(1).to_i
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def get_codigo_convenio
|
|
67
|
+
self.get_section_value(2)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def get_nome_empresa
|
|
71
|
+
self.get_section_value(3)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def get_codigo_banco
|
|
75
|
+
self.get_section_value(4).to_i
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def get_nome_banco
|
|
79
|
+
self.get_section_value(5)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def get_data_geracao
|
|
83
|
+
data = self.get_section_value(6)
|
|
84
|
+
Date.new(data[0..3].to_i, data[4..5].to_i, data[6..7].to_i)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def get_numero_sequencial
|
|
88
|
+
data = self.get_section_value(7).to_i
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def get_versao_layout
|
|
92
|
+
data = self.get_section_value(8).to_i
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def get_identificacao_servico
|
|
96
|
+
data = self.get_section_value(9)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
#-------------------------------------------------------------------
|
|
100
|
+
#-------------------------------------------------------------------
|
|
101
|
+
# Setters
|
|
102
|
+
def set_codigo_remessa code
|
|
103
|
+
code = code.to_i
|
|
104
|
+
|
|
105
|
+
if code == 1 or code == 2
|
|
106
|
+
self.set_section_value(1, code)
|
|
107
|
+
else
|
|
108
|
+
raise "#{get_id}: 1 = Remessa - Enviado pela Empresa para o Banco
|
|
109
|
+
2 = Retorno - Enviado pelo Banco para a Empresa
|
|
110
|
+
Valor: #{code}"
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def set_codigo_convenio code
|
|
115
|
+
code = code.to_s
|
|
116
|
+
|
|
117
|
+
if !code.nil? and
|
|
118
|
+
(code.length > 0 and code.length <= 20)
|
|
119
|
+
|
|
120
|
+
self.set_section_value(2, code)
|
|
121
|
+
else
|
|
122
|
+
raise "#{get_id}: Código atribuído pelo Banco, para seu controle interno.
|
|
123
|
+
Este código será informado à Empresa, pelo Banco, antes
|
|
124
|
+
da implantação do serviço de débito automático.
|
|
125
|
+
Valor: #{code}"
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def set_nome_empresa nome
|
|
130
|
+
nome = nome.to_s
|
|
131
|
+
|
|
132
|
+
if nome.to_s.length > 0
|
|
133
|
+
self.set_section_value(3, nome)
|
|
134
|
+
else
|
|
135
|
+
raise "#{get_id}: Nome da Empresa não pode estar vazio"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def set_codigo_banco codigo
|
|
140
|
+
codigo = codigo.to_i
|
|
141
|
+
|
|
142
|
+
if codigo > 0
|
|
143
|
+
self.set_section_value(4, codigo)
|
|
144
|
+
else
|
|
145
|
+
raise "#{get_id}: Código do Banco não pode estar vazio"
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def set_nome_banco nome
|
|
150
|
+
nome = nome.to_s
|
|
151
|
+
|
|
152
|
+
if nome.to_s.length > 0
|
|
153
|
+
self.set_section_value(5, nome)
|
|
154
|
+
else
|
|
155
|
+
raise "#{get_id}: Nome do Banco não pode estar vazio"
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def set_data_geracao data
|
|
160
|
+
begin
|
|
161
|
+
real_data = data.strftime("%Y%m%d")
|
|
162
|
+
|
|
163
|
+
if real_data.length == 8
|
|
164
|
+
self.set_section_value(6, real_data)
|
|
165
|
+
else
|
|
166
|
+
raise
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
rescue
|
|
170
|
+
raise "#{get_id}: Data de Geração Inválida
|
|
171
|
+
Valor: #{data}"
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def set_numero_sequencial numero
|
|
176
|
+
numero = numero.to_i
|
|
177
|
+
|
|
178
|
+
if numero > 0
|
|
179
|
+
self.set_section_value(7, numero)
|
|
180
|
+
else
|
|
181
|
+
raise "#{get_id}: Número Sequencial deve ser positivo e maior que 0
|
|
182
|
+
Valor: #{numero}"
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def set_versao_layout versao
|
|
187
|
+
versao = versao.to_i
|
|
188
|
+
|
|
189
|
+
if versao > 0
|
|
190
|
+
self.set_section_value(8, versao)
|
|
191
|
+
else
|
|
192
|
+
raise "#{get_id}: Versão deve ser 05 (a partir de 05.05.2008)
|
|
193
|
+
Valor: #{versao}"
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def set_identificacao_servico identificacao
|
|
198
|
+
identificacao = identificacao.to_s
|
|
199
|
+
|
|
200
|
+
if identificacao.length > 0
|
|
201
|
+
self.set_section_value(9, identificacao)
|
|
202
|
+
else
|
|
203
|
+
raise "#{get_id}: Deve ser Débito Automático
|
|
204
|
+
Valor: #{identificacao}"
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def set_reservado reservado
|
|
209
|
+
reservado = reservado.to_s
|
|
210
|
+
self.set_section_value(10, reservado)
|
|
211
|
+
end
|
|
212
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: formatos-febraban
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- josé Ricardo Almeida
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-04-
|
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -46,6 +46,14 @@ extensions: []
|
|
|
46
46
|
extra_rdoc_files: []
|
|
47
47
|
files:
|
|
48
48
|
- ".gitignore"
|
|
49
|
+
- ".idea/.rakeTasks"
|
|
50
|
+
- ".idea/encodings.xml"
|
|
51
|
+
- ".idea/formatos-febraban.iml"
|
|
52
|
+
- ".idea/misc.xml"
|
|
53
|
+
- ".idea/modules.xml"
|
|
54
|
+
- ".idea/scopes/scope_settings.xml"
|
|
55
|
+
- ".idea/vcs.xml"
|
|
56
|
+
- ".idea/workspace.xml"
|
|
49
57
|
- ".rspec"
|
|
50
58
|
- ".travis.yml"
|
|
51
59
|
- CODE_OF_CONDUCT.md
|
|
@@ -59,6 +67,13 @@ files:
|
|
|
59
67
|
- bin/console
|
|
60
68
|
- bin/setup
|
|
61
69
|
- formatos-febraban.gemspec
|
|
70
|
+
- lib/formatos/cnab400/cnab_400.rb
|
|
71
|
+
- lib/formatos/cnab400/cnab_400_0.rb
|
|
72
|
+
- lib/formatos/cnab400/cnab_400_1.rb
|
|
73
|
+
- lib/formatos/cnab400/cnab_400_2.rb
|
|
74
|
+
- lib/formatos/cnab400/cnab_400_3.rb
|
|
75
|
+
- lib/formatos/cnab400/cnab_400_7.rb
|
|
76
|
+
- lib/formatos/cnab400/cnab_400_9.rb
|
|
62
77
|
- lib/formatos/febraban.rb
|
|
63
78
|
- lib/formatos/febraban/version.rb
|
|
64
79
|
- lib/formatos/febraban150/febraban_150.rb
|