cobro_digital 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cobro_digital.gemspec +7 -7
- data/lib/cobro_digital/meta.rb +53 -5
- data/lib/cobro_digital/operador.rb +5 -4
- data/lib/cobro_digital/transaccion.rb +14 -6
- data/lib/cobro_digital/version.rb +1 -1
- data/lib/cobro_digital.rb +6 -2
- metadata +13 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02ddf257503cd550fc4b8a1583475c5f56a3c363
|
4
|
+
data.tar.gz: f577d7d9b881a5282c20a507598eff02af683002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '098cd90720c214cff2cb970244a1c859854bcc778fa0c33235bfcc06c2536a82dfdb0ccd9f484890e4a5c05c9c8e3450da96587c249b4c915404d6660501ab82'
|
7
|
+
data.tar.gz: 204eb5352e5a3d52128b52a47c44e5d81f6000d18d29364f94c764b641c199cf70fee732a25f177a09d1eb104ace611c33411434105f11c5389037c474e2852d
|
data/cobro_digital.gemspec
CHANGED
@@ -27,14 +27,14 @@ 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.
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
31
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_development_dependency "rspec"
|
32
|
+
# spec.add_development_dependency "rspec"
|
33
33
|
|
34
|
-
spec.add_runtime_dependency
|
34
|
+
spec.add_runtime_dependency 'savon', '~> 2.4'
|
35
35
|
|
36
|
-
spec.add_dependency
|
37
|
-
spec.add_dependency
|
38
|
-
spec.add_dependency
|
39
|
-
spec.add_dependency
|
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'
|
40
40
|
end
|
data/lib/cobro_digital/meta.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module CobroDigital
|
2
2
|
class Meta < CobroDigital::Operador
|
3
3
|
|
4
|
-
META_WS = 'meta'
|
4
|
+
META_WS = 'meta'.freeze
|
5
5
|
|
6
6
|
# md5(microtime(true)*rand())
|
7
7
|
# { 'handshake'=>Digest::MD5.hexdigest(Time.now.to_f.to_s),
|
@@ -38,10 +38,58 @@ module CobroDigital
|
|
38
38
|
# '5' => { 'metodo_webservice' => 'inhabilitar_boleta',
|
39
39
|
# 'handshake' => Digest::MD5.hexdigest(Time.now.to_f.to_s),
|
40
40
|
# 'nro_boleta' => '65' } }
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
|
42
|
+
def self.transaction(desde, hasta, filtros = {})
|
43
|
+
filter = {
|
44
|
+
::CobroDigital::Transaccion::FILTRO_TIPO => ::CobroDigital::Transaccion::FILTRO_TIPO_INGRESO
|
45
|
+
}
|
46
|
+
|
47
|
+
filter.merge!(filtros) unless filtros.empty?
|
48
|
+
|
49
|
+
CobroDigital::Transaccion.consultar(
|
50
|
+
desde,
|
51
|
+
hasta,
|
52
|
+
filter
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.render(objs)
|
57
|
+
querys = {}
|
58
|
+
objs.each_with_index do |obj, i|
|
59
|
+
querys[i] = obj.render.merge(metodo_webservice: obj.webservice)
|
60
|
+
end
|
61
|
+
querys
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.meta(objs)
|
65
|
+
CobroDigital::Meta.new(
|
66
|
+
:http_method => CobroDigital::Https::POST,
|
67
|
+
:webservice => META_WS,
|
68
|
+
:render => render(objs)
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
def parse_response
|
73
|
+
output = response.body[:webservice_cobrodigital_response][:output]
|
74
|
+
parsed_response = JSON.parse(output)
|
75
|
+
|
76
|
+
datos = parsed_response['datos'].map do |data|
|
77
|
+
parsed_data = JSON.parse(data)
|
78
|
+
|
79
|
+
local_data = if parsed_data['datos'].present?
|
80
|
+
JSON.parse(parsed_data['datos'].first) rescue []
|
81
|
+
else
|
82
|
+
[]
|
83
|
+
end
|
84
|
+
|
85
|
+
{ resultado: (parsed_data['ejecucion_correcta'] == '1'),
|
86
|
+
log: parsed_data['log'],
|
87
|
+
datos: local_data }
|
88
|
+
end
|
89
|
+
|
90
|
+
{ resultado: (parsed_response['ejecucion_correcta'] == '1'),
|
91
|
+
log: parsed_response['log'],
|
92
|
+
datos: datos }
|
45
93
|
end
|
46
94
|
|
47
95
|
end
|
@@ -1,21 +1,22 @@
|
|
1
1
|
module CobroDigital
|
2
2
|
class Operador
|
3
3
|
|
4
|
-
attr_accessor :http_method, :webservice, :render, :response
|
4
|
+
attr_accessor :http_method, :webservice, :render, :response, :client
|
5
5
|
|
6
6
|
def initialize(attrs={})
|
7
7
|
@http_method = attrs[:http_method]
|
8
8
|
@webservice = attrs[:webservice]
|
9
9
|
@render = attrs[:render]
|
10
|
+
@client = nil
|
10
11
|
end
|
11
12
|
|
12
13
|
def request
|
13
14
|
{ :metodo_webservice => @webservice }.merge(render)
|
14
15
|
end
|
15
16
|
|
16
|
-
def call(id_comercio, sid, opt={})
|
17
|
-
client = CobroDigital::Client.new(opt.merge(:id_comercio => id_comercio, :sid => sid, :http_method => http_method))
|
18
|
-
@response = client.call(request)
|
17
|
+
def call(id_comercio, sid, opt = {})
|
18
|
+
@client = CobroDigital::Client.new(opt.merge(:id_comercio => id_comercio, :sid => sid, :http_method => http_method))
|
19
|
+
@response = @client.call(request)
|
19
20
|
end
|
20
21
|
|
21
22
|
def parse_response
|
@@ -15,13 +15,21 @@ module CobroDigital
|
|
15
15
|
FILTRO_TIPO_TARJETA_CREDITO = 'tarjeta_credito' # Solo aquellas cobranzas abonadas con tarjeta de crédito.
|
16
16
|
FILTRO_TIPO_DEBITO_AUTOMATICO = 'debito_automatico' # Está relacionado a los débitos realizados por CBU.
|
17
17
|
|
18
|
+
def self.render(desde, hasta, filtros = {})
|
19
|
+
{
|
20
|
+
:desde => desde.strftime('%Y%m%d'),
|
21
|
+
:hasta => hasta.strftime('%Y%m%d'),
|
22
|
+
:filtros => filtros
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
18
26
|
# { 'desde'=>'20160932', 'hasta'=>'20161001' }
|
19
|
-
def self.consultar(desde, hasta, filtros={})
|
20
|
-
CobroDigital::Transaccion.new(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
def self.consultar(desde, hasta, filtros = {})
|
28
|
+
CobroDigital::Transaccion.new(
|
29
|
+
:http_method => CobroDigital::Https::GET,
|
30
|
+
:webservice => CONSULTAR_TRANSACCIONES_WS,
|
31
|
+
:render => render(desde, hasta, filtros)
|
32
|
+
)
|
25
33
|
end
|
26
34
|
|
27
35
|
def parse_response
|
data/lib/cobro_digital.rb
CHANGED
@@ -24,7 +24,7 @@ module CobroDigital
|
|
24
24
|
|
25
25
|
class Client
|
26
26
|
|
27
|
-
attr_accessor :id_comercio, :sid, :client_to_use, :http_method, :pagadores, :boletas, :transacciones, :micrositios, :requests
|
27
|
+
attr_accessor :id_comercio, :sid, :client_to_use, :http_method, :pagadores, :boletas, :transacciones, :micrositios, :requests, :request_xml
|
28
28
|
|
29
29
|
def initialize(attrs={})
|
30
30
|
@id_comercio = attrs[:id_comercio]
|
@@ -35,10 +35,14 @@ module CobroDigital
|
|
35
35
|
@boletas = []
|
36
36
|
@transacciones = []
|
37
37
|
@micrositios = []
|
38
|
+
@request_xml = nil
|
38
39
|
end
|
39
40
|
|
40
41
|
def soap_client(params)
|
41
|
-
client = Savon.client(
|
42
|
+
client = Savon.client(wsdl: CobroDigital::WSDL, log_level: :debug, pretty_print_xml: true)
|
43
|
+
operation = client.operation(:webservice_cobrodigital)
|
44
|
+
request = operation.build(message: { 'parametros_de_entrada' => params.to_json })
|
45
|
+
@request_xml = request.pretty
|
42
46
|
client.call(:webservice_cobrodigital, message: { 'parametros_de_entrada' => params.to_json })
|
43
47
|
end
|
44
48
|
|
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
|
+
version: 1.3.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:
|
11
|
+
date: 2018-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.13'
|
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.
|
26
|
+
version: '1.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,34 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: savon
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.4
|
47
|
+
version: '2.4'
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.4
|
54
|
+
version: '2.4'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: nokogiri
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +72,14 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.2
|
75
|
+
version: '3.2'
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.2
|
82
|
+
version: '3.2'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: akami
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +100,14 @@ dependencies:
|
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2.3
|
103
|
+
version: '2.3'
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: 2.3
|
110
|
+
version: '2.3'
|
125
111
|
description: Adaptador para el Web Service de CobroDigital
|
126
112
|
email:
|
127
113
|
- gab.edera@gmail.com
|
@@ -168,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
154
|
version: '0'
|
169
155
|
requirements: []
|
170
156
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.6.
|
157
|
+
rubygems_version: 2.6.14
|
172
158
|
signing_key:
|
173
159
|
specification_version: 4
|
174
160
|
summary: Adaptador CobroDigital
|