class OffsitePayments::Integrations::Liqpay::Return

Public Class Methods

new(post) click to toggle source
Calls superclass method OffsitePayments::Return::new
# File lib/offsite_payments/integrations/liqpay.rb, line 144
def initialize(post)
  super
  xml = Base64.decode64(@params["operation_xml"])
  @params.merge!(Hash.from_xml(xml)["response"])
end
recognizes?(params) click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 140
def self.recognizes?(params)
  params.has_key?('amount') && params.has_key?('order_id')
end

Public Instance Methods

account() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 154
def account
  params['merchant_id']
end
acknowledge(authcode = nil) click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 210
def acknowledge(authcode = nil)
  security_key == generate_signature
end
action_name() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 170
def action_name
  params['action_name'] # either 'result_url' or 'server_url'
end
amount() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 158
def amount
  BigDecimal.new(gross)
end
code() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 198
def code
  params['code']
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 150
def complete?
  status == 'success'
end
currency() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 190
def currency
  params['currency']
end
generate_signature() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 206
def generate_signature
  Base64.encode64(Digest::SHA1.digest(generate_signature_string)).gsub(/\n/, '')
end
generate_signature_string() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 202
def generate_signature_string
  ['', version, @options[:secret], action_name, sender_phone, account, gross, currency, item_id, transaction_id, status, code, ''].flatten.compact.join('|')
end
gross() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 186
def gross
  params['amount']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 162
def item_id
  params['order_id']
end
security_key() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 182
def security_key
  params[OffsitePayments::Integrations::Liqpay.signature_parameter_name]
end
sender_phone() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 178
def sender_phone
  params['sender_phone']
end
status() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 194
def status
  params['status'] # 'success', 'failure' or 'wait_secure'
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 166
def transaction_id
  params['transaction_id']
end
version() click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 174
def version
  params['version']
end