dinero_mail_ipn 0.0.1
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.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +19 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +2 -0
- data/dinero_mail_ipn.gemspec +25 -0
- data/lib/dinero_mail_ipn.rb +63 -0
- data/lib/dinero_mail_ipn/version.rb +3 -0
- data/script/console +10 -0
- metadata +105 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dinero_mail_ipn (0.0.1)
|
5
|
+
httparty (~> 0.7.6)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
crack (0.1.8)
|
11
|
+
httparty (0.7.6)
|
12
|
+
crack (= 0.1.8)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
dinero_mail_ipn!
|
19
|
+
httparty (~> 0.7.6)
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= Dinero Mail IPN Gem
|
2
|
+
|
3
|
+
Sirve para consumir los metodos de IPN 1 y IPN 2.
|
4
|
+
|
5
|
+
Por ejemplo:
|
6
|
+
|
7
|
+
#IPN v1
|
8
|
+
c = DineroMailIpn::Client.new(:email => 'EMAILPRUEBA@gmail.com', :account => '09813581', :pin => 'URJYRLU2PP')
|
9
|
+
c.consulta_pago(before,now) # before y now son Dates
|
10
|
+
#Response
|
11
|
+
{"Report"=>{"Email"=>"EMAILPRUEBA@gmail.com", "Acount"=>"09813581", "Pin"=>"URJYRLU2PP", "StartDate"=>"20110419", "EndDate"=>"20110419", "XML"=>"1", "State"=>"2", "Pays"=>nil, "Collections"=>nil, "Tickets"=>nil, "Reception"=>nil, "Retreats"=>nil, "Credits"=>nil, "Debits"=>nil}}
|
12
|
+
|
13
|
+
#IPN v2
|
14
|
+
c = DineroMailIpn::Client.new(:account => '09813581', :password => 'mipassword)
|
15
|
+
c.consulta_transacciones("31548", "XA5547")
|
16
|
+
#Response
|
17
|
+
{"REPORTE"=>{"ESTADOREPORTE"=>"8", "DETALLE"=>{"OPERACIONES"=>nil}}}
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "dinero_mail_ipn/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "dinero_mail_ipn"
|
7
|
+
s.version = DineroMailIpn::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Ernesto Tagwerker", "Esteban Pastorino"]
|
10
|
+
s.email = ["ernesto@etagwerker.com", "kito@pinggers.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Dinero Mail IPN gem}
|
13
|
+
s.description = %q{Dinero Mail IPN stub}
|
14
|
+
|
15
|
+
s.rubyforge_project = "dinero_mail_ipn"
|
16
|
+
|
17
|
+
s.add_dependency 'httparty', '~> 0.7.6'
|
18
|
+
s.add_dependency 'nokogiri', '~> 1.4.4'
|
19
|
+
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module DineroMailIpn
|
5
|
+
class Client
|
6
|
+
include HTTParty
|
7
|
+
format :xml
|
8
|
+
attr_reader :email, :account, :pin, :pais, :password
|
9
|
+
|
10
|
+
DEFAULT_PAIS = 'argentina'
|
11
|
+
|
12
|
+
def initialize(opts)
|
13
|
+
@email = opts[:email]
|
14
|
+
@account = opts[:account]
|
15
|
+
@pin = opts[:pin]
|
16
|
+
@password = opts[:password]
|
17
|
+
@pais = opts[:pais] || DEFAULT_PAIS
|
18
|
+
end
|
19
|
+
|
20
|
+
# devuelve una response
|
21
|
+
def consulta_pago(start_date, end_date)
|
22
|
+
params = default_params.merge({:StartDate => format_date(start_date), :EndDate => format_date(end_date)})
|
23
|
+
self.class.get("https://#{@pais}.dineromail.com/vender/ConsultaPago.asp", :query => params).parsed_response
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_params
|
27
|
+
{:XML => 1, :Acount => @account, :Pin => @pin, :Email => @email}
|
28
|
+
end
|
29
|
+
|
30
|
+
# formatea una date a 20110201
|
31
|
+
def format_date(a_date)
|
32
|
+
a_date.strftime("%Y%m%d")
|
33
|
+
end
|
34
|
+
|
35
|
+
def consulta_transacciones(*transacciones)
|
36
|
+
xml_builder = Nokogiri::XML::Builder.new do |xml|
|
37
|
+
xml.REPORTE {
|
38
|
+
xml.NROCTA @account
|
39
|
+
xml.DETALLE {
|
40
|
+
xml.CONSULTA {
|
41
|
+
xml.CLAVE @password
|
42
|
+
xml.TIPO 1
|
43
|
+
xml.OPERACIONES {
|
44
|
+
transacciones.each do |transaccion|
|
45
|
+
xml.ID transaccion
|
46
|
+
end
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
body = xml_builder.to_xml
|
53
|
+
body.sub!("<?xml version=\"1.0\"?>", "")
|
54
|
+
body.gsub!(/\s/, '')
|
55
|
+
|
56
|
+
self.class.post("http://#{@pais}.dineromail.com/Vender/Consulta_IPN.asp", :body => "DATA=#{body}",
|
57
|
+
:headers => {"Content-type" => "application/x-www-form-urlencoded", "Content-length" => "#{body.length}" }).parsed_response
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# DineroMail::Ipn.consulta_ipn()
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/dinero_mail_ipn.rb'}"
|
9
|
+
puts "Loading Dinero Mail IPN gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dinero_mail_ipn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ernesto Tagwerker
|
13
|
+
- Esteban Pastorino
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-19 00:00:00 -03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: httparty
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 7
|
32
|
+
- 6
|
33
|
+
version: 0.7.6
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: nokogiri
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 4
|
47
|
+
- 4
|
48
|
+
version: 1.4.4
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
description: Dinero Mail IPN stub
|
52
|
+
email:
|
53
|
+
- ernesto@etagwerker.com
|
54
|
+
- kito@pinggers.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files: []
|
60
|
+
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- MIT-LICENSE
|
66
|
+
- README.rdoc
|
67
|
+
- Rakefile
|
68
|
+
- dinero_mail_ipn.gemspec
|
69
|
+
- lib/dinero_mail_ipn.rb
|
70
|
+
- lib/dinero_mail_ipn/version.rb
|
71
|
+
- script/console
|
72
|
+
has_rdoc: true
|
73
|
+
homepage: ""
|
74
|
+
licenses: []
|
75
|
+
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
requirements: []
|
98
|
+
|
99
|
+
rubyforge_project: dinero_mail_ipn
|
100
|
+
rubygems_version: 1.3.7
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Dinero Mail IPN gem
|
104
|
+
test_files: []
|
105
|
+
|