Class: ActiveMerchant::Billing::Integrations::Paydollar::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/paydollar/notification.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

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

Constructor Details

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

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/active_merchant/billing/integrations/paydollar/notification.rb', line 37

def acknowledge(authcode = nil)
  # paydollar supports multiple signature keys, therefore we need to check if any
  # of their signatures match ours
  hash = @params['secureHash']
  if !hash
    return false
  end
  hash.split(',').include? generate_secure_hash
end

#complete?Boolean

Returns:

  • (Boolean)


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

def complete?
  status == 'Completed'
end

#currencyObject



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

def currency
  CURRENCY_MAP.key(@params['Cur'])
end

#grossObject



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

def gross
  @params['Amt']
end

#item_idObject



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

def item_id
  @params['Ref']
end

#statusObject



30
31
32
33
34
35
# File 'lib/active_merchant/billing/integrations/paydollar/notification.rb', line 30

def status
  case @params['successcode']
    when '0' then 'Completed'
    else 'Failed'
  end
end

#transaction_idObject



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

def transaction_id
  @params['PayRef']
end