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

Returns a new instance of Notification


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

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

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object


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

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

#currencyObject


146
147
148
# File 'lib/offsite_payments/integrations/universal.rb', line 146

def currency
  @params['x_currency']
end

#grossObject


150
151
152
# File 'lib/offsite_payments/integrations/universal.rb', line 150

def gross
  @params['x_amount']
end

#item_idObject


142
143
144
# File 'lib/offsite_payments/integrations/universal.rb', line 142

def item_id
  @params['x_reference']
end

#statusObject


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

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

#test?Boolean

Returns:

  • (Boolean)

163
164
165
# File 'lib/offsite_payments/integrations/universal.rb', line 163

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

#transaction_idObject


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

def transaction_id
  @params['x_gateway_reference']
end