class OffsitePayments::Integrations::Dotpay::Notification

Constants

PAYMENT_HOOK_FIELDS
PAYMENT_HOOK_SIGNATURE_FIELDS

Public Instance Methods

acknowledge(authcode = nil) click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 157
def acknowledge(authcode = nil)
  generate_signature.to_s == md5.to_s
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 86
def complete?
  status == 'OK' && %w(2 4 5).include?(t_status)
end
currency() click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 90
def currency
  orginal_amount.split(' ')[1]
end
generate_signature() click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 153
def generate_signature
  Digest::MD5.hexdigest(generate_signature_string)
end
generate_signature_string() click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 149
def generate_signature_string
  "#{@options[:pin]}:" + PAYMENT_HOOK_SIGNATURE_FIELDS.map {|key| params[key.to_s]} * ":"
end
gross() click to toggle source

the money amount we received in X.2 decimal.

# File lib/offsite_payments/integrations/dotpay.rb, line 95
def gross
  params['amount']
end
pin=(value) click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 99
def pin=(value)
  @options[:pin] = value
end
status() click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 103
def status
  params['status']
end
test?() click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 107
def test?
  params['t_id'].match('.*-TST\d+') ? true : false
end