mercadopago-api 0.1.4 → 0.1.5
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/README.md +61 -29
- data/Rakefile +6 -16
- data/lib/mercadopago-api.rb +1 -2
- data/lib/mercadopago/api.rb +58 -58
- data/lib/mercadopago/sdk.rb +156 -122
- data/lib/mercadopago/version.rb +1 -1
- data/lib/mercadopagoapi.rb +9 -9
- data/spec/mercadopago_spec.rb +45 -45
- data/spec/spec_helper.rb +10 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33f9c37574dabe7dd37cda46cb7321ce50a12f53
|
4
|
+
data.tar.gz: a5b67f6ac9501e65f38d70711978f0948be96f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34438eaae1f425714f1382ceac07cc3b4d96d955bf7a2a1de768184e433294f17224fe3cf4d81fccbe37e8701e232504c55bc385ad479112762f0849c4e55938
|
7
|
+
data.tar.gz: 33bafaec71860b5c8c3216bd3f08133f16a5f2eb5846a43a9c116185d2ea9fffded4aadee5ed6416e51c82f81678e16045cef49de2c14a82d67fcbc5a3aab06c
|
data/README.md
CHANGED
@@ -165,41 +165,41 @@ Search a payment by payment_id, you can get that when you set your back_urls on
|
|
165
165
|
The response for a payment search is:
|
166
166
|
|
167
167
|
{
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
168
|
+
id: id-del-pago,
|
169
|
+
site_id: "Identificador de país",
|
170
|
+
date_created: "2011-12-25T12:16:45.000-04:00",
|
171
|
+
date_approved: "2011-12-25T12:16:45.000-04:00",
|
172
|
+
last_modified: "2011-12-25T12:16:55.000-04:00",
|
173
|
+
collector_id: id-del-vendedor,
|
174
|
+
payer: {
|
175
|
+
id: 36073078,
|
176
|
+
email: "payer@email.com"
|
177
|
+
}
|
178
|
+
order_id: "id-orden",
|
179
|
+
external_reference: null,
|
180
|
+
reason: "Título de lo que estás pagando",
|
181
|
+
transaction_amount: 40,
|
182
|
+
currency_id: "Tipo de moneda",
|
183
|
+
total_paid_amount: 40,
|
184
|
+
shipping_cost: 0,
|
185
|
+
net_received_amount: 38,
|
186
|
+
status: "approved",
|
187
|
+
status_detail: "accredited",
|
188
|
+
released: "yes",
|
189
|
+
payment_type: "credit_card",
|
190
|
+
installments: 1,
|
191
|
+
money_release_date: "2011-12-27T12:16:45.000-04:00",
|
192
|
+
operation_type: "regular_payment"
|
193
193
|
}
|
194
194
|
|
195
195
|
Search in all your payments given a hash, this hash will set your search parameters. For more details of what parameters you can use to search look [here](http://developers.mercadopago.com/documentation/search-received-payments#search-filters)
|
196
196
|
|
197
197
|
search_query = { :id => "13232333" }
|
198
|
-
payments = search_payments_where( search_query )
|
198
|
+
payments = mp_client.search_payments_where( search_query )
|
199
199
|
|
200
200
|
# Search by status
|
201
201
|
search_query = { :status => "approved" }
|
202
|
-
payments = search_payments_where( search_query )
|
202
|
+
payments = mp_client.search_payments_where( search_query )
|
203
203
|
|
204
204
|
the response of that will be:
|
205
205
|
|
@@ -214,10 +214,42 @@ the response of that will be:
|
|
214
214
|
]
|
215
215
|
}
|
216
216
|
|
217
|
-
|
217
|
+
Refund Payment, return the money to the original payer
|
218
218
|
|
219
|
-
|
219
|
+
refund = mp_client.refund_payment(payment_id)
|
220
220
|
|
221
|
+
Cancel Payment
|
222
|
+
|
223
|
+
cancel = mp_client.cancel_payment(payment_id)
|
224
|
+
|
225
|
+
Create recurrent payment (preapproval payment)
|
226
|
+
|
227
|
+
This method create a preapproval payment (recurrent payment). Recive a data hash with this structure
|
228
|
+
|
229
|
+
data = {
|
230
|
+
payer_email: String,
|
231
|
+
back_url: String,
|
232
|
+
reason: String,
|
233
|
+
external_reference: String,
|
234
|
+
auto_recurring: {
|
235
|
+
frecuency: Number,
|
236
|
+
frequency_type: String, // months or days
|
237
|
+
transaction_amount: Number,
|
238
|
+
currency_id: String,
|
239
|
+
start_date,
|
240
|
+
end_date
|
241
|
+
}
|
242
|
+
|
243
|
+
For more information about avaliable options go to [here](http://developers.mercadopago.com/documentation/glossary/recurring-payments)
|
244
|
+
|
245
|
+
preapproval_payment = mp_client.create_preapproval_payment(data)
|
246
|
+
|
247
|
+
Get a recurrent payment information
|
248
|
+
|
249
|
+
This method get all the information about a recurrent payments. for more information about what return this method go to [here](http://developers.mercadopago.com/documentation/glossary/recurring-payments#!/get)
|
250
|
+
|
251
|
+
preapproval_payment = mp_client.get_preapproval_payment(id)
|
252
|
+
|
221
253
|
### Usage like extension
|
222
254
|
|
223
255
|
TODO: write this
|
data/Rakefile
CHANGED
@@ -1,27 +1,17 @@
|
|
1
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
require 'rake'
|
3
3
|
require File.expand_path('../lib/mercadopago/version', __FILE__)
|
4
4
|
|
5
5
|
desc 'Run Tests'
|
6
6
|
task :test do
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Builds the gem'
|
11
|
-
task :build do
|
12
|
-
sh "gem build mercadopago-api.gemspec"
|
13
|
-
end
|
14
|
-
|
15
|
-
desc 'Builds and installs the gem'
|
16
|
-
task :install => :build do
|
17
|
-
sh "gem install mercadopago-api-#{Mercadopago::VERSION}"
|
7
|
+
sh "rspec"
|
18
8
|
end
|
19
9
|
|
20
10
|
desc 'Tags version, pushes to remote, and pushes gem'
|
21
11
|
task :release => :build do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
sh "git tag v#{Mercadopago::VERSION}"
|
13
|
+
sh "git push github master"
|
14
|
+
sh "git push github v#{Mercadopago::VERSION}"
|
15
|
+
sh "gem push mercadopago-api-#{Mercadopago::VERSION}.gem"
|
26
16
|
end
|
27
17
|
|
data/lib/mercadopago-api.rb
CHANGED
data/lib/mercadopago/api.rb
CHANGED
@@ -1,69 +1,69 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require "mercadopago/sdk"
|
2
|
+
:w
|
3
3
|
module Mercadopago
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
module Api
|
5
|
+
attr_writer :credentials, :preference
|
6
|
+
attr_reader :sdk
|
7
|
+
|
8
|
+
def checkout_link(data)
|
9
|
+
preference = sdk.create_checkout_preference(data, config[:excluded_payment_methods])
|
10
|
+
if config[:sandbox]
|
11
|
+
preference['sandbox_init_point']
|
12
|
+
else
|
13
|
+
preference['init_point']
|
14
|
+
end
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
def find_payment(payment_id)
|
18
|
+
if config[:sandbox]
|
19
|
+
result = sdk.search_payments_where({:id => payment_id})['results'].first
|
20
|
+
else
|
21
|
+
result = sdk.search_payment(payment_id)
|
22
|
+
end
|
23
|
+
result
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
def find_payment_with_notification(payment_id)
|
27
|
+
result = sdk.get_payment_info(payment_id)
|
28
|
+
payment = result['collection']
|
29
|
+
payment[:code] = result[:code]
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
def sdk
|
33
|
+
@sdk ||= Sdk.new(credentials[:client_id], credentials[:client_secret], config[:sandbox])
|
34
|
+
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
def credentials
|
37
|
+
if @credentials.empty?
|
38
|
+
raise "Please set yours Credentials, using set_credentials"
|
39
|
+
else
|
40
|
+
@credentials
|
41
|
+
end
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
def preference
|
45
|
+
if @preference.nil?
|
46
|
+
raise "You have to create or get a preference first"
|
47
|
+
else
|
48
|
+
@preference
|
49
|
+
end
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def config
|
53
|
+
@config || {}
|
54
|
+
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
def config=(config)
|
57
|
+
@config = config
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
def set_credentials(client_id, client_secret)
|
61
|
+
@credentials = {
|
62
|
+
:client_id => client_id,
|
63
|
+
:client_secret => client_secret
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
67
|
|
68
68
|
end
|
69
|
-
|
69
|
+
|
data/lib/mercadopago/sdk.rb
CHANGED
@@ -1,128 +1,162 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'rest_client'
|
3
2
|
require 'json/ext'
|
4
3
|
require 'uri'
|
5
4
|
|
6
5
|
module Mercadopago
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
6
|
+
class Sdk
|
7
|
+
|
8
|
+
attr_accessor :client_id, :client_secret, :sandbox
|
9
|
+
attr_writer :access_token
|
10
|
+
|
11
|
+
def initialize(client_id, client_secret, sandbox=false)
|
12
|
+
@client_id = client_id
|
13
|
+
@client_secret = client_secret
|
14
|
+
@sandbox = sandbox
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_access_token
|
18
|
+
url = "/oauth/token"
|
19
|
+
data = {
|
20
|
+
:grant_type => "client_credentials",
|
21
|
+
:client_id => @client_id,
|
22
|
+
:client_secret => @client_secret
|
23
|
+
}
|
24
|
+
result = Rest::exec(:post, url, data)
|
25
|
+
if result[:code] == 200
|
26
|
+
@access_token = result["access_token"]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def access_token
|
31
|
+
@access_token || get_access_token
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_checkout_preference(data, exclude_methods=nil)
|
35
|
+
unless exclude_methods.nil?
|
36
|
+
data[:payment_methods] = {
|
37
|
+
:excluded_payment_methods => exclude_methods
|
38
|
+
}
|
39
|
+
end
|
40
|
+
url = "/checkout/preferences?access_token="+access_token
|
41
|
+
Rest::exec(:post, url, data, true)
|
42
|
+
end
|
43
|
+
|
44
|
+
def update_checkout_preference(preference_id, data)
|
45
|
+
url = build_url "/checkout/preferences/#{preference_id}"
|
46
|
+
Rest::exec(:put, url, data, true)
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_checkout_preference(id)
|
50
|
+
url = build_url "/checkout/preferences/#{preference_id}"
|
51
|
+
Rest::exec(:get, url, nil, true)
|
52
|
+
end
|
53
|
+
|
54
|
+
# This method create a preapproval payment (recurrent payment)
|
55
|
+
# Recive a data hash with this structure:
|
56
|
+
#
|
57
|
+
# data = {
|
58
|
+
# payer_email: String,
|
59
|
+
# back_url: String,
|
60
|
+
# reason: String,
|
61
|
+
# external_reference: String,
|
62
|
+
# auto_recurring: {
|
63
|
+
# frecuency: Number,
|
64
|
+
# frequency_type: String, // months or days
|
65
|
+
# transaction_amount: Number,
|
66
|
+
# currency_id: String,
|
67
|
+
# start_date,
|
68
|
+
# end_date
|
69
|
+
# }
|
70
|
+
#
|
71
|
+
# For more information about avaliable options go to
|
72
|
+
# http://developers.mercadopago.com/documentation/glossary/recurring-payments
|
73
|
+
def create_preapproval_payment(data)
|
74
|
+
url = build_url "/preapproval"
|
75
|
+
Rest::exec(:post, url, data, true)
|
76
|
+
end
|
77
|
+
|
78
|
+
# This method get all the information about a recurrent payment
|
79
|
+
# for information about what return this method go to
|
80
|
+
# http://developers.mercadopago.com/documentation/glossary/recurring-payments#!/get
|
81
|
+
def get_preapproval_payment(id)
|
82
|
+
url = build_url "/preapproval/#{id}"
|
83
|
+
Rest::exec(:get, url)
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_payment_info(notification_id)
|
87
|
+
url = build_url "/collections/notifications/#{notification_id}"
|
88
|
+
Rest::exec(:get, url, nil, true)
|
89
|
+
end
|
90
|
+
|
91
|
+
def search_payment(payment_id)
|
92
|
+
url = build_url "/collections/#{payment_id}"
|
93
|
+
Rest::exec(:get, url, nil, true)
|
94
|
+
end
|
95
|
+
|
96
|
+
def search_payments_where(params)
|
97
|
+
url = build_url "/collections/search", false
|
98
|
+
params[:access_token] = access_token
|
99
|
+
Rest::exec(:get, url, { :params => params })
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_test_user(site_id)
|
103
|
+
url = build_url "users/test_user"
|
104
|
+
Rest::exec(:post, url, { :site_id => site_id }, true )
|
105
|
+
end
|
106
|
+
|
107
|
+
def refund_payment(payment_id)
|
108
|
+
url = build_url "/collections/#{payment_id}"
|
109
|
+
Rest::exec(:put, url, {:status => "refunded"}, true )
|
110
|
+
end
|
111
|
+
|
112
|
+
def cancel_payment(payment_id)
|
113
|
+
url = build_url "/collections/#{payment_id}"
|
114
|
+
Rest::exec(:put, url, {:status => "cancelled"}, true )
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_url(action, access_token=true)
|
118
|
+
if access_token
|
119
|
+
sandbox_prefix + action + "?access_token=#{access_token}"
|
120
|
+
else
|
121
|
+
sandbox_prefix + action
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def sandbox_prefix
|
126
|
+
@sandbox ? "/sandbox":""
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
module Rest
|
132
|
+
URL = "https://api.mercadolibre.com/"
|
133
|
+
def exec(method, url, data=nil, json=false)
|
134
|
+
url = uri(url)
|
135
|
+
if !data.nil? and json
|
136
|
+
RestClient.send(method, url, data.to_json, :content_type => :json, :accept => :json) do |response, request, result|
|
137
|
+
build_response(response)
|
138
|
+
end
|
139
|
+
elsif data.nil? and json
|
140
|
+
RestClient.send(method, url, :accept => :json) do |response, request, result|
|
141
|
+
build_response(response)
|
142
|
+
end
|
143
|
+
else
|
144
|
+
RestClient.send(method, url, data) do |response, request, result|
|
145
|
+
build_response(response)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def build_response( response )
|
151
|
+
r = JSON.parse(response.force_encoding("UTF-8"))
|
152
|
+
r[:code] = response.code
|
153
|
+
return r
|
154
|
+
end
|
155
|
+
|
156
|
+
def uri(url)
|
157
|
+
URI.join(URL, url).to_s
|
158
|
+
end
|
159
|
+
|
160
|
+
module_function :exec, :uri, :build_response
|
161
|
+
end
|
128
162
|
end
|
data/lib/mercadopago/version.rb
CHANGED
data/lib/mercadopagoapi.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require "mercadopago/api"
|
2
|
+
require "mercadopago/version"
|
3
3
|
|
4
4
|
module Mercadopago
|
5
|
-
|
6
|
-
|
5
|
+
class Mp
|
6
|
+
include Api
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def initialize(client_id, client_secret)
|
9
|
+
set_credentials(client_id, client_secret)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
13
|
end
|
data/spec/mercadopago_spec.rb
CHANGED
@@ -1,54 +1,54 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Test Mercadopago Api Object' do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
before do
|
5
|
+
@credenciales = MercadopagoTest::CREDENTIALS
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
it "The object must be a dependecy of Mercadopago::Mp" do
|
9
|
+
api = MercadopagoTest.new(@credenciales[:client_id], @credenciales[:client_secret])
|
10
|
+
api.should be_kind_of(Mercadopago::Mp)
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
it "SDK method initialize" do
|
14
|
+
sdk = Mercadopago::Sdk.new @credenciales[:client_id], @credenciales[:client_secret]
|
15
|
+
sdk.should be_kind_of(Mercadopago::Sdk)
|
16
|
+
end
|
17
17
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe 'Mercado Pago api' do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
21
|
+
before do
|
22
|
+
@credenciales = MercadopagoTest::CREDENTIALS
|
23
|
+
@api = MercadopagoTest.new(@credenciales[:client_id], @credenciales[:client_secret])
|
24
|
+
end
|
25
|
+
|
26
|
+
it "The object must initialize only with credentials" do
|
27
|
+
@api.should be_kind_of(Mercadopago::Mp)
|
28
|
+
@api.credentials.should == @credenciales
|
29
|
+
end
|
30
|
+
|
31
|
+
it "The sdk most have a token to work" do
|
32
|
+
@api.sdk.access_token.should_not be_nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it "The object most accept config values" do
|
36
|
+
config = { :currency_id => "VEF", :sandbox => true }
|
37
|
+
@api.config = config
|
38
|
+
@api.config.should == config
|
39
|
+
end
|
40
|
+
|
41
|
+
it "The preference need to be a mercadopago api preference hash, respond 200" do
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "Search a payment and return only the collection" do
|
46
|
+
payment_id = "660685397121"
|
47
|
+
payment = @api.find_payment(payment_id)
|
48
|
+
if payment
|
49
|
+
payment.should == @api.sdk.search_payment(payment_id)
|
50
|
+
else
|
51
|
+
payment[:code].should == 404
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,15 +2,16 @@ require File.join(File.dirname(__FILE__), '../lib/', 'mercadopagoapi.rb')
|
|
2
2
|
require 'rspec'
|
3
3
|
|
4
4
|
# setup test environment
|
5
|
-
class MercadopagoTest < Mercadopago::Mp
|
6
|
-
CREDENTIALS = {
|
7
|
-
:client_id => "your-client-id",
|
8
|
-
:client_secret => "your-client-secret"
|
9
|
-
}
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
class MercadopagoTest < Mercadopago::Mp
|
7
|
+
CREDENTIALS = {
|
8
|
+
:client_id => "your-client-id",
|
9
|
+
:client_secret => "your-client-secret"
|
10
|
+
}
|
11
|
+
|
12
|
+
CONFIG = {
|
13
|
+
:currency_id => "VEF",
|
14
|
+
:sandbox => false
|
15
|
+
}
|
15
16
|
end
|
16
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercadopago-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Marin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.0
|
124
|
+
rubygems_version: 2.1.0
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: This gem manage the Mercadopago api using rest-client and mercadopago rest
|