Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atualização do Boleto, Remessa/Retorno CNAB400 do banco UNICRED. #215

Merged
merged 8 commits into from
Dec 11, 2021

Conversation

mbcosta
Copy link
Contributor

@mbcosta mbcosta commented Jun 25, 2020

Atualização do Boleto, Remessa/Retorno CNAB400 do banco UNICRED. #214

Trabalho em Andamento

def codigo_barras_segunda_parte
campo_livre = "#{carteira}1#{nosso_numero_codigo_barra}#{agencia_posto_conta}10"
campo_livre = "#{agencia}#{conta_corrente_codigo_barra}#{nosso_numero_codigo_barra}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [92/80]

# 44 – 44 # 01 # DV do campo livre calculado por módulo 11 com aproveitamento total (resto igual a 0 ou 1 DV cai para 0)
# 20 - 23 04 Agência BENEFICIÁRIO(Sem o dígito verificador, completar com zeros à esquerda quando necessário)
# 24 - 33 10 Conta do BENEFICIÁRIO (Com o dígito verificador - Completar com zeros à esquerda quando necessário)
# 34 – 44 11 Nosso Número (Com o dígito verificador)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

# 43 – 43 # 01 # Filler – zeros “0”
# 44 – 44 # 01 # DV do campo livre calculado por módulo 11 com aproveitamento total (resto igual a 0 ou 1 DV cai para 0)
# 20 - 23 04 Agência BENEFICIÁRIO(Sem o dígito verificador, completar com zeros à esquerda quando necessário)
# 24 - 33 10 Conta do BENEFICIÁRIO (Com o dígito verificador - Completar com zeros à esquerda quando necessário)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.
Metrics/LineLength: Line is too long. [129/80]

# 42 – 42 # 01 # Será 1 (um) quando houver valor expresso no campo “valor do documento”
# 43 – 43 # 01 # Filler – zeros “0”
# 44 – 44 # 01 # DV do campo livre calculado por módulo 11 com aproveitamento total (resto igual a 0 ou 1 DV cai para 0)
# 20 - 23 04 Agência BENEFICIÁRIO(Sem o dígito verificador, completar com zeros à esquerda quando necessário)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.
Metrics/LineLength: Line is too long. [126/80]

end

# Dígito verificador do nosso número
# @return [Integer] 1 caracteres numéricos.
def nosso_numero_dv
"#{agencia_posto_conta}#{nosso_numero_with_byte_idt}"
"#{nosso_numero}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/UnneededInterpolation: Prefer to_s over string interpolation.

def conta_corrente=(valor)
@conta_corrente = valor.to_s.rjust(5, '0') if valor
@conta_corrente = valor.to_s.rjust(9, '0') if valor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

# Número da conta corrente
# @return [String] 5 caracteres numéricos.
# @return [String] 9 caracteres numéricos.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

# @return [String] 2 caracteres numéricos.
def posto=(valor)
@posto = valor.to_s.rjust(2, '0') if valor
'136'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

campos = {
carteira: '21',
local_pagamento: 'PAGÁVEL PREFERENCIALMENTE NAS AGÊNCIAS DA UNICRED',
aceite: 'N',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Style/TrailingCommaInHashLiteral: Avoid comma after the last item of a hash.

local_pagamento: 'PAGÁVEL PREFERENCIALMENTE NAS AGÊNCIAS DA UNICRED'
campos = {
carteira: '21',
local_pagamento: 'PAGÁVEL PREFERENCIALMENTE NAS AGÊNCIAS DA UNICRED',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@coveralls
Copy link

coveralls commented Jun 25, 2020

Coverage Status

Coverage decreased (-2.1%) to 97.019% when pulling ed71bf7 on akretion:unicred_cnab400 into 9bb3def on kivanio:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 98.364% when pulling bbcee35 on akretion:unicred_cnab400 into 9bb3def on kivanio:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 98.364% when pulling bbcee35 on akretion:unicred_cnab400 into 9bb3def on kivanio:master.

# completar com zeros a esquerda quando necessario)
# 24 - 33 10 Conta do BENEFICIARIO (Com o dígito verificador -
# Completar com zeros a esquerda quando necessario)
# 34 – 44 11 Nosso Numero (Com o digito verificador)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

# 44 – 44 # 01 # DV do campo livre calculado por módulo 11 com aproveitamento total (resto igual a 0 ou 1 DV cai para 0)
# 20 - 23 04 Agencia BENEFICIARIO(Sem o dígito verificador,
# completar com zeros a esquerda quando necessario)
# 24 - 33 10 Conta do BENEFICIARIO (Com o dígito verificador -
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

# 42 – 42 # 01 # Será 1 (um) quando houver valor expresso no campo “valor do documento”
# 43 – 43 # 01 # Filler – zeros “0”
# 44 – 44 # 01 # DV do campo livre calculado por módulo 11 com aproveitamento total (resto igual a 0 ou 1 DV cai para 0)
# 20 - 23 04 Agencia BENEFICIARIO(Sem o dígito verificador,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

# AGENCIA / CODIGO DO BENEFICIARIO: devera ser preenchido com o codigo da
# agencia, contendo 4 (quatro) caracteres / Conta Corrente com 10 (dez)
# caracteres. Ex. 9999/999999999-9. Obs.: Preencher com zeros à direita
# quando necessário.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

"#{agencia}#{posto}#{convenio}"
# AGENCIA / CODIGO DO BENEFICIARIO: devera ser preenchido com o codigo da
# agencia, contendo 4 (quatro) caracteres / Conta Corrente com 10 (dez)
# caracteres. Ex. 9999/999999999-9. Obs.: Preencher com zeros à direita
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

especie_documento: 'DM',
local_pagamento: 'PAGÁVEL PREFERENCIALMENTE NAS AGÊNCIAS DA UNICRED'
campos = {
carteira: '21',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

# validates_length_of :conta_corrente, maximum: 5, message: 'deve ser menor ou igual a 5 dígitos.'
# Carteira com 2(dois) caracteres ( SEMPRE 21 )
validates_length_of :carteira, maximum: 2, message: 'deve ser menor ou igual a 2 dígitos.'
validates_length_of :convenio, maximum: 10, message: 'deve ser menor ou igual a 10 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [98/80]

validates_length_of :nosso_numero, maximum: 10, message: 'deve ser menor ou igual a 10 dígitos.'
# validates_length_of :conta_corrente, maximum: 5, message: 'deve ser menor ou igual a 5 dígitos.'
# Carteira com 2(dois) caracteres ( SEMPRE 21 )
validates_length_of :carteira, maximum: 2, message: 'deve ser menor ou igual a 2 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [96/80]

validates_length_of :byte_idt, is: 1, message: 'deve ser 1 se o numero foi gerado pela agencia ou 2-9 se foi gerado pelo beneficiário'
validates_length_of :convenio, maximum: 5, message: 'deve ser menor ou igual a 5 dígitos.'
validates_length_of :nosso_numero, maximum: 10, message: 'deve ser menor ou igual a 10 dígitos.'
# validates_length_of :conta_corrente, maximum: 5, message: 'deve ser menor ou igual a 5 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [104/80]
Style/AsciiComments: Use only ascii symbols in comments.

validates_length_of :posto, maximum: 2, message: 'deve ser menor ou igual a 2 dígitos.'
validates_length_of :byte_idt, is: 1, message: 'deve ser 1 se o numero foi gerado pela agencia ou 2-9 se foi gerado pelo beneficiário'
validates_length_of :convenio, maximum: 5, message: 'deve ser menor ou igual a 5 dígitos.'
validates_length_of :nosso_numero, maximum: 10, message: 'deve ser menor ou igual a 10 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [102/80]

# completar com zeros a esquerda quando necessario
# 24 - 33 10 Conta do BENEFICIARIO Com o digito verificador -
# Completar com zeros a esquerda quando necessario
# 34 – 44 11 Nosso Numero Com o digito verificador
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

campos = {
carteira: "21",
local_pagamento: "PAGÁVEL PREFERENCIALMENTE NAS AGÊNCIAS DA UNICRED",
aceite: "N",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/TrailingCommaInHashLiteral: Avoid comma after the last item of a hash.

validates_length_of :nosso_numero, maximum: 10, message:
"deve ser menor ou igual a 10 dígitos."
# validates_length_of :conta_corrente, maximum: 5, message:
# 'deve ser menor ou igual a 5 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

@kivanio
Copy link
Owner

kivanio commented Jun 28, 2020

@mbcosta Show! Quando finalizar, avisa que faço o merge.

detalhe

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body end.

detalhe << pagamento.cidade_sacado.format_size(20) # cidade do pagador X[15] 335 a 354
detalhe << pagamento.uf_sacado # uf do pagador X[02] 355 a 356
detalhe << pagamento.nome_avalista.format_size(38) # nome do sacador/avalista X[38] 357 a 394
detalhe << sequencial.to_s.rjust(6, '0') # numero do registro no arquivo 9[06] 395 a 400
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [118/80]

detalhe << pagamento.cep_sacado # cep do pagador 9[08] 327 a 334
detalhe << pagamento.cidade_sacado.format_size(20) # cidade do pagador X[15] 335 a 354
detalhe << pagamento.uf_sacado # uf do pagador X[02] 355 a 356
detalhe << pagamento.nome_avalista.format_size(38) # nome do sacador/avalista X[38] 357 a 394
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [110/80]

detalhe << pagamento.bairro_sacado.format_size(12) # bairro do pagador X[12] 315 a 326
detalhe << pagamento.cep_sacado # cep do pagador 9[08] 327 a 334
detalhe << pagamento.cidade_sacado.format_size(20) # cidade do pagador X[15] 335 a 354
detalhe << pagamento.uf_sacado # uf do pagador X[02] 355 a 356
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [100/80]

detalhe << pagamento.endereco_sacado.format_size(40) # endereco do pagador X[40] 275 a 314
detalhe << pagamento.bairro_sacado.format_size(12) # bairro do pagador X[12] 315 a 326
detalhe << pagamento.cep_sacado # cep do pagador 9[08] 327 a 334
detalhe << pagamento.cidade_sacado.format_size(20) # cidade do pagador X[15] 335 a 354
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [103/80]

detalhe << pagamento.formata_valor_desconto # valor do desconto 9[13] 180 a 192
detalhe << formata_nosso_numero(pagamento.nosso_numero) # nosso numero X[11] 193 a 203
detalhe << "00" # Zeros 9[2] 204 a 205
detalhe << pagamento.formata_valor_abatimento(13) # valor do abatimento 9[13] 206 a 218
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [106/80]

detalhe << pagamento.formata_data_desconto # data limite para desconto 9[06] 174 a 179
detalhe << pagamento.formata_valor_desconto # valor do desconto 9[13] 180 a 192
detalhe << formata_nosso_numero(pagamento.nosso_numero) # nosso numero X[11] 193 a 203
detalhe << "00" # Zeros 9[2] 204 a 205
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [90/80]

detalhe << pagamento.formata_valor_mora(13) # valor mora ao dia 9[13] 161 a 173
detalhe << pagamento.formata_data_desconto # data limite para desconto 9[06] 174 a 179
detalhe << pagamento.formata_valor_desconto # valor do desconto 9[13] 180 a 192
detalhe << formata_nosso_numero(pagamento.nosso_numero) # nosso numero X[11] 193 a 203
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [98/80]

detalhe << pagamento.dias_protesto.rjust(2, '0') # numero de dias para protesto 9[02] 159 a 160
detalhe << pagamento.formata_valor_mora(13) # valor mora ao dia 9[13] 161 a 173
detalhe << pagamento.formata_data_desconto # data limite para desconto 9[06] 174 a 179
detalhe << pagamento.formata_valor_desconto # valor do desconto 9[13] 180 a 192
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [103/80]

detalhe << pagamento.codigo_protesto # Codigo para Protesto 9[1] 158 a 158
detalhe << pagamento.dias_protesto.rjust(2, '0') # numero de dias para protesto 9[02] 159 a 160
detalhe << pagamento.formata_valor_mora(13) # valor mora ao dia 9[13] 161 a 173
detalhe << pagamento.formata_data_desconto # data limite para desconto 9[06] 174 a 179
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [111/80]

# :Tipo de Instrucao de Origem 326..327

# :FIXO 328..393 BRANCOS* Este campo deve ser
# desconsiderado. Ele está reservado para melhorias.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.


parse.field :motivo_ocorrencia, 318..319, ->(motivos) do
# :Complemento do Movimento 318..325
parse.field :motivo_ocorrencia, 318..325, ->(motivos) do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/Lambda: Use the lambda method for multiline lambdas.

# :brancos, 292..293
# :motivo_do_codigo_de_ocorrencia, 294..294
# : Valor Liquido, 305..317 Diferença entre: Valor Pago e Valor da
# Tarifa (Valor Pago – Valor da Tarifa)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.


# :brancos, 292..293
# :motivo_do_codigo_de_ocorrencia, 294..294
# : Valor Liquido, 305..317 Diferença entre: Valor Pago e Valor da
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

# :valor_do_iof, 214..226 # valor do iof a ser recolhido (ultimos 2 digitos, virgula decimal assumida)
parse.field :iof, 214..226
# :FIXO 188..226 BRANCOS* Este campo deve ser
# desconsiderado. Ele está reservado para melhorias.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

detalhe << "".rjust(10, '0') # Filler 9[10] 140 a 149
detalhe << pagamento.cod_desconto # Codigo do Desconto 9[1] 150 a 150
detalhe << pagamento.data_emissao.strftime('%d%m%y') # data de emissao 9[06] 151 a 156
detalhe << "0" # Filler 9[01] 157 a 157
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [92/80]

detalhe << pagamento.formata_valor # valor do documento 9[13] 127 a 139
detalhe << "".rjust(10, '0') # Filler 9[10] 140 a 149
detalhe << pagamento.cod_desconto # Codigo do Desconto 9[1] 150 a 150
detalhe << pagamento.data_emissao.strftime('%d%m%y') # data de emissao 9[06] 151 a 156
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [101/80]

detalhe << pagamento.data_vencimento.strftime('%d%m%y') # data do vencimento 9[06] 121 a 126
detalhe << pagamento.formata_valor # valor do documento 9[13] 127 a 139
detalhe << "".rjust(10, '0') # Filler 9[10] 140 a 149
detalhe << pagamento.cod_desconto # Codigo do Desconto 9[1] 150 a 150
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [103/80]

detalhe << pagamento.numero.to_s.rjust(10, '0') # numero do documento X[10] 111 a 120
detalhe << pagamento.data_vencimento.strftime('%d%m%y') # data do vencimento 9[06] 121 a 126
detalhe << pagamento.formata_valor # valor do documento 9[13] 127 a 139
detalhe << "".rjust(10, '0') # Filler 9[10] 140 a 149
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [92/80]

detalhe << pagamento.identificacao_ocorrencia # Identificacao da Ocorrencia 9[2] 109 a 110
detalhe << pagamento.numero.to_s.rjust(10, '0') # numero do documento X[10] 111 a 120
detalhe << pagamento.data_vencimento.strftime('%d%m%y') # data do vencimento 9[06] 121 a 126
detalhe << pagamento.formata_valor # valor do documento 9[13] 127 a 139
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [104/80]

detalhe << " " # Branco 9[1] 107 a 108
detalhe << pagamento.identificacao_ocorrencia # Identificacao da Ocorrencia 9[2] 109 a 110
detalhe << pagamento.numero.to_s.rjust(10, '0') # numero do documento X[10] 111 a 120
detalhe << pagamento.data_vencimento.strftime('%d%m%y') # data do vencimento 9[06] 121 a 126
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [104/80]

detalhe << "N" # Identificacao de Titulo Descontavel 9[1] 106 a 106
detalhe << " " # Branco 9[1] 107 a 108
detalhe << pagamento.identificacao_ocorrencia # Identificacao da Ocorrencia 9[2] 109 a 110
detalhe << pagamento.numero.to_s.rjust(10, '0') # numero do documento X[10] 111 a 120
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [106/80]

detalhe << pagamento.tipo_mora # Tipo de Valor Mora 9[1] 105 a 105
detalhe << "N" # Identificacao de Titulo Descontavel 9[1] 106 a 106
detalhe << " " # Branco 9[1] 107 a 108
detalhe << pagamento.identificacao_ocorrencia # Identificacao da Ocorrencia 9[2] 109 a 110
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [112/80]

detalhe << pagamento.formata_percentual_multa(10) # Valor/Percentual da Multa 9[1] 095 a 104
detalhe << pagamento.tipo_mora # Tipo de Valor Mora 9[1] 105 a 105
detalhe << "N" # Identificacao de Titulo Descontavel 9[1] 106 a 106
detalhe << " " # Branco 9[1] 107 a 108
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [91/80]

detalhe << pagamento.codigo_multa # Codigo da multa 9[1] 094 a 094
detalhe << pagamento.formata_percentual_multa(10) # Valor/Percentual da Multa 9[1] 095 a 104
detalhe << pagamento.tipo_mora # Tipo de Valor Mora 9[1] 105 a 105
detalhe << "N" # Identificacao de Titulo Descontavel 9[1] 106 a 106
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [120/80]

detalhe << carteira.rjust(3, "0") # Codigo da Carteira 9[3] 022 a 024
detalhe << "".rjust(13, "0") # Zeros 9[13] 025 a 037
detalhe << "".rjust(25, " ") # No Controle do Participante Uso da empresa 9[25] 038 a 062
detalhe << cod_banco # Codigo do Banco na Camara de Compensacao 9[3] 063 a 065
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [125/80]

detalhe << "0" # Zero 9[1] 021 a 021
detalhe << carteira.rjust(3, "0") # Codigo da Carteira 9[3] 022 a 024
detalhe << "".rjust(13, "0") # Zeros 9[13] 025 a 037
detalhe << "".rjust(25, " ") # No Controle do Participante Uso da empresa 9[25] 038 a 062
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [128/80]

detalhe << digito_conta # Digito da Conta 9[1] 020 a 020
detalhe << "0" # Zero 9[1] 021 a 021
detalhe << carteira.rjust(3, "0") # Codigo da Carteira 9[3] 022 a 024
detalhe << "".rjust(13, "0") # Zeros 9[13] 025 a 037
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [91/80]

detalhe << conta_corrente.rjust(12, "0") # Conta Corrente 9[12] 008 a 019
detalhe << digito_conta # Digito da Conta 9[1] 020 a 020
detalhe << "0" # Zero 9[1] 021 a 021
detalhe << carteira.rjust(3, "0") # Codigo da Carteira 9[3] 022 a 024
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [103/80]

detalhe << digito_agencia # Digito da Agência 9[01] 007 a 007
detalhe << conta_corrente.rjust(12, "0") # Conta Corrente 9[12] 008 a 019
detalhe << digito_conta # Digito da Conta 9[1] 020 a 020
detalhe << "0" # Zero 9[1] 021 a 021
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [89/80]

detalhe << pagamento.nome_avalista.format_size(38)
# nome do sacador/avalista X[38] 357 a 394
detalhe << sequencial.to_s.rjust(6, "0")
# numero do registro no arquivo 9[06] 395 a 400
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.uf_sacado
# uf do pagador X[02] 355 a 356
detalhe << pagamento.nome_avalista.format_size(38)
# nome do sacador/avalista X[38] 357 a 394
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.cidade_sacado.format_size(20)
# cidade do pagador X[15] 335 a 354
detalhe << pagamento.uf_sacado
# uf do pagador X[02] 355 a 356
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.cep_sacado
# cep do pagador 9[08] 327 a 334
detalhe << pagamento.cidade_sacado.format_size(20)
# cidade do pagador X[15] 335 a 354
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.bairro_sacado.format_size(12)
# bairro do pagador X[12] 315 a 326
detalhe << pagamento.cep_sacado
# cep do pagador 9[08] 327 a 334
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << formata_nosso_numero(pagamento.nosso_numero)
# nosso numero X[11] 193 a 203
detalhe << "00"
# Zeros 9[2] 204 a 205
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.formata_valor_desconto
# valor do desconto 9[13] 180 a 192
detalhe << formata_nosso_numero(pagamento.nosso_numero)
# nosso numero X[11] 193 a 203
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.formata_data_desconto
# data limite para desconto 9[06] 174 a 179
detalhe << pagamento.formata_valor_desconto
# valor do desconto 9[13] 180 a 192
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.formata_valor_mora(13)
# valor mora ao dia 9[13] 161 a 173
detalhe << pagamento.formata_data_desconto
# data limite para desconto 9[06] 174 a 179
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

detalhe << pagamento.dias_protesto.rjust(2, "0")
# numero de dias para protesto 9[02] 159 a 160
detalhe << pagamento.formata_valor_mora(13)
# valor mora ao dia 9[13] 161 a 173
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/CommentIndentation: Incorrect indentation detected (column 21 instead of 10).

# tipo do registro [1] 0
# operacao [1] 1
# literal remessa [7] REMESSA
# Código do serviço [2] 01
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/AsciiComments: Use only ascii symbols in comments.

#
# @return [String]
#
def complemento
''.rjust(294, ' ')
''.rjust(277, " ")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

"#{nosso_numero_boleto(nosso_numero)}"
end

def codigo_beneficiario=(valor)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/DuplicateMethods: Method Brcobranca::Remessa::Cnab400::Unicred#codigo_beneficiario= is defined at both lib/brcobranca/remessa/cnab400/unicred.rb:7 and lib/brcobranca/remessa/cnab400/unicred.rb:83.

#
# @return [String]
#
def formata_nosso_numero(nosso_numero)
"#{nosso_numero_boleto(nosso_numero)}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/UnneededInterpolation: Prefer to_s over string interpolation.

# Digito verificador do nosso numero
# @return [Integer] 1 caracteres numericos.
def nosso_numero_dv(nosso_numero)
"#{nosso_numero}".modulo11(mapeamento: mapeamento_para_modulo_11)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/UnneededInterpolation: Prefer to_s over string interpolation.

validates_length_of :documento_cedente, minimum: 11, maximum: 14,
message: 'deve ter entre 11 e 14 dígitos.'
validates_length_of :carteira, maximum: 2,
message: 'deve ter 2 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

validates_length_of :conta_corrente, maximum: 5,
message: 'deve ter 5 dígitos.'
validates_length_of :documento_cedente, minimum: 11, maximum: 14,
message: 'deve ter entre 11 e 14 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

validates_length_of :agencia, maximum: 4,
message: 'deve ter 4 dígitos.'
validates_length_of :conta_corrente, maximum: 5,
message: 'deve ter 5 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

validates_length_of :digito_conta, maximum: 1, message: 'deve ter 1 dígito.'
validates_length_of :codigo_transmissao, maximum: 20, message: 'deve ter 20 dígitos.'
validates_length_of :agencia, maximum: 4,
message: 'deve ter 4 dígitos.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


validates_presence_of :agencia, :conta_corrente, :documento_cedente,
:digito_conta, :codigo_transmissao, message: 'não pode estar em branco.'
:digito_conta, :codigo_beneficiario,
message: 'não pode estar em branco.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -40,7 +38,7 @@

it 'Criar nova instancia com atributos válidos' do
boleto_novo = described_class.new(@valid_attributes)
expect(boleto_novo.banco).to eql('748')
expect(boleto_novo.banco).to eql('136')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

it 'cod_banco deve ser 748' do
expect(unicred.cod_banco).to eq '748'
it 'cod_banco deve ser 136' do
expect(unicred.cod_banco).to eq '136'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -118,8 +117,8 @@
end

context 'formatacoes dos valores' do
it 'cod_banco deve ser 748' do
expect(unicred.cod_banco).to eq '748'
it 'cod_banco deve ser 136' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@mbcosta
Copy link
Contributor Author

mbcosta commented Oct 28, 2021

ola @kivanio o PR está pronto para revisão, os testes aqui estão retornando erros mas gostaria que você confirmasse se é algo que eu alterei, desculpe a demora no retorno acabei deixando funcional mas faltava a atualização dos outros arquivos.

@kivanio
Copy link
Owner

kivanio commented Nov 1, 2021

@mbcosta falta uma configuração no CI.
Rodou na sua máquina todos os testes?

boleto_novo.conta_corrente = '12345'
boleto_novo.nosso_numero = '13871'
boleto_novo.carteira = '3'
boleto_novo.carteira = '21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@valid_attributes[:posto] = '8'
@valid_attributes[:aceite] = 'N'
@valid_attributes[:byte_idt] = '2'
@valid_attributes[:carteira] = '21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

it 'Montar código de barras para carteira número 03' do
it 'Montar código de barras para carteira número 21' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -59,20 +57,17 @@
expect(boleto_novo.agencia).to eql('4042')
expect(boleto_novo.convenio).to eql('12345')
expect(boleto_novo.nosso_numero).to eql('00168')
expect(boleto_novo.carteira).to eql('3')
expect(boleto_novo.carteira).to eql('21')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -35,12 +33,12 @@
expect(boleto_novo.valor).to eq(0.0)
expect(boleto_novo.valor_documento).to eq(0.0)
expect(boleto_novo.local_pagamento).to eql('PAGÁVEL PREFERENCIALMENTE NAS AGÊNCIAS DA UNICRED')
expect(boleto_novo.carteira).to eql('3')
expect(boleto_novo.carteira).to eql('21')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -157,21 +156,21 @@
expect(header[1]).to eq '1' # tipo operacao (1 = remessa)
expect(header[2..8]).to eq 'REMESSA' # literal da operacao
expect(header[26..45]).to eq unicred.info_conta # informacoes da conta
expect(header[76..78]).to eq '748' # codigo do banco
expect(header[76..78]).to eq '136' # codigo do banco
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/ExtraSpacing: Unnecessary spacing detected.

unicred.carteira = '03'
expect(unicred.codigo_carteira).to eq '3'
unicred.carteira = '21'
expect(unicred.codigo_carteira).to eq '21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

it 'deve retornar o codigo da carteira de acordo com o tipo de emissão' do
unicred.carteira = '03'
expect(unicred.codigo_carteira).to eq '3'
unicred.carteira = '21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(info_conta.size).to eq 20
expect(info_conta[0..19]).to eq '12345678901234567890'
expect(info_conta.size).to eq 10
expect(info_conta[0..9]).to eq '1234567890'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -132,15 +131,15 @@
expect(unicred.complemento.size).to eq 294
end

it 'info_conta deve retornar com 20 posicoes as informacoes da conta' do
it 'info_conta deve retornar com 10 posicoes as informacoes da conta' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

boleto_novo.conta_corrente = '12345'
expect(boleto_novo.agencia_conta_boleto).to eql('1234.18.12345')
expect(boleto_novo.agencia_conta_boleto).to eql('1234 / 000012345-5')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(boleto_novo.nosso_numero_boleto).to eql('12/213871-5')
expect(boleto_novo.nosso_numero_dv).to be(5)
boleto_novo.carteira = '21'
expect(boleto_novo.nosso_numero_boleto).to eql('0000013871-1')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

boleto_novo = described_class.new(@valid_attributes)

expect(boleto_novo.codigo_barras.linha_digitavel).to eql('74893.11220 13871.212349 08123.451018 3 52220000295295')
expect(boleto_novo.codigo_barras.linha_digitavel).to eql('13691.23409 00012.345500 00001.387117 1 52220000295295')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [118/80]

expect(boleto_novo.especie_documento).to eql('DM')
expect(boleto_novo.especie).to eql('R$')
expect(boleto_novo.moeda).to eql('9')
expect(boleto_novo.data_processamento).to eql(Date.parse('2012-01-18'))
expect(boleto_novo.data_vencimento).to eql(Date.current)
expect(boleto_novo.aceite).to eql('S')
expect(boleto_novo.aceite).to eql('N')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(boleto_novo.especie_documento).to eql('DM')
expect(boleto_novo.especie).to eql('R$')
expect(boleto_novo.moeda).to eql('9')
expect(boleto_novo.data_processamento).to eql(Date.current)
expect(boleto_novo.data_vencimento).to eql(Date.current)
expect(boleto_novo.aceite).to eql('S')
expect(boleto_novo.aceite).to eql('N')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

uf_sacado: 'SP')
end
let(:params) do
{
carteira: '03',
carteira: '21',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

cep_sacado: '12345678',
cidade_sacado: 'Santa rita de cássia maria da silva',
cidade_do_sacado: 'SAO PAULO',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

bairro_sacado: 'São josé dos quatro apostolos magros',
nome_sacado: 'AKRETION LTDA',
endereco_sacado: 'AVENIDA PAULISTA 1',
bairro_sacado: 'CENTRO',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

endereco_sacado: 'RUA RIO GRANDE DO SUL,!^.?\/@ São paulo Minas caçapa da silva junior',
bairro_sacado: 'São josé dos quatro apostolos magros',
nome_sacado: 'AKRETION LTDA',
endereco_sacado: 'AVENIDA PAULISTA 1',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

nome_sacado: 'PABLO DIEGO JOSÉ FRANCISCO,!^.?\/@ DE PAULA JUAN NEPOMUCENO MARÍA DE LOS REMEDIOS CIPRIANO DE LA SANTÍSSIMA TRINIDAD RUIZ Y PICASSO',
endereco_sacado: 'RUA RIO GRANDE DO SUL,!^.?\/@ São paulo Minas caçapa da silva junior',
bairro_sacado: 'São josé dos quatro apostolos magros',
nome_sacado: 'AKRETION LTDA',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(boleto_novo.codigo_barras.linha_digitavel).to eql('74893.11220 13871.212349 08123.451018 3 52220000295295')
expect(boleto_novo.codigo_barras_segunda_parte).to eql('3112213871212340812345101')
expect(boleto_novo.codigo_barras.linha_digitavel).to eql('13691.23409 00012.345500 00001.387117 1 52220000295295')
expect(boleto_novo.codigo_barras_segunda_parte).to eql('1234000012345500000138711')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [87/80]

@@ -55,28 +53,25 @@
expect(boleto_novo.documento_cedente).to eql('12345678912')
expect(boleto_novo.sacado).to eql('Claudio Pozzebom')
expect(boleto_novo.sacado_documento).to eql('12345678900')
expect(boleto_novo.conta_corrente).to eql('61900')
expect(boleto_novo.conta_corrente).to eql('000061900')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

nosso_numero: '072000031',
documento: 6969,
nosso_numero: '72000031',
documento: '1/01',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -5,26 +5,25 @@
let(:pagamento) do
Brcobranca::Remessa::Pagamento.new(valor: 199.9,
data_vencimento: Date.current,
nosso_numero: '072000031',
documento: 6969,
nosso_numero: '72000031',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(pagamento.codigo_ocorrencia).to eql('06')
expect(pagamento.data_ocorrencia).to eql('150515')
expect(pagamento.valor_recebido).to eql('0000000044400')
expect(pagamento.data_credito).to eql('150515')
expect(pagamento.motivo_ocorrencia).to eql(['20'])
expect(pagamento.motivo_ocorrencia).to eql(['00'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(pagamento.especie_documento).to eql('01')
expect(pagamento.valor_tarifa).to eql('0000000000160')
expect(pagamento.iof).to eql('0000000000000')
expect(pagamento.valor_tarifa).to eql('0000160')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(pagamento.nosso_numero).to eql('00000116')
expect(pagamento.carteira).to eql('5')
expect(pagamento.cedente_com_dv).to eql('060001566')
expect(pagamento.nosso_numero).to eql('00000000000000116')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(pagamento.cedente_com_dv).to eql('60001566')
expect(pagamento.nosso_numero).to eql('00000116')
expect(pagamento.carteira).to eql('5')
expect(pagamento.cedente_com_dv).to eql('060001566')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

info_conta = unicred.info_conta
expect(info_conta.size).to eq 20
expect(info_conta[0..19]).to eq '12345678901234567890'
expect(info_conta.size).to eq 20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

info_conta = unicred.info_conta
expect(info_conta.size).to eq 20
expect(info_conta[0..19]).to eq '12345678901234567890'
expect(info_conta.size).to eq 20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

expect(boleto_novo.agencia).to eql('4042')
expect(boleto_novo.convenio).to eql('12345')
expect(boleto_novo.nosso_numero).to eql('00168')
expect(boleto_novo.carteira).to eql('3')
expect(boleto_novo.nosso_numero).to eql('0000000168')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(detalhe[62..81]).to eq '072000031'.rjust(20, ' ') # nosso numero
expect(detalhe[2..5]).to eq '1234' # Agencia
expect(detalhe[108..109]).to eq '01' # Instrução
expect(detalhe[110..119]).to eq "0000001/01" # documento
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/ExtraSpacing: Unnecessary spacing detected.
Metrics/LineLength: Line is too long. [81/80]

unicred.carteira = '03'
expect(unicred.codigo_carteira).to eq '3'
unicred.carteira = '21'
expect(unicred.carteira).to eq '21'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

expect(info_conta.size).to eq 20
expect(info_conta[0..19]).to eq '12345678901234567890'
expect(info_conta.size).to eq 20
expect(info_conta[0..19]).to eq '00000000001234567890'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -128,19 +127,19 @@
expect(nome_banco.strip).to eq 'UNICRED'
end

it 'complemento deve retornar 294 caracteres' do
expect(unicred.complemento.size).to eq 294
it 'complemento deve retornar 277 caracteres' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@kivanio kivanio merged commit 2a00a90 into kivanio:master Dec 11, 2021
@mbcosta
Copy link
Contributor Author

mbcosta commented Dec 11, 2021

ola @kivanio , eu estava vendo de corrigir a questão das aspas duplas e os testes, tinha duas alterações que iriam ser feitas:

image

Os testes estavam retornando um erro que eu não estava conseguindo identificar que é um campo que existia codigo_transmissao e passou a ser codigo_beneficiario:

image

Mesmo fazendo um $ grep -rn 'codigo_transmissao' . --color=always para tentar encontrar onde estaria a referencia no caso do UNICRED o comando retorna apenas um campo com esse nome no Santander e não no UNICRED o que eu acabei não entendendo o porque isso estava gerando erro:

image
image

@kivanio
Copy link
Owner

kivanio commented Dec 11, 2021

Se mudou o nome, basta mudar o nome nos testes:
codigo_beneficiario

@mbcosta
Copy link
Contributor Author

mbcosta commented Dec 11, 2021

Certo, o problema é que eu mudei e não encontrei em nenhum arquivo do UNICRED referencia a esse campo apenas no Santander, por isso não entendi o motivo do erro.

@kivanio
Copy link
Owner

kivanio commented Dec 11, 2021

Vi agora que tem vários coisas quebradas, não deveria ter feito o merge 💩
O que eu falei:
ff6d1f7

@mbcosta
Copy link
Contributor Author

mbcosta commented Dec 11, 2021

humm o erro estava nesse arquivo spec/support/shared_examples/cnab400.rb ( preciso entender melhor a forma como os testes rodam ), não sei se vai afetar os testes mas o campo codigo_beneficiario tem limite de 10 caracteres e é preenchido com zeros para ficar com 20 caracteres, no arquivo .rem eu alterei isso mas no commit que você mencionou está codigo_beneficiario: '12345678901234567890'

Caso seja possível e se você quiser ver de reverter esse "merge" posso ver de criar outro PR, ou você apontando o que precisa ser feito posso ver de fazer nos próximos dias.

@kivanio
Copy link
Owner

kivanio commented Dec 13, 2021

@mbcosta Arrumei todos os testes.
Agora quando mandar o PR, já envia com testes!

Comentei os códigos de teste de remessa e retorno do UNICRED,
notei que não está feito esses arquivos, certo?

Arrumei o código do boleto e de testes do UNICRED, esse já ficou OK.

@mbcosta
Copy link
Contributor Author

mbcosta commented Dec 13, 2021

@kivanio sim da minha parte a ideia é ter sempre os PRs com testes passando, infelizmente esse PR acabou ficando em aberto por bastante tempo, alguns do motivos são porque eu não domino o Ruby e durante o mesmo período em paralelo eu precisei implementar o CNAB usando o BRCobranca no projeto de Localização do Odoo no Brasil( https://github.com/OCA/l10n-brazil/tree/12.0/l10n_br_account_payment_brcobranca ), o foco acabou ficando lá e acabei deixando aqui apenas funcional, bom espero que essa integração traga novos colaboradores ao projeto BRCobranca.

Os commits recentes passaram a causar erro #228 e sobre o UNICRED 400 ele esta funcional, esse caso foi homologado junto a uma empresa e parece estar tudo de acordo, aqui no projeto estava pendente apenas atualizar os testes, os arquivos de Remessa https://github.com/kivanio/brcobranca/blob/master/spec/fixtures/remessa/remessa-unicred-cnab400.rem e Retorno https://github.com/kivanio/brcobranca/blob/master/spec/arquivos/CNAB400UNICRED.RET foram atualizados de acordo com a especificação dos arquivos na pasta https://github.com/kivanio/brcobranca/tree/master/docs/unicred, as alterações recentes que foram feitas nesse caso do UNICRED 400 passaram a gerar erro:

image

mrbongiolo pushed a commit to mrbongiolo/brcobranca that referenced this pull request Sep 17, 2022
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
lbarbieri-esl pushed a commit to dnicolau/brcobranca that referenced this pull request Apr 3, 2023
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
lbarbieri-esl pushed a commit to dnicolau/brcobranca that referenced this pull request Apr 13, 2023
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
lbarbieri-esl pushed a commit to dnicolau/brcobranca that referenced this pull request May 10, 2023
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
lbarbieri-esl pushed a commit to dnicolau/brcobranca that referenced this pull request May 30, 2023
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
lbarbieri-esl pushed a commit to dnicolau/brcobranca that referenced this pull request May 30, 2023
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
jhenrique-esl pushed a commit to dnicolau/brcobranca that referenced this pull request May 30, 2023
…anio#215)

* Atualização do Boleto do banco UNICRED.

* Atualização Remessa CNAB400 do Banco UNICRED.

* Atualização Retorno CNAB400 Banco Unicred.

* Removido hardcode do campo carteira na Remessa CNAB 400 Unicred.

* [FIX] Especificações do Repo, aspas duplas e tamanho da linha.

* Atualização dados de teste do UNICRED 400.

* Atualização do README para o UNICRED 400.

* [FIX] Atualização dados de teste do UNICRED 400.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants