class OffsitePayments::Integrations::Verkkomaksut::Notification

Public Instance Methods

acknowledge(authcode = nil) click to toggle source

Acknowledges the payment. If the authcodes match, returns true.

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 128
def acknowledge(authcode = nil)
  return_authcode = [params["ORDER_NUMBER"], params["TIMESTAMP"], params["PAID"], params["METHOD"], authcode].join("|")
  Digest::MD5.hexdigest(return_authcode).upcase == params["RETURN_AUTHCODE"]
end
complete?() click to toggle source

Is the payment complete or not. Verkkomaksut only has two statuses: random string or 0000000000 which means pending

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 94
def complete?
  params['PAID'] != "0000000000"
end
method() click to toggle source

Payment method used

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 104
def method
  params['METHOD']
end
order_id() click to toggle source

Order id

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 99
def order_id
  params['ORDER_NUMBER']
end
received_at() click to toggle source

When was this payment received by the client.

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 109
def received_at
  params['TIMESTAMP']
end
security_key() click to toggle source

Security key got from Verkkomaksut

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 114
def security_key
  params['RETURN_AUTHCODE']
end
status() click to toggle source

Another way of asking the payment status

# File lib/offsite_payments/integrations/verkkomaksut.rb, line 119
def status
  if complete?
    "PAID"
  else
    "PENDING"
  end
end

Private Instance Methods

parse(post) click to toggle source
# File lib/offsite_payments/integrations/verkkomaksut.rb, line 135
def parse(post)
  post.each do |key, value|
    params[key] = value
  end
end