lib/pagseguro/notification.rb in pagseguro-0.1.7 vs lib/pagseguro/notification.rb in pagseguro-0.1.8

- old
+ new

@@ -165,10 +165,11 @@ hash end # Convert amount format to float def to_price(amount) + amount = "0#{amount}" if amount =~ /^\,/ amount.to_s.gsub(/[^\d]/, "").gsub(/^(\d+)(\d{2})$/, '\1.\2').to_f end # Check if the provided data is valid by requesting the # confirmation API url. The request will always be valid while running in @@ -184,10 +185,11 @@ # 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_NONE + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + http.ca_file = File.dirname(__FILE__) + "/cacert.pem" request = Net::HTTP::Post.new(uri.path) request.set_form_data request_params response = http.start {|r| r.request request } (response.body =~ /VERIFICADO/) != nil