class OffsitePayments::Integrations::Paydollar::Notification

Public Instance Methods

acknowledge(authcode = nil) click to toggle source
# 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?() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 83
def complete?
  status == 'Completed'
end
currency() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 91
def currency
  CURRENCY_MAP.key(@params['Cur'])
end
gross() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 95
def gross
  @params['Amt']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 87
def item_id
  @params['Ref']
end
status() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 103
def status
  case @params['successcode']
    when '0' then 'Completed'
    else 'Failed'
  end
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 99
def transaction_id
  @params['PayRef']
end

Private Instance Methods

generate_secure_hash() click to toggle source
# File lib/offsite_payments/integrations/paydollar.rb, line 122
def generate_secure_hash
  fields = [@params['src'],
            @params['prc'],
            @params['successcode'],
            @params['Ref'],
            @params['PayRef'],
            @params['Cur'],
            @params['Amt'],
            @params['payerAuth']]
  Paydollar.sign(fields, @options[:credential2])
end