Class: ActiveMerchant::Billing::Integrations::Doku::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Doku::Notification
show all
- Defined in:
- lib/active_merchant/billing/integrations/doku/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #initialize, #test?, #valid_sender?
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 54
def acknowledge(authcode = nil)
case type
when 'verify'
words == Digest::SHA1.hexdigest("#{gross}#{@options[:credential2]}#{item_id}")
when 'notify'
true
else
false
end
end
|
#complete? ⇒ Boolean
11
12
13
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 11
def complete?
status.present?
end
|
#currency ⇒ Object
32
33
34
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 32
def currency
'IDR'
end
|
#gross ⇒ Object
19
20
21
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 19
def gross
params['AMOUNT']
end
|
#item_id ⇒ Object
15
16
17
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 15
def item_id
params['TRANSIDMERCHANT']
end
|
#status ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 23
def status
case params['RESULT']
when 'Success'
'Completed'
when 'Fail'
'Failed'
end
end
|
#transaction_id ⇒ Object
no unique ID is generated by Doku at any point in the process, so use the same as the original order number.
50
51
52
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 50
def transaction_id
params['TRANSIDMERCHANT']
end
|
#type ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 40
def type
if words && params['STOREID']
'verify'
elsif status
'notify'
end
end
|
#words ⇒ Object
36
37
38
|
# File 'lib/active_merchant/billing/integrations/doku/notification.rb', line 36
def words
params['WORDS']
end
|