class OffsitePayments::Integrations::Liqpay::Notification
Public Class Methods
new(post, options = {})
click to toggle source
Calls superclass method
OffsitePayments::Notification::new
# File lib/offsite_payments/integrations/liqpay.rb, line 64 def initialize(post, options = {}) raise ArgumentError if post.blank? super @params.merge!(Hash.from_xml(Base64.decode64(xml))["response"]) end
recognizes?(params)
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 60 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 78 def account params['merchant_id'] end
acknowledge(authcode = nil)
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 134 def acknowledge(authcode = nil) security_key == generate_signature end
action_name()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 94 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 82 def amount BigDecimal.new(gross) end
code()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 122 def code params['code'] end
complete?()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 74 def complete? status == 'success' end
currency()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 114 def currency params['currency'] end
generate_signature()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 130 def generate_signature Base64.encode64(Digest::SHA1.digest(generate_signature_string)).strip end
generate_signature_string()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 126 def generate_signature_string "#{@options[:secret]}#{Base64.decode64(xml)}#{@options[:secret]}" end
gross()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 110 def gross params['amount'] end
item_id()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 86 def item_id params['order_id'] end
security_key()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 106 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 102 def sender_phone params['sender_phone'] end
status()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 118 def status params['status'] # 'success', 'failure' or 'wait_secure' end
transaction_id()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 90 def transaction_id params['transaction_id'] end
version()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 98 def version params['version'] end
xml()
click to toggle source
# File lib/offsite_payments/integrations/liqpay.rb, line 70 def xml @params["operation_xml"] end