Class: OffsitePayments::Integrations::HiTrust::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/hi_trust.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, #iso_currency, #valid_sender?

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#accountObject



100
101
102
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 100

def 
  params['storeid']
end

#acknowledgeObject



112
113
114
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 112

def acknowledge
  true
end

#complete?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 72

def complete?
  status == 'Completed'
end

#currencyObject



88
89
90
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 88

def currency
  params['currency']
end

#grossObject



92
93
94
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 92

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

#gross_centsObject



96
97
98
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 96

def gross_cents
  params['approveamount'].to_i
end

#item_idObject



80
81
82
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 80

def item_id
  params['ordernumber']
end

#received_atObject



84
85
86
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 84

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

#statusObject



104
105
106
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 104

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

#test?Boolean

Returns:

  • (Boolean)


108
109
110
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 108

def test?
  OffsitePayments.mode == :test
end

#transaction_idObject



76
77
78
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 76

def transaction_id
  params['authRRN']
end