Class: OffsitePayments::Integrations::HiTrust::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::HiTrust::Notification
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
#amount, #empty!, #initialize, #iso_currency, #valid_sender?
Instance Method Details
#account ⇒ Object
100
101
102
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 100
def account
params['storeid']
end
|
#acknowledge ⇒ Object
112
113
114
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 112
def acknowledge
true
end
|
#complete? ⇒ Boolean
72
73
74
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 72
def complete?
status == 'Completed'
end
|
#currency ⇒ Object
88
89
90
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 88
def currency
params['currency']
end
|
#gross ⇒ Object
92
93
94
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 92
def gross
sprintf("%.2f", gross_cents.to_f / 100)
end
|
#gross_cents ⇒ Object
96
97
98
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 96
def gross_cents
params['approveamount'].to_i
end
|
#item_id ⇒ Object
80
81
82
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 80
def item_id
params['ordernumber']
end
|
#received_at ⇒ Object
84
85
86
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 84
def received_at
Time.parse(params['orderdate']) rescue nil
end
|
#status ⇒ Object
104
105
106
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 104
def status
params['retcode'] == SUCCESS ? 'Completed' : 'Failed'
end
|
#test? ⇒ Boolean
108
109
110
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 108
def test?
OffsitePayments.mode == :test
end
|
#transaction_id ⇒ Object
76
77
78
|
# File 'lib/offsite_payments/integrations/hi_trust.rb', line 76
def transaction_id
params['authRRN']
end
|