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



140
141
142
143
144
145
146
147
148
# File 'lib/offsite_payments/integrations/paydollar.rb', line 140

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)


113
114
115
# File 'lib/offsite_payments/integrations/paydollar.rb', line 113

def complete?
  status == 'Completed'
end

#currencyObject



121
122
123
# File 'lib/offsite_payments/integrations/paydollar.rb', line 121

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

#grossObject



125
126
127
# File 'lib/offsite_payments/integrations/paydollar.rb', line 125

def gross
  @params['Amt']
end

#item_idObject



117
118
119
# File 'lib/offsite_payments/integrations/paydollar.rb', line 117

def item_id
  @params['Ref']
end

#statusObject



133
134
135
136
137
138
# File 'lib/offsite_payments/integrations/paydollar.rb', line 133

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

#transaction_idObject



129
130
131
# File 'lib/offsite_payments/integrations/paydollar.rb', line 129

def transaction_id
  @params['PayRef']
end