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.



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

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

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



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

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

#currencyObject



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

def currency
  @params['x_currency']
end

#grossObject



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

def gross
  @params['x_amount']
end

#item_idObject



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

def item_id
  @params['x_reference']
end

#statusObject



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

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

#test?Boolean

Returns:

  • (Boolean)


166
167
168
# File 'lib/offsite_payments/integrations/universal.rb', line 166

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

#transaction_idObject



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

def transaction_id
  @params['x_gateway_reference']
end