Class: OffsitePayments::Integrations::Universal::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/universal.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #gross_cents, #iso_currency, #valid_sender?

Constructor Details

#initialize(post, options = {}) ⇒ Notification


126
127
128
129
# File 'lib/offsite_payments/integrations/universal.rb', line 126

def initialize(post, options = {})
  super
  @key = options[:credential2]
end

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object


131
132
133
134
# File 'lib/offsite_payments/integrations/universal.rb', line 131

def acknowledge(authcode = nil)
  signature = @params['x_signature']
  signature && signature.casecmp(generate_signature) == 0
end

#currencyObject


140
141
142
# File 'lib/offsite_payments/integrations/universal.rb', line 140

def currency
  @params['x_currency']
end

#grossObject


144
145
146
# File 'lib/offsite_payments/integrations/universal.rb', line 144

def gross
  @params['x_amount']
end

#item_idObject


136
137
138
# File 'lib/offsite_payments/integrations/universal.rb', line 136

def item_id
  @params['x_reference']
end

#statusObject


152
153
154
155
# File 'lib/offsite_payments/integrations/universal.rb', line 152

def status
  result = @params['x_result']
  result && result.capitalize
end

#test?Boolean


157
158
159
# File 'lib/offsite_payments/integrations/universal.rb', line 157

def test?
  @params['x_test'] == 'true'
end

#transaction_idObject


148
149
150
# File 'lib/offsite_payments/integrations/universal.rb', line 148

def transaction_id
  @params['x_gateway_reference']
end