Class: AdyenNotification
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AdyenNotification
- Defined in:
- lib/adyen/templates/notification_model.rb
Overview
The AdyenNotification
class handles notifications sent by Adyen to your servers.
Because notifications contain important payment status information, you should store these notifications in your database. For this reason, AdyenNotification
inherits from ActiveRecord::Base
, and a migration is included to simply create a suitable table to store the notifications in.
Adyen can either send notifications to you via HTTP POST requests, or SOAP requests. Because SOAP is not really well supported in Rails and setting up a SOAP server is not trivial, only handling HTTP POST notifications is currently supported.
Class Method Summary collapse
-
.log(params) ⇒ Adyen::Notification
Logs an incoming notification into the database.
Instance Method Summary collapse
-
#authorisation? ⇒ true, false
(also: #authorization?)
Returns true if this notification is an AUTHORISATION notification.
-
#successful_authorisation? ⇒ true, false
(also: #successful_authorization?)
Returns true if this notification is an AUTHORISATION notification and the success status indicates that the authorization was successfull.
Class Method Details
.log(params) ⇒ Adyen::Notification
Logs an incoming notification into the database.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/adyen/templates/notification_model.rb', line 38 def self.log(params) # Assign explicit each attribute from CamelCase notation to notification # For example, merchantReference will be converted to merchant_reference self.new.tap do |notification| params.each do |key, value| setter = "#{key.to_s.underscore}=" notification.send(setter, value) if notification.respond_to?(setter) end notification.save! end end |
Instance Method Details
#authorisation? ⇒ true, false Also known as:
Returns true if this notification is an AUTHORISATION notification
54 55 56 |
# File 'lib/adyen/templates/notification_model.rb', line 54 def event_code == 'AUTHORISATION' end |
#successful_authorisation? ⇒ true, false Also known as:
Returns true if this notification is an AUTHORISATION notification and the success status indicates that the authorization was successfull.
64 65 66 |
# File 'lib/adyen/templates/notification_model.rb', line 64 def && success? end |