Class: BrBoleto::Retorno::Pagamento

Inherits:
ActiveModelBase show all
Includes:
HaveConta
Defined in:
lib/br_boleto/retorno/pagamento.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HaveConta

#conta, #conta=

Methods inherited from ActiveModelBase

#assign_attributes, #default_values

Constructor Details

#initialize(attributes = {}) ⇒ Pagamento

Returns a new instance of Pagamento.



271
272
273
274
# File 'lib/br_boleto/retorno/pagamento.rb', line 271

def initialize(attributes = {})
	define_formatted_methods!
	super
end

Instance Attribute Details

#agencia_com_dvObject

VALORES ENCONTRADOS NO SEGMENTO T #############################

AGÊNCIA



11
12
13
# File 'lib/br_boleto/retorno/pagamento.rb', line 11

def agencia_com_dv
  @agencia_com_dv
end

#agencia_recebedora_com_dvObject

AGÊNCIA(com dv) DO BANCO RECEBEDOR DO TÚTULO Tamanho Posição

6        100-105


85
86
87
# File 'lib/br_boleto/retorno/pagamento.rb', line 85

def agencia_recebedora_com_dv
  @agencia_recebedora_com_dv
end

#agencia_sem_dvObject

tamanho = 5



12
13
14
# File 'lib/br_boleto/retorno/pagamento.rb', line 12

def agencia_sem_dv
  @agencia_sem_dv
end

#banco_recebedorObject

CÓDIGO DO BANCO RECEBEDOR DO TÚTULO Tamanho Posição

3        97-99


80
81
82
# File 'lib/br_boleto/retorno/pagamento.rb', line 80

def banco_recebedor
  @banco_recebedor
end

#carteiraObject

CARTEIRA DE COBRANÇA



53
54
55
# File 'lib/br_boleto/retorno/pagamento.rb', line 53

def carteira
  @carteira
end

#cnabObject

Codigo identificação CNAB



23
24
25
# File 'lib/br_boleto/retorno/pagamento.rb', line 23

def cnab
  @cnab
end

#cod_carteiraObject

CÓDIGO DA CARTEIRA (TIPO DE COBRANÇA)



56
57
58
# File 'lib/br_boleto/retorno/pagamento.rb', line 56

def cod_carteira
  @cod_carteira
end

#codigo_moedaObject

CÓDIGO DA MOEDA Tamanho Posição

2        131-132


95
96
97
# File 'lib/br_boleto/retorno/pagamento.rb', line 95

def codigo_moeda
  @codigo_moeda
end

#codigo_movimento_retornoObject

CÓDIGO DE MOVIMENTO RETORNO Tamanho Posição

2         16-17


28
29
30
# File 'lib/br_boleto/retorno/pagamento.rb', line 28

def codigo_movimento_retorno
  @codigo_movimento_retorno
end

#codigo_ocorrencia_banco_correspondenteObject

CÓDIGO DA OCORRÊNCIA DO BANCO CORRESPONDETNTE Tamanho Posição

3        211-213


253
254
255
# File 'lib/br_boleto/retorno/pagamento.rb', line 253

def codigo_ocorrencia_banco_correspondente
  @codigo_ocorrencia_banco_correspondente
end

#codigo_ocorrencia_sacadoObject

CÓDIGO DA OCORRÊNCIA DO SACADO Tamanho Posição

4        154-157


233
234
235
# File 'lib/br_boleto/retorno/pagamento.rb', line 233

def codigo_ocorrencia_sacado
  @codigo_ocorrencia_sacado
end

#codigo_pagador_associadoObject

Código do pagador junto ao associado

Tamanho    Posição
  05       020-024


175
176
177
# File 'lib/br_boleto/retorno/pagamento.rb', line 175

def codigo_pagador_associado
  @codigo_pagador_associado
end

#codigo_pagador_cooperativaObject

Código do pagador na cooperativa do beneficiário

Tamanho    Posição
  05       015-019


170
171
172
# File 'lib/br_boleto/retorno/pagamento.rb', line 170

def codigo_pagador_cooperativa
  @codigo_pagador_cooperativa
end

#complemento_ocorrencia_sacadoObject

COMPLEMENTO DA OCORRÊNCIA DO SACADO Tamanho Posição

30        181-210


248
249
250
# File 'lib/br_boleto/retorno/pagamento.rb', line 248

def complemento_ocorrencia_sacado
  @complemento_ocorrencia_sacado
end

#data_creditoObject

DATA DA EFETIVAÇÃO DO CRÉDITO Tamanho Posição

8        146-153


228
229
230
# File 'lib/br_boleto/retorno/pagamento.rb', line 228

def data_credito
  @data_credito
end

#data_ocorrenciaObject

DATA OCORRÊNCIA Tamanho Posição

8        138-145


