Class: OffsitePayments::Integrations::Robokassa::Notification

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

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#generate_signature, #generate_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


98
99
100
# File 'lib/offsite_payments/integrations/robokassa.rb', line 98

def self.recognizes?(params)
  params.has_key?('InvId') && params.has_key?('OutSum')
end

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object


134
135
136
# File 'lib/offsite_payments/integrations/robokassa.rb', line 134

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

#amountObject


106
107
108
# File 'lib/offsite_payments/integrations/robokassa.rb', line 106

def amount
  BigDecimal.new(gross)
end

#complete?Boolean


102
103
104
# File 'lib/offsite_payments/integrations/robokassa.rb', line 102

def complete?
  true
end

#grossObject


118
119
120
# File 'lib/offsite_payments/integrations/robokassa.rb', line 118

def gross
  params['OutSum']
end

#item_idObject


110
111
112
# File 'lib/offsite_payments/integrations/robokassa.rb', line 110

def item_id
  params['InvId']
end

#main_paramsObject


130
131
132
# File 'lib/offsite_payments/integrations/robokassa.rb', line 130

def main_params
  [gross, item_id]
end

#secretObject


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

def secret
  @options[:secret]
end

#security_keyObject


114
115
116
# File 'lib/offsite_payments/integrations/robokassa.rb', line 114

def security_key
  params[OffsitePayments::Integrations::Robokassa.signature_parameter_name].to_s.downcase
end

#statusObject


122
123
124
# File 'lib/offsite_payments/integrations/robokassa.rb', line 122

def status
  'success'
end

#success_response(*args) ⇒ Object


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

def success_response(*args)
  "OK#{item_id}"
end