mercadopago-sdk 0.1.9 → 0.2.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
  SHA512:
3
- data.tar.gz: 8eb916ec77b1003671faba69adfbe28df8a9f0aef2d69dfe239ae6ee8e16f06c7c3170739c4ed1eae3cb51f804af3fecbfd2e2dacc6fbbc02e331d0c95152c67
4
- metadata.gz: d30ef4d7ac1b06b6b600096013ba7668f33d531a1c7ba1780dd00e0daca9ff562dafe03ccd804d7202d42c0e93e63fb053c2d95efb98a347b3c9394c51fdc79e
3
+ data.tar.gz: 8dc115b70071090b1f2302935463d8e123acdeac553fefbe8bf7001abdb80d2dc91fc5b7461070f2e27f7fbef6a13b327b3f62e87e092bd5520ae2c92ce95f36
4
+ metadata.gz: 231f603d21cbbaf887675e4e5269d1f4484bfd7cbf1a8061a83afce4bfe885ff858356bc03cb0ece80b090f34862d343195f30f38da63233aa86e53534960ed7
5
5
  SHA1:
6
- data.tar.gz: 203a56d7e9a9e68984b5840d8ff2d21dd27fc5ce
7
- metadata.gz: d20effa87e4ee0430dcbfdaf410cb4ce78733bea
6
+ data.tar.gz: 313cfa7db52697a68753f34d017e5d2bacb7f389
7
+ metadata.gz: d250d507f91f7526658421c5e3fee250366d6fa5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mercadopago-sdk (0.1.9)
4
+ mercadopago-sdk (0.2.0)
5
5
  json
6
6
 
7
7
  GEM
@@ -7,7 +7,7 @@ class Button
7
7
 
8
8
  def call(env)
9
9
  mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
10
- preferenceData = Hash["items" => Array(Array["title"=>"sdk-ruby", "quantity"=>1, "unit_price"=>10.2, "currency_id"=>"ARS"])]
10
+ preferenceData = Hash["items" => Array(Hash["title"=>"sdk-ruby", "quantity"=>1, "unit_price"=>10.2, "currency_id"=>"ARS"])]
11
11
  preference = mp.create_preference(preferenceData)
12
12
 
13
13
  html = '<!doctype html>
@@ -8,7 +8,7 @@ class IPN
8
8
  mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
9
 
10
10
  # Sets the filters you want
11
- filters = Hash[Array["range"=>"date_created", "begin_date"=>"NOW-1MONTH", "end_date"=>"NOW", "status"=>"approved", "operation_type"=>"regular_payment"]]
11
+ filters = Hash["range"=>"date_created", "begin_date"=>"NOW-1MONTH", "end_date"=>"NOW", "status"=>"approved", "operation_type"=>"regular_payment"]
12
12
 
13
13
  # Search payment data according to filters
14
14
  searchResult = mp.search_payment(filters)
@@ -8,7 +8,7 @@ class IPN
8
8
  mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
9
 
10
10
  # Sets the filters you want
11
- filters = Hash[Array["range"=>"date_created", "begin_date"=>"2011-10-21T00:00:00Z", "end_date"=>"2011-10-25T24:00:00Z", "payment_type"=>"credit_card", "operation_type"=>"regular_payment"]]
11
+ filters = Hash["range"=>"date_created", "begin_date"=>"2011-10-21T00:00:00Z", "end_date"=>"2011-10-25T24:00:00Z", "payment_type"=>"credit_card", "operation_type"=>"regular_payment"]
12
12
 
13
13
  # Search payment data according to filters
14
14
  searchResult = mp.search_payment(filters)
@@ -8,7 +8,7 @@ class IPN
8
8
  mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
9
 
10
10
  # Sets the filters you want
11
- filters = Hash[Array["installments" => 12, "reason"=>"product_name", "operation_type"=>"regular_payment"]]
11
+ filters = Hash["installments" => 12, "reason"=>"product_name", "operation_type"=>"regular_payment"]
12
12
 
13
13
  # Search payment data according to filters
14
14
  searchResult = mp.search_payment(filters)
@@ -8,7 +8,7 @@ class IPN
8
8
  mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
9
 
10
10
  # Sets the filters you want
11
- filters = Hash[Array["payer_email" => "mail02@mail02.com%20mail01@mail01.com", "begin_date"=>"2011-01-01T00:00:00Z", "end_date"=>"2011-02-01T00:00:00Z"]]
11
+ filters = Hash["payer_email" => "mail02@mail02.com%20mail01@mail01.com", "begin_date"=>"2011-01-01T00:00:00Z", "end_date"=>"2011-02-01T00:00:00Z"]
12
12
 
