cobro_digital 1.4.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb2ab648eaab4bbb8d09d2f9e46af668ef853f110cf44f60ce0f7bd394f6f710
4
- data.tar.gz: 8f837e57f9b81d1321c12c4273886ea9a1ca46287c071ddde9e489d0e57cfd19
3
+ metadata.gz: 1431de1dda40a74f6ab394c4daaf709fcdeb5b1940ed690d910a62ce125d9f35
4
+ data.tar.gz: 1b90b9277bc8c861085c89b13a54970dad3d9af51b1bc4f44549dff0fbc327c4
5
5
  SHA512:
6
- metadata.gz: 7303bc44c0fcb6f13d8f3ad753f77471069b3d787404b6066a8cb1491134b90ef794436b14e8af8959a8bf8f6cb868530b35358204b8987759980d4268540541
7
- data.tar.gz: '05977f4535b8ba420a7e38ea81327ed08b9b9f39f0f808a232cdf71b7937e162659790d82d740b52d2426169adde31fdce892c555652bc836591d435d516e2a2'
6
+ metadata.gz: 66c59e28a25a5b8d5e7a14e0a03421964771cb5a75c6ccceb25d764f1b8e62f73972d94f4384bdd6858e93647de7a27d6323a0d7c6ad820d24c5c5117b5117dc
7
+ data.tar.gz: cc5268206b18a73b26fc08c51e081c6044f2dbd448af1f2bdf043873c982a8dd3b418a622c1b90b92773fb388dcc80a9e0fc139ca6d59d3153e9cc3a19e13ef8
@@ -27,14 +27,15 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_development_dependency "bundler", "~> 1.13"
31
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "bundler", "~> 2.3.4"
31
+ # spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rake", ">= 13.0.6"
32
33
  # spec.add_development_dependency "rspec"
33
34
 
34
- spec.add_runtime_dependency 'savon', '~> 2.4'
35
+ spec.add_runtime_dependency 'savon', '~> 2.12.1'
35
36
 
36
- spec.add_dependency 'nokogiri', '~> 1.6'
37
- spec.add_dependency 'wasabi', '~> 3.2'
38
- spec.add_dependency 'akami', '~> 1.1'
39
- spec.add_dependency 'nori', '~> 2.3'
37
+ spec.add_dependency 'nokogiri', '~> 1.10.10'
38
+ spec.add_dependency 'wasabi', '~> 3.6.1'
39
+ spec.add_dependency 'akami', '~> 1.3.1'
40
+ spec.add_dependency 'nori', '~> 2.6.0'
40
41
  end
@@ -5,18 +5,18 @@ module CobroDigital
5
5
 
6
6
  # md5(microtime(true)*rand())
7
7
  # { 'handshake'=>Digest::MD5.hexdigest(Time.now.to_f.to_s),
8
- # 'metodo_webservice'=>'meta',
9
- # '0' => { 'metodo_webservice' => 'crear_pagador',
8
+ # 'metodo_webservice'=>'meta',
9
+ # '0' => { 'metodo_webservice' => 'crear_pagador',
10
10
  # 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
11
11
  # 'pagador' => { 'Nombre' => 'Juan',
12
12
  # 'Su_identificador' => '1AF8',
13
13
  # 'Unidad' => '201' } },
14
- # '1' => { 'metodo_webservice' => 'crear_pagador',
14
+ # '1' => { 'metodo_webservice' => 'crear_pagador',
15
15
  # 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
16
16
  # 'pagador'=> { 'Nombre'=>'Pedro',
17
17
  # 'Su_identificador'=>'1AG9',
18
18
  # 'Unidad'=>'202' } },
19
- # '2' => { 'metodo_webservice' => 'generar_boleta',
19
+ # '2' => { 'metodo_webservice' => 'generar_boleta',
20
20
  # 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
21
21
  # 'identificador' => 'Su_identificador',
22
22
  # 'buscar' => '1AF8',
@@ -24,7 +24,7 @@ module CobroDigital
24
24
  # 'fechas_vencimiento' => ['20160930'],
25
25
  # 'plantilla' => 'init',
26
26
  # 'concepto' => 'Test I'},
27
- # '3' => { 'metodo_webservice' => 'generar_boleta',
27
+ # '3' => { 'metodo_webservice' => 'generar_boleta',
28
28
  # 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
29
29
  # 'identificador' => 'Su_identificador',
30
30
  # 'buscar' => '1AG9',
@@ -32,10 +32,10 @@ module CobroDigital
32
32
  # 'fechas_vencimiento' => ['20160929'],
33
33
  # 'plantilla' => 'init',
34
34
  # 'concepto' => 'Test II'},
35
- # '4' => { 'metodo_webservice' => 'inhabilitar_boleta',
35
+ # '4' => { 'metodo_webservice' => 'inhabilitar_boleta',
36
36
  # 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
37
37
  # 'nro_boleta' => '4' },
38
- # '5' => { 'metodo_webservice' => 'inhabilitar_boleta',
38
+ # '5' => { 'metodo_webservice' => 'inhabilitar_boleta',
39
39
  # 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
40
40
  # 'nro_boleta' => '65' } }
41
41
 
@@ -68,32 +68,5 @@ module CobroDigital
68
68
  :render => render(objs)
69
69
  )
70
70
  end
71
-
72
- def parse_response
73
- output = response.body[:webservice_cobrodigital_response][:output]
74
-
75
- parsed_response = JSON.parse(output)
76
-
77
- datos = if parsed_response.key?('datos')
78
- parsed_response['datos'].map do |data|
79
- parsed_data = JSON.parse(data)
80
-
81
- local_data = if parsed_data['datos'].present?
82
- JSON.parse(parsed_data['datos'].first) rescue []
83
- else
84
- []
85
- end
86
-
87
- { resultado: (parsed_data['ejecucion_correcta'] == '1'),
88
- log: parsed_data['log'],
89
- datos: local_data }
90
- end
91
- end
92
-
93
- { resultado: (parsed_response['ejecucion_correcta'] == '1'),
94
- log: parsed_response['log'],
95
- datos: datos }
96
- end
97
-
98
71
  end
99
72
  end
@@ -20,20 +20,16 @@ module CobroDigital
20
20
  end
21
21
 
22
22
  def parse_response
23
- parsed_response = JSON.parse(response.body[:webservice_cobrodigital_response][:output])
23
+ output = response.body[:webservice_cobrodigital_response][:output]
24
+ parsed_response = JSON.parse(output)
24
25
 
25
- datos = []
26
+ raw_datos = parsed_response['datos'] || []
26
27
 
27
- if parsed_response['datos'].present?
28
- parsed_response['datos'].each do |data|
29
- _data = data.split("\"")
30
- _data.delete("")
31
- datos << _data
32
- end
33
- end
28
+ datos = raw_datos.map do |row|
29
+ row.is_a?(Array) ? row : (JSON.parse(row) rescue row)
30
+ end.flatten
34
31
 
35
- { resultado: (parsed_response['ejecucion_correcta'] == '1'), log: parsed_response['log'], datos: datos.flatten }
32
+ { resultado: (parsed_response['ejecucion_correcta'] == '1'), log: parsed_response['log'], datos: datos }
36
33
  end
37
-
38
34
  end
39
35
  end
@@ -31,15 +31,5 @@ module CobroDigital
31
31
  :render => render(desde, hasta, filtros)
32
32
  )
33
33
  end
34
-
35
- def parse_response
36
- output = response.body[:webservice_cobrodigital_response][:output]
37
- parsed_response = JSON.parse(output)
38
-
39
- datos = parsed_response['datos'].present? ? (JSON.parse(JSON.parse(output)['datos'].first) rescue []) : []
40
-
41
- { resultado: (parsed_response['ejecucion_correcta'] == '1'), log: parsed_response['log'], datos: datos }
42
- end
43
-
44
34
  end
45
35
  end
@@ -1,3 +1,3 @@
1
1
  module CobroDigital
2
- VERSION = "1.4.1"
2
+ VERSION = "1.7.0"
3
3
  end
data/lib/cobro_digital.rb CHANGED
@@ -14,8 +14,10 @@ module CobroDigital
14
14
  HTTPS = 'https'
15
15
 
16
16
  CLIENTS = [SOAP, HTTPS]
17
- URI = 'https://www.cobrodigital.com:14365/ws3/'
18
- WSDL = 'https://www.cobrodigital.com:14365/ws3/?wsdl'
17
+ URI = ((ENV['ENDPOINT_COBRODIGITAL'] || 'https://cobro.digital:14365') + '/ws3/').freeze
18
+ WSDL = ((ENV['ENDPOINT_COBRODIGITAL'] || 'https://cobro.digital:14365') + '/ws3/?wsdl').freeze
19
+
20
+ TIMEOUT = 300
19
21
 
20
22
  module Https
21
23
  POST = 'Post'
@@ -39,10 +41,17 @@ module CobroDigital
39
41
  end
40
42
 
41
43
  def soap_client(params)
42
- client = Savon.client(wsdl: CobroDigital::WSDL, log_level: :debug, pretty_print_xml: true)
44
+ client = Savon.client(
45
+ wsdl: CobroDigital::WSDL,
46
+ log_level: :debug,
47
+ pretty_print_xml: true,
48
+ open_timeout: CobroDigital::TIMEOUT,
49
+ read_timeout: CobroDigital::TIMEOUT
50
+ )
43
51
  operation = client.operation(:webservice_cobrodigital)
44
52
  request = operation.build(message: { 'parametros_de_entrada' => params.to_json })
45
53
  @request_xml = request.pretty
54
+
46
55
  client.call(:webservice_cobrodigital, message: { 'parametros_de_entrada' => params.to_json })
47
56
  end
48
57
 
@@ -57,7 +66,15 @@ module CobroDigital
57
66
  req = "Net::HTTP::#{http_method}".constantize.new(uri)
58
67
  end
59
68
 
60
- Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == CobroDigital::HTTPS) { |http| http.request(req) }
69
+ Net::HTTP.start(
70
+ uri.hostname,
71
+ uri.port,
72
+ use_ssl: uri.scheme == CobroDigital::HTTPS,
73
+ open_timeout: CobroDigital::TIMEOUT,
74
+ read_timeout: CobroDigital::TIMEOUT
75
+ ) do |http|
76
+ http.request(req)
77
+ end
61
78
  end
62
79
 
63
80
  def call(request)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobro_digital
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - g.edera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-28 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: 2.3.4
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.13'
26
+ version: 2.3.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 13.0.6
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 13.0.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: savon
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.4'
47
+ version: 2.12.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.4'
54
+ version: 2.12.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.6'
61
+ version: 1.10.10
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.6'
68
+ version: 1.10.10
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: wasabi
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.2'
75
+ version: 3.6.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.2'
82
+ version: 3.6.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: akami
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.1'
89
+ version: 1.3.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.1'
96
+ version: 1.3.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: nori
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.3'
103
+ version: 2.6.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.3'
110
+ version: 2.6.0
111
111
  description: Adaptador para el Web Service de CobroDigital
112
112
  email:
113
113
  - gab.edera@gmail.com
@@ -153,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubyforge_project:
157
- rubygems_version: 2.7.6
156
+ rubygems_version: 3.2.3
158
157
  signing_key:
159
158
  specification_version: 4
160
159
  summary: Adaptador CobroDigital