cnab_rb 0.1.0
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 +7 -0
- data/.editorconfig +9 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cnab_rb.gemspec +36 -0
- data/lib/cnab_rb/format/field.rb +46 -0
- data/lib/cnab_rb/format/file.rb +28 -0
- data/lib/cnab_rb/format/line.rb +49 -0
- data/lib/cnab_rb/format/picture.rb +37 -0
- data/lib/cnab_rb/format/picture_formats/float.rb +30 -0
- data/lib/cnab_rb/format/picture_formats/integer.rb +21 -0
- data/lib/cnab_rb/format/picture_formats/text.rb +31 -0
- data/lib/cnab_rb/layouts/cnab240/generic/header_batch.rb +137 -0
- data/lib/cnab_rb/layouts/cnab240/generic/header_file.rb +211 -0
- data/lib/cnab_rb/layouts/cnab240/generic/return/segment_a.rb +163 -0
- data/lib/cnab_rb/layouts/cnab240/generic/return/segment_t.rb +151 -0
- data/lib/cnab_rb/layouts/cnab240/generic/return/segment_u.rb +127 -0
- data/lib/cnab_rb/layouts/cnab240/generic/return/segment_w.rb +65 -0
- data/lib/cnab_rb/layouts/cnab240/generic/trailer_batch.rb +86 -0
- data/lib/cnab_rb/layouts/cnab240/generic/trailer_file.rb +50 -0
- data/lib/cnab_rb/layouts/layout.rb +40 -0
- data/lib/cnab_rb/return/cnab240/caixa_return.rb +4 -0
- data/lib/cnab_rb/return/cnab240/generic_return.rb +4 -0
- data/lib/cnab_rb/return/return_factory.rb +19 -0
- data/lib/cnab_rb/version.rb +3 -0
- data/lib/cnab_rb.rb +41 -0
- metadata +119 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
module CnabRb::Layouts::Cnab240::Generic
|
|
2
|
+
class HeaderFile < CnabRb::Layouts::Layout
|
|
3
|
+
def init_fields
|
|
4
|
+
field :bank_code,
|
|
5
|
+
pos: 1..3,
|
|
6
|
+
picture: '9(3)'
|
|
7
|
+
|
|
8
|
+
field :service_batch,
|
|
9
|
+
# Se registro for Header do Arquivo = '0000'
|
|
10
|
+
pos: 4..7,
|
|
11
|
+
picture: '9(4)',
|
|
12
|
+
default: 0
|
|
13
|
+
|
|
14
|
+
field :registry_type,
|
|
15
|
+
# Código adotado pela FEBRABAN para identificar o tipo de registro.
|
|
16
|
+
# '0' = Header de Arquivo
|
|
17
|
+
pos: 8..8,
|
|
18
|
+
picture: '9(1)',
|
|
19
|
+
default: '0'
|
|
20
|
+
|
|
21
|
+
field :exclusive_use_febraban_1,
|
|
22
|
+
pos: 9..17,
|
|
23
|
+
picture: 'X(9)',
|
|
24
|
+
default: ''
|
|
25
|
+
|
|
26
|
+
field :registration_code,
|
|
27
|
+
# '1' = CPF
|
|
28
|
+
# '2' = CGC / CNPJ
|
|
29
|
+
pos: 18..18,
|
|
30
|
+
picture: '9(1)'
|
|
31
|
+
|
|
32
|
+
field :registration_number,
|
|
33
|
+
# CNPJ ou CPF
|
|
34
|
+
pos: 19..32,
|
|
35
|
+
picture: '9(14)'
|
|
36
|
+
|
|
37
|
+
field :agreement_code,
|
|
38
|
+
# Código do Convênio no Banco (Código do Cedente)
|
|
39
|
+
# Código fornecido pela CAIXA, através da agência de relacionamento do cliente, específico para
|
|
40
|
+
# identificar determinados tipos de serviços / produtos.
|
|
41
|
+
# O campo CÓDIGO DO CEDENTE deverá ser preenchido da seguinte forma:
|
|
42
|
+
# AAAAOOOCCCCCCCCD, onde:
|
|
43
|
+
# AAAA = código da Agência CAIXA de relacionamento do cliente / cedente
|
|
44
|
+
# OOO = Operação
|
|
45
|
+
# CCCCCCCC = Número da Conta Corrente ou seqüencial
|
|
46
|
+
# D = Dígito Verificador
|
|
47
|
+
pos: 33..48,
|
|
48
|
+
picture: '9(16)'
|
|
49
|
+
|
|
50
|
+
field :exclusive_use_bank_1,
|
|
51
|
+
# Padrão: deixar em branco
|
|
52
|
+
pos: 49..52,
|
|
53
|
+
picture: 'X(4)',
|
|
54
|
+
default: ''
|
|
55
|
+
|
|
56
|
+
field :agency,
|
|
57
|
+
# Código da Agência mantenedora da conta, fornecido pela CAIXA.
|
|
58
|
+
pos: 53..57,
|
|
59
|
+
picture: '9(5)'
|
|
60
|
+
|
|
61
|
+
field :agency_cd,
|
|
62
|
+
# Dígito Verificador da Agência mantendedora da conta, fornecido pela CAIXA.
|
|
63
|
+
pos: 58..58,
|
|
64
|
+
picture: '9(1)'
|
|
65
|
+
|
|
66
|
+
field :transferor_code,
|
|
67
|
+
# Código do Cedente
|
|
68
|
+
# Remessa: Código do Convênio no Banco (sem operação), tamanho: 12 posições, no formato
|
|
69
|
+
# 0000CCCCCCCC.
|
|
70
|
+
# Retorno: Código do Convênio no Banco (com operação), tamanho: 12 posições, no formato
|
|
71
|
+
# 0OOOCCCCCCCC.
|
|
72
|
+
# Onde:
|
|
73
|
+
# 0 = zero
|
|
74
|
+
# OOO = Operação
|
|
75
|
+
# CCCCCCCC = Cedente
|
|
76
|
+
pos: 59..70,
|
|
77
|
+
picture: '9(12)'
|
|
78
|
+
|
|
79
|
+
field :transferor_code_cd,
|
|
80
|
+
# Dígito Verificador do Cedente
|
|
81
|
+
# Código adotado pela CAIXA, para verificação da autenticidade do Código do Cedente. Calculado
|
|
82
|
+
# através do módulo 11.
|
|
83
|
+
# Exemplo de como calcular o DV do Cedente:
|
|
84
|
+
# Agência/Código do Cedente: 0012.870.00000575-1
|
|
85
|
+
# Para Remessa – Cedente sem operação e sem DV: 00000575
|
|
86
|
+
# Para Retorno – Cedente com operação e sem DV: 87000000575
|
|
87
|
+
# 0 0 0 0 0 5 7 5
|
|
88
|
+
# 9 8 7 6 5 4 3 2
|
|
89
|
+
# 0 0 0 0 0 20 21 10
|
|
90
|
+
# 1ª linha – Código do Cedente
|
|
91
|
+
# 2ª linha – Índice multiplicação, preencher sequencialmente de 2 a 9 da direita para a esquerda
|
|
92
|
+
# 3ª linha – Multiplicação coluna por coluna (0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 3x3, 3x2)
|
|
93
|
+
# Soma-se os valores da 3ª linha: 0+0+0+0+0+20+21+10 = 51
|
|
94
|
+
# Dividir o resultado da soma por onze: 51/11 = 4 (resto 7)
|
|
95
|
+
# Subtrair onze pelo resto da divisão: 11 – 7 = 4
|
|
96
|
+
# O Dígito Verificador calculado para o Código de Cedente acima é 4
|
|
97
|
+
# Obs.: se o resultado da subtração for maior que 9 (nove) o dígito será 0 (zero)
|
|
98
|
+
pos: 71..71,
|
|
99
|
+
picture: '9(1)'
|
|
100
|
+
|
|
101
|
+
field :agency_transferor_cd,
|
|
102
|
+
# Dígito Verificador da Agência / Código do Cedente
|
|
103
|
+
# Código adotado pela CAIXA para verificação da autenticidade do par Código da Agência / Código do
|
|
104
|
+
# Cedente. Calculado através do módulo 11.
|
|
105
|
+
# Obs: Para o Retorno é o mesmo DV do Código do Cedente, fornecido pela CAIXA.
|
|
106
|
+
# Exemplo de como calcular o DV da Agência/Código do Cedente (Remessa):
|
|
107
|
+
# Agência/Código do Cedente: 0012.870.00000575-1
|
|
108
|
+
# Agência (sem DV): 0012
|
|
109
|
+
# Cedente (sem operação e sem DV) – tamanho 8 posições: 00000575
|
|
110
|
+
# 0 0 1 2 0 0 0 0 0 5 7 5
|
|
111
|
+
# 5 4 3 2 9 8 7 6 5 4 3 2
|
|
112
|
+
# 0 0 3 4 0 0 0 0 0 20 21 10
|
|
113
|
+
# 1ª Linha – Agência/Código do Cedente
|
|
114
|
+
# 2ª Linha – Ìndice multiplicação, preencher sequencialmente de 2 a 9 da direita para a esquerda
|
|
115
|
+
# 3ª Linha – Multiplicação coluna por coluna
|
|
116
|
+
# Soma-se os valores da 3ª linha: 0+0+3+4+0+0+0+0+0+20+21+10 = 58
|
|
117
|
+
# Dividir o resultado da soma por onze: 58/11 = 5 (RESTO 3)
|
|
118
|
+
# Subtrair onze pelo resto da divisão: 11 – 3 = 8
|
|
119
|
+
# O Dígito Verificador calculado para o Código de Cedente acima é 8
|
|
120
|
+
# Obs.: se o resultado da subtração for maior que 9 (nove) o dígito será 0 (zero)
|
|
121
|
+
# No Banco do Brasil, é o Dígito verificador da Ag/Conta
|
|
122
|
+
pos: 72..72,
|
|
123
|
+
picture: '9(1)'
|
|
124
|
+
|
|
125
|
+
field :company_name,
|
|
126
|
+
# Nome que identifica a pessoa, física ou jurídica, a qual se quer fazer referência
|
|
127
|
+
pos: 73..102,
|
|
128
|
+
picture: 'X(30)'
|
|
129
|
+
|
|
130
|
+
field :bank_name,
|
|
131
|
+
# Nome que identifica o banco que está recebendo ou enviando o arquivo.
|
|
132
|
+
# Informar: CAIXA ECONÔMICA FEDERAL (se o banco for a caixa)
|
|
133
|
+
pos: 103..132,
|
|
134
|
+
picture: 'X(30)'
|
|
135
|
+
|
|
136
|
+
field :exclusive_use_febraban_2,
|
|
137
|
+
# Texto de observações destinado para uso exclusivo da FEBRABAN. Preencher com Brancos.
|
|
138
|
+
pos: 133..142,
|
|
139
|
+
picture: 'X(10)',
|
|
140
|
+
default: ''
|
|
141
|
+
|
|
142
|
+
field :remittance_return_code,
|
|
143
|
+
# Código Remessa / Retorno
|
|
144
|
+
# Código adotado pela febraban para qualificar o envio ou devolução de arquivo entre a empresa
|
|
145
|
+
# cliente e o banco prestador dos serviços. informar:
|
|
146
|
+
# '1' = remessa (cliente banco)
|
|
147
|
+
# '2' = retorno (banco cliente)
|
|
148
|
+
pos: 143..143,
|
|
149
|
+
picture: '9(1)'
|
|
150
|
+
|
|
151
|
+
field :generation_date,
|
|
152
|
+
# Data da criação do arquivo. utilizar o formato DDMMAAAA, onde : dd = dia, mm = mês, aa = ano
|
|
153
|
+
pos: 144..151,
|
|
154
|
+
picture: '9(8)',
|
|
155
|
+
date_format: '%d%m%Y'
|
|
156
|
+
|
|
157
|
+
field :generation_time,
|
|
158
|
+
# Hora da criação do arquivo. utilizar o formato hhmmss, onde : HH = hora, MM = minuto, SS = segundo
|
|
159
|
+
pos: 152..157,
|
|
160
|
+
picture: '9(6)',
|
|
161
|
+
date_format: '%H%M%S'
|
|
162
|
+
|
|
163
|
+
field :sequential_number_file,
|
|
164
|
+
# Número seqüencial adotado e controlado pelo responsável pela geração do arquivo para ordenar a
|
|
165
|
+
# disposição dos arquivos encaminhados.
|
|
166
|
+
# Evoluir um número seqüencial a cada header de arquivo.
|
|
167
|
+
pos: [158, 163],
|
|
168
|
+
picture: '9(6)'
|
|
169
|
+
|
|
170
|
+
file :layout_version,
|
|
171
|
+
# Código adotado pela FEBRABAN para identificar qual a versão de layout do arquivo encaminhado. O
|
|
172
|
+
# código é composto de:
|
|
173
|
+
# Versão = 2 dígitos
|
|
174
|
+
# Release = 1 dígito
|
|
175
|
+
# Padrão: 030
|
|
176
|
+
pos: 164..166,
|
|
177
|
+
picture: '9(3)',
|
|
178
|
+
default: '030'
|
|
179
|
+
|
|
180
|
+
file :density_file,
|
|
181
|
+
# Densidade de gravação (bpi), do arquivo encaminhado. Pode ser:
|
|
182
|
+
# 1600 BPI
|
|
183
|
+
# 6250 BPI
|
|
184
|
+
# Pode ser informado ‘0’. (Padrão)
|
|
185
|
+
pos: 167..171,
|
|
186
|
+
picture: '9(5)',
|
|
187
|
+
default: '0'
|
|
188
|
+
|
|
189
|
+
field :exclusive_use_bank,
|
|
190
|
+
# Para Uso Reservado do Banco
|
|
191
|
+
# Texto de observações destinado para uso exclusivo da caixa econômica federal.
|
|
192
|
+
# Durante a fase de testes (simulado) deverá conter a literal ‘RETORNO-TESTE’
|
|
193
|
+
pos: 172..191,
|
|
194
|
+
picture: 'X(20)',
|
|
195
|
+
default: ''
|
|
196
|
+
|
|
197
|
+
field :exclusive_use_company,
|
|
198
|
+
# Campo utilizado pelo cliente/cedente. Na fase de testes (simulado), deverá conter a literal
|
|
199
|
+
# ‘REMESSA-TESTE’ e na fase de produção deverá conter a literal ‘REMESSA-PRODUÇÃO’
|
|
200
|
+
pos: 192..211,
|
|
201
|
+
picture: 'X(20)',
|
|
202
|
+
default: 'REMESSA-PRODUCAO'
|
|
203
|
+
|
|
204
|
+
field :exclusive_use_febraban_2,
|
|
205
|
+
# Texto de observações destinado para uso exclusivo da FEBRABAN. Preencher com Brancos.
|
|
206
|
+
pos: 212..240,
|
|
207
|
+
picture: 'X(29)',
|
|
208
|
+
default: ''
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
module CnabRb::Layouts::Cnab240::Generic::Return
|
|
2
|
+
class SegmentA < CnabRb::Layouts::Layout
|
|
3
|
+
def init_fields
|
|
4
|
+
field :bank_code,
|
|
5
|
+
# codigo_banco
|
|
6
|
+
pos: 1..3,
|
|
7
|
+
picture: '9(3)'
|
|
8
|
+
|
|
9
|
+
field :service_batch,
|
|
10
|
+
# lote_servico
|
|
11
|
+
pos: 4..7,
|
|
12
|
+
picture: '9(4)'
|
|
13
|
+
|
|
14
|
+
field :registry_type,
|
|
15
|
+
# tipo_registro
|
|
16
|
+
pos: 8..8,
|
|
17
|
+
picture: '9(1)',
|
|
18
|
+
default: '3'
|
|
19
|
+
|
|
20
|
+
field :sequential_number_batch,
|
|
21
|
+
# numero_sequencial_lote
|
|
22
|
+
pos: 9..13,
|
|
23
|
+
picture: '9(5)'
|
|
24
|
+
|
|
25
|
+
field :segment_code,
|
|
26
|
+
# codigo_segmento
|
|
27
|
+
pos: 14..14,
|
|
28
|
+
picture: 'X(1)',
|
|
29
|
+
default: 'A'
|
|
30
|
+
|
|
31
|
+
field :movement_type,
|
|
32
|
+
# tipo_movimento
|
|
33
|
+
pos: 15..15,
|
|
34
|
+
picture: '9(1)',
|
|
35
|
+
default: ''
|
|
36
|
+
|
|
37
|
+
field :movement_instruction_code,
|
|
38
|
+
# codigo_instrucao_movimento
|
|
39
|
+
pos: 16..17,
|
|
40
|
+
picture: '9(2)'
|
|
41
|
+
|
|
42
|
+
field :centering_chamber,
|
|
43
|
+
# camara_centralizadora
|
|
44
|
+
pos: 18..20,
|
|
45
|
+
picture: '9(3)'
|
|
46
|
+
|
|
47
|
+
field :favored_bank,
|
|
48
|
+
# banco_favorecido
|
|
49
|
+
pos: 21..23,
|
|
50
|
+
picture: '9(3)'
|
|
51
|
+
|
|
52
|
+
field :favored_agency,
|
|
53
|
+
# agencia_favorecido
|
|
54
|
+
pos: 24..28,
|
|
55
|
+
picture: '9(5)'
|
|
56
|
+
|
|
57
|
+
field :favored_agency_cd,
|
|
58
|
+
# agencia_dv_favorecido
|
|
59
|
+
pos: 29..29,
|
|
60
|
+
picture: 'X(1)'
|
|
61
|
+
|
|
62
|
+
field :favored_account,
|
|
63
|
+
# conta_favorecido
|
|
64
|
+
pos: 30..41,
|
|
65
|
+
picture: '9(12)'
|
|
66
|
+
|
|
67
|
+
field :favored_account_cd,
|
|
68
|
+
# conta_dv_favorecido
|
|
69
|
+
pos: 42..42,
|
|
70
|
+
picture: 'X(1)'
|
|
71
|
+
|
|
72
|
+
field :favored_agency_account_cd,
|
|
73
|
+
# agencia_conta_dv_favorecido
|
|
74
|
+
pos: 43..43,
|
|
75
|
+
picture: 'X(1)'
|
|
76
|
+
|
|
77
|
+
field :favored_name,
|
|
78
|
+
# nome_favorecido
|
|
79
|
+
pos: 44..73,
|
|
80
|
+
picture: 'X(30)'
|
|
81
|
+
|
|
82
|
+
field :document_number,
|
|
83
|
+
# numero_documento
|
|
84
|
+
pos: 74..93,
|
|
85
|
+
picture: 'X(20)'
|
|
86
|
+
|
|
87
|
+
field :payment_date,
|
|
88
|
+
# data_pagamento
|
|
89
|
+
pos: 94..101,
|
|
90
|
+
picture: '9(8)',
|
|
91
|
+
date_format: '%d%m%Y'
|
|
92
|
+
|
|
93
|
+
field :currency_code,
|
|
94
|
+
# tipo_moeda
|
|
95
|
+
pos: 102..104,
|
|
96
|
+
picture: 'X(3)',
|
|
97
|
+
default: 'BRL'
|
|
98
|
+
|
|
99
|
+
field :coin_quantity,
|
|
100
|
+
# quantidade_moeda
|
|
101
|
+
pos: 105..119,
|
|
102
|
+
picture: '9(10)V9(5)'
|
|
103
|
+
|
|
104
|
+
field :payment_amount,
|
|
105
|
+
# valor_pagamento
|
|
106
|
+
pos: 120..134,
|
|
107
|
+
picture: '9(13)V9(2)'
|
|
108
|
+
|
|
109
|
+
field :our_number,
|
|
110
|
+
# nosso_numero
|
|
111
|
+
pos: 135..154,
|
|
112
|
+
picture: 'X(20)'
|
|
113
|
+
|
|
114
|
+
field :real_date,
|
|
115
|
+
# data_real
|
|
116
|
+
pos: 155..162,
|
|
117
|
+
picture: '9(8)',
|
|
118
|
+
date_format: '%d%m%Y'
|
|
119
|
+
|
|
120
|
+
field :real_amount,
|
|
121
|
+
# valor_real
|
|
122
|
+
pos: 163..177,
|
|
123
|
+
picture: '9(13)V9(2)'
|
|
124
|
+
|
|
125
|
+
field :information_2,
|
|
126
|
+
# informacao_2
|
|
127
|
+
pos: 178..217,
|
|
128
|
+
picture: 'X(40)'
|
|
129
|
+
|
|
130
|
+
field :document_finality,
|
|
131
|
+
# finalidade_doc
|
|
132
|
+
pos: 218..219,
|
|
133
|
+
picture: 'X(2)'
|
|
134
|
+
|
|
135
|
+
field :ted_finality,
|
|
136
|
+
# finalidade_ted
|
|
137
|
+
pos: 220..224,
|
|
138
|
+
picture: 'X(5)'
|
|
139
|
+
|
|
140
|
+
field :complementary_finality,
|
|
141
|
+
# finalidade_complementar
|
|
142
|
+
pos: 225..226,
|
|
143
|
+
picture: 'X(2)'
|
|
144
|
+
|
|
145
|
+
field :exclusive_use_febraban_1,
|
|
146
|
+
# uso_exclusivo_febraban
|
|
147
|
+
pos: 227..229,
|
|
148
|
+
picture: 'X(3)',
|
|
149
|
+
default: ''
|
|
150
|
+
|
|
151
|
+
field :notice,
|
|
152
|
+
# aviso
|
|
153
|
+
pos: 230..230,
|
|
154
|
+
picture: '9(1)'
|
|
155
|
+
|
|
156
|
+
field :ocurrences,
|
|
157
|
+
# ocorencias
|
|
158
|
+
pos: 231..240,
|
|
159
|
+
picture: 'X(10)',
|
|
160
|
+
default: ''
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
module CnabRb::Layouts::Cnab240::Generic::Return
|
|
2
|
+
class SegmentT < CnabRb::Layouts::Layout
|
|
3
|
+
def init_fields
|
|
4
|
+
field :bank_code,
|
|
5
|
+
# codigo_banco
|
|
6
|
+
pos: 1..3,
|
|
7
|
+
picture: '9(3)'
|
|
8
|
+
|
|
9
|
+
field :service_batch,
|
|
10
|
+
# lote_servico
|
|
11
|
+
pos: 4..7,
|
|
12
|
+
picture: '9(4)'
|
|
13
|
+
|
|
14
|
+
field :registry_type,
|
|
15
|
+
# tipo_registro
|
|
16
|
+
pos: 8..8,
|
|
17
|
+
picture: '9(1)'
|
|
18
|
+
|
|
19
|
+
field :sequential_number_batch,
|
|
20
|
+
# numero_sequencial_lote
|
|
21
|
+
pos: 9..13,
|
|
22
|
+
picture: '9(5)'
|
|
23
|
+
|
|
24
|
+
field :segment_code,
|
|
25
|
+
# codigo_segmento
|
|
26
|
+
pos: 14..14,
|
|
27
|
+
picture: 'X(1)'
|
|
28
|
+
|
|
29
|
+
field :exclusive_use_febraban_1,
|
|
30
|
+
# uso_exclusivo_febraban_01
|
|
31
|
+
pos: 15..15,
|
|
32
|
+
picture: 'X(1)'
|
|
33
|
+
|
|
34
|
+
field :movement_code,
|
|
35
|
+
# codigo_movimento
|
|
36
|
+
pos: 16..17,
|
|
37
|
+
picture: '9(2)'
|
|
38
|
+
|
|
39
|
+
field :mantainer_agency,
|
|
40
|
+
# agencia_mantenedora
|
|
41
|
+
pos: 18..22,
|
|
42
|
+
picture: '9(5)'
|
|
43
|
+
|
|
44
|
+
field :agency_cd,
|
|
45
|
+
# agencia_dv
|
|
46
|
+
pos: 23..23,
|
|
47
|
+
picture: '9(1)'
|
|
48
|
+
|
|
49
|
+
field :transferor_code,
|
|
50
|
+
# codigo_cedente
|
|
51
|
+
pos: 24..35,
|
|
52
|
+
picture: '9(12)'
|
|
53
|
+
|
|
54
|
+
field :transferor_code_cd,
|
|
55
|
+
# codigo_cedente_dv
|
|
56
|
+
pos: 36..36,
|
|
57
|
+
picture: '9(1)'
|
|
58
|
+
|
|
59
|
+
field :agency_transferor_cd,
|
|
60
|
+
# agencia_dv_mais_cedente_dv
|
|
61
|
+
pos: 37..37,
|
|
62
|
+
picture: '9(1)'
|
|
63
|
+
|
|
64
|
+
field :our_number,
|
|
65
|
+
# nosso_numero
|
|
66
|
+
pos: 38..57,
|
|
67
|
+
picture: '9(20)'
|
|
68
|
+
|
|
69
|
+
field :wallet_code,
|
|
70
|
+
# codigo_carteira
|
|
71
|
+
pos: 58..58,
|
|
72
|
+
picture: '9(1)'
|
|
73
|
+
|
|
74
|
+
field :document_number,
|
|
75
|
+
# numero_documento
|
|
76
|
+
pos: 59..73,
|
|
77
|
+
picture: 'X(15)'
|
|
78
|
+
|
|
79
|
+
field :due_date,
|
|
80
|
+
# data_vencimento
|
|
81
|
+
pos: 74..81,
|
|
82
|
+
picture: '9(8)',
|
|
83
|
+
date_format: '%d%m%Y'
|
|
84
|
+
|
|
85
|
+
field :title_amount,
|
|
86
|
+
# valor_titulo
|
|
87
|
+
pos: 82..96,
|
|
88
|
+
picture: '9(13)V9(2)'
|
|
89
|
+
|
|
90
|
+
field :bank_number,
|
|
91
|
+
# numero_banco
|
|
92
|
+
pos: 97..99,
|
|
93
|
+
picture: '9(3)'
|
|
94
|
+
|
|
95
|
+
field :collector_agency,
|
|
96
|
+
# agencia_cobradora
|
|
97
|
+
pos: 100..104,
|
|
98
|
+
picture: '9(5)'
|
|
99
|
+
|
|
100
|
+
field :collector_agency_cd,
|
|
101
|
+
# agencia_cobradora_dac
|
|
102
|
+
pos: 105..105,
|
|
103
|
+
picture: '9(1)'
|
|
104
|
+
|
|
105
|
+
field :company_use,
|
|
106
|
+
# uso_empresa
|
|
107
|
+
pos: 106..130,
|
|
108
|
+
picture: 'X(25)'
|
|
109
|
+
|
|
110
|
+
field :currency_code,
|
|
111
|
+
# codigo_moeda
|
|
112
|
+
pos: 131..132,
|
|
113
|
+
picture: '9(2)'
|
|
114
|
+
|
|
115
|
+
field :registration_type,
|
|
116
|
+
# tipo_inscricao
|
|
117
|
+
pos: 133..133,
|
|
118
|
+
picture: '9(1)'
|
|
119
|
+
|
|
120
|
+
field :registration_number,
|
|
121
|
+
# numero_inscricao
|
|
122
|
+
pos: 134..148,
|
|
123
|
+
picture: '9(15)'
|
|
124
|
+
|
|
125
|
+
field :draw_name,
|
|
126
|
+
# nome_sacado
|
|
127
|
+
pos: 149..188,
|
|
128
|
+
picture: 'X(40)'
|
|
129
|
+
|
|
130
|
+
field :exclusive_use_febraban_2,
|
|
131
|
+
# uso_exclusivo_febraban_02
|
|
132
|
+
pos: 189..198,
|
|
133
|
+
picture: 'X(10)'
|
|
134
|
+
|
|
135
|
+
field :tax_amount,
|
|
136
|
+
# valor_tarifa
|
|
137
|
+
pos: 199..213,
|
|
138
|
+
picture: '9(13)V9(2)'
|
|
139
|
+
|
|
140
|
+
field :rejection_indentification,
|
|
141
|
+
# identificacao_rejeicao
|
|
142
|
+
pos: 214..223,
|
|
143
|
+
picture: 'X(10)'
|
|
144
|
+
|
|
145
|
+
field :exclusive_use_febraban_3,
|
|
146
|
+
# uso_exclusivo_febraban
|
|
147
|
+
pos: 224..240,
|
|
148
|
+
picture: 'X(17)'
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
module CnabRb::Layouts::Cnab240::Generic::Return
|
|
2
|
+
class SegmentU < CnabRb::Layouts::Layout
|
|
3
|
+
def init_fields
|
|
4
|
+
field :bank_code,
|
|
5
|
+
# codigo_banco
|
|
6
|
+
pos: 1..3,
|
|
7
|
+
picture: '9(3)'
|
|
8
|
+
|
|
9
|
+
field :service_batch,
|
|
10
|
+
# lote_servico
|
|
11
|
+
pos: 4..7,
|
|
12
|
+
picture: '9(4)'
|
|
13
|
+
|
|
14
|
+
field :registry_type,
|
|
15
|
+
# tipo_registro
|
|
16
|
+
pos: 8..8,
|
|
17
|
+
picture: '9(1)'
|
|
18
|
+
|
|
19
|
+
field :sequential_number_register,
|
|
20
|
+
# numero_sequencial_registro
|
|
21
|
+
pos: 9..13,
|
|
22
|
+
picture: '9(5)'
|
|
23
|
+
|
|
24
|
+
field :segment_code,
|
|
25
|
+
# codigo_segmento
|
|
26
|
+
pos: 14..14,
|
|
27
|
+
picture: 'X(1)'
|
|
28
|
+
|
|
29
|
+
field :exclusive_use_febraban_1,
|
|
30
|
+
# uso_exclusivo_febraban_01
|
|
31
|
+
pos: 15..15,
|
|
32
|
+
picture: 'X(1)'
|
|
33
|
+
|
|
34
|
+
field :movement_code,
|
|
35
|
+
# codigo_movimento
|
|
36
|
+
pos: 16..17,
|
|
37
|
+
picture: '9(2)'
|
|
38
|
+
|
|
39
|
+
field :additions_amount,
|
|
40
|
+
# valor_acrescimos
|
|
41
|
+
pos: 18..32,
|
|
42
|
+
picture: '9(13)V9(2)'
|
|
43
|
+
|
|
44
|
+
field :discount_amount,
|
|
45
|
+
# valor_desconto
|
|
46
|
+
pos: 33..47,
|
|
47
|
+
picture: '9(13)V9(2)'
|
|
48
|
+
|
|
49
|
+
field :abatement_amount,
|
|
50
|
+
# valor_abatimento
|
|
51
|
+
pos: 48..62,
|
|
52
|
+
picture: '9(13)V9(2)'
|
|
53
|
+
|
|
54
|
+
field :iof_amount,
|
|
55
|
+
# valor_iof
|
|
56
|
+
pos: 63..77,
|
|
57
|
+
picture: '9(13)V9(2)'
|
|
58
|
+
|
|
59
|
+
field :paid_amount,
|
|
60
|
+
# valor_pago
|
|
61
|
+
pos: 78..92,
|
|
62
|
+
picture: '9(13)V9(2)'
|
|
63
|
+
|
|
64
|
+
field :net_amount,
|
|
65
|
+
# valor_liquido
|
|
66
|
+
pos: 93..107,
|
|
67
|
+
picture: '9(13)V9(2)'
|
|
68
|
+
|
|
69
|
+
field :other_expenses_amount,
|
|
70
|
+
# valor_outras_despesas
|
|
71
|
+
pos: 108..122,
|
|
72
|
+
picture: '9(13)V9(2)'
|
|
73
|
+
|
|
74
|
+
field :other_credits_amount,
|
|
75
|
+
# valor_outros_creditos
|
|
76
|
+
pos: 123..137,
|
|
77
|
+
picture: '9(13)V9(2)'
|
|
78
|
+
|
|
79
|
+
field :ocurrency_date,
|
|
80
|
+
# data_ocorrencia
|
|
81
|
+
pos: 138..145,
|
|
82
|
+
picture: '9(8)',
|
|
83
|
+
date_format: '%d%m%Y'
|
|
84
|
+
|
|
85
|
+
field :credit_date,
|
|
86
|
+
# data_credito
|
|
87
|
+
pos: 146..153,
|
|
88
|
+
picture: '9(8)',
|
|
89
|
+
date_format: '%d%m%Y'
|
|
90
|
+
|
|
91
|
+
field :ocurrency_drawn_code,
|
|
92
|
+
# ocorrencia_sacado_codigo
|
|
93
|
+
pos: 154..157,
|
|
94
|
+
picture: 'X(4)'
|
|
95
|
+
|
|
96
|
+
field :ocurrency_drawn_date,
|
|
97
|
+
# ocorrencia_sacado_data
|
|
98
|
+
pos: 158..165,
|
|
99
|
+
picture: 'X(8)'
|
|
100
|
+
|
|
101
|
+
field :ocurrency_drawn_amount,
|
|
102
|
+
# ocorrencia_sacado_valor
|
|
103
|
+
pos: 166..180,
|
|
104
|
+
picture: '9(13)V9(2)'
|
|
105
|
+
|
|
106
|
+
field :ocurrency_draw_complement,
|
|
107
|
+
# ocorrencia_sacado_complemento
|
|
108
|
+
pos: 181..210,
|
|
109
|
+
picture: 'X(30)'
|
|
110
|
+
|
|
111
|
+
field :ocurrency_draw_corresponding,
|
|
112
|
+
# codigo_banco_correspondente
|
|
113
|
+
pos: 211..213,
|
|
114
|
+
picture: '9(3)'
|
|
115
|
+
|
|
116
|
+
field :our_number_bank_corresponding,
|
|
117
|
+
# nosso_numero_banco_correspondente
|
|
118
|
+
pos: 214..233,
|
|
119
|
+
picture: '9(20)'
|
|
120
|
+
|
|
121
|
+
field :exclusive_use_febraban_2,
|
|
122
|
+
# uso_exclusivo_febraban_02
|
|
123
|
+
pos: 234..240,
|
|
124
|
+
picture: '9(7)'
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module CnabRb::Layouts::Cnab240::Generic::Return
|
|
2
|
+
class SegmentW < CnabRb::Layouts::Layout
|
|
3
|
+
def init_fields
|
|
4
|
+
field :bank_code,
|
|
5
|
+
# codigo_banco
|
|
6
|
+
pos: 1..3,
|
|
7
|
+
picture: '9(3)'
|
|
8
|
+
|
|
9
|
+
field :service_batch,
|
|
10
|
+
# lote_servico
|
|
11
|
+
pos: 4..7,
|
|
12
|
+
picture: '9(4)'
|
|
13
|
+
|
|
14
|
+
field :registry_type,
|
|
15
|
+
# tipo_registro
|
|
16
|
+
pos: 8..8,
|
|
17
|
+
picture: '9(1)'
|
|
18
|
+
|
|
19
|
+
field :sequantial_number,
|
|
20
|
+
# numero_sequencial
|
|
21
|
+
pos: 9..13,
|
|
22
|
+
picture: '9(5)'
|
|
23
|
+
|
|
24
|
+
field :segment_code,
|
|
25
|
+
# codigo_segmento
|
|
26
|
+
pos: 14..14,
|
|
27
|
+
picture: 'X(1)'
|
|
28
|
+
|
|
29
|
+
field :exclusive_use_febraban_1,
|
|
30
|
+
# uso_exclusivo_febraban_01
|
|
31
|
+
pos: 15..15,
|
|
32
|
+
picture: 'X(1)'
|
|
33
|
+
|
|
34
|
+
field :movement_code,
|
|
35
|
+
# codigo_movimento
|
|
36
|
+
pos: 16..17,
|
|
37
|
+
picture: '9(2)'
|
|
38
|
+
|
|
39
|
+
field :relative_position,
|
|
40
|
+
# posicao_relativa
|
|
41
|
+
pos: 18..23,
|
|
42
|
+
picture: '9(6)'
|
|
43
|
+
|
|
44
|
+
field :exclusive_use_bank_1,
|
|
45
|
+
# uso_exclusivo_banco_01
|
|
46
|
+
pos: 24..24,
|
|
47
|
+
picture: 'X(1)'
|
|
48
|
+
|
|
49
|
+
field :field_01_code,
|
|
50
|
+
# codigo_campo_01
|
|
51
|
+
pos: 25..28,
|
|
52
|
+
picture: '9(4)'
|
|
53
|
+
|
|
54
|
+
field :error_01_code,
|
|
55
|
+
# codigo_erro_01
|
|
56
|
+
pos: 29..31,
|
|
57
|
+
picture: '9(3)'
|
|
58
|
+
|
|
59
|
+
field :todo_repeat_code_field_error_20,
|
|
60
|
+
# todo_repeat_codigo_campo_codigo_erro_20
|
|
61
|
+
pos: 32..157,
|
|
62
|
+
picture: 'X(126)'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|