Sha256: 6eee7a4aae80da9950d98714651d2472cd6f3f626de71243609456034f9e3e1e
Contents?: true
Size: 856 Bytes
Versions: 17
Compression:
Stored size: 856 Bytes
Contents
module Spree # Base class for all types of promotion action. # # PromotionActions perform the necessary tasks when a promotion is activated # by an event and determined to be eligible. class PromotionAction < Spree::Base acts_as_paranoid belongs_to :promotion, class_name: 'Spree::Promotion' scope :of_type, ->(t) { where(type: t) } # Updates the state of the order or performs some other action depending on # the subclass options will contain the payload from the event that # activated the promotion. This will include the key :user which allows # user based actions to be performed in addition to actions on the order # # @note This method should be overriden in subclassses. def perform(_options = {}) raise 'perform should be implemented in a sub-class of PromotionAction' end end end
Version data entries
17 entries across 17 versions & 1 rubygems