Class: ActiveMerchant::Billing::Integrations::Paysbuy::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/paysbuy/notification.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, #test?, #valid_sender?

Constructor Details

This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object



32
33
34
# File 'lib/active_merchant/billing/integrations/paysbuy/notification.rb', line 32

def acknowledge(authcode = nil)
  true
end

#complete?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/active_merchant/billing/integrations/paysbuy/notification.rb', line 10

def complete?
  status == 'Completed'
end

#item_idObject



14
15
16
# File 'lib/active_merchant/billing/integrations/paysbuy/notification.rb', line 14

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

#statusObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/active_merchant/billing/integrations/paysbuy/notification.rb', line 18

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