mercadopago-sdk 0.3.6 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- 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/.gitignore +2 -1
- 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 +54 -143
- 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.html +123 -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/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.rb +24 -349
- 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/mercadopago.gemspec +15 -15
- data/tests/test_card.rb +79 -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_user.rb +17 -0
- data/tests/tests.rb +12 -56
- metadata +154 -37
- 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 -1
- data/mercadopago-sdk-0.3.2.gem +0 -0
- data/mercadopago-sdk-0.3.3.gem +0 -0
@@ -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
@@ -1 +0,0 @@
|
|
1
|
-
MERCADO_PAGO_VERSION = '0.3.6' unless defined?(MERCADO_PAGO_VERSION)
|
data/mercadopago-sdk-0.3.2.gem
DELETED
Binary file
|
data/mercadopago-sdk-0.3.3.gem
DELETED
Binary file
|