Class: ActiveMerchant::Billing::Integrations::Robokassa::Notification

Inherits:
Notification
  • Object
show all
Includes:
Common
Defined in:
lib/active_merchant/billing/integrations/robokassa/notification.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, #test?, #valid_sender?

Constructor Details

This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification

Class Method Details

.recognizes?(params) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 8

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

Instance Method Details

#acknowledgeObject



44
45
46
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 44

def acknowledge
  security_key == generate_signature
end

#amountObject



16
17
18
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 16

def amount
  BigDecimal.new(gross)
end

#complete?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 12

def complete?
  true
end

#grossObject



28
29
30
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 28

def gross
  params['OutSum']
end

#item_idObject



20
21
22
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 20

def item_id
  params['InvId']
end

#main_paramsObject



40
41
42
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 40

def main_params
  [gross, item_id]
end

#secretObject



36
37
38
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 36

def secret
  @options[:secret]
end

#security_keyObject



24
25
26
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 24

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

#statusObject



32
33
34
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 32

def status
  'success'
end

#success_response(*args) ⇒ Object



48
49
50
# File 'lib/active_merchant/billing/integrations/robokassa/notification.rb', line 48

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