223
224
225
# File 'lib/br_boleto/retorno/pagamento.rb', line 223

def data_ocorrencia
  @data_ocorrencia
end

#data_ocorrencia_sacadoObject

DATA DA OCORRÊNCIA DO SACADO Tamanho Posição

8        158-165


238
239
240
# File 'lib/br_boleto/retorno/pagamento.rb', line 238

def data_ocorrencia_sacado
  @data_ocorrencia_sacado
end

#data_vencimentoObject

DATA DE VENCIMENTO Tamanho Posição

8        74-81


70
71
72
# File 'lib/br_boleto/retorno/pagamento.rb', line 70

def data_vencimento
  @data_vencimento
end

#dv_conta_e_agenciaObject

IDENTIFICAÇÃO DO TÍTULO Tamanho Posição

1         37-37


37
38
39
# File 'lib/br_boleto/retorno/pagamento.rb', line 37

def dv_conta_e_agencia
  @dv_conta_e_agencia
end

#especie_tituloObject

Prefixo do Título: Informa Espécie do Título



269
270
271
# File 'lib/br_boleto/retorno/pagamento.rb', line 269

def especie_titulo
  @especie_titulo
end

#identificacao_titulo_empresaObject

IDENTIFICAÇÃO/DESCRIÇÃO DO TÍTULO DA EMPRESA Tamanho Posição

25        106-130


90
91
92
# File 'lib/br_boleto/retorno/pagamento.rb', line 90

def identificacao_titulo_empresa
  @identificacao_titulo_empresa
end

#modalidadeObject

MODALIDADE O Padrão da FEBRABAN não prevê este valor, porém na maioria dos bancos este valor está incluso junto com a posição do nosso_numero É implementado apenas para os bancos que não conseguem seguir um padrão estabelecido



264
265
266
# File 'lib/br_boleto/retorno/pagamento.rb', line 264

def modalidade
  @modalidade
end

#motivo_ocorrencia_original_1Object

IDENTIFICAÇÃO PARA REJEIÇÕES, TARIFAS, CUSTOS, LIQUIDAÇÃO E BAIXAS Tamanho Posição

10       214-223


136
137
138
# File 'lib/br_boleto/retorno/pagamento.rb', line 136

def motivo_ocorrencia_original_1
  @motivo_ocorrencia_original_1
end

#motivo_ocorrencia_original_2Object

Returns the value of attribute motivo_ocorrencia_original_2.



141
142
143
# File 'lib/br_boleto/retorno/pagamento.rb', line 141

def motivo_ocorrencia_original_2
  @motivo_ocorrencia_original_2
end

#motivo_ocorrencia_original_3Object

Returns the value of attribute motivo_ocorrencia_original_3.



146
147
148
# File 'lib/br_boleto/retorno/pagamento.rb', line 146

def motivo_ocorrencia_original_3
  @motivo_ocorrencia_original_3
end

#motivo_ocorrencia_original_4Object

Returns the value of attribute motivo_ocorrencia_original_4.



151
152
153
# File 'lib/br_boleto/retorno/pagamento.rb', line 151

def motivo_ocorrencia_original_4
  @motivo_ocorrencia_original_4
end

#motivo_ocorrencia_original_5Object

Returns the value of attribute motivo_ocorrencia_original_5.



156
157
158
# File 'lib/br_boleto/retorno/pagamento.rb', line 156

def motivo_ocorrencia_original_5
  @motivo_ocorrencia_original_5
end

#nosso_numero_banco_correspondenteObject

CÓDIGO DA OCORRÊNCIA DO BANCO CORRESPONDETNTE Tamanho Posição

3        211-213


258
259
260
# File 'lib/br_boleto/retorno/pagamento.rb', line 258

def nosso_numero_banco_correspondente
  @nosso_numero_banco_correspondente
end

#nosso_numero_dvObject

DÍGITO VERIFICADOR NOSSO NÚMERO



45
46
47
# File 'lib/br_boleto/retorno/pagamento.rb', line 45

def nosso_numero_dv
  @nosso_numero_dv
end

#nosso_numero_sem_dvObject

IDENTIFICAÇÃO DO TÍTULO Tamanho Posição

20        38-57


42
43
44
# File 'lib/br_boleto/retorno/pagamento.rb', line 42

def nosso_numero_sem_dv
  @nosso_numero_sem_dv
end

#numero_conta_dvObject

tamanho = 1



16
17
18
# File 'lib/br_boleto/retorno/pagamento.rb', line 16

def numero_conta_dv
  @numero_conta_dv
end

#numero_conta_sem_dvObject

NÚMERO DA CONTA CORRENTE/CEDENTE



15
16
17
# File 'lib/br_boleto/retorno/pagamento.rb', line 15

def numero_conta_sem_dv
  @numero_conta_sem_dv
end