13
13
  # Search payment data according to filters
14
14
  searchResult = mp.search_payment(filters)
@@ -21,10 +21,3 @@ class IPN
21
21
  end
22
22
 
23
23
  Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
24
-
25
-
26
- $filters = array (
27
- "payer_email" => "mail02@mail02.com%20mail01@mail01.com",
28
- "begin_date" => "2011-01-01T00:00:00Z",
29
- "end_date" => "2011-02-01T00:00:00Z"
30
- );
@@ -8,7 +8,7 @@ class IPN
8
8
  mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9
9
 
10
10
  # Sets the filters you want
11
- filters = Hash[Array["site_id" => "MLA", "external_reference"=>"Bill001"]]
11
+ filters = Hash["site_id" => "MLA", "external_reference"=>"Bill001"]
12
12
 
13
13
  # Search payment data according to filters
14
14
  searchResult = mp.search_payment(filters)
data/lib/mercadopago.rb CHANGED
@@ -50,7 +50,7 @@ class MercadoPago
50
50
  end
51
51
 
52
52
  # Get information for specific payment
53
- def get_payment_info(id)
53
+ def get_payment(id)
54
54
  begin
55
55
  access_token = get_access_token
56
56
  rescue => e
@@ -61,6 +61,21 @@ class MercadoPago
61
61
  @rest_client.get(uri_prefix + "/collections/notifications/" + id + "?access_token=" + access_token)
62
62
  end
63
63
 
64
+ def get_payment_info(id)
65
+ get_payment(id)
66
+ end
67
+
68
+ # Get information for specific authorized payment
69
+ def get_authorized_payment(id)
70
+ begin
71
+ access_token = get_access_token
72
+ rescue => e
73
+ return e.message
74
+ end
75
+
76
+ @rest_client.get("/authorized_payments/" + id + "?access_token=" + access_token)
77
+ end
78
+
64
79
  # Refund accredited payment
65
80
  def refund_payment(id)
66
81
  begin
@@ -85,6 +100,18 @@ class MercadoPago
85
100
  @rest_client.put("/collections/" + id + "?access_token=" + access_token, cancel_status)
86
101
  end
87
102
 
103
+ # Cancel preapproval payment
104
+ def cancel_preapproval_payment(id)
105
+ begin
106
+ access_token = get_access_token
107
+ rescue => e
108
+ return e.message
109
+ end
110
+
111
+ cancel_status = {"status" => "cancelled"}
112
+ @rest_client.put("/preapproval/" + id + "?access_token=" + access_token, cancel_status)
113
+ end
114
+
88
115
  # Search payments according to filters, with pagination
89
116
  def search_payment(filters, offset=0, limit=0)
90
117
  begin
@@ -135,6 +162,28 @@ class MercadoPago
135
162
  @rest_client.get("/checkout/preferences/" + id + "?access_token=" + access_token)
136
163
  end
137
164
 
165
+ # Create a preapproval payment
166
+ def create_preapproval_payment(preapproval_payment)
167
+ begin
168
+ access_token = get_access_token
169
+ rescue => e
170
+ return e.message
171
+ end
172
+
173
+ @rest_client.post("/preapproval?access_token=" + access_token, preapproval_payment)
174
+ end
175
+
176
+ # Get a preapproval payment
177
+ def get_preapproval_payment(id)
178
+ begin
179
+ access_token = get_access_token
180
+ rescue => e
181
+ return e.message
182
+ end
183
+
184
+ @rest_client.get("/preapproval/" + id + "?access_token=" + access_token)
185
+ end
186
+
138
187
  def build_query(params)
139
188
  URI.escape(params.collect { |k, v| "#{k}=#{v}" }.join('&'))
140
189
  end
data/lib/version.rb CHANGED
@@ -1 +1 @@
1
- MERCADO_PAGO_VERSION = '0.1.9' unless defined?(MERCADO_PAGO_VERSION)
1
+ MERCADO_PAGO_VERSION = '0.2.0' unless defined?(MERCADO_PAGO_VERSION)
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercadopago-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - maticompiano
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2013-04-05 00:00:00 Z
12
+ date: 2013-05-07 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -63,6 +63,7 @@ files:
63
63
  - lib/cacert.pem
64
64
  - lib/mercadopago.rb
65
65
  - lib/version.rb
66
+ - mercadopago-sdk-0.1.9.gem
66
67
  - mercadopago.gemspec
67
68
  - tests/tests.rb
68
69
  homepage: http://github.com/mercadopago/sdk-ruby