Class: MerbMerchant::Billing::Integrations::HiTrust::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/merb_merchant/billing/integrations/hi_trust/notification.rb

Constant Summary collapse

SUCCESS =
'00'

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #initialize, #valid_sender?

Constructor Details

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

Instance Method Details

#accountObject



40
41
42
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 40

def 
  params['storeid']
end

#acknowledgeObject



52
53
54
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 52

def acknowledge      
  true
end

#complete?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 12

def complete?
  status == 'Completed'
end

#currencyObject



28
29
30
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 28

def currency
  params['currency']
end

#grossObject



32
33
34
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 32

def gross
  sprintf("%.2f", gross_cents.to_f / 100)
end

#gross_centsObject



36
37
38
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 36

def gross_cents
  params['approveamount'].to_i
end

#item_idObject



20
21
22
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 20

def item_id
  params['ordernumber']
end

#received_atObject



24
25
26
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 24

def received_at
  Time.parse(params['orderdate']) rescue nil
end

#statusObject



44
45
46
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 44

def status
  params['retcode'] == SUCCESS ? 'Completed' : 'Failed'
end

#test?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 48

def test?
  MerbMerchant::Billing::Base.integration_mode == :test
end

#transaction_idObject



16
17
18
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 16

def transaction_id
  params['authRRN']
end