#numero_contratoObject

NÚMERO DO CONTRATO DA OPERAÇÃO DE CRÉDITO Tamanho Posição

10       189-198


120
121
122
# File 'lib/br_boleto/retorno/pagamento.rb', line 120

def numero_contrato
  @numero_contrato
end

#numero_documentoObject

NÚMERO DO DOCUMENTO Tamanho Posição

15        59-73


65
66
67
# File 'lib/br_boleto/retorno/pagamento.rb', line 65

def numero_documento
  @numero_documento
end

#parcelaObject

Returns the value of attribute parcela.



266
267
268
# File 'lib/br_boleto/retorno/pagamento.rb', line 266

def parcela
  @parcela
end

#sacado_documentoObject

NÚMEDO DO DOCUMENTO DO SACADO (CPF/CNPJ) Tamanho Posição

15       134-148


110
111
112
# File 'lib/br_boleto/retorno/pagamento.rb', line 110

def sacado_documento
  @sacado_documento
end

#sacado_nomeObject

NOME DO SACADO Tamanho Posição

40       149-188


115
116
117
# File 'lib/br_boleto/retorno/pagamento.rb', line 115

def sacado_nome
  @sacado_nome
end

#sacado_tipo_documentoObject

SACADO TIPO DE INSCRIÇÃO ‘0’ = Isento / Não Informado ‘1’ = CPF ‘2’ = CGC / CNPJ ‘3’ = PIS / PASEP ‘9’ = Outros Tamanho Posição

1        133-133


105
106
107
# File 'lib/br_boleto/retorno/pagamento.rb', line 105

def sacado_tipo_documento
  @sacado_tipo_documento
end

#valor_abatimentoObject

VALOR DO ABATIMENTO CONCEDIDO/CENCELADO Tamanho Posição

15        48-62


193
194
195
# File 'lib/br_boleto/retorno/pagamento.rb', line 193

def valor_abatimento
  @valor_abatimento
end

#valor_descontoObject

VALOR DO DESCONTO Tamanho Posição

15        33-47


188
189
190
# File 'lib/br_boleto/retorno/pagamento.rb', line 188

def valor_desconto
  @valor_desconto
end

#valor_iofObject

VALOR DO IOF Tamanho Posição

15        63-77


198
199
200
# File 'lib/br_boleto/retorno/pagamento.rb', line 198

def valor_iof
  @valor_iof
end

#valor_juros_multaObject

VALORES ENCONTRADOS NO SEGMENTO U #############################

ACRÉSCIMOS COM JUROS E MULTAS Tamanho Posição

15        18-32


183
184
185
# File 'lib/br_boleto/retorno/pagamento.rb', line 183

def valor_juros_multa
  @valor_juros_multa
end

#valor_liquidoObject

VALOR LIQUIDO Tamanho Posição

15        93-107


208
209
210
# File 'lib/br_boleto/retorno/pagamento.rb', line 208

def valor_liquido
  @valor_liquido
end

#valor_multaObject

VALOR DA MULTA PAGA PELO PAGADOR Tamanho Posição

13        280-92


130
131
132
# File 'lib/br_boleto/retorno/pagamento.rb', line 130

def valor_multa
  @valor_multa
end

#valor_ocorrencia_sacadoObject

VALOR DA OCORRÊNCIA DO SACADO Tamanho Posição

15        166-180


243
244
245
# File 'lib/br_boleto/retorno/pagamento.rb', line 243

def valor_ocorrencia_sacado
  @valor_ocorrencia_sacado
end

#valor_outras_despesasObject

VALRO COM outras DESPESAS Tamanho Posição

15        108-122


213
214
215
# File 'lib/br_boleto/retorno/pagamento.rb', line 213

def valor_outras_despesas
  @valor_outras_despesas
end

#valor_outros_creditosObject

VALRO COM outros CRÉDITOS Tamanho Posição

15        123-137


218
219
220
# File 'lib/br_boleto/retorno/pagamento.rb', line 218

def valor_outros_creditos
  @valor_outros_creditos
end

#valor_pagoObject

VALOR PAGO PELO SACADO Tamanho Posição

15        78-92


203
204
205
# File 'lib/br_boleto/retorno/pagamento.rb', line 203

def valor_pago
  @valor_pago
end

#valor_tarifaObject

VALOR DA TARIFA Tamanho Posição

15       199-213


125
126
127
# File 'lib/br_boleto/retorno/pagamento.rb', line 125

def valor_tarifa
  @valor_tarifa
end

#valor_tituloObject

VALRO DO TÍTULO Tamanho Posição

15        82-96


75
76
77
# File 'lib/br_boleto/retorno/pagamento.rb', line 75

def valor_titulo
  @valor_titulo
end

#variacao_carteiraObject

VARIAÇÃO DA CARTEIRA



