Class: OffsitePayments::Integrations::RealexOffsite::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::RealexOffsite::Notification
show all
- Includes:
- Common
- Defined in:
- lib/offsite_payments/integrations/realex_offsite.rb
Constant Summary
Constants included
from Common
Common::CURRENCY_SPECIAL_MINOR_UNITS
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
Methods included from Common
#create_signature, #extract_avs_code, #extract_digits, #format_amount, #format_amount_as_float
#amount, #empty!, #gross_cents, #iso_currency, #valid_sender?
Constructor Details
#initialize(post, options = {}) ⇒ Notification
Returns a new instance of Notification.
174
175
176
177
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 174
def initialize(post, options={})
super
@secret = options[:credential3]
end
|
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
Required Notification methods to define
180
181
182
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 180
def acknowledge(authcode = nil)
verified?
end
|
#authcode ⇒ Object
247
248
249
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 247
def authcode
params['AUTHCODE']
end
|
#avs_address_result ⇒ Object
273
274
275
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 273
def avs_address_result
params['AVSADDRESSRESULT']
end
|
#avs_postcode_result ⇒ Object
269
270
271
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 269
def avs_postcode_result
params['AVSPOSTCODERESULT']
end
|
#calculated_signature ⇒ Object
255
256
257
258
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 255
def calculated_signature
fields = [timestamp, merchant_id, order_id, result, message, pasref, authcode]
create_signature(fields, @secret)
end
|
#cavv ⇒ Object
285
286
287
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 285
def cavv
params['CAVV']
end
|
#checkout_id ⇒ Object
227
228
229
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 227
def checkout_id
params['CHECKOUT_ID']
end
|
#complete? ⇒ Boolean
214
215
216
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 214
def complete?
verified? && status == 'Completed'
end
|
#currency ⇒ Object
Realex does not send back the currency param by default we have sent this additional parameter
206
207
208
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 206
def currency
params['X-CURRENCY']
end
|
#cvn_result ⇒ Object
Extra data (available from Realex)
265
266
267
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 265
def cvn_result
params['CVNRESULT']
end
|
#eci ⇒ Object
281
282
283
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 281
def eci
params['ECI']
end
|
#gross ⇒ Object
210
211
212
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 210
def gross
format_amount_as_float(params['AMOUNT'], currency)
end
|
#item_id ⇒ Object
184
185
186
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 184
def item_id
checkout_id
end
|
#merchant_id ⇒ Object
223
224
225
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 223
def merchant_id
params['MERCHANT_ID']
end
|
#message ⇒ Object
239
240
241
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 239
def message
params['MESSAGE']
end
|
#order_id ⇒ Object
231
232
233
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 231
def order_id
params['ORDER_ID']
end
|
#pasref ⇒ Object
243
244
245
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 243
def pasref
params['PASREF']
end
|
#result ⇒ Object
235
236
237
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 235
def result
params['RESULT']
end
|
#signature ⇒ Object
251
252
253
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 251
def signature
params['SHA1HASH']
end
|
#status ⇒ Object
196
197
198
199
200
201
202
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 196
def status
if result == '00'
'Completed'
else
'Invalid'
end
end
|
#test? ⇒ Boolean
192
193
194
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 192
def test?
params['X-TEST']
end
|
#timestamp ⇒ Object
Fields for Realex signature verification
219
220
221
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 219
def timestamp
params['TIMESTAMP']
end
|
#transaction_id ⇒ Object
188
189
190
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 188
def transaction_id
pasref
end
|
#verified? ⇒ Boolean
260
261
262
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 260
def verified?
signature == calculated_signature
end
|
#xid ⇒ Object
289
290
291
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 289
def xid
params['XID']
end
|