Class: OffsitePayments::Integrations::WebPay::Notification

Inherits:
Notification
  • Object
show all
Includes:
Common
Defined in:
lib/offsite_payments/integrations/web_pay.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#generate_signature, #notify_signature_string, #request_signature_string

Methods inherited from Notification

#empty!, #gross_cents, #initialize, #iso_currency, #test?, #valid_sender?

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Class Method Details

.recognizes?(params) ⇒ Boolean


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

def self.recognizes?(params)
  params.has_key?('site_order_id') && params.has_key?('amount')
end

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object


176
177
178
# File 'lib/offsite_payments/integrations/web_pay.rb', line 176

def acknowledge(authcode = nil)
  (security_key == generate_signature(:notify))
end

#amountObject


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

def amount
  BigDecimal.new(gross)
end

#complete?Boolean


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

def complete?
  true
end

#grossObject


164
165
166
# File 'lib/offsite_payments/integrations/web_pay.rb', line 164

def gross
  params['amount']
end

#item_idObject


156
157
158
# File 'lib/offsite_payments/integrations/web_pay.rb', line 156

def item_id
  params['site_order_id']
end

#secretObject


172
173
174
# File 'lib/offsite_payments/integrations/web_pay.rb', line 172

def secret
  @options[:secret]
end

#security_keyObject


160
161
162
# File 'lib/offsite_payments/integrations/web_pay.rb', line 160

def security_key
  params[OffsitePayments::Integrations::WebPay.signature_parameter_name]
end

#statusObject


168
169
170
# File 'lib/offsite_payments/integrations/web_pay.rb', line 168

def status
  'success'
end

#success_response(*args) ⇒ Object


180
181
182
# File 'lib/offsite_payments/integrations/web_pay.rb', line 180

def success_response(*args)
  {:nothing => true}
end