60
61
62
# File 'lib/br_boleto/retorno/pagamento.rb', line 60

def variacao_carteira
  @variacao_carteira
end

Class Method Details

.formatted_valuesObject



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/br_boleto/retorno/pagamento.rb', line 276

def self.formatted_values
	{
		data_vencimento:         {type: :date},
		data_ocorrencia:         {type: :date},
		data_credito:            {type: :date},
		data_ocorrencia_sacado:  {type: :date},
		valor_titulo:            {type: :float},
		valor_tarifa:            {type: :float},
		valor_juros_multa:       {type: :float},
		valor_desconto:          {type: :float},
		valor_abatimento:        {type: :float},
		valor_iof:               {type: :float},
		valor_pago:              {type: :float},
		valor_liquido:           {type: :float},
		valor_outras_despesas:  {type: :float},
		valor_outros_creditos:  {type: :float},
		valor_ocorrencia_sacado: {type: :float},
	}
end

Instance Method Details

#conta_classObject



322
323
324
# File 'lib/br_boleto/retorno/pagamento.rb', line 322

def conta_class
	@conta_class
end

#conta_class=(value) ⇒ Object



319
320
321
# File 'lib/br_boleto/retorno/pagamento.rb', line 319

def conta_class= value
	@conta_class = value
end

#define_date_attribute(attr_name) ⇒ Object



313
314
315
316
317
# File 'lib/br_boleto/retorno/pagamento.rb', line 313

def define_date_attribute(attr_name)
	define_singleton_method "#{attr_name}=" do |value|
		self.instance_variable_set("@#{attr_name}", BrBoleto::Helper::FormatValue.string_to_date(value) )
	end
end

#define_float_attribute(attr_name) ⇒ Object



307
308
309
310
311
# File 'lib/br_boleto/retorno/pagamento.rb', line 307

def define_float_attribute(attr_name)
	define_singleton_method "#{attr_name}=" do |value|
		self.instance_variable_set("@#{attr_name}", BrBoleto::Helper::FormatValue.string_to_float(value) )
	end
end

#define_formatted_methods!Object



296
297
298
299
300
301
302
303
304
305
# File 'lib/br_boleto/retorno/pagamento.rb', line 296

def define_formatted_methods!
	self.class.formatted_values.each do |attr_name, options|
		case options[:type]
		when :date
			define_date_attribute(attr_name)
		when :float
			define_float_attribute(attr_name)
		end						
	end
end

#motivo_ocorrenciaObject



161
162
163
# File 'lib/br_boleto/retorno/pagamento.rb', line 161

def motivo_ocorrencia
	"#{motivo_ocorrencia_1}#{motivo_ocorrencia_2}#{motivo_ocorrencia_3}#{motivo_ocorrencia_4}#{motivo_ocorrencia_5}"	
end

#motivo_ocorrencia_1Object



137
138
139
# File 'lib/br_boleto/retorno/pagamento.rb', line 137

def motivo_ocorrencia_1
	conta.get_codigo_motivo_ocorrencia motivo_ocorrencia_original_1, codigo_movimento_retorno, cnab
end

#motivo_ocorrencia_2Object



142
143
144
# File 'lib/br_boleto/retorno/pagamento.rb', line 142

def motivo_ocorrencia_2
	conta.get_codigo_motivo_ocorrencia motivo_ocorrencia_original_2, codigo_movimento_retorno, cnab
end

#motivo_ocorrencia_3Object



147
148
149
# File 'lib/br_boleto/retorno/pagamento.rb', line 147

def motivo_ocorrencia_3
	conta.get_codigo_motivo_ocorrencia motivo_ocorrencia_original_3, codigo_movimento_retorno, cnab
end

#motivo_ocorrencia_4Object



152
153
154
# File 'lib/br_boleto/retorno/pagamento.rb', line 152

def motivo_ocorrencia_4
	conta.get_codigo_motivo_ocorrencia motivo_ocorrencia_original_4, codigo_movimento_retorno, cnab
end

#motivo_ocorrencia_5Object



157
158
159
# File 'lib/br_boleto/retorno/pagamento.rb', line 157

def motivo_ocorrencia_5
	conta.get_codigo_motivo_ocorrencia motivo_ocorrencia_original_5, codigo_movimento_retorno, cnab
end

#nosso_numeroObject

IDENTIFICAÇÃO DO TÍTULO (NOSSO NÚMERO)



48
49
50
# File 'lib/br_boleto/retorno/pagamento.rb', line 48

def nosso_numero
	"#{nosso_numero_sem_dv}#{nosso_numero_dv}"
end

#numero_contaObject



18
19
20
# File 'lib/br_boleto/retorno/pagamento.rb', line 18

def numero_conta
	"#{numero_conta_sem_dv}#{numero_conta_dv}" # tamanho = 13
end