Class: OffsitePayments::Integrations::CheckoutFinland::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/checkout_finland.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #gross, #gross_cents, #initialize, #iso_currency, #test?, #valid_sender?

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object

Verify authenticity of returned data



150
151
152
153
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 150

def acknowledge(authcode = nil)
  return_authcode = [params["VERSION"], params["STAMP"], params["REFERENCE"], params["PAYMENT"], params["STATUS"], params["ALGORITHM"]].join("&")
  OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), authcode, return_authcode).upcase == params["MAC"]
end

#activation?Boolean

Payment requires manual activation (fraud check etc)

Returns:

  • (Boolean)


121
122
123
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 121

def activation?
  params['STATUS'] == "7"
end

#cancelled?Boolean

Did the customer cancel the payment

Returns:

  • (Boolean)


116
117
118
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 116

def cancelled?
  params['STATUS'] == "-1"
end

#complete?Boolean

Payment can be market complete with the following status codes

Returns:

  • (Boolean)


106
107
108
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 106

def complete?
  ["2", "5", "6", "8", "9", "10"].include? params["STATUS"]
end

#delayed?Boolean

Did the customer choose delayed payment method

Returns:

  • (Boolean)


111
112
113
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 111

def delayed?
  params['STATUS'] == "3"
end

#macObject

Returned Message Authentication Code



141
142
143
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 141

def mac
  params['MAC']
end

#referenceObject

Reference specified by the client when sending payment



126
127
128
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 126

def reference
  params['REFERENCE']
end

#stampObject

Unique ID assigned by customer



136
137
138
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 136

def stamp
  params['STAMP']
end

#statusObject



145
146
147
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 145

def status
  params['STATUS']
end

#transaction_idObject

Unique ID assigned by Checkout



131
132
133
# File 'lib/offsite_payments/integrations/checkout_finland.rb', line 131

def transaction_id
  params['PAYMENT']
end