class OffsitePayments::Integrations::Rbkmoney::Notification

Public Instance Methods

acknowledge(authcode = nil) click to toggle source
# File lib/offsite_payments/integrations/rbkmoney.rb, line 81
def acknowledge(authcode = nil)
  string = [
    eshop_id,
    order_id,
    service_name,
    eshop_account,
    recipient_amount,
    recipient_currency,
    payment_status,
    user_name,
    user_email,
    payment_data,
    @options[:secret]
  ].join '::'

  signature = case hash.to_s.length
  when 32
    Digest::MD5.hexdigest(string)
  when 128
    Digest::SHA512.hexdigest(string)
  else
    return false
  end

  signature == hash
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/rbkmoney.rb, line 46
def complete?
  (payment_status == '5')
end
status() click to toggle source
# File lib/offsite_payments/integrations/rbkmoney.rb, line 54
def status
  case payment_status
  when '3'
    'pending'
  when '5'
    'completed'
  else 'unknown'
  end
end
test?() click to toggle source
# File lib/offsite_payments/integrations/rbkmoney.rb, line 50
def test?
  false
end
user_fields() click to toggle source
# File lib/offsite_payments/integrations/rbkmoney.rb, line 64
def user_fields
  params.inject({}) do |fields, (k,v)|
    if /\AuserField_[\d+]\z/.match(k)
      fields[k] = v
    end
    fields
  end
end