From 93bebe855adf12668b66cc3730f61434cf4a8586 Mon Sep 17 00:00:00 2001 From: rchaves Date: Sun, 9 Dec 2012 13:29:36 -0200 Subject: [PATCH 1/4] added extras --- lib/pagseguro/notification.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pagseguro/notification.rb b/lib/pagseguro/notification.rb index b56a970..07bfbfa 100644 --- a/lib/pagseguro/notification.rb +++ b/lib/pagseguro/notification.rb @@ -13,7 +13,8 @@ class Notification :transaction_id => "TransacaoID", :shipping_type => "TipoFrete", :shipping => "ValorFrete", - :notes => "Anotacao" + :notes => "Anotacao", + :extras => "Extras" } # Map order status from PagSeguro. From f4215db2e64959e1cca0a593ba545b8f0f2b37dd Mon Sep 17 00:00:00 2001 From: rchaves Date: Tue, 25 Dec 2012 09:27:47 -0200 Subject: [PATCH 2/4] ssl version changed for ruby 1.9.3 --- lib/pagseguro/notification.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pagseguro/notification.rb b/lib/pagseguro/notification.rb index 07bfbfa..3ada1d2 100644 --- a/lib/pagseguro/notification.rb +++ b/lib/pagseguro/notification.rb @@ -217,6 +217,7 @@ def validates? http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER + http.ssl_version = :SSLv3 http.ca_file = File.dirname(__FILE__) + "/cacert.pem" request = Net::HTTP::Post.new(uri.path) From 4d8529f625896525d661d6d73a102c3def7d6791 Mon Sep 17 00:00:00 2001 From: rchaves Date: Tue, 25 Dec 2012 10:38:30 -0200 Subject: [PATCH 3/4] try twice --- lib/pagseguro/notification.rb | 57 ++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/lib/pagseguro/notification.rb b/lib/pagseguro/notification.rb index 3ada1d2..5d66103 100644 --- a/lib/pagseguro/notification.rb +++ b/lib/pagseguro/notification.rb @@ -206,24 +206,45 @@ def to_price(amount) def validates? return true if PagSeguro.developer? - # include the params to validate our request - request_params = params.merge({ - :Comando => "validar", - :Token => @token || PagSeguro.config["authenticity_token"] - }).dup - - # do the request - uri = URI.parse(API_URL) - http = Net::HTTP.new(uri.host, uri.port) - http.use_ssl = true - http.verify_mode = OpenSSL::SSL::VERIFY_PEER - http.ssl_version = :SSLv3 - http.ca_file = File.dirname(__FILE__) + "/cacert.pem" - - request = Net::HTTP::Post.new(uri.path) - request.form_data = denormalize(request_params) - response = http.start {|r| r.request request } - (response.body =~ /VERIFICADO/) != nil + begin + # include the params to validate our request + request_params = params.merge({ + :Comando => "validar", + :Token => @token || PagSeguro.config["authenticity_token"] + }).dup + + # do the request + uri = URI.parse(API_URL) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + http.ssl_version = :SSLv3 + http.ca_file = File.dirname(__FILE__) + "/cacert.pem" + + request = Net::HTTP::Post.new(uri.path) + request.form_data = denormalize(request_params) + response = http.start {|r| r.request request } + (response.body =~ /VERIFICADO/) != nil + rescue + # include the params to validate our request + request_params = params.merge({ + :Comando => "validar", + :Token => @token || PagSeguro.config["authenticity_token"] + }).dup + + # do the request + uri = URI.parse(API_URL) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + http.ssl_version = :SSLv3 + http.ca_file = File.dirname(__FILE__) + "/cacert.pem" + + request = Net::HTTP::Post.new(uri.path) + request.form_data = denormalize(request_params) + response = http.start {|r| r.request request } + (response.body =~ /VERIFICADO/) != nil + end end end end From 4442ae98cb1372209862f46e6d1e1c678cca772e Mon Sep 17 00:00:00 2001 From: Rogerio Chaves Date: Sun, 17 May 2015 13:04:43 -0300 Subject: [PATCH 4/4] Remove SSL verification --- lib/pagseguro/notification.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/pagseguro/notification.rb b/lib/pagseguro/notification.rb index 5d66103..14c4b0a 100644 --- a/lib/pagseguro/notification.rb +++ b/lib/pagseguro/notification.rb @@ -217,9 +217,7 @@ def validates? uri = URI.parse(API_URL) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true - http.verify_mode = OpenSSL::SSL::VERIFY_PEER - http.ssl_version = :SSLv3 - http.ca_file = File.dirname(__FILE__) + "/cacert.pem" + http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(uri.path) request.form_data = denormalize(request_params)