mercadopago-sdk 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +76 -50
- data/lib/mercadopago.rb +3 -2
- data/lib/version.rb +1 -1
- data/mercadopago-sdk-0.3.3.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2526054c3f3d6dc96d18621f4f070e20eddf55ad
|
4
|
+
data.tar.gz: 9bb6445930f25e9e4ca5c3a046aec1a2ebe63ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7faa5c0a5a2067ad49df8153434b1d704a40741fc3c2f6527746f770c8cfaa50903444182014d3a760536164042b171766bbe378d6b5ff96e6b7182d43ca291e
|
7
|
+
data.tar.gz: 350a5fae33bca384b219538160d99878f6f7a98948b9d523b680d5d67d41cb6feff94fa5d55a5082822dab7045d9e3ade7efb96026d7f1306916cd7f70a38f34
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mercadopago-sdk (0.
|
4
|
+
mercadopago-sdk (0.3.3)
|
5
5
|
json
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
coderay (1.0.9)
|
11
|
-
json (1.
|
11
|
+
json (1.8.3)
|
12
12
|
method_source (0.8.1)
|
13
13
|
pry (0.9.12)
|
14
14
|
coderay (~> 1.0.5)
|
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# MercadoPago SDK module for Payments integration
|
2
2
|
|
3
|
-
* [
|
4
|
-
* [
|
5
|
-
* [
|
3
|
+
* [Install](#install)
|
4
|
+
* [Basic checkout](#basic-checkout)
|
5
|
+
* [Customized checkout](#custom-checkout)
|
6
|
+
* [Generic methods](#generic-methods)
|
6
7
|
|
7
|
-
<a name="
|
8
|
-
##
|
8
|
+
<a name="install"></a>
|
9
|
+
## Install
|
9
10
|
|
10
11
|
```gem install mercadopago-sdk```
|
11
12
|
|
12
|
-
|
13
|
+
<a name="basic-checkout"></a>
|
14
|
+
## Basic checkout
|
13
15
|
|
14
|
-
###
|
16
|
+
### Configure your credentials
|
15
17
|
|
16
18
|
* Get your **CLIENT_ID** and **CLIENT_SECRET** in the following address:
|
17
19
|
* Argentina: [https://www.mercadopago.com/mla/herramientas/aplicaciones](https://www.mercadopago.com/mla/herramientas/aplicaciones)
|
@@ -19,6 +21,7 @@ Then, instantiate the SDK...
|
|
19
21
|
* México: [https://www.mercadopago.com/mlm/herramientas/aplicaciones](https://www.mercadopago.com/mlm/herramientas/aplicaciones)
|
20
22
|
* Venezuela: [https://www.mercadopago.com/mlv/herramientas/aplicaciones](https://www.mercadopago.com/mlv/herramientas/aplicaciones)
|
21
23
|
* Colombia: [https://www.mercadopago.com/mco/herramientas/aplicaciones](https://www.mercadopago.com/mco/herramientas/aplicaciones)
|
24
|
+
* Chile: [https://www.mercadopago.com/mlc/herramientas/aplicaciones](https://www.mercadopago.com/mlc/herramientas/aplicaciones)
|
22
25
|
|
23
26
|
```ruby
|
24
27
|
require 'mercadopago.rb'
|
@@ -26,26 +29,9 @@ require 'mercadopago.rb'
|
|
26
29
|
$mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
27
30
|
```
|
28
31
|
|
29
|
-
###
|
32
|
+
### Preferences
|
30
33
|
|
31
|
-
|
32
|
-
require 'mercadopago.rb'
|
33
|
-
|
34
|
-
$mp = MercadoPago.new('LL_ACCESS_TOKEN')
|
35
|
-
```
|
36
|
-
|
37
|
-
### Get your Access Token:
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
$accessToken = $mp.get_access_token()
|
41
|
-
|
42
|
-
puts (accessToken)
|
43
|
-
```
|
44
|
-
|
45
|
-
<a name="checkout"></a>
|
46
|
-
## Using MercadoPago Checkout
|
47
|
-
|
48
|
-
### Get an existent Checkout preference:
|
34
|
+
#### Get an existent Checkout preference
|
49
35
|
|
50
36
|
```ruby
|
51
37
|
preference = $mp.get_preference('PREFERENCE_ID')
|
@@ -53,18 +39,26 @@ preference = $mp.get_preference('PREFERENCE_ID')
|
|
53
39
|
puts $preferenceResult
|
54
40
|
```
|
55
41
|
|
56
|
-
|
42
|
+
#### Create a Checkout preference
|
57
43
|
|
58
44
|
```ruby
|
59
|
-
|
60
|
-
|
61
|
-
|
45
|
+
|
46
|
+
preference_data = {
|
47
|
+
"items": [
|
48
|
+
{
|
49
|
+
"title": "testCreate",
|
50
|
+
"quantity": 1,
|
51
|
+
"unit_price": 10.2,
|
52
|
+
"currency_id": "ARS"
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
preference = $mp.create_preference(preference_data)
|
62
57
|
|
63
58
|
puts preference
|
64
59
|
```
|
65
|
-
<a href="http://developers.mercadopago.com/documentacion/recibir-pagos#glossary">Others items to use</a>
|
66
60
|
|
67
|
-
|
61
|
+
#### Update an existent Checkout preference
|
68
62
|
|
69
63
|
```ruby
|
70
64
|
preferenceDataToUpdate = Hash["items" => Array(Array["title"=>"testUpdated", "quantity"=>1, "unit_price"=>2])]
|
@@ -74,10 +68,9 @@ preferenceUpdate = $mp.update_preference("PREFERENCE_ID", preferenceDataToUpdate
|
|
74
68
|
puts preferenceUpdate
|
75
69
|
```
|
76
70
|
|
77
|
-
|
78
|
-
## Using MercadoPago Payment
|
71
|
+
### Payments/Collections
|
79
72
|
|
80
|
-
|
73
|
+
#### Search for payments
|
81
74
|
|
82
75
|
```ruby
|
83
76
|
filters = Array["id"=>null, "site_id"=>null, "external_reference"=>null]
|
@@ -86,25 +79,16 @@ searchResult = $mp.search_payment(filters)
|
|
86
79
|
|
87
80
|
puts searchResult
|
88
81
|
```
|
89
|
-
<a href="http://developers.mercadopago.com/documentacion/busqueda-de-pagos-recibidos">More search examples</a>
|
90
|
-
|
91
|
-
### Receiving IPN notification:
|
92
82
|
|
93
|
-
|
94
|
-
* Argentina: [https://www.mercadopago.com/mla/herramientas/notificaciones](https://www.mercadopago.com/mla/herramientas/notificaciones)
|
95
|
-
* Brasil: [https://www.mercadopago.com/mlb/ferramentas/notificacoes](https://www.mercadopago.com/mlb/ferramentas/notificacoes)
|
96
|
-
* México: [https://www.mercadopago.com/mlm/herramientas/notificaciones](https://www.mercadopago.com/mlm/herramientas/notificaciones)
|
97
|
-
* Venezuela: [https://www.mercadopago.com/mlv/herramientas/notificaciones](https://www.mercadopago.com/mlv/herramientas/notificaciones)
|
98
|
-
* Colombia: [https://www.mercadopago.com/mco/herramientas/notificaciones](https://www.mercadopago.com/mco/herramientas/notificaciones)<br />
|
83
|
+
#### Get payment data
|
99
84
|
|
100
85
|
```ruby
|
101
|
-
|
102
|
-
paymentInfo = $mp.get_payment_info("ID")
|
86
|
+
paymentInfo = $mp.get_payment("ID")
|
103
87
|
|
104
88
|
puts paymentInfo
|
105
89
|
```
|
106
90
|
|
107
|
-
### Cancel (only for pending payments)
|
91
|
+
### Cancel (only for pending payments)
|
108
92
|
|
109
93
|
```ruby
|
110
94
|
result = $mp.cancel_payment("ID");
|
@@ -113,7 +97,7 @@ result = $mp.cancel_payment("ID");
|
|
113
97
|
puts result
|
114
98
|
```
|
115
99
|
|
116
|
-
### Refund (only for accredited payments)
|
100
|
+
### Refund (only for accredited payments)
|
117
101
|
|
118
102
|
```ruby
|
119
103
|
result = $mp.refund_payment("ID");
|
@@ -121,10 +105,52 @@ result = $mp.refund_payment("ID");
|
|
121
105
|
// Show result
|
122
106
|
puts result
|
123
107
|
```
|
124
|
-
<a href=http://developers.mercadopago.com/documentacion/devolucion-y-cancelacion>About Cancel & Refund</a>
|
125
108
|
|
126
|
-
|
109
|
+
<a name="custom-checkout"></a>
|
110
|
+
## Customized checkout
|
111
|
+
|
112
|
+
### Configure your credentials
|
113
|
+
|
114
|
+
* Get your **ACCESS_TOKEN** in the following address:
|
115
|
+
* Argentina: [https://www.mercadopago.com/mla/account/credentials](https://www.mercadopago.com/mla/account/credentials)
|
116
|
+
* Brazil: [https://www.mercadopago.com/mlb/account/credentials](https://www.mercadopago.com/mlb/account/credentials)
|
117
|
+
* Mexico: [https://www.mercadopago.com/mlm/account/credentials](https://www.mercadopago.com/mlm/account/credentials)
|
118
|
+
* Venezuela: [https://www.mercadopago.com/mlv/account/credentials](https://www.mercadopago.com/mlv/account/credentials)
|
119
|
+
* Colombia: [https://www.mercadopago.com/mco/account/credentials](https://www.mercadopago.com/mco/account/credentials)
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
require 'mercadopago.rb'
|
123
|
+
|
124
|
+
$mp = MercadoPago.new('ACCESS_TOKEN')
|
125
|
+
```
|
126
|
+
|
127
|
+
### Create payment
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
$mp.post ("/v1/payments", payment_data);
|
131
|
+
```
|
132
|
+
|
133
|
+
### Create customer
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
$mp.post ("/v1/customers", Hash["email" => "email@test.com"]);
|
137
|
+
```
|
138
|
+
|
139
|
+
### Get customer
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
$mp.get ("/v1/customers/CUSTOMER_ID");
|
143
|
+
```
|
144
|
+
|
145
|
+
* View more Custom checkout related APIs in Developers Site
|
146
|
+
* Argentina: [https://www.mercadopago.com.ar/developers](https://www.mercadopago.com.ar/developers)
|
147
|
+
* Brazil: [https://www.mercadopago.com.br/developers](https://www.mercadopago.com.br/developers)
|
148
|
+
* Mexico: [https://www.mercadopago.com.mx/developers](https://www.mercadopago.com.mx/developers)
|
149
|
+
* Venezuela: [https://www.mercadopago.com.ve/developers](https://www.mercadopago.com.ve/developers)
|
150
|
+
* Colombia: [https://www.mercadopago.com.co/developers](https://www.mercadopago.com.co/developers)
|
127
151
|
|
152
|
+
<a name="generic-methods"></a>
|
153
|
+
## Generic methods
|
128
154
|
You can access any other resource from the MercadoPago API using the generic methods:
|
129
155
|
|
130
156
|
```ruby
|
data/lib/mercadopago.rb
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
#@contributors @chrismo
|
6
6
|
|
7
7
|
require 'rubygems'
|
8
|
-
require 'json
|
8
|
+
require 'json'
|
9
9
|
require 'uri'
|
10
10
|
require 'net/https'
|
11
11
|
require 'yaml'
|
12
|
-
require 'version'
|
12
|
+
require File.dirname(__FILE__) + '/version'
|
13
13
|
require 'ssl_options_patch'
|
14
14
|
|
15
15
|
class MercadoPago
|
@@ -298,6 +298,7 @@ class MercadoPago
|
|
298
298
|
|
299
299
|
if API_BASE_URL.scheme == "https" # enable SSL/TLS
|
300
300
|
@http.use_ssl = true
|
301
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
301
302
|
@http.ssl_options = OpenSSL::SSL::OP_NO_SSLv3 # explicitly tell OpenSSL not to use SSL3
|
302
303
|
end
|
303
304
|
|
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
MERCADO_PAGO_VERSION = '0.3.
|
1
|
+
MERCADO_PAGO_VERSION = '0.3.4' unless defined?(MERCADO_PAGO_VERSION)
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercadopago-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maticompiano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/ssl_options_patch.rb
|
77
77
|
- lib/version.rb
|
78
78
|
- mercadopago-sdk-0.3.2.gem
|
79
|
+
- mercadopago-sdk-0.3.3.gem
|
79
80
|
- mercadopago.gemspec
|
80
81
|
- tests/tests.rb
|
81
82
|
homepage: http://github.com/mercadopago/sdk-ruby
|