Class: OffsitePayments::Integrations::Doku::Notification
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #initialize, #iso_currency, #test?, #valid_sender?
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/offsite_payments/integrations/doku.rb', line 155
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
112
113
114
|
# File 'lib/offsite_payments/integrations/doku.rb', line 112
def complete?
status.present?
end
|
#currency ⇒ Object
133
134
135
|
# File 'lib/offsite_payments/integrations/doku.rb', line 133
def currency
'IDR'
end
|
#gross ⇒ Object
120
121
122
|
# File 'lib/offsite_payments/integrations/doku.rb', line 120
def gross
params['AMOUNT']
end
|
#item_id ⇒ Object
116
117
118
|
# File 'lib/offsite_payments/integrations/doku.rb', line 116
def item_id
params['TRANSIDMERCHANT']
end
|
#status ⇒ Object
124
125
126
127
128
129
130
131
|
# File 'lib/offsite_payments/integrations/doku.rb', line 124
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.
151
152
153
|
# File 'lib/offsite_payments/integrations/doku.rb', line 151
def transaction_id
params['TRANSIDMERCHANT']
end
|
#type ⇒ Object
141
142
143
144
145
146
147
|
# File 'lib/offsite_payments/integrations/doku.rb', line 141
def type
if words && params['STOREID']
'verify'
elsif status
'notify'
end
end
|
#words ⇒ Object
137
138
139
|
# File 'lib/offsite_payments/integrations/doku.rb', line 137
def words
params['WORDS']
end
|