Class: ActiveMerchant::Billing::Integrations::Paxum::Notification

Inherits:
Notification
  • Object
show all
Includes:
Common
Defined in:
lib/active_merchant/billing/integrations/paxum/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

#amount, #empty!, #gross, #gross_cents, #status, #test?, #valid_sender?

Constructor Details

#initialize(post, options = {}) ⇒ Notification

Returns a new instance of Notification.



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

def initialize(post, options = {})
  @raw_post = post.dup
  post.slice!(0)
  super
end

Class Method Details

.recognizes?(params) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/active_merchant/billing/integrations/paxum/notification.rb', line 14

def self.recognizes?(params)
  (params.has_key?('transaction_item_id') && params.has_key?('transaction_amount'))
end

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



26
27
28
# File 'lib/active_merchant/billing/integrations/paxum/notification.rb', line 26

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

#secretObject



22
23
24
# File 'lib/active_merchant/billing/integrations/paxum/notification.rb', line 22

def secret
  @options[:secret]
end

#security_keyObject



18
19
20
# File 'lib/active_merchant/billing/integrations/paxum/notification.rb', line 18

def security_key
  params["key"]
end