brcobranca 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -2
  4. data/Gemfile.lock +13 -9
  5. data/README.md +5 -1
  6. data/brcobranca.gemspec +2 -0
  7. data/lib/brcobranca/arquivos/logos/sicoob.eps +209 -0
  8. data/lib/brcobranca/boleto/bradesco.rb +20 -0
  9. data/lib/brcobranca/boleto/sicoob.rb +80 -0
  10. data/lib/brcobranca/remessa/base.rb +1 -1
  11. data/lib/brcobranca/remessa/cnab240/banco_brasil.rb +7 -2
  12. data/lib/brcobranca/remessa/cnab240/base.rb +133 -134
  13. data/lib/brcobranca/remessa/cnab240/caixa.rb +6 -1
  14. data/lib/brcobranca/remessa/cnab240/sicoob.rb +128 -0
  15. data/lib/brcobranca/remessa/cnab400/base.rb +5 -5
  16. data/lib/brcobranca/remessa/cnab400/bradesco.rb +5 -3
  17. data/lib/brcobranca/remessa/cnab400/citibank.rb +140 -0
  18. data/lib/brcobranca/remessa/cnab400/itau.rb +4 -11
  19. data/lib/brcobranca/remessa/pagamento.rb +39 -5
  20. data/lib/brcobranca/retorno/base.rb +1 -0
  21. data/lib/brcobranca/retorno/cnab400/base.rb +40 -0
  22. data/lib/brcobranca/retorno/cnab400/bradesco.rb +117 -0
  23. data/lib/brcobranca/retorno/cnab400/itau.rb +136 -0
  24. data/lib/brcobranca/retorno/retorno_cnab400.rb +6 -1
  25. data/lib/brcobranca/util/empresa.rb +29 -0
  26. data/lib/brcobranca/version.rb +1 -1
  27. data/lib/brcobranca.rb +19 -5
  28. data/spec/arquivos/CNAB400BRADESCO.RET +8 -0
  29. data/spec/arquivos/CNAB400ITAU.RET +54 -0
  30. data/spec/brcobranca/base_spec.rb +175 -179
  31. data/spec/brcobranca/{banco_bradesco_spec.rb → boleto/banco_bradesco_spec.rb} +80 -53
  32. data/spec/brcobranca/{banco_brasil_spec.rb → boleto/banco_brasil_spec.rb} +2 -2
  33. data/spec/brcobranca/{banco_caixa_spec.rb → boleto/banco_caixa_spec.rb} +1 -1
  34. data/spec/brcobranca/{banco_hsbc_spec.rb → boleto/banco_hsbc_spec.rb} +2 -2
  35. data/spec/brcobranca/{banco_itau_spec.rb → boleto/banco_itau_spec.rb} +2 -2
  36. data/spec/brcobranca/{banco_santander_spec.rb → boleto/banco_santander_spec.rb} +2 -2
  37. data/spec/brcobranca/boleto/banco_sicoob_spec.rb +132 -0
  38. data/spec/brcobranca/{banco_sicredi_spec.rb → boleto/banco_sicredi_spec.rb} +2 -2
  39. data/spec/brcobranca/boletos_em_lote_spec.rb +2 -2
  40. data/spec/brcobranca/core_ext_spec.rb +198 -199
  41. data/spec/brcobranca/currency_spec.rb +67 -71
  42. data/spec/brcobranca/remessa/base_spec.rb +1 -17
  43. data/spec/brcobranca/remessa/cnab240/banco_brasil_spec.rb +22 -13
  44. data/spec/brcobranca/remessa/cnab240/base_spec.rb +28 -27
  45. data/spec/brcobranca/remessa/cnab240/caixa_spec.rb +13 -4
  46. data/spec/brcobranca/remessa/cnab240/sicoob_spec.rb +155 -0
  47. data/spec/brcobranca/remessa/cnab400/base_spec.rb +1 -17
  48. data/spec/brcobranca/remessa/cnab400/bradesco_spec.rb +15 -2
  49. data/spec/brcobranca/remessa/cnab400/citibank_spec.rb +117 -0
  50. data/spec/brcobranca/remessa/cnab400/itau_spec.rb +15 -10
  51. data/spec/brcobranca/remessa/pagamento_spec.rb +6 -8
  52. data/spec/brcobranca/retorno/cnab400/base_spec.rb +35 -0
  53. data/spec/brcobranca/retorno/cnab400/bradesco_spec.rb +55 -0
  54. data/spec/brcobranca/retorno/cnab400/itau_spec.rb +55 -0
  55. data/spec/brcobranca/{retorno_cbr643_spec.rb → retorno/retorno_cbr643_spec.rb} +3 -3
  56. data/spec/brcobranca/{retorno_cnab400_spec.rb → retorno/retorno_cnab400_spec.rb} +3 -3
  57. data/spec/brcobranca/{retorno_cnab_240_spec.rb → retorno/retorno_cnab_240_spec.rb} +3 -3
  58. data/spec/brcobranca/rghost_spec.rb +2 -2
  59. data/spec/brcobranca/util/empresa_spec.rb +35 -0
  60. data/spec/brcobranca_spec.rb +25 -10
  61. data/spec/fixtures/remessa/.keep +0 -0
  62. data/spec/fixtures/remessa/remessa-bancoob.rem +6 -0
  63. data/spec/spec_helper.rb +23 -0
  64. data/spec/support/remessa_helpers.rb +12 -0
  65. data/spec/{shared_examples → support/shared_examples}/cnab240.rb +17 -15
  66. data/spec/{shared_examples → support/shared_examples}/cnab400.rb +11 -3
  67. metadata +72 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 191577bf1cc0eef88703781e90a0fd8a09a84a3c
4
- data.tar.gz: 14c1e24db904b85354cb45ccbe472e399667dab3
3
+ metadata.gz: f207e4ab5343d33ec1bd49dd3855887684f7e5be
4
+ data.tar.gz: 58b0eb4d58eab09ef07e780a7d514ada237a6b08
5
5
  SHA512:
6
- metadata.gz: ccaf00a578c7470296d4716a7330426d80943dc17bff9844c9f65c9d35ec6297f311bc99a1bb5f8842831f9111636a9fe48f88c083f545d4c377af3a118cafd9
7
- data.tar.gz: d30517c1f8a64a4279009b4c06ee5eaec0e4c26c9d3d2f0bbae5d4511838a1ba079e538354d9cf12875fb20dba20fa398990bf277d6e5647f0e1603a1cdfe8a4
6
+ metadata.gz: c5ef2a9c880d5365a08613a4b58b1102b7b7e56dd5e81885297efa1c9ca9f17347a56593ec882c1945d952008b22ec5302960b74c9068a231ed8bbe245b296fb
7
+ data.tar.gz: 141d9c780794cde4c49d753eb8e0667493642aa10b86e9ab66282c18626aad16d25ad0ddf8f2d352aa3d08f0b8f0f3838bcea8cb94ae7bd25ad0cfa05fa73df0
data/.gitignore CHANGED
@@ -12,6 +12,7 @@ tmtags
12
12
 
13
13
  ## VIM
14
14
  *.swp
15
+ *.orig
15
16
 
16
17
  ## PROJECT::GENERAL
17
18
  coverage
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ end
12
12
  group :test do
13
13
  gem 'codeclimate-test-reporter', require: nil
14
14
  gem 'coveralls', require: false
15
- gem 'rspec', '~> 3.3'
16
- gem 'rake', '~> 10.4'
15
+ gem 'rspec'
16
+ gem 'rake'
17
+ gem 'timecop'
17
18
  end
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brcobranca (5.0.0)
4
+ brcobranca (5.0.1)
5
5
  activemodel (>= 3)
6
6
  parseline (~> 1.0.3)
7
7
  rghost (= 0.9.5)
8
8
  rghost_barcode (~> 0.9)
9
+ unidecoder (>= 1.1.2)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
@@ -20,8 +21,8 @@ GEM
20
21
  thread_safe (~> 0.3, >= 0.3.4)
21
22
  tzinfo (~> 1.1)
22
23
  ast (2.0.0)
23
- astrolabe (1.3.0)
24
- parser (>= 2.2.0.pre.3, < 3.0)
24
+ astrolabe (1.3.1)
25
+ parser (~> 2.2)
25
26
  builder (3.2.2)
26
27
  codeclimate-test-reporter (0.4.7)
27
28
  simplecov (>= 0.7.1, < 1.0.0)
@@ -36,7 +37,7 @@ GEM
36
37
  docile (1.1.5)
37
38
  domain_name (0.5.24)
38
39
  unf (>= 0.0.5, < 1.0.0)
39
- ffi (1.9.10)
40
+ ffi (1.9.10-x86-mingw32)
40
41
  http-cookie (1.0.2)
41
42
  domain_name (~> 0.5)
42
43
  i18n (0.7.0)
@@ -75,12 +76,12 @@ GEM
75
76
  rspec-core (~> 3.3.0)
76
77
  rspec-expectations (~> 3.3.0)
77
78
  rspec-mocks (~> 3.3.0)
78
- rspec-core (3.3.1)
79
+ rspec-core (3.3.2)
79
80
  rspec-support (~> 3.3.0)
80
- rspec-expectations (3.3.0)
81
+ rspec-expectations (3.3.1)
81
82
  diff-lcs (>= 1.2.0, < 2.0)
82
83
  rspec-support (~> 3.3.0)
83
- rspec-mocks (3.3.1)
84
+ rspec-mocks (3.3.2)
84
85
  diff-lcs (>= 1.2.0, < 2.0)
85
86
  rspec-support (~> 3.3.0)
86
87
  rspec-support (3.3.0)
@@ -102,6 +103,7 @@ GEM
102
103
  tins (~> 1.0)
103
104
  thor (0.19.1)
104
105
  thread_safe (0.3.5)
106
+ timecop (0.7.4)
105
107
  tins (1.5.4)
106
108
  tzinfo (1.2.2)
107
109
  thread_safe (~> 0.1)
@@ -109,6 +111,7 @@ GEM
109
111
  unf_ext
110
112
  unf_ext (0.0.7.1)
111
113
  unf_ext (0.0.7.1-x86-mingw32)
114
+ unidecoder (1.1.2)
112
115
  win32console (1.3.2-x86-mingw32)
113
116
 
114
117
  PLATFORMS
@@ -120,10 +123,11 @@ DEPENDENCIES
120
123
  codeclimate-test-reporter
121
124
  coveralls
122
125
  pry (~> 0.10.0)
123
- rake (~> 10.4)
124
- rspec (~> 3.3)
126
+ rake
127
+ rspec
125
128
  rubocop (~> 0.32.1)
126
129
  rubocop-rspec (~> 1.3.0)
130
+ timecop
127
131
 
128
132
  BUNDLED WITH
129
133
  1.10.5
data/README.md CHANGED
@@ -4,6 +4,7 @@ Gem para emissão de bloquetos de cobrança para bancos brasileiros.
4
4
  [![Build Status](http://img.shields.io/travis/kivanio/brcobranca.svg)][travis]
5
5
  [![Dependency Status](http://img.shields.io/gemnasium/kivanio/brcobranca.svg)][gemnasium]
6
6
  [![Code Climate](http://img.shields.io/codeclimate/github/kivanio/brcobranca.svg)][codeclimate]
7
+ [![Test Coverage](https://codeclimate.com/github/kivanio/brcobranca/badges/coverage.svg)](https://codeclimate.com/github/kivanio/brcobranca/coverage)
7
8
  [![Coverage Status](https://coveralls.io/repos/kivanio/brcobranca/badge.svg)](https://coveralls.io/r/kivanio/brcobranca)
8
9
 
9
10
  [gem]: https://rubygems.org/gems/brcobranca
@@ -41,6 +42,9 @@ Gem para emissão de bloquetos de cobrança para bancos brasileiros.
41
42
  * Sem registro
42
43
  * Com registro
43
44
 
45
+ * Banco Sicoob
46
+ * Todas as carteiras presentes na documentação
47
+
44
48
  ### Retornos Disponíveis
45
49
 
46
50
  * CBR643
@@ -74,4 +78,4 @@ Caso queira verificar(ou adicionar) alguma documentação, acesse [nosso wiki](h
74
78
  ### Licença
75
79
 
76
80
  * BSD
77
- * Copyleft 2009 [Kivanio Barbosa](http://www.workingwithrails.com/recommendation/new/person/5679-kivanio-pereira-barbosa)
81
+ * Copyleft 2009 [Kivanio Barbosa](http://www.workingwithrails.com/recommendation/new/person/5679-kivanio-pereira-barbosa)
data/brcobranca.gemspec CHANGED
@@ -25,4 +25,6 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency 'rghost_barcode', '~> 0.9'
26
26
  gem.add_dependency 'parseline', '~> 1.0.3'
27
27
  gem.add_dependency 'activemodel', '>= 3'
28
+
29
+ gem.add_dependency 'unidecoder', '>= 1.1.2'
28
30
  end
@@ -0,0 +1,209 @@
1
+ %!PS-Adobe-3.0 EPSF-3.0
2
+ %%Creator: cairo 1.14.0 (http://cairographics.org)
3
+ %%CreationDate: Fri Jul 17 14:07:27 2015
4
+ %%Pages: 1
5
+ %%DocumentData: Clean7Bit
6
+ %%LanguageLevel: 2
7
+ %%BoundingBox: 0 -1 109 29
8
+ %%EndComments
9
+ %%BeginProlog
10
+ save
11
+ 50 dict begin
12
+ /q { gsave } bind def
13
+ /Q { grestore } bind def
14
+ /cm { 6 array astore concat } bind def
15
+ /w { setlinewidth } bind def
16
+ /J { setlinecap } bind def
17
+ /j { setlinejoin } bind def
18
+ /M { setmiterlimit } bind def
19
+ /d { setdash } bind def
20
+ /m { moveto } bind def
21
+ /l { lineto } bind def
22
+ /c { curveto } bind def
23
+ /h { closepath } bind def
24
+ /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
25
+ 0 exch rlineto 0 rlineto closepath } bind def
26
+ /S { stroke } bind def
27
+ /f { fill } bind def
28
+ /f* { eofill } bind def
29
+ /n { newpath } bind def
30
+ /W { clip } bind def
31
+ /W* { eoclip } bind def
32
+ /BT { } bind def
33
+ /ET { } bind def
34
+ /pdfmark where { pop globaldict /?pdfmark /exec load put }
35
+ { globaldict begin /?pdfmark /pop load def /pdfmark
36
+ /cleartomark load def end } ifelse
37
+ /BDC { mark 3 1 roll /BDC pdfmark } bind def
38
+ /EMC { mark /EMC pdfmark } bind def
39
+ /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
40
+ /Tj { show currentpoint cairo_store_point } bind def
41
+ /TJ {
42
+ {
43
+ dup
44
+ type /stringtype eq
45
+ { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
46
+ } forall
47
+ currentpoint cairo_store_point
48
+ } bind def
49
+ /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
50
+ cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
51
+ /Tf { pop /cairo_font exch def /cairo_font_matrix where
52
+ { pop cairo_selectfont } if } bind def
53
+ /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
54
+ /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
55
+ /cairo_font where { pop cairo_selectfont } if } bind def
56
+ /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
57
+ cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
58
+ /g { setgray } bind def
59
+ /rg { setrgbcolor } bind def
60
+ /d1 { setcachedevice } bind def
61
+ %%EndProlog
62
+ %%BeginSetup
63
+ %%EndSetup
64
+ %%Page: 1 1
65
+ %%BeginPageSetup
66
+ %%PageBoundingBox: 0 -1 109 29
67
+ %%EndPageSetup
68
+ q 0 -1 109 30 rectclip q
69
+ 0.470588 0.717647 0.105882 rg
70
+ 1.371 28.593 m 1.156 28.574 0.941 28.511 0.742 28.398 c 0.27 28.125 0 27.625
71
+ 0 27.109 c 0 26.886 0.055 26.66 0.16 26.445 c 7.477 13.726 l 9.848 17.832
72
+ l 13.711 24.5 l 11.34 28.593 l h
73
+ 1.371 28.593 m f*
74
+ 0 0.631373 0.564706 rg
75
+ 11.34 28.593 m 17.57 17.832 l 22.297 17.832 l 27.273 26.476 l 27.363 26.664
76
+ 27.422 26.882 27.422 27.109 c 27.422 27.898 26.797 28.543 26.016 28.593
77
+ c h
78
+ 11.34 28.593 m f*
79
+ 0.788235 0.823529 0 rg
80
+ 21.949 17.832 m 9.848 17.832 l 7.477 13.726 l 12.488 5.097 l 12.605 4.918
81
+ 12.766 4.761 12.961 4.648 c 13.195 4.515 13.453 4.449 13.707 4.449 c 14.191
82
+ 4.449 14.668 4.695 14.953 5.125 c 22.297 17.832 l h
83
+ 21.949 17.832 m f*
84
+ 0 0.223529 0.254902 rg
85
+ 69.699 24.726 m 69.602 24.726 l 64.699 24.675 61.672 20.957 61.672 16.293
86
+ c 61.672 11.812 64.426 8.05 69.434 8.05 c 69.602 8.05 l 74.48 8.113 77.535
87
+ 11.406 77.535 16.558 c 77.535 20.863 74.898 24.726 69.699 24.726 c h
88
+ 69.652 11.472 m 69.602 11.476 l 67.52 11.476 66.223 13.492 66.246 16.386
89
+ c 66.246 19.191 67.52 21.3 69.602 21.3 c 71.715 21.3 72.957 19.191 72.957
90
+ 16.41 c 72.957 13.488 71.734 11.472 69.652 11.472 c h
91
+ 105.672 17.035 m 105.672 17.082 l 107.566 17.8 108.309 19.121 108.309 20.461
92
+ c 108.309 22.039 107.398 23.191 106.129 23.789 c 105.066 24.32 103.906
93
+ 24.519 102.176 24.57 c 101.863 24.582 101.539 24.582 101.191 24.582 c 99.203
94
+ 24.582 97.07 24.414 96.086 24.226 c 96.086 8.41 l 96.949 8.238 98.387 8.121
95
+ 100.355 8.121 c 101.008 8.121 101.617 8.14 102.176 8.179 c 104.543 8.339
96
+ 106.043 8.824 107.012 9.554 c 108.094 10.371 108.832 11.57 108.832 13.105
97
+ c 108.832 15.023 107.637 16.488 105.672 17.035 c h
98
+ 100.375 21.371 m 100.664 21.421 101.07 21.468 101.789 21.468 c 101.918
99
+ 21.468 102.051 21.461 102.176 21.449 c 103.379 21.355 103.973 20.785 103.973
100
+ 19.933 c 103.973 19.093 103.387 18.511 102.176 18.32 c 101.891 18.281 101.586
101
+ 18.257 101.238 18.257 c 100.375 18.257 l h
102
+ 102.176 11.312 m 101.992 11.293 101.809 11.281 101.625 11.281 c 101.07
103
+ 11.281 100.688 11.281 100.375 11.332 c 100.375 15.187 l 101.402 15.187 l
104
+ 101.676 15.187 101.93 15.175 102.176 15.148 c 103.41 14.992 104.281 14.437
105
+ 104.281 13.296 c 104.281 12.046 103.355 11.445 102.176 11.312 c h
106
+ 94.785 16.558 m 94.785 20.863 92.152 24.726 86.949 24.726 c 86.855 24.726
107
+ l 81.953 24.675 78.926 20.957 78.926 16.293 c 78.926 11.812 81.68 8.05
108
+ 86.691 8.05 c 86.855 8.05 l 91.73 8.113 94.785 11.406 94.785 16.558 c h
109
+ 86.898 11.472 m 86.855 11.476 l 84.773 11.476 83.477 13.488 83.504 16.386
110
+ c 83.504 19.191 84.773 21.3 86.855 21.3 c 88.965 21.3 90.211 19.191 90.211
111
+ 16.41 c 90.211 13.488 88.988 11.472 86.898 11.472 c h
112
+ 60.426 12.121 m 59.75 11.855 58.578 11.668 57.551 11.668 c 54.578 11.668
113
+ 52.832 13.492 52.832 16.41 c 52.832 19.695 54.98 21.156 57.453 21.156 c
114
+ 58.746 21.156 60.082 20.773 60.445 20.578 c 61.211 22.324 61.027 24.699
115
+ 57.262 24.699 c 52.445 24.699 48.277 21.804 48.277 16.125 c 48.277 11.832
116
+ 50.938 8.074 56.977 8.074 c 58.898 8.074 60.426 8.433 61.023 8.746 c h
117
+ 41.875 24.457 m 41.875 23.004 41.875 8.312 41.875 8.312 c 46.211 8.312
118
+ l 46.211 8.312 46.211 21.593 46.211 21.82 c 46.211 23.843 45.109 24.457
119
+ 41.875 24.457 c h
120
+ 35.574 18.086 m 33.535 18.851 32.668 19.164 32.668 19.98 c 32.668 20.695
121
+ 33.395 21.175 34.711 21.175 c 36.316 21.175 37.914 20.578 38.211 20.41
122
+ c 38.82 22.066 39.172 24.699 34.758 24.699 c 30.688 24.699 28.266 22.496
123
+ 28.266 19.64 c 28.266 17.246 30.09 15.761 32.82 14.781 c 34.641 14.156
124
+ 35.355 13.722 35.355 12.933 c 35.355 12.117 34.641 11.617 33.148 11.617
125
+ c 31.523 11.617 29.941 12.117 28.965 12.621 c 28.145 9.054 l 29.055 8.574
126
+ 30.949 8.07 32.891 8.07 c 37.613 8.07 39.766 10.441 39.766 13.222 c 39.766
127
+ 15.472 38.477 17.007 35.574 18.086 c h
128
+ 54.418 4.195 m 53.16 0.07 l 54.125 0.07 l 54.418 1.125 l 55.598 1.125 l
129
+ 55.918 0.07 l 56.926 0.07 l 55.641 4.195 l h
130
+ 54.551 1.824 m 54.797 2.699 l 54.867 2.937 54.926 3.25 54.984 3.492 c 55
131
+ 3.492 l 55.062 3.25 55.137 2.941 55.207 2.699 c 55.465 1.824 l h
132
+ 59.078 2.515 m 58.535 2.714 58.312 2.832 58.312 3.093 c 58.312 3.304 58.508
133
+ 3.492 58.91 3.492 c 59.309 3.492 59.605 3.379 59.766 3.3 c 59.977 4.046
134
+ l 59.73 4.16 59.391 4.254 58.922 4.254 c 57.957 4.254 57.363 3.722 57.363
135
+ 3.015 c 57.363 2.418 57.816 2.035 58.5 1.793 c 58.996 1.621 59.191 1.472
136
+ 59.191 1.214 c 59.191 0.949 58.969 0.769 58.535 0.769 c 58.137 0.769 57.746
137
+ 0.898 57.5 1.027 c 57.312 0.261 l 57.547 0.136 58.012 0.004 58.48 0.004
138
+ c 59.617 0.004 60.141 0.593 60.141 1.285 c 60.141 1.867 59.801 2.246 59.078
139
+ 2.515 c h
140
+ 62.383 2.515 m 61.844 2.714 61.617 2.832 61.617 3.093 c 61.617 3.304 61.812
141
+ 3.492 62.219 3.492 c 62.613 3.492 62.914 3.379 63.066 3.3 c 63.281 4.046
142
+ l 63.031 4.16 62.699 4.254 62.227 4.254 c 61.262 4.254 60.668 3.722 60.668
143
+ 3.015 c 60.668 2.418 61.121 2.035 61.809 1.793 c 62.297 1.621 62.496 1.472
144
+ 62.496 1.214 c 62.496 0.949 62.27 0.769 61.844 0.769 c 61.441 0.769 61.051
145
+ 0.898 60.809 1.027 c 60.617 0.261 l 60.852 0.136 61.316 0.004 61.789 0.004
146
+ c 62.918 0.004 63.445 0.593 63.445 1.285 c 63.445 1.867 63.109 2.246 62.383
147
+ 2.515 c h
148
+ 65.898 4.265 m 64.688 4.265 63.891 3.339 63.891 2.105 c 63.891 0.921 64.613
149
+ -0 65.832 -0 c 67.043 -0 67.859 0.812 67.859 2.171 c 67.859 3.32 67.164
150
+ 4.265 65.898 4.265 c h
151
+ 65.879 0.742 m 65.258 0.742 64.879 1.308 64.879 2.125 c 64.879 2.921 65.242
152
+ 3.527 65.879 3.527 c 66.523 3.527 66.867 2.886 66.867 2.14 c 66.867 1.339
153
+ 66.512 0.742 65.879 0.742 c h
154
+ 70.566 3.488 m 70.91 3.488 71.168 3.414 71.355 3.336 c 71.547 4.07 l 71.383
155
+ 4.16 71.012 4.254 70.535 4.254 c 69.281 4.254 68.277 3.476 68.277 2.066
156
+ c 68.277 0.89 69.012 -0 70.438 -0 c 70.938 -0 71.328 0.097 71.492 0.179
157
+ c 71.359 0.91 l 71.168 0.832 70.863 0.777 70.574 0.777 c 69.75 0.777 69.258
158
+ 1.296 69.258 2.125 c 69.258 3.043 69.832 3.488 70.566 3.488 c h
159
+ 72.117 0.07 m 73.047 0.07 l 73.047 4.195 l 72.117 4.195 l h
160
+ 74.812 4.195 m 73.559 0.07 l 74.523 0.07 l 74.812 1.125 l 76 1.125 l 76.312
161
+ 0.07 l 77.324 0.07 l 76.039 4.195 l h
162
+ 74.949 1.824 m 75.195 2.699 l 75.266 2.937 75.324 3.25 75.383 3.492 c 75.398
163
+ 3.492 l 75.457 3.25 75.535 2.941 75.605 2.699 c 75.863 1.824 l h
164
+ 79.125 4.222 m 78.66 4.222 78.215 4.187 77.867 4.132 c 77.867 0.086 l 78.094
165
+ 0.054 78.445 0.027 78.93 0.027 c 79.738 0.027 80.406 0.195 80.84 0.554
166
+ c 81.23 0.89 81.516 1.437 81.516 2.226 c 81.516 2.957 81.246 3.464 80.82
167
+ 3.781 c 80.43 4.078 79.914 4.222 79.125 4.222 c h
168
+ 79.125 0.75 m 79.016 0.75 78.879 0.75 78.801 0.769 c 78.801 3.472 l 78.879
169
+ 3.488 79.02 3.504 79.219 3.504 c 80.027 3.504 80.535 3.054 80.535 2.195
170
+ c 80.535 1.211 79.973 0.746 79.125 0.75 c h
171
+ 83.945 4.265 m 82.734 4.265 81.934 3.339 81.934 2.105 c 81.934 0.921 82.66
172
+ -0 83.879 -0 c 85.09 -0 85.906 0.812 85.906 2.171 c 85.906 3.32 85.215
173
+ 4.265 83.945 4.265 c h
174
+ 83.926 0.742 m 83.305 0.742 82.922 1.308 82.922 2.125 c 82.922 2.921 83.293
175
+ 3.527 83.926 3.527 c 84.574 3.527 84.922 2.886 84.922 2.14 c 84.922 1.339
176
+ 84.559 0.742 83.926 0.742 c h
177
+ 88.715 4.195 m 87.461 0.07 l 88.422 0.07 l 88.715 1.125 l 89.895 1.125
178
+ l 90.211 0.07 l 91.223 0.07 l 89.938 4.195 l h
179
+ 88.852 1.824 m 89.094 2.699 l 89.16 2.937 89.219 3.25 89.281 3.492 c 89.297
180
+ 3.492 l 89.355 3.25 89.43 2.941 89.5 2.699 c 89.762 1.824 l h
181
+ 94.711 2.429 m 94.57 1.957 94.445 1.468 94.336 0.972 c 94.32 0.972 l 94.223
182
+ 1.484 94.094 1.953 93.953 2.449 c 93.449 4.195 l 92.43 4.195 l 93.75 0.07
183
+ l 94.84 0.07 l 96.23 4.195 l 95.234 4.195 l h
184
+ 98.438 4.265 m 97.227 4.265 96.43 3.339 96.43 2.105 c 96.43 0.921 97.152
185
+ -0 98.371 -0 c 99.586 -0 100.398 0.812 100.398 2.171 c 100.398 3.32 99.703
186
+ 4.265 98.438 4.265 c h
187
+ 98.422 0.742 m 97.797 0.742 97.418 1.308 97.418 2.125 c 97.418 2.921 97.781
188
+ 3.527 98.422 3.527 c 99.062 3.527 99.41 2.886 99.41 2.14 c 99.41 1.339
189
+ 99.047 0.742 98.422 0.742 c h
190
+ 103.105 3.488 m 103.441 3.488 103.707 3.414 103.887 3.336 c 104.086 4.07
191
+ l 103.922 4.16 103.555 4.254 103.07 4.254 c 101.824 4.254 100.816 3.476
192
+ 100.816 2.066 c 100.816 0.89 101.551 -0 102.98 -0 c 103.477 -0 103.867
193
+ 0.097 104.031 0.179 c 103.898 0.91 l 103.707 0.832 103.402 0.777 103.113
194
+ 0.777 c 102.285 0.777 101.801 1.296 101.801 2.125 c 101.801 3.043 102.371
195
+ 3.488 103.105 3.488 c h
196
+ 105.953 4.793 m 106.258 4.414 l 106.914 4.414 l 106.297 5.168 l 105.598
197
+ 5.168 l 104.988 4.414 l 105.633 4.414 l 105.941 4.793 l h
198
+ 105.586 1.812 m 107.102 1.812 l 107.102 2.566 l 105.586 2.566 l 105.586
199
+ 3.429 l 107.199 3.429 l 107.199 4.195 l 104.652 4.195 l 104.652 0.07 l
200
+ 107.281 0.07 l 107.281 0.832 l 105.586 0.832 l h
201
+ 108.32 1.132 m 107.996 1.132 107.773 0.898 107.773 0.562 c 107.773 0.238
202
+ 107.996 -0 108.309 -0 c 108.645 -0 108.863 0.238 108.863 0.562 c 108.859
203
+ 0.906 108.637 1.132 108.32 1.132 c h
204
+ 108.32 1.132 m f*
205
+ Q Q
206
+ showpage
207
+ %%Trailer
208
+ end restore
209
+ %%EOF
@@ -45,6 +45,17 @@ module Brcobranca
45
45
  "#{carteira}/#{numero_documento}-#{nosso_numero_dv}"
46
46
  end
47
47
 
48
+ # Dígito verificador da agência
49
+ # @return [Integer] 1 caracteres numéricos.
50
+ def agencia_dv
51
+ agencia.modulo11(
52
+ multiplicador: [2, 3, 4, 5],
53
+ mapeamento: { 10 => 'P', 11 => 0 }
54
+ ) { |total| 11 - (total % 11) }
55
+ end
56
+
57
+ # Dígito verificador do nosso número
58
+ # @return [Integer] 1 caracteres numéricos.
48
59
  def nosso_numero_dv
49
60
  "#{carteira}#{numero_documento}".modulo11(
50
61
  multiplicador: [2, 3, 4, 5, 6, 7],
@@ -52,6 +63,15 @@ module Brcobranca
52
63
  ) { |total| 11 - (total % 11) }
53
64
  end
54
65
 
66
+ # Dígito verificador da conta corrente
67
+ # @return [Integer] 1 caracteres numéricos.
68
+ def conta_corrente_dv
69
+ conta_corrente.modulo11(
70
+ multiplicador: [2, 3, 4, 5, 6, 7],
71
+ mapeamento: { 10 => 'P', 11 => 0 }
72
+ ) { |total| 11 - (total % 11) }
73
+ end
74
+
55
75
  # Agência + conta corrente do cliente para exibir no boleto.
56
76
  # @return [String]
57
77
  # @example
@@ -0,0 +1,80 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Brcobranca
3
+ module Boleto
4
+ class Sicoob < Base # Sicoob (Bancoob)
5
+ validates_length_of :agencia, maximum: 4, message: "deve ser menor ou igual a 4 dígitos."
6
+ validates_length_of :conta_corrente, maximum: 8, message: "deve ser menor ou igual a 8 dígitos."
7
+ validates_length_of :numero_documento, maximum: 6, message: "deve ser menor ou igual a 6 dígitos."
8
+
9
+ def initialize(campos = {})
10
+ campos = { carteira: "1" }.merge!(campos)
11
+ super(campos)
12
+ end
13
+
14
+ # Codigo do banco emissor (3 dígitos sempre)
15
+ #
16
+ # @return [String] 3 caracteres numéricos.
17
+ def banco
18
+ "756"
19
+ end
20
+
21
+ # Dígito verificador do banco
22
+ #
23
+ # @return [String] 1 caractere.
24
+ def banco_dv
25
+ "0"
26
+ end
27
+
28
+ # Agência
29
+ #
30
+ # @return [String] 4 caracteres numéricos.
31
+ def agencia=(valor)
32
+ @agencia = valor.to_s.rjust(4, "0") if valor
33
+ end
34
+
35
+
36
+ # Convênio
37
+ #
38
+ # @return [String] 7 caracteres numéricos.
39
+ def convenio=(valor)
40
+ @convenio = valor.to_s.rjust(7, "0") if valor
41
+ end
42
+
43
+ # Número documento
44
+ #
45
+ # @return [String] 6 caracteres numéricos.
46
+ def numero_documento=(valor)
47
+ @numero_documento = valor.to_s.rjust(6, "0") if valor
48
+ end
49
+
50
+ # Nosso número para exibição no boleto.
51
+ #
52
+ # @return [String] 8 caracteres numéricos.
53
+ def nosso_numero_boleto
54
+ "#{Date.today.strftime("%y")}#{numero_documento}"
55
+ end
56
+
57
+ # Modalidade de cobrança
58
+ #
59
+ # @return [String] 2 caracteres numéricos.
60
+ def modalidade_cobranca
61
+ "01"
62
+ end
63
+
64
+ # Número da parcela do título
65
+ #
66
+ # @return [String] 3 caracteres numéricos.
67
+ def parcela_titulo
68
+ "001"
69
+ end
70
+
71
+ def agencia_conta_boleto
72
+ "#{agencia} / #{convenio}"
73
+ end
74
+
75
+ def codigo_barras_segunda_parte
76
+ "#{carteira}#{agencia}#{modalidade_cobranca}#{convenio}#{nosso_numero_boleto}#{parcela_titulo}"
77
+ end
78
+ end
79
+ end
80
+ end
@@ -22,7 +22,7 @@ module Brcobranca
22
22
  # Validações do Rails 3
23
23
  include ActiveModel::Validations
24
24
 
25
- validates_presence_of :pagamentos, :empresa_mae, :agencia, :conta_corrente, message: 'não pode estar em branco.'
25
+ validates_presence_of :pagamentos, :empresa_mae, message: 'não pode estar em branco.'
26
26
  validates_length_of :empresa_mae, maximum: 30, message: 'deve ser menor ou igual a 30 caracteres.'
27
27
 
28
28
  validates_each :pagamentos do |record, attr, value|
@@ -11,6 +11,7 @@ module Brcobranca
11
11
  # campo nao tratado pelo sistema do Banco do Brasil
12
12
 
13
13
  validates_presence_of :carteira, :variacao, message: 'não pode estar em branco.'
14
+ validates_presence_of :convenio, message: 'não pode estar em branco.'
14
15
  validates_length_of :conta_corrente, is: 5, message: 'deve ter 5 dígitos.'
15
16
  validates_length_of :agencia, is: 4, message: 'deve ter 4 dígitos.'
16
17
  validates_length_of :carteira, is: 2, message: 'deve ter 2 dígitos.'
@@ -32,8 +33,12 @@ module Brcobranca
32
33
  'BANCO DO BRASIL S.A.'.ljust(30, ' ')
33
34
  end
34
35
 
35
- def versao_layout
36
- '000'
36
+ def versao_layout_arquivo
37
+ '083'
38
+ end
39
+
40
+ def versao_layout_lote
41
+ '042'
37
42
  end
38
43
 
39
44
  def digito_agencia