class OffsitePayments::Integrations::Epay::Notification

Constants

CURRENCY_CODES

Public Instance Methods

acknowledge() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 151
def acknowledge
  generate_md5hash == params['hash']
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 100
def complete?
  Integer(transaction_id) > 0
end
currency() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 134
def currency
  CURRENCY_CODES.invert[params['currency']].to_s
end
generate_md5hash() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 147
def generate_md5hash
  Digest::MD5.hexdigest(generate_md5string)
end
generate_md5string() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 138
def generate_md5string
  md5string = String.new
  for line in @raw.split('&')
    key, _ = *line.scan( %r{^([A-Za-z0-9_.]+)\=(.*)$} ).flatten
    md5string += params[key] if key != 'hash'
  end
  return md5string + @options[:credential3]
end
gross() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 116
def gross
  "%.2f" % (gross_cents / 100.0)
end
gross_cents() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 120
def gross_cents
  params['amount'].to_i
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 104
def item_id
  params['orderid']
end
received_at() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 112
def received_at
  Time.mktime(params['date'][0..3], params['date'][4..5], params['date'][6..7], params['time'][0..1], params['time'][2..3])
end
test?() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 124
def test?
  return false
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/epay.rb, line 108
def transaction_id
  params['txnid']
end