class OffsitePayments::Integrations::Dwolla::Helper
Public Class Methods
new(order, account, options = {})
click to toggle source
Calls superclass method
# File lib/offsite_payments/integrations/dwolla.rb, line 30 def initialize(order, account, options = {}) super add_field('name', 'Store Purchase') timestamp = Time.now.to_i.to_s if OffsitePayments.mode == :test || options[:test] add_field('test', 'true') # timestamp used for test signature generation: timestamp = "1370726016" end add_field('timestamp', timestamp) add_field('allowFundingSources', 'true') key = options[:credential2].to_s secret = options[:credential3].to_s orderid = order.to_s signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA1.new, secret, "#{key}&#{timestamp}&#{orderid}") add_field('signature', signature) end