cnab240_bancoabc 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +17 -0
- data/LICENSE +21 -0
- data/README.md +72 -0
- data/Rakefile +48 -0
- data/lib/cnab240/bancoabc/entities/base.rb +50 -0
- data/lib/cnab240/bancoabc/entities/header.rb +120 -0
- data/lib/cnab240/bancoabc/entities/header_builder.rb +91 -0
- data/lib/cnab240/bancoabc/entities/header_lote_builder.rb +84 -0
- data/lib/cnab240/bancoabc/entities/register_p.rb +183 -0
- data/lib/cnab240/bancoabc/entities/register_q.rb +101 -0
- data/lib/cnab240/bancoabc/entities/register_r.rb +129 -0
- data/lib/cnab240/bancoabc/entities/register_s.rb +73 -0
- data/lib/cnab240/bancoabc/entities/register_t.rb +116 -0
- data/lib/cnab240/bancoabc/entities/register_u.rb +79 -0
- data/lib/cnab240/bancoabc/entities/trailler.rb +54 -0
- data/lib/cnab240/bancoabc/entities/trailler_builder.rb +45 -0
- data/lib/cnab240/bancoabc/entities/trailler_lote_builder.rb +49 -0
- data/lib/cnab240/bancoabc/ocorrencias.rb +68 -0
- data/lib/cnab240/bancoabc/services/parse_line.rb +21 -0
- data/lib/cnab240/bancoabc/version.rb +14 -0
- data/lib/cnab240_bancoabc.rb +25 -0
- data/spec/cnab240/bancoabc/entities/base_spec.rb +93 -0
- data/spec/cnab240/bancoabc/entities/header_spec.rb +64 -0
- data/spec/cnab240/bancoabc/entities/register_p_spec.rb +298 -0
- data/spec/cnab240/bancoabc/entities/register_q_spec.rb +149 -0
- data/spec/cnab240/bancoabc/entities/register_r_spec.rb +191 -0
- data/spec/cnab240/bancoabc/entities/register_t_spec.rb +64 -0
- data/spec/cnab240/bancoabc/entities/register_u_spec.rb +49 -0
- data/spec/cnab240/bancoabc/entities/trailler_builder_spec.rb +60 -0
- data/spec/cnab240/bancoabc/entities/trailler_lote_builder_spec.rb +65 -0
- data/spec/cnab240/bancoabc/entities/trailler_spec.rb +73 -0
- data/spec/cnab240/bancoabc/services/parse_line_spec.rb +37 -0
- data/spec/spec_helper.rb +34 -0
- metadata +223 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5f0409fdc5a38967ab550f437467b55c42f37ab6a33a360552d3f7a35aad1f6f
|
4
|
+
data.tar.gz: b8d07de12a0e04dd3750fe163b91eb19ee6b474ca5211933d4cfa6eb49a01ad9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a64ad2ed9050092d0c9dfb7b946292c75234b201ff07ce41f05b044277cdf017b567c7514ad4dbd81a579c04855ce112bd13af094a7be93b38f727470b6287c8
|
7
|
+
data.tar.gz: dd516db0342b85b4fa41a441ea15caed352a102f77438ac54f0c4d7ab3fe098a5c1697416da6b066884e1d44e15f77ace9c5f9721e45136f48dc8caff68fde72
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## v1.1.0-20220202 - Danilo Carolino
|
4
|
+
|
5
|
+
* [QC-79](https://qflash.atlassian.net/jira/software/projects/QC/boards/31?selectedIssue=QC-79)
|
6
|
+
Reduzir uso de pipelines em projetos Ruby [Dependabot]
|
7
|
+
* Bump Ruby version to v3.1.0
|
8
|
+
|
9
|
+
## v1.0.0
|
10
|
+
|
11
|
+
Features
|
12
|
+
|
13
|
+
* Criar débito de Tarifa para custas de Cartório [PL #11](https://github.com/Quasar-Flash/cnab240_bancoabc/pull/11) [QCedente 1324](https://gitlab.com/quasar_flash/flash/-/issues/1324)
|
14
|
+
|
15
|
+
## v0.1.0
|
16
|
+
|
17
|
+
* Initial files
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 QFlash
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
CNAB240 Banco ABC Library for Ruby
|
2
|
+
==============
|
3
|
+
|
4
|
+
Build Status
|
5
|
+
-----------------
|
6
|
+
|
7
|
+
[![cnab240_bancoabc](https://github.com/Quasar-Flash/cnab240_bancoabc/actions/workflows/ruby.yml/badge.svg)](https://github.com/Quasar-Flash/cnab240_bancoabc/actions/workflows/ruby.yml)
|
8
|
+
[![Quality Gate Status](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=alert_status&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
9
|
+
[![Coverage](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=coverage&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
10
|
+
[![Maintainability Rating](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=sqale_rating&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
11
|
+
|
12
|
+
Project Scores
|
13
|
+
-----------------
|
14
|
+
|
15
|
+
[![Bugs](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=bugs&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
16
|
+
[![Code Smells](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=code_smells&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
17
|
+
[![Duplicated Lines (%)](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=duplicated_lines_density&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
18
|
+
[![Lines of Code](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=ncloc&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
19
|
+
[![Reliability Rating](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=reliability_rating&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
20
|
+
[![Security Rating](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=security_rating&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
21
|
+
[![Technical Debt](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=sqale_index&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
22
|
+
[![Vulnerabilities](https://sonarqube.eks.qflash.com.br/api/project_badges/measure?project=Quasar-Flash_cnab240_bancoabc&metric=vulnerabilities&token=ae764c50c4edff52b7a03d970f68bc697cdc5819)](https://sonarqube.eks.qflash.com.br/dashboard?id=Quasar-Flash_cnab240_bancoabc)
|
23
|
+
|
24
|
+
Requirements
|
25
|
+
-----------------
|
26
|
+
|
27
|
+
- Ruby: Any version (tested: 3.0.1, 2.7.3, 2.6.7, 2.5.9)
|
28
|
+
- Bundler
|
29
|
+
|
30
|
+
Problems?
|
31
|
+
-----------------
|
32
|
+
|
33
|
+
**Please do not directly email any committers with questions or problems.** A community is best served when discussions are held in public.
|
34
|
+
|
35
|
+
Searching the [issues](https://github.com/Quasar-Flash/cnab240_bancoabc/issues) for your problem is also a good idea.
|
36
|
+
|
37
|
+
Contributing
|
38
|
+
-----------------
|
39
|
+
|
40
|
+
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet;
|
41
|
+
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it;
|
42
|
+
- Fork the project;
|
43
|
+
- Start a feature/bugfix branch;
|
44
|
+
- Commit and push until you are happy with your contribution;
|
45
|
+
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.;
|
46
|
+
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
47
|
+
|
48
|
+
License
|
49
|
+
-----------------
|
50
|
+
|
51
|
+
Please see [LICENSE](https://github.com/Quasar-Flash/cnab240_bancoabc/blob/master/LICENSE.txt) for licensing details.
|
52
|
+
|
53
|
+
Maintainers
|
54
|
+
-----------------
|
55
|
+
|
56
|
+
- Cícero Caiazzo, [@caiazzo14](https://github.com/caiazzo14) / [@Quasar-Flash](https://github.com/Quasar-Flash)
|
57
|
+
- Danilo Carolino, [@danilogco](https://github.com/danilogco) / [@Quasar-Flash](https://github.com/Quasar-Flash)
|
58
|
+
|
59
|
+
Run with Docker
|
60
|
+
-----------------
|
61
|
+
|
62
|
+
The commands bellow are used to run this project in a container.
|
63
|
+
They use the Dockerfile at the root of the project and create a volume to update the container with the code changes you make at the outside.
|
64
|
+
|
65
|
+
After every change to the source code you should do a '$rake install' in the container's bash and then you can run a new console or rspec/rubocop.
|
66
|
+
|
67
|
+
```bash
|
68
|
+
# in case you didn't build the image yet
|
69
|
+
docker build -t cnab-gem .
|
70
|
+
# raises the container and keeps it open and running using a never closing foreground job (in this case, 'bash')
|
71
|
+
docker run -it -v $(pwd):/cnab240_bancoabc cnab-gem bash
|
72
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "bundler/setup"
|
6
|
+
rescue LoadError
|
7
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
8
|
+
end
|
9
|
+
|
10
|
+
begin
|
11
|
+
require "rdoc/task"
|
12
|
+
rescue LoadError
|
13
|
+
require "rdoc/rdoc"
|
14
|
+
require "rake/rdoctask"
|
15
|
+
|
16
|
+
RDoc::Task = Rake::RDocTask
|
17
|
+
end
|
18
|
+
|
19
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
20
|
+
rdoc.rdoc_dir = "rdoc"
|
21
|
+
rdoc.title = "cnab240_bancoabc"
|
22
|
+
rdoc.options << "--line-numbers"
|
23
|
+
rdoc.rdoc_files.include("README.rdoc")
|
24
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
25
|
+
end
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
28
|
+
|
29
|
+
begin
|
30
|
+
require "rake/testtask"
|
31
|
+
require "rubocop/rake_task"
|
32
|
+
|
33
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
34
|
+
t.options = ["--display-cop-names"]
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
# no rspec available
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
require "rspec/core/rake_task"
|
42
|
+
|
43
|
+
RSpec::Core::RakeTask.new(:spec)
|
44
|
+
rescue LoadError
|
45
|
+
# no rspec available
|
46
|
+
end
|
47
|
+
|
48
|
+
task default: %i[rubocop spec]
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
module CNAB240
|
4
|
+
module BancoABC
|
5
|
+
module Entities
|
6
|
+
class Base
|
7
|
+
def header?
|
8
|
+
false
|
9
|
+
end
|
10
|
+
|
11
|
+
def trailler?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def register?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def white_space(range)
|
21
|
+
"".center(range.to_i)
|
22
|
+
end
|
23
|
+
|
24
|
+
def prepend_zero(data, range)
|
25
|
+
return white_space(range) if data.nil?
|
26
|
+
|
27
|
+
data = data.to_s
|
28
|
+
|
29
|
+
return data if data.length == range
|
30
|
+
|
31
|
+
zeros_size = range - data.length
|
32
|
+
(1..zeros_size).each { data.prepend("0") }
|
33
|
+
|
34
|
+
data
|
35
|
+
end
|
36
|
+
|
37
|
+
def append_space(data, range)
|
38
|
+
return white_space(range) if data.nil?
|
39
|
+
|
40
|
+
data = data.to_s
|
41
|
+
|
42
|
+
return data if data.length == range
|
43
|
+
return data[0..range - 1] if data.length > range
|
44
|
+
|
45
|
+
data + white_space(range - data.length)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
|
4
|
+
module CNAB240
|
5
|
+
module BancoABC
|
6
|
+
module Entities
|
7
|
+
class Header < Base
|
8
|
+
attr_reader :line
|
9
|
+
|
10
|
+
def initialize(line)
|
11
|
+
@line = line
|
12
|
+
end
|
13
|
+
|
14
|
+
def header?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def data
|
19
|
+
{
|
20
|
+
codigo_do_banco: codigo_do_banco.strip,
|
21
|
+
lote_servico: lote_servico.strip,
|
22
|
+
tipo_servico: tipo_servico.strip,
|
23
|
+
uso_exclusivo_febraban_1: uso_exclusivo_febraban_1.strip,
|
24
|
+
tipo_inscricao_da_empresa: tipo_inscricao_da_empresa.strip,
|
25
|
+
numero_inscricao_da_empresa: numero_inscricao_da_empresa.strip,
|
26
|
+
codigo_identificacao_empresa_banco: codigo_identificacao_empresa_banco.strip,
|
27
|
+
nome_empresa: nome_empresa.strip,
|
28
|
+
nome_banco: nome_banco.strip,
|
29
|
+
uso_exclusivo_febraban_2: uso_exclusivo_febraban_2.strip,
|
30
|
+
codigo_retorno: codigo_retorno.strip,
|
31
|
+
data_geracao: data_geracao.strip,
|
32
|
+
hora_geracao: hora_geracao.strip,
|
33
|
+
numero_sequencial: numero_sequencial.strip,
|
34
|
+
numero_versao_layout: numero_versao_layout.strip,
|
35
|
+
desidade_gravacao_arquivo: desidade_gravacao_arquivo.strip,
|
36
|
+
uso_reservado_banco: uso_reservado_banco.strip,
|
37
|
+
uso_reservado_empresa: uso_reservado_empresa.strip,
|
38
|
+
uso_exclusivo_febraban_3: uso_exclusivo_febraban_3.strip
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def codigo_do_banco
|
43
|
+
line[0..2]
|
44
|
+
end
|
45
|
+
|
46
|
+
def lote_servico
|
47
|
+
line[3..6]
|
48
|
+
end
|
49
|
+
|
50
|
+
def tipo_servico
|
51
|
+
line[7]
|
52
|
+
end
|
53
|
+
|
54
|
+
def uso_exclusivo_febraban_1
|
55
|
+
line[8..16]
|
56
|
+
end
|
57
|
+
|
58
|
+
def tipo_inscricao_da_empresa
|
59
|
+
line[17]
|
60
|
+
end
|
61
|
+
|
62
|
+
def numero_inscricao_da_empresa
|
63
|
+
line[18..31]
|
64
|
+
end
|
65
|
+
|
66
|
+
def codigo_identificacao_empresa_banco
|
67
|
+
line[32..71]
|
68
|
+
end
|
69
|
+
|
70
|
+
def nome_empresa
|
71
|
+
line[72..101]
|
72
|
+
end
|
73
|
+
|
74
|
+
def nome_banco
|
75
|
+
line[102..131]
|
76
|
+
end
|
77
|
+
|
78
|
+
def uso_exclusivo_febraban_2
|
79
|
+
line[132..141]
|
80
|
+
end
|
81
|
+
|
82
|
+
def codigo_retorno
|
83
|
+
line[142]
|
84
|
+
end
|
85
|
+
|
86
|
+
def data_geracao
|
87
|
+
line[143..150]
|
88
|
+
end
|
89
|
+
|
90
|
+
def hora_geracao
|
91
|
+
line[151..156]
|
92
|
+
end
|
93
|
+
|
94
|
+
def numero_sequencial
|
95
|
+
line[157..162]
|
96
|
+
end
|
97
|
+
|
98
|
+
def numero_versao_layout
|
99
|
+
line[163..165]
|
100
|
+
end
|
101
|
+
|
102
|
+
def desidade_gravacao_arquivo
|
103
|
+
line[166..170]
|
104
|
+
end
|
105
|
+
|
106
|
+
def uso_reservado_banco
|
107
|
+
line[171..190]
|
108
|
+
end
|
109
|
+
|
110
|
+
def uso_reservado_empresa
|
111
|
+
line[191..210]
|
112
|
+
end
|
113
|
+
|
114
|
+
def uso_exclusivo_febraban_3
|
115
|
+
line[211..239]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CNAB240
|
4
|
+
module BancoABC
|
5
|
+
module Entities
|
6
|
+
class HeaderBuilder < Base
|
7
|
+
def header?
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
def codigo_do_banco
|
12
|
+
"246"
|
13
|
+
end
|
14
|
+
|
15
|
+
def lote_servico
|
16
|
+
"0" * 4
|
17
|
+
end
|
18
|
+
|
19
|
+
def tipo_servico
|
20
|
+
"0"
|
21
|
+
end
|
22
|
+
|
23
|
+
def uso_exclusivo_febraban_1(data = nil)
|
24
|
+
append_space(data, 9)
|
25
|
+
end
|
26
|
+
|
27
|
+
def tipo_inscricao_da_empresa
|
28
|
+
"2"
|
29
|
+
end
|
30
|
+
|
31
|
+
def numero_inscricao_da_empresa
|
32
|
+
"34218965000177"
|
33
|
+
end
|
34
|
+
|
35
|
+
def codigo_identificacao_empresa_banco
|
36
|
+
"00019070022307900000"
|
37
|
+
end
|
38
|
+
|
39
|
+
def nome_empresa
|
40
|
+
"QUASAR FLASH FI EM DIREITOS CM"
|
41
|
+
end
|
42
|
+
|
43
|
+
def nome_banco
|
44
|
+
"BCO ABC BRASIL#{' ' * 16}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def uso_exclusivo_febraban_2(data = nil)
|
48
|
+
append_space(data, 10)
|
49
|
+
end
|
50
|
+
|
51
|
+
def codigo_retorno
|
52
|
+
"1"
|
53
|
+
end
|
54
|
+
|
55
|
+
def data_geracao(date_time)
|
56
|
+
date_time.strftime("%d%m%Y")
|
57
|
+
end
|
58
|
+
|
59
|
+
def hora_geracao(date_time)
|
60
|
+
date_time.strftime("%H%M%S")
|
61
|
+
end
|
62
|
+
|
63
|
+
def numero_sequencial(date_time)
|
64
|
+
date = date_time.day.to_s + date_time.hour.to_s + date_time.min.to_s
|
65
|
+
|
66
|
+
prepend_zero(date, 6)
|
67
|
+
end
|
68
|
+
|
69
|
+
def numero_versao_layout
|
70
|
+
"040"
|
71
|
+
end
|
72
|
+
|
73
|
+
def desidade_gravacao_arquivo
|
74
|
+
"01600"
|
75
|
+
end
|
76
|
+
|
77
|
+
def uso_reservado_banco(data = nil)
|
78
|
+
append_space(data, 20)
|
79
|
+
end
|
80
|
+
|
81
|
+
def uso_reservado_empresa(data = nil)
|
82
|
+
append_space(data, 20)
|
83
|
+
end
|
84
|
+
|
85
|
+
def uso_exclusivo_febraban_3(data = nil)
|
86
|
+
append_space(data, 29)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
|
4
|
+
module CNAB240
|
5
|
+
module BancoABC
|
6
|
+
module Entities
|
7
|
+
class HeaderLoteBuilder < Base
|
8
|
+
def header?
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
def codigo_do_banco
|
13
|
+
"246"
|
14
|
+
end
|
15
|
+
|
16
|
+
def lote_servico
|
17
|
+
"#{'0' * 3}1"
|
18
|
+
end
|
19
|
+
|
20
|
+
def tipo_registro
|
21
|
+
"1"
|
22
|
+
end
|
23
|
+
|
24
|
+
def tipo_operacao
|
25
|
+
"R"
|
26
|
+
end
|
27
|
+
|
28
|
+
def tipo_servico
|
29
|
+
"01"
|
30
|
+
end
|
31
|
+
|
32
|
+
def uso_exclusivo_cnab_1(data = nil)
|
33
|
+
append_space(data, 2)
|
34
|
+
end
|
35
|
+
|
36
|
+
def numero_versao_layout
|
37
|
+
"030"
|
38
|
+
end
|
39
|
+
|
40
|
+
def uso_exclusivo_cnab_2(data = nil)
|
41
|
+
append_space(data, 1)
|
42
|
+
end
|
43
|
+
|
44
|
+
def tipo_inscricao_empresa
|
45
|
+
"2"
|
46
|
+
end
|
47
|
+
|
48
|
+
def numero_inscricao_empresa
|
49
|
+
"034218965000177"
|
50
|
+
end
|
51
|
+
|
52
|
+
def codigo_identificacao_empresa_banco
|
53
|
+
"00019070022307900000"
|
54
|
+
end
|
55
|
+
|
56
|
+
def nome_empresa
|
57
|
+
"QUASAR FLASH FI EM DIREITOS CM"
|
58
|
+
end
|
59
|
+
|
60
|
+
def mensagem(data = nil)
|
61
|
+
append_space(data, 40)
|
62
|
+
end
|
63
|
+
|
64
|
+
def numero_remessa(date_time)
|
65
|
+
date = date_time.day.to_s.to_s + date_time.month.to_s.to_s + date_time.hour.to_s.to_s + date_time.min.to_s.to_s
|
66
|
+
|
67
|
+
prepend_zero(date, 8)
|
68
|
+
end
|
69
|
+
|
70
|
+
def data_gravacao(date_time)
|
71
|
+
date_time.strftime("%d%m%Y")
|
72
|
+
end
|
73
|
+
|
74
|
+
def data_credito
|
75
|
+
"0" * 8
|
76
|
+
end
|
77
|
+
|
78
|
+
def uso_exclusivo(data = nil)
|
79
|
+
append_space(data, 33)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
module CNAB240
|
4
|
+
module BancoABC
|
5
|
+
module Entities
|
6
|
+
class RegisterP < Base
|
7
|
+
def register?
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
def codigo_banco(data = nil)
|
12
|
+
append_space(data, 3)
|
13
|
+
end
|
14
|
+
|
15
|
+
def lote_servico(data = nil)
|
16
|
+
append_space(data, 4)
|
17
|
+
end
|
18
|
+
|
19
|
+
def tipo_registro(data = nil)
|
20
|
+
append_space(data, 1)
|
21
|
+
end
|
22
|
+
|
23
|
+
def numero_registro(data = nil)
|
24
|
+
prepend_zero(data, 5)
|
25
|
+
end
|
26
|
+
|
27
|
+
def segmento
|
28
|
+
"P"
|
29
|
+
end
|
30
|
+
|
31
|
+
def cnab(data = nil)
|
32
|
+
append_space(data, 1)
|
33
|
+
end
|
34
|
+
|
35
|
+
def codigo_movimento(data = nil)
|
36
|
+
append_space(data, 2)
|
37
|
+
end
|
38
|
+
|
39
|
+
def identificacao_empresa
|
40
|
+
"00019070022307900000"
|
41
|
+
end
|
42
|
+
|
43
|
+
def direcionamento_cobranca(data = nil)
|
44
|
+
append_space(data, 1)
|
45
|
+
end
|
46
|
+
|
47
|
+
def modalidade_cobranca
|
48
|
+
"0" * 3
|
49
|
+
end
|
50
|
+
|
51
|
+
def uso_exclusivo_abc(data = nil)
|
52
|
+
append_space(data, 2)
|
53
|
+
end
|
54
|
+
|
55
|
+
def modalidade_banco_cedente(data = nil)
|
56
|
+
append_space(data, 3)
|
57
|
+
end
|
58
|
+
|
59
|
+
def identificacao_do_titulo(data = nil)
|
60
|
+
append_space(data, 11)
|
61
|
+
end
|
62
|
+
|
63
|
+
def carteira(data = nil)
|
64
|
+
append_space(data, 1)
|
65
|
+
end
|
66
|
+
|
67
|
+
def cadastramento(data = nil)
|
68
|
+
append_space(data, 1)
|
69
|
+
end
|
70
|
+
|
71
|
+
def documento(data = nil)
|
72
|
+
append_space(data, 1)
|
73
|
+
end
|
74
|
+
|
75
|
+
def emissao_boleto(data = nil)
|
76
|
+
append_space(data, 1)
|
77
|
+
end
|
78
|
+
|
79
|
+
def dist_boleto(data = nil)
|
80
|
+
append_space(data, 1)
|
81
|
+
end
|
82
|
+
|
83
|
+
def numero_documento(data = nil)
|
84
|
+
append_space(data, 15)
|
85
|
+
end
|
86
|
+
|
87
|
+
def data_vencimento(data = nil)
|
88
|
+
append_space(data, 8)
|
89
|
+
end
|
90
|
+
|
91
|
+
def valor_titulo(data = nil)
|
92
|
+
prepend_zero(data, 15)
|
93
|
+
end
|
94
|
+
|
95
|
+
def agencia(data = nil)
|
96
|
+
append_space(data, 5)
|
97
|
+
end
|
98
|
+
|
99
|
+
def digito_verificador(data = nil)
|
100
|
+
append_space(data, 1)
|
101
|
+
end
|
102
|
+
|
103
|
+
def especie_titulo(data = nil)
|
104
|
+
append_space(data, 2)
|
105
|
+
end
|
106
|
+
|
107
|
+
def aceite
|
108
|
+
"N"
|
109
|
+
end
|
110
|
+
|
111
|
+
def data_emissao(data = nil)
|
112
|
+
append_space(data, 8)
|
113
|
+
end
|
114
|
+
|
115
|
+
def codigo_juros_mora(data = nil)
|
116
|
+
append_space(data, 1)
|
117
|
+
end
|
118
|
+
|
119
|
+
def data_juros_mora(data = nil)
|
120
|
+
append_space(data, 8)
|
121
|
+
end
|
122
|
+
|
123
|
+
def juros_mora(data = nil)
|
124
|
+
prepend_zero(data, 15)
|
125
|
+
end
|
126
|
+
|
127
|
+
def cod_desconto(data = nil)
|
128
|
+
append_space(data, 1)
|
129
|
+
end
|
130
|
+
|
131
|
+
def data_desconto(data = nil)
|
132
|
+
append_space(data, 8)
|
133
|
+
end
|
134
|
+
|
135
|
+
def valor_desconto(data = nil)
|
136
|
+
prepend_zero(data, 15)
|
137
|
+
end
|
138
|
+
|
139
|
+
def valor_iof(data = nil)
|
140
|
+
prepend_zero(data, 15)
|
141
|
+
end
|
142
|
+
|
143
|
+
def valor_abatimento(data = nil)
|
144
|
+
prepend_zero(data, 15)
|
145
|
+
end
|
146
|
+
|
147
|
+
def uso_empresa_cedente(data = nil)
|
148
|
+
append_space(data, 25)
|
149
|
+
end
|
150
|
+
|
151
|
+
def codigo_protesto(data = nil)
|
152
|
+
append_space(data, 1)
|
153
|
+
end
|
154
|
+
|
155
|
+
def prazo_protesto(data, codigo_protesto = 1)
|
156
|
+
return "00" if codigo_protesto.to_i == 3
|
157
|
+
|
158
|
+
prepend_zero(data, 2)
|
159
|
+
end
|
160
|
+
|
161
|
+
def codigo_baixa_devolucao
|
162
|
+
"2"
|
163
|
+
end
|
164
|
+
|
165
|
+
def prazo_baixa_devolucao
|
166
|
+
"0" * 3
|
167
|
+
end
|
168
|
+
|
169
|
+
def codigo_moeda(data = nil)
|
170
|
+
append_space(data, 2)
|
171
|
+
end
|
172
|
+
|
173
|
+
def numero_contrato(data = nil)
|
174
|
+
append_space(data, 10)
|
175
|
+
end
|
176
|
+
|
177
|
+
def uso_livre(data = nil)
|
178
|
+
append_space(data, 1)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|