br_boleto 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e64f77a51c6ebe687f02db490d0ff132e56e3337
4
- data.tar.gz: 82c1df5cbd10e76284ffd210b3b9fab459401418
3
+ metadata.gz: e251082e45232d8d43cf666641b8db24670b034f
4
+ data.tar.gz: 348d22561d586b904762f0ac3159e53bb7b86512
5
5
  SHA512:
6
- metadata.gz: 78b8d428a19bf09beab79ae85240fad86e2a4398544829b432b1c1101dabce8d9b0ba9cebdbbf9754f7a9561a00e46f20e5587c63afc681befa2232b2a4d9f8d
7
- data.tar.gz: 3dc8627e035198d9154af01a70d1b40a0dc54c7cc7f893dcf698f727470e78215e519fa8fa59790f3693b2877f5a454041516f48b85407fbc3be05fd1e57c4dc
6
+ metadata.gz: 2bcfad706412d14bcb9ebffa6acae7a9712616bd9bd2bf78ce32f49694ee47ac1d2c6d45daeeaee37fb29741559a5295645ee61571af4e9e12fdef0a36c8b3ee
7
+ data.tar.gz: 786abed167db7f2ea5beab350cf002b87c4c1b09a1c5ba26000d3fe8910494bd0070ac41d7cfb8426beed89965128b6ebdd318bdc9dfc2e7c7857b99e959adec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_boleto (1.2.0)
4
+ br_boleto (1.2.2)
5
5
  activemodel (~> 4.2)
6
6
  activesupport (~> 4.2)
7
7
  rake (>= 0.8.7)
@@ -15,7 +15,7 @@ module BrBoleto
15
15
  # Cada loop representa um pagamento.
16
16
  #
17
17
  def read_file! #:doc:
18
- File.readlines(file).reject{|l| l =~ /^((?!^.{7}3.{5}[T|U].*$).)*$/}.each_slice(2) do |line|
18
+ File.readlines(file).reject{|l| adjust_encode(l) =~ /^((?!^.{7}3.{5}[T|U].*$).)*$/}.each_slice(2) do |line|
19
19
  instnce_payment(line)
20
20
  end
21
21
  pagamentos
@@ -95,6 +95,14 @@ module BrBoleto
95
95
  }
96
96
  end
97
97
 
98
+ # Resolve problema quando existe algum caractere com acentuação e encode UTF-16
99
+ # converte esse caractere para ? e converte para o encode UTF-8.
100
+ # Fix issue #5
101
+ #
102
+ def adjust_encode(line)
103
+ line.encode!("UTF-16be", invalid: :replace, replace: "?").encode!('UTF-8')
104
+ end
105
+
98
106
  end
99
107
  end
100
108
  end
@@ -2,7 +2,7 @@ module BrBoleto
2
2
  module Version
3
3
  MAJOR = 1 #inclui alterações de API e pode quebrar compatibilidade com versões anteriores
4
4
  MINOR = 2 #inclui novas funcionalidades, sem quebrar APIs existentes
5
- PATCH = 1 #corrige bugs ou traz melhorias em implementações já existentes
5
+ PATCH = 2 #corrige bugs ou traz melhorias em implementações já existentes
6
6
  CURRENT = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -33,7 +33,7 @@ describe BrBoleto::Retorno::Cnab240::Base do
33
33
  pagamento.codigo_moeda.must_equal "09"
34
34
  pagamento.sacado_tipo_documento.must_equal "2"
35
35
  pagamento.sacado_documento.must_equal "111111111111111"
36
- pagamento.sacado_nome.must_equal "NOME DO CLIENTE 1"
36
+ pagamento.sacado_nome.must_equal "NOME DO CLIENTE 1 ??O"
37
37
  pagamento.numero_contrato.must_equal "0000000000"
38
38
  pagamento.valor_tarifa.must_equal 2.69
39
39
  pagamento.motivo_ocorrencia.must_equal "0000000004"
@@ -32,7 +32,7 @@ describe BrBoleto::Retorno::Cnab240::Sicoob do
32
32
  pagamento.codigo_moeda.must_equal "09"
33
33
  pagamento.sacado_tipo_documento.must_equal "2"
34
34
  pagamento.sacado_documento.must_equal "111111111111111"
35
- pagamento.sacado_nome.must_equal "NOME DO CLIENTE 1"
35
+ pagamento.sacado_nome.must_equal "NOME DO CLIENTE 1 ??O"
36
36
  pagamento.numero_contrato.must_equal "0000000000"
37
37
  pagamento.valor_tarifa.must_equal 2.69
38
38
  pagamento.motivo_ocorrencia.must_equal "0000000004"
@@ -1,14 +1,14 @@
1
- 75600000 299999666655555 03069000000007777780NOME DA EMPRESA SACADO LTDA NOME DO BANCO 20905201608511600000108500000
2
- 75600011T01 043 2099999666655555 306900000203069000000007777780NOME DA EMPRESA SACADO LTDA 000000000905201600000000
3
- 7560001300001T 0603069000000007777780000000033001014 100000000000033003052016000000000012939756030690 092111111111111111NOME DO CLIENTE 1 00000000000000000000002690000000004
4
- 7560001300002U 060000000000000000000000000000000000000000000000000000000000000000000000129390000000000129390000000000000000000000000000000205201603052016 00000000000000000000000 75600000000000000000000
5
- 7560001300003T 0603069000000007777780000000034801024 100000000000034806052016000000000002900756030690 092222222222222222NOME DO CLIENTE 2 00000000000000000000002690000000004
6
- 7560001300004U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000505201606052016 00000000000000000000000 30400000000000000000000
7
- 7560001300005T 0603069000000007777780000000035501014 100000000000035506052016000000000008910756030690 092333333333333333NOME DO CLIENTE 3 00000000000000000000002690000000004
8
- 7560001300006U 060000000000000000000000000000000000000000000000000000000000000000000000089100000000000089100000000000000000000000000000000505201606052016 00000000000000000000000 10000000000000000000000
9
- 7560001300007T 0603069000000007777780000000036201014 100000000000036206052016000000000002900104004140 091444444444444444NOME DO CLIENTE 4 00000000000000000000002690000000004
10
- 7560001300008U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000605201600000000 00000000000000000000000 75600000000000000000000
11
- 7560001300009T 0603069000000007777780000000036201014 100000000000036206052016000000000004737104004140 091555555555555555NOME DO CLIENTE 5 00000000000000000000002690000000004
12
- 7560001300010U 060000000000000000000000000000000000000000000000000000000000000000000000047370000000000047370000000000000000000000000000000605201600000000 00000000000000000000000 75600000000000000000000
13
- 75600015 00001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
+ 75600000 299999666655555 03069000000007777780NOME DA EMPRESA SACADO LTDA NOME DO BANCO 20905201608511600000108500000
2
+ 75600011T01 043 2099999666655555 306900000203069000000007777780NOME DA EMPRESA SACADO LTDA 000000000905201600000000
3
+ 7560001300001T 0603069000000007777780000000033001014 100000000000033003052016000000000012939756030690 092111111111111111NOME DO CLIENTE 1 ��O 00000000000000000000002690000000004
4
+ 7560001300002U 060000000000000000000000000000000000000000000000000000000000000000000000129390000000000129390000000000000000000000000000000205201603052016 00000000000000000000000 75600000000000000000000
5
+ 7560001300003T 0603069000000007777780000000034801024 100000000000034806052016000000000002900756030690 092222222222222222NOME DO CLIENTE 2 00000000000000000000002690000000004
6
+ 7560001300004U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000505201606052016 00000000000000000000000 30400000000000000000000
7
+ 7560001300005T 0603069000000007777780000000035501014 100000000000035506052016000000000008910756030690 092333333333333333NOME DO CLIENTE 3 00000000000000000000002690000000004
8
+ 7560001300006U 060000000000000000000000000000000000000000000000000000000000000000000000089100000000000089100000000000000000000000000000000505201606052016 00000000000000000000000 10000000000000000000000
9
+ 7560001300007T 0603069000000007777780000000036201014 100000000000036206052016000000000002900104004140 091444444444444444NOME DO CLIENTE 4 00000000000000000000002690000000004
10
+ 7560001300008U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000605201600000000 00000000000000000000000 75600000000000000000000
11
+ 7560001300009T 0603069000000007777780000000036201014 100000000000036206052016000000000004737104004140 091555555555555555NOME DO CLIENTE 5 00000000000000000000002690000000004
12
+ 7560001300010U 060000000000000000000000000000000000000000000000000000000000000000000000047370000000000047370000000000000000000000000000000605201600000000 00000000000000000000000 75600000000000000000000
13
+ 75600015 00001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
14
14
  75699999 000001000012000000
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: br_boleto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno M. Mergen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-07 00:00:00.000000000 Z
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake