class Twocheckout::ValidateResponse
Public Class Methods
notification(options)
click to toggle source
# File lib/twocheckout/validate_response.rb, line 20 def self.notification(options) if valid?(options[:sale_id], options[:vendor_id], options[:invoice_id], options[:secret], options[:md5_hash]) {:code => "PASS", :message => "Hash Matched"} else {:code => "FAIL", :message => "Hash Mismatch"} end end
purchase(options)
click to toggle source
# File lib/twocheckout/validate_response.rb, line 11 def self.purchase(options) oid = options[:demo] == 'Y' ? 1 : options[:order_number] if valid?(options[:secret], options[:sid], oid, options[:total], options[:key]) {:code => "PASS", :message => "Hash Matched"} else {:code => "FAIL", :message => "Hash Mismatch"} end end
valid?(arg1, arg2, arg3, arg4, key)
click to toggle source
Checks against MD5 Hash
# File lib/twocheckout/validate_response.rb, line 7 def self.valid?(arg1, arg2, arg3, arg4, key) Digest::MD5.hexdigest("#{arg1}#{arg2}#{arg3}#{arg4}").upcase == key end