class OffsitePayments::Integrations::DirecPay::Notification

Constants

RESPONSE_PARAMS

Public Instance Methods

acknowledge(authcode = nil) click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 227
def acknowledge(authcode = nil)
  true
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 231
def complete?
  status == 'Completed' || status == 'Pending'
end
country() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 265
def country
  params['Country']
end
currency() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 261
def currency
  params['Currency']
end
gross() click to toggle source

the money amount we received in X.2 decimal

# File lib/offsite_payments/integrations/direc_pay.rb, line 257
def gross
  params['Amount']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 248
def item_id
  params['Merchant Order No']
end
other_details() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 269
def other_details
  params['Other Details']
end
parse(post) click to toggle source

Take the posted data and move the relevant data into a hash

Calls superclass method OffsitePayments::Notification#parse
# File lib/offsite_payments/integrations/direc_pay.rb, line 278
def parse(post)
  super

  values = params['responseparams'].to_s.split('|')
  response_params = values.size == 3 ? ['DirecPay Reference ID', 'Flag', 'Error message'] : RESPONSE_PARAMS
  response_params.each_with_index do |name, index|
    params[name] = values[index]
  end
  params
end
status() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 235
def status
  case params['Flag']
  when 'SUCCESS'
    'Completed'
  when 'PENDING'
    'Pending'
  when 'FAIL'
    'Failed'
  else
    'Error'
  end
end
test?() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 273
def test?
  false
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/direc_pay.rb, line 252
def transaction_id
  params['DirecPay Reference ID']
end