Class: OffsitePayments::Integrations::Paydollar::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/paydollar.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

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

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



110
111
112
113
114
115
116
117
118
# File 'lib/offsite_payments/integrations/paydollar.rb', line 110

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)


83
84
85
# File 'lib/offsite_payments/integrations/paydollar.rb', line 83

def complete?
  status == 'Completed'
end

#currencyObject



91
92
93
# File 'lib/offsite_payments/integrations/paydollar.rb', line 91

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

#grossObject



95
96
97
# File 'lib/offsite_payments/integrations/paydollar.rb', line 95

def gross
  @params['Amt']
end

#item_idObject



87
88
89
# File 'lib/offsite_payments/integrations/paydollar.rb', line 87

def item_id
  @params['Ref']
end

#statusObject



103
104
105
106
107
108
# File 'lib/offsite_payments/integrations/paydollar.rb', line 103

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

#transaction_idObject



99
100
101
# File 'lib/offsite_payments/integrations/paydollar.rb', line 99

def transaction_id
  @params['PayRef']
end