mercadopago-sdk 1.2.0 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- data/.github/workflows/ruby.yml +35 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +104 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CODING_GUIDELINES.md +70 -0
- data/CONTRIBUTING.md +57 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +51 -12
- data/LICENSE.txt +21 -0
- data/README.md +45 -117
- data/Rakefile +3 -1
- data/docs/CODE_OF_CONDUCT_md.html +154 -0
- data/docs/CODING_GUIDELINES_md.html +188 -0
- data/docs/CONTRIBUTING_md.html +165 -0
- data/docs/LICENSE_txt.html +96 -0
- data/docs/Mercadopago/AdvancedPayment.html +279 -0
- data/docs/Mercadopago/Card.html +204 -0
- data/docs/Mercadopago/CardToken.html +160 -0
- data/docs/Mercadopago/Config.html +266 -0
- data/docs/Mercadopago/Customer.html +228 -0
- data/docs/Mercadopago/DisbursementRefund.html +183 -0
- data/docs/Mercadopago/HttpClient.html +249 -0
- data/docs/Mercadopago/IdentificationType.html +136 -0
- data/docs/Mercadopago/MPBase.html +316 -0
- data/docs/Mercadopago/MerchantOrder.html +209 -0
- data/docs/Mercadopago/Payment.html +208 -0
- data/docs/Mercadopago/PaymentMethods.html +136 -0
- data/docs/Mercadopago/Preference.html +184 -0
- data/docs/Mercadopago/Refund.html +160 -0
- data/docs/Mercadopago/RequestOptions.html +433 -0
- data/docs/Mercadopago/SDK.html +528 -0
- data/docs/Mercadopago/User.html +136 -0
- data/docs/Mercadopago.html +123 -0
- data/docs/README_md.html +181 -0
- data/docs/created.rid +25 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +619 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +109 -0
- data/docs/js/darkfish.js +84 -0
- data/docs/js/navigation.js +105 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +110 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +562 -0
- data/lib/mercadopago/config/config.rb +42 -0
- data/lib/mercadopago/config/request_options.rb +85 -0
- data/lib/mercadopago/core/mp_base.rb +77 -0
- data/lib/mercadopago/http/http_client.rb +74 -0
- data/lib/mercadopago/resources/advanced_payment.rb +48 -0
- data/lib/mercadopago/resources/card.rb +31 -0
- data/lib/mercadopago/resources/card_token.rb +19 -0
- data/lib/mercadopago/resources/customer.rb +36 -0
- data/lib/mercadopago/resources/disbursement_refund.rb +24 -0
- data/lib/mercadopago/resources/identification_type.rb +13 -0
- data/lib/mercadopago/resources/merchant_order.rb +32 -0
- data/lib/mercadopago/resources/payment.rb +35 -0
- data/lib/mercadopago/resources/payment_methods.rb +13 -0
- data/lib/mercadopago/resources/preference.rb +26 -0
- data/lib/mercadopago/resources/refund.rb +24 -0
- data/lib/mercadopago/resources/user.rb +13 -0
- data/lib/mercadopago/sdk.rb +85 -0
- data/lib/mercadopago.rb +24 -389
- data/mercadopago.gemspec +15 -15
- data/tests/test_card.rb +78 -0
- data/tests/test_card_token.rb +39 -0
- data/tests/test_customer.rb +54 -0
- data/tests/test_identification_type.rb +16 -0
- data/tests/test_merchant_order.rb +94 -0
- data/tests/test_payment.rb +102 -0
- data/tests/test_payment_methods.rb +14 -0
- data/tests/test_preference.rb +49 -0
- data/tests/test_refund.rb +88 -0
- data/tests/test_refund_with_custom_headers.rb +97 -0
- data/tests/test_user.rb +17 -0
- data/tests/tests.rb +13 -56
- metadata +155 -36
- data/.travis.yml +0 -14
- data/examples/checkout-buttons/basic_preference/button.rb +0 -28
- data/examples/instant-payment-notifications/receive-ipn.rb +0 -25
- data/examples/payment-search/search-approved-payments.rb +0 -23
- data/examples/payment-search/search-creditcard-payments.rb +0 -23
- data/examples/payment-search/search-funded-payments-by-name.rb +0 -23
- data/examples/payment-search/search-payments-from-email-and-date.rb +0 -23
- data/examples/payment-search/search-payments.rb +0 -23
- data/examples/preapproval-payments/button.rb +0 -42
- data/lib/ssl_options_patch.rb +0 -15
- data/lib/version.rb +0 -2
- data/travis_Gemfile +0 -4
metadata
CHANGED
@@ -1,88 +1,196 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercadopago-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Mercado Pago
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.5'
|
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: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: pry
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
47
|
+
version: '0.14'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
54
|
+
version: '0.14'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
61
|
+
version: '13.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
description:
|
68
|
+
version: '13.0'
|
69
|
+
description: Mercado Pago Ruby SDK
|
56
70
|
email:
|
57
|
-
- matias.compiano@mercadolibre.com
|
58
71
|
executables: []
|
59
72
|
extensions: []
|
60
73
|
extra_rdoc_files: []
|
61
74
|
files:
|
75
|
+
- ".editorconfig"
|
76
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
77
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
78
|
+
- ".github/workflows/ruby.yml"
|
62
79
|
- ".gitignore"
|
63
|
-
- ".
|
80
|
+
- ".rubocop.yml"
|
81
|
+
- ".rubocop_todo.yml"
|
82
|
+
- ".ruby-version"
|
83
|
+
- CODE_OF_CONDUCT.md
|
84
|
+
- CODING_GUIDELINES.md
|
85
|
+
- CONTRIBUTING.md
|
64
86
|
- Gemfile
|
65
87
|
- Gemfile.lock
|
88
|
+
- LICENSE.txt
|
66
89
|
- README.md
|
67
90
|
- Rakefile
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
91
|
+
- docs/CODE_OF_CONDUCT_md.html
|
92
|
+
- docs/CODING_GUIDELINES_md.html
|
93
|
+
- docs/CONTRIBUTING_md.html
|
94
|
+
- docs/LICENSE_txt.html
|
95
|
+
- docs/Mercadopago.html
|
96
|
+
- docs/Mercadopago/AdvancedPayment.html
|
97
|
+
- docs/Mercadopago/Card.html
|
98
|
+
- docs/Mercadopago/CardToken.html
|
99
|
+
- docs/Mercadopago/Config.html
|
100
|
+
- docs/Mercadopago/Customer.html
|
101
|
+
- docs/Mercadopago/DisbursementRefund.html
|
102
|
+
- docs/Mercadopago/HttpClient.html
|
103
|
+
- docs/Mercadopago/IdentificationType.html
|
104
|
+
- docs/Mercadopago/MPBase.html
|
105
|
+
- docs/Mercadopago/MerchantOrder.html
|
106
|
+
- docs/Mercadopago/Payment.html
|
107
|
+
- docs/Mercadopago/PaymentMethods.html
|
108
|
+
- docs/Mercadopago/Preference.html
|
109
|
+
- docs/Mercadopago/Refund.html
|
110
|
+
- docs/Mercadopago/RequestOptions.html
|
111
|
+
- docs/Mercadopago/SDK.html
|
112
|
+
- docs/Mercadopago/User.html
|
113
|
+
- docs/README_md.html
|
114
|
+
- docs/created.rid
|
115
|
+
- docs/css/fonts.css
|
116
|
+
- docs/css/rdoc.css
|
117
|
+
- docs/fonts/Lato-Light.ttf
|
118
|
+
- docs/fonts/Lato-LightItalic.ttf
|
119
|
+
- docs/fonts/Lato-Regular.ttf
|
120
|
+
- docs/fonts/Lato-RegularItalic.ttf
|
121
|
+
- docs/fonts/SourceCodePro-Bold.ttf
|
122
|
+
- docs/fonts/SourceCodePro-Regular.ttf
|
123
|
+
- docs/images/add.png
|
124
|
+
- docs/images/arrow_up.png
|
125
|
+
- docs/images/brick.png
|
126
|
+
- docs/images/brick_link.png
|
127
|
+
- docs/images/bug.png
|
128
|
+
- docs/images/bullet_black.png
|
129
|
+
- docs/images/bullet_toggle_minus.png
|
130
|
+
- docs/images/bullet_toggle_plus.png
|
131
|
+
- docs/images/date.png
|
132
|
+
- docs/images/delete.png
|
133
|
+
- docs/images/find.png
|
134
|
+
- docs/images/loadingAnimation.gif
|
135
|
+
- docs/images/macFFBgHack.png
|
136
|
+
- docs/images/package.png
|
137
|
+
- docs/images/page_green.png
|
138
|
+
- docs/images/page_white_text.png
|
139
|
+
- docs/images/page_white_width.png
|
140
|
+
- docs/images/plugin.png
|
141
|
+
- docs/images/ruby.png
|
142
|
+
- docs/images/tag_blue.png
|
143
|
+
- docs/images/tag_green.png
|
144
|
+
- docs/images/transparent.png
|
145
|
+
- docs/images/wrench.png
|
146
|
+
- docs/images/wrench_orange.png
|
147
|
+
- docs/images/zoom.png
|
148
|
+
- docs/index.html
|
149
|
+
- docs/js/darkfish.js
|
150
|
+
- docs/js/navigation.js
|
151
|
+
- docs/js/navigation.js.gz
|
152
|
+
- docs/js/search.js
|
153
|
+
- docs/js/search_index.js
|
154
|
+
- docs/js/search_index.js.gz
|
155
|
+
- docs/js/searcher.js
|
156
|
+
- docs/js/searcher.js.gz
|
157
|
+
- docs/table_of_contents.html
|
76
158
|
- lib/mercadopago.rb
|
77
|
-
- lib/
|
78
|
-
- lib/
|
159
|
+
- lib/mercadopago/config/config.rb
|
160
|
+
- lib/mercadopago/config/request_options.rb
|
161
|
+
- lib/mercadopago/core/mp_base.rb
|
162
|
+
- lib/mercadopago/http/http_client.rb
|
163
|
+
- lib/mercadopago/resources/advanced_payment.rb
|
164
|
+
- lib/mercadopago/resources/card.rb
|
165
|
+
- lib/mercadopago/resources/card_token.rb
|
166
|
+
- lib/mercadopago/resources/customer.rb
|
167
|
+
- lib/mercadopago/resources/disbursement_refund.rb
|
168
|
+
- lib/mercadopago/resources/identification_type.rb
|
169
|
+
- lib/mercadopago/resources/merchant_order.rb
|
170
|
+
- lib/mercadopago/resources/payment.rb
|
171
|
+
- lib/mercadopago/resources/payment_methods.rb
|
172
|
+
- lib/mercadopago/resources/preference.rb
|
173
|
+
- lib/mercadopago/resources/refund.rb
|
174
|
+
- lib/mercadopago/resources/user.rb
|
175
|
+
- lib/mercadopago/sdk.rb
|
79
176
|
- mercadopago.gemspec
|
177
|
+
- tests/test_card.rb
|
178
|
+
- tests/test_card_token.rb
|
179
|
+
- tests/test_customer.rb
|
180
|
+
- tests/test_identification_type.rb
|
181
|
+
- tests/test_merchant_order.rb
|
182
|
+
- tests/test_payment.rb
|
183
|
+
- tests/test_payment_methods.rb
|
184
|
+
- tests/test_preference.rb
|
185
|
+
- tests/test_refund.rb
|
186
|
+
- tests/test_refund_with_custom_headers.rb
|
187
|
+
- tests/test_user.rb
|
80
188
|
- tests/tests.rb
|
81
|
-
- travis_Gemfile
|
82
189
|
homepage: http://github.com/mercadopago/sdk-ruby
|
83
|
-
licenses:
|
190
|
+
licenses:
|
191
|
+
- MIT
|
84
192
|
metadata: {}
|
85
|
-
post_install_message:
|
193
|
+
post_install_message:
|
86
194
|
rdoc_options: []
|
87
195
|
require_paths:
|
88
196
|
- lib
|
@@ -90,16 +198,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
198
|
requirements:
|
91
199
|
- - ">="
|
92
200
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
201
|
+
version: 2.3.0
|
94
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
203
|
requirements:
|
96
204
|
- - ">="
|
97
205
|
- !ruby/object:Gem::Version
|
98
206
|
version: '0'
|
99
207
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
101
|
-
signing_key:
|
208
|
+
rubygems_version: 3.2.22
|
209
|
+
signing_key:
|
102
210
|
specification_version: 4
|
103
|
-
summary:
|
211
|
+
summary: Mercado Pago Ruby SDK
|
104
212
|
test_files:
|
213
|
+
- tests/test_card.rb
|
214
|
+
- tests/test_card_token.rb
|
215
|
+
- tests/test_customer.rb
|
216
|
+
- tests/test_identification_type.rb
|
217
|
+
- tests/test_merchant_order.rb
|
218
|
+
- tests/test_payment.rb
|
219
|
+
- tests/test_payment_methods.rb
|
220
|
+
- tests/test_preference.rb
|
221
|
+
- tests/test_refund.rb
|
222
|
+
- tests/test_refund_with_custom_headers.rb
|
223
|
+
- tests/test_user.rb
|
105
224
|
- tests/tests.rb
|
data/.travis.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class Button
|
7
|
-
|
8
|
-
def call(env)
|
9
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
10
|
-
preferenceData = {"items" => ["title"=>"testCreate", "quantity"=>1, "unit_price"=>10.2, "currency_id"=>"ARS"]}
|
11
|
-
preference = mp.create_preference(preferenceData)
|
12
|
-
|
13
|
-
html = '<!doctype html>
|
14
|
-
<html>
|
15
|
-
<head>
|
16
|
-
<title>MercadoPago SDK - Create Preference and Show Checkout Example</title>
|
17
|
-
</head>
|
18
|
-
<body>
|
19
|
-
<a href="' + preference['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a>
|
20
|
-
<script type="text/javascript" src="//resources.mlstatic.com/mptools/render.js"></script>
|
21
|
-
</body>
|
22
|
-
</html>'
|
23
|
-
|
24
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
Rack::Handler::WEBrick.run(Button.new, :Port => 9000)
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class IPN
|
7
|
-
def call(env)
|
8
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
9
|
-
|
10
|
-
# Get the payment reported by the IPN. Glossary of attributes response in https://developers.mercadopago.com
|
11
|
-
payment_info = mp.get_payment_info('ID');
|
12
|
-
|
13
|
-
html = ""
|
14
|
-
# Show payment information
|
15
|
-
if (payment_info['status'] == 200)
|
16
|
-
html = payment_info['response'].inspect
|
17
|
-
else
|
18
|
-
html = payment_info['response'].inspect
|
19
|
-
end
|
20
|
-
|
21
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class IPN
|
7
|
-
def call(env)
|
8
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
9
|
-
|
10
|
-
# Sets the filters you want
|
11
|
-
filters = Hash["range"=>"date_created", "begin_date"=>"NOW-1MONTH", "end_date"=>"NOW", "status"=>"approved", "operation_type"=>"regular_payment"]
|
12
|
-
|
13
|
-
# Search payment data according to filters
|
14
|
-
searchResult = mp.search_payment(filters)
|
15
|
-
|
16
|
-
# Show payment information
|
17
|
-
html = searchResult.inspect
|
18
|
-
|
19
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class IPN
|
7
|
-
def call(env)
|
8
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
9
|
-
|
10
|
-
# Sets the filters you want
|
11
|
-
filters = Hash["range"=>"date_created", "begin_date"=>"2011-10-21T00:00:00Z", "end_date"=>"2011-10-25T24:00:00Z", "payment_type_id"=>"credit_card", "operation_type"=>"regular_payment"]
|
12
|
-
|
13
|
-
# Search payment data according to filters
|
14
|
-
searchResult = mp.search_payment(filters)
|
15
|
-
|
16
|
-
# Show payment information
|
17
|
-
html = searchResult.inspect
|
18
|
-
|
19
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class IPN
|
7
|
-
def call(env)
|
8
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
9
|
-
|
10
|
-
# Sets the filters you want
|
11
|
-
filters = Hash["installments" => 12, "description"=>"product_name", "operation_type"=>"regular_payment"]
|
12
|
-
|
13
|
-
# Search payment data according to filters
|
14
|
-
searchResult = mp.search_payment(filters)
|
15
|
-
|
16
|
-
# Show payment information
|
17
|
-
html = searchResult.inspect
|
18
|
-
|
19
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class IPN
|
7
|
-
def call(env)
|
8
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
9
|
-
|
10
|
-
# Sets the filters you want
|
11
|
-
filters = Hash["payer.email" => "mail02@mail02.com", "begin_date"=>"2011-01-01T00:00:00Z", "end_date"=>"2011-02-01T00:00:00Z"]
|
12
|
-
|
13
|
-
# Search payment data according to filters
|
14
|
-
searchResult = mp.search_payment(filters)
|
15
|
-
|
16
|
-
# Show payment information
|
17
|
-
html = searchResult.inspect
|
18
|
-
|
19
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class IPN
|
7
|
-
def call(env)
|
8
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
9
|
-
|
10
|
-
# Sets the filters you want
|
11
|
-
filters = Hash["external_reference"=>"Bill001"]
|
12
|
-
|
13
|
-
# Search payment data according to filters
|
14
|
-
searchResult = mp.search_payment(filters)
|
15
|
-
|
16
|
-
# Show payment information
|
17
|
-
html = searchResult.inspect
|
18
|
-
|
19
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Rack::Handler::WEBrick.run(IPN.new, :Port => 9000)
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rack'
|
3
|
-
$LOAD_PATH << '../../lib'
|
4
|
-
require 'mercadopago.rb'
|
5
|
-
|
6
|
-
class Button
|
7
|
-
|
8
|
-
def call(env)
|
9
|
-
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
|
10
|
-
preapprovalPayment_data = Hash[
|
11
|
-
"payer_email" => "my_customer@my_site.com",
|
12
|
-
"back_url" => "http://www.my_site.com",
|
13
|
-
"reason" => "Monthly subscription to premium package",
|
14
|
-
"external_reference" => "OP-1234",
|
15
|
-
"auto_recurring" => Hash[
|
16
|
-
"frequency" => 1,
|
17
|
-
"frequency_type" => "months",
|
18
|
-
"transaction_amount" => 60,
|
19
|
-
"currency_id" => "BRL",
|
20
|
-
"start_date" => "2012-12-10T14:58:11.778-03:00",
|
21
|
-
"end_date" => "2013-06-10T14:58:11.778-03:00"
|
22
|
-
]
|
23
|
-
]
|
24
|
-
|
25
|
-
preapprovalPayment = mp.create_preapproval_payment(preapprovalPayment_data)
|
26
|
-
|
27
|
-
html = '<!doctype html>
|
28
|
-
<html>
|
29
|
-
<head>
|
30
|
-
<title>MercadoPago SDK - Create Preapproval Payment and Show Subscription Example</title>
|
31
|
-
</head>
|
32
|
-
<body>
|
33
|
-
<a href="' + preapprovalPayment['response']['init_point'] + '" name="MP-Checkout" class="orange-ar-m-sq-arall">Pay</a>
|
34
|
-
<script type="text/javascript" src="//resources.mlstatic.com/mptools/render.js"></script>
|
35
|
-
</body>
|
36
|
-
</html>'
|
37
|
-
|
38
|
-
return [200, {'Content-Type' => 'text/html'}, [html]]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
Rack::Handler::WEBrick.run(Button.new, :Port => 9000)
|
data/lib/ssl_options_patch.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This is a workaround for issue #9450 in Ruby core
|
2
|
-
# https://bugs.ruby-lang.org/issues/9450
|
3
|
-
#
|
4
|
-
# Add an :ssl_options accessor to Net::HTTP, which controls the options
|
5
|
-
# attribute on the resulting SSLContext. This allows the user to customize
|
6
|
-
# behavior of SSL connections, like disabling specific protocol versions.
|
7
|
-
|
8
|
-
require 'net/http'
|
9
|
-
|
10
|
-
(Net::HTTP::SSL_IVNAMES << :@ssl_options).uniq!
|
11
|
-
(Net::HTTP::SSL_ATTRIBUTES << :options).uniq!
|
12
|
-
|
13
|
-
Net::HTTP.class_eval do
|
14
|
-
attr_accessor :ssl_options
|
15
|
-
end
|
data/lib/version.rb
DELETED
data/travis_Gemfile
DELETED