class Avangate::Notification

Public Class Methods

new(params) click to toggle source
# File lib/avangate/notification.rb, line 5
def initialize(params)
  @ipn_pid0 = params[:IPN_PID].first
  @ipn_pname0 = params[:IPN_PNAME].first
  @date = params[:IPN_DATE]
end

Public Instance Methods

generate_receipt() click to toggle source
# File lib/avangate/notification.rb, line 11
def generate_receipt
  "<EPAYMENT>#{@date}|#{hash}</EPAYMENT>"
end

Private Instance Methods

data_for_hash() click to toggle source
# File lib/avangate/notification.rb, line 22
def data_for_hash
  values = [@ipn_pid0, @ipn_pname0, @date, @date]
  str = ""
  values.each do |value|
    str << value.size.to_s + value.to_s
  end
  str
end
hash() click to toggle source
# File lib/avangate/notification.rb, line 18
def hash
  OpenSSL::HMAC.hexdigest  OpenSSL::Digest.new('md5'), secret_key, data_for_hash
end
secret_key() click to toggle source
# File lib/avangate/notification.rb, line 31
def secret_key
  Avangate::Base.secret_key
end