Class: OffsitePayments::Integrations::Paysbuy::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/paysbuy.rb

Constant Summary collapse

SUCCESS =
'00'
FAIL =
'99'
PENDING =
'02'

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #gross, #gross_cents, #initialize, #iso_currency, #test?, #valid_sender?

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



65
66
67
# File 'lib/offsite_payments/integrations/paysbuy.rb', line 65

def acknowledge(authcode = nil)
  true
end

#complete?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/offsite_payments/integrations/paysbuy.rb', line 43

def complete?
  status == 'Completed'
end

#item_idObject



47
48
49
# File 'lib/offsite_payments/integrations/paysbuy.rb', line 47

def item_id
  params['result'][2..-1]
end

#statusObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/offsite_payments/integrations/paysbuy.rb', line 51

def status
  status_code = params['result'][0..1]
  case status_code
  when SUCCESS
    'Completed'
  when FAIL
    'Failed'
  when PENDING
    'Pending'
  else
    raise "Unknown status code"
  end
end