pago_efectivo 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +0 -2
- data/lib/pago_efectivo.rb +47 -35
- data/pago_efectivo.gemspec +4 -4
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 345175b41707929def64235200de1cbb07173d3ff0154aa57d85bd6513726c7f
|
4
|
+
data.tar.gz: 17848ad1be621f93a14951980bb1797de5f66fffd103134072c6582d514ffee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9c07f045b5555f70e965c7a0027d0038325232ae0cc40fdbfbdff9cb4ba37c2c65e9287a769a142a2bdeee497c801c0eb9a1514e631d728c7c6d0684d3b777a
|
7
|
+
data.tar.gz: 01362611db3b3961ccbdeb69bb0e9cb9f3e0a95a88f8adaf9973a44d47a31cb1f27a131c0c77dfe8eb0749db23fbe1f652c0e4f43a32d94bfd8dcf9b601f6953
|
data/Gemfile
CHANGED
data/lib/pago_efectivo.rb
CHANGED
@@ -13,18 +13,35 @@ module PagoEfectivo
|
|
13
13
|
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
|
14
14
|
}
|
15
15
|
|
16
|
-
def initialize env=nil
|
16
|
+
def initialize env=nil, proxy=false
|
17
17
|
if env == 'production'
|
18
18
|
@api_server = 'https://pagoefectivo.pe'
|
19
19
|
else
|
20
|
-
@api_server = '
|
20
|
+
@api_server = 'https://pre.2b.pagoefectivo.pe'
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
crypto_path = '/PagoEfectivoWSCrypto/WSCrypto.asmx?WSDL'
|
24
|
+
cip_path = '/PagoEfectivoWSGeneralv2/service.asmx?WSDL'
|
25
|
+
crypto_service = @api_server + crypto_path
|
26
|
+
cip_service = @api_server + cip_path
|
27
|
+
|
28
|
+
if env=='production'
|
29
|
+
if proxy
|
30
|
+
@crypto_client = Savon.client(wsdl: crypto_service, proxy: ENV['PROXY_URL'])
|
31
|
+
@cip_client = Savon.client(wsdl: cip_service, proxy: ENV['PROXY_URL'])
|
32
|
+
else
|
33
|
+
@crypto_client = Savon.client(wsdl: crypto_service)
|
34
|
+
@cip_client = Savon.client(wsdl: cip_service)
|
35
|
+
end
|
36
|
+
else
|
37
|
+
if proxy
|
38
|
+
@crypto_client = Savon.client(wsdl: crypto_service, proxy: ENV['PROXY_URL'], ssl_verify_mode: :none)
|
39
|
+
@cip_client = Savon.client(wsdl: cip_service, proxy: ENV['PROXY_URL'], ssl_verify_mode: :none)
|
40
|
+
else
|
41
|
+
@crypto_client = Savon.client(wsdl: crypto_service, ssl_verify_mode: :none)
|
42
|
+
@cip_client = Savon.client(wsdl: cip_service, ssl_verify_mode: :none)
|
43
|
+
end
|
25
44
|
end
|
26
|
-
@crypto_path = '/PagoEfectivoWSCrypto/WSCrypto.asmx?WSDL'
|
27
|
-
@cip_path = '/PagoEfectivoWSGeneralv2/service.asmx?WSDL'
|
28
45
|
end
|
29
46
|
|
30
47
|
def set_key type, path
|
@@ -41,38 +58,41 @@ module PagoEfectivo
|
|
41
58
|
end
|
42
59
|
|
43
60
|
def signature(text)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
plain_text: text, private_key: @private_key
|
48
|
-
})
|
61
|
+
response = @crypto_client.call(:signer, message: {
|
62
|
+
plain_text: text, private_key: @private_key
|
63
|
+
})
|
49
64
|
response.to_hash[:signer_response][:signer_result]
|
50
65
|
end
|
51
66
|
|
52
67
|
def encrypt_text(text)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
plain_text: text, public_key: @public_key
|
57
|
-
})
|
68
|
+
response = @crypto_client.call(:encrypt_text, message: {
|
69
|
+
plain_text: text, public_key: @public_key
|
70
|
+
})
|
58
71
|
response.to_hash[:encrypt_text_response][:encrypt_text_result]
|
59
72
|
end
|
60
73
|
|
61
74
|
def unencrypt enc_text
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
encrypt_text: enc_text, private_key: @private_key
|
66
|
-
})
|
75
|
+
response = @crypto_client.call(:decrypt_text, message: {
|
76
|
+
encrypt_text: enc_text, private_key: @private_key
|
77
|
+
})
|
67
78
|
response.to_hash[:decrypt_text_response][:decrypt_text_result]
|
68
79
|
end
|
69
80
|
|
70
81
|
# after unencrypt cip result this return like string so we need parse this
|
71
82
|
# for access cip data in more easy way
|
72
|
-
def parse_cip_result uncrypt_text
|
83
|
+
def parse_cip_result uncrypt_text, keys=[]
|
73
84
|
parser = Nori.new
|
74
85
|
cip = parser.parse uncrypt_text
|
75
|
-
|
86
|
+
if keys.length > 0
|
87
|
+
result = cip
|
88
|
+
|
89
|
+
keys.map do |k|
|
90
|
+
result = result[k]
|
91
|
+
end
|
92
|
+
result
|
93
|
+
else
|
94
|
+
cip
|
95
|
+
end
|
76
96
|
end
|
77
97
|
|
78
98
|
def generate_xml(cod_serv, currency, total, pay_methods, cod_trans, email,
|
@@ -135,9 +155,7 @@ module PagoEfectivo
|
|
135
155
|
end
|
136
156
|
|
137
157
|
def generate_cip(cod_serv, signer, xml)
|
138
|
-
|
139
|
-
client = Savon.client(wsdl: server, proxy: @proxy)
|
140
|
-
response = client.call(:generar_cip_mod1, message: {
|
158
|
+
response = @cip_client.call(:generar_cip_mod1, message: {
|
141
159
|
request: {
|
142
160
|
'CodServ' => cod_serv,
|
143
161
|
'Firma' => signer,
|
@@ -153,9 +171,7 @@ module PagoEfectivo
|
|
153
171
|
# info_request: no specified in pago efectivo documentation, send blank
|
154
172
|
# for now
|
155
173
|
def consult_cip cod_serv, signed_cips, encrypted_cips, info_request=''
|
156
|
-
|
157
|
-
client = Savon.client(wsdl: server, proxy: @proxy)
|
158
|
-
response = client.call(:consultar_cip_mod1, message: {
|
174
|
+
response = @cip_client.call(:consultar_cip_mod1, message: {
|
159
175
|
'request' => {
|
160
176
|
'CodServ' => cod_serv,
|
161
177
|
'Firma' => signed_cips,
|
@@ -181,9 +197,7 @@ module PagoEfectivo
|
|
181
197
|
# info_request: no specified in pago efectivo documentation, send blank
|
182
198
|
# for now
|
183
199
|
def delete_cip cod_serv, signed_cip, encrypted_cip, info_request=''
|
184
|
-
|
185
|
-
client = Savon.client(wsdl: server, proxy: @proxy)
|
186
|
-
response = client.call(:eliminar_cip_mod1, message: {
|
200
|
+
response = @cip_client.call(:eliminar_cip_mod1, message: {
|
187
201
|
'request' => {
|
188
202
|
'CodServ' => cod_serv,
|
189
203
|
'Firma' => signed_cip,
|
@@ -201,9 +215,7 @@ module PagoEfectivo
|
|
201
215
|
# info_request: no specified in pago efectivo documentation, send blank
|
202
216
|
# for now
|
203
217
|
def update_cip cod_serv,signed_cip,encrypted_cip,exp_date,info_request=''
|
204
|
-
|
205
|
-
client = Savon.client(wsdl: server, proxy: @proxy)
|
206
|
-
response = client.call(:actualizar_cip_mod1, message: {
|
218
|
+
response = @cip_client.call(:actualizar_cip_mod1, message: {
|
207
219
|
'request' => {
|
208
220
|
'CodServ' => cod_serv,
|
209
221
|
'Firma' => signed_cip,
|
data/pago_efectivo.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "pago_efectivo"
|
3
|
-
s.version = "0.0
|
3
|
+
s.version = "0.1.0"
|
4
4
|
s.summary = "SOAP client to use Pago Efectivo"
|
5
5
|
s.description = s.summary
|
6
6
|
s.authors = ["César Carruitero"]
|
7
7
|
s.email = ["cesar@mozilla.pe"]
|
8
8
|
s.homepage = "https://github.com/ccarruitero/pago_efectivo"
|
9
|
-
s.license = "MPL"
|
9
|
+
s.license = "MPL-2"
|
10
10
|
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
|
13
|
-
s.add_runtime_dependency "gyoku"
|
14
|
-
s.add_runtime_dependency "savon"
|
13
|
+
s.add_runtime_dependency "gyoku", "1.1.1"
|
14
|
+
s.add_runtime_dependency "savon", "2.6.0"
|
15
15
|
|
16
16
|
s.add_development_dependency "cutest"
|
17
17
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pago_efectivo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- César Carruitero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gyoku
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.1.1
|
20
20
|
type: :runtime
|
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:
|
26
|
+
version: 1.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: savon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.6.0
|
34
34
|
type: :runtime
|
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:
|
40
|
+
version: 2.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cutest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ files:
|
|
71
71
|
- test/helper.rb
|
72
72
|
homepage: https://github.com/ccarruitero/pago_efectivo
|
73
73
|
licenses:
|
74
|
-
- MPL
|
74
|
+
- MPL-2
|
75
75
|
metadata: {}
|
76
76
|
post_install_message:
|
77
77
|
rdoc_options: []
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.7.6
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: SOAP client to use Pago Efectivo
|