lib/paynow_sdk.rb in paynow_sdk-1.0.8 vs lib/paynow_sdk.rb in paynow_sdk-1.0.9

- old
+ new

@@ -4,16 +4,16 @@ require "uri" require "net/http" #throws error when hash from Paynow does not match locally generated hash module PaynowStatus - def paid + def self.paid status_paid = check_transaction_status(poll_url) status_paid["status"] == "Paid" end - def check_transaction_status(poll_url) + def self.check_transaction_status(poll_url) url = URI(poll_url) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE @@ -22,15 +22,11 @@ request["content-type"] = "application/x-www-form-urlencoded" response = http.request(request) response.read_body - response_object = rebuild_response(response.read_body) - response_object - end - - def rebuild_response(response) - URI.decode_www_form(response).to_h + response_object = rebuild(response.read_body) + URI.decode_www_form(response_object).to_h end end class HashMismatchException < Exception def initialize(message)