class OffsitePayments::Integrations::Universal::Notification
Public Class Methods
new(post, options = {})
click to toggle source
Calls superclass method
OffsitePayments::Notification::new
# File lib/offsite_payments/integrations/universal.rb, line 126 def initialize(post, options = {}) super @key = options[:credential2] end
Public Instance Methods
acknowledge(authcode = nil)
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 131 def acknowledge(authcode = nil) signature = @params['x_signature'] signature && signature.casecmp(generate_signature) == 0 end
currency()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 140 def currency @params['x_currency'] end
gross()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 144 def gross @params['x_amount'] end
item_id()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 136 def item_id @params['x_reference'] end
status()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 152 def status result = @params['x_result'] result && result.capitalize end
test?()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 157 def test? @params['x_test'] == 'true' end
transaction_id()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 148 def transaction_id @params['x_gateway_reference'] end
Private Instance Methods
generate_signature()
click to toggle source
# File lib/offsite_payments/integrations/universal.rb, line 163 def generate_signature signature_params = @params.select { |k| k.start_with? 'x_' }.reject { |k| k == 'x_signature' } Universal.sign(signature_params, @key) end