Class: MerbMerchant::Billing::Integrations::HiTrust::Notification
- Inherits:
-
Notification
- Object
- Notification
- MerbMerchant::Billing::Integrations::HiTrust::Notification
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
#amount, #empty!, #initialize, #valid_sender?
Instance Method Details
#account ⇒ Object
40
41
42
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 40
def account
params['storeid']
end
|
#acknowledge ⇒ Object
52
53
54
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 52
def acknowledge
true
end
|
#complete? ⇒ Boolean
12
13
14
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 12
def complete?
status == 'Completed'
end
|
#currency ⇒ Object
28
29
30
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 28
def currency
params['currency']
end
|
#gross ⇒ Object
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_cents ⇒ Object
36
37
38
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 36
def gross_cents
params['approveamount'].to_i
end
|
#item_id ⇒ Object
20
21
22
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 20
def item_id
params['ordernumber']
end
|
#received_at ⇒ Object
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
|
#status ⇒ Object
44
45
46
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 44
def status
params['retcode'] == SUCCESS ? 'Completed' : 'Failed'
end
|
#transaction_id ⇒ Object
16
17
18
|
# File 'lib/merb_merchant/billing/integrations/hi_trust/notification.rb', line 16
def transaction_id
params['authRRN']
end
|