summaryrefslogtreecommitdiff
path: root/app/services/solidus_subscriptions/dispatcher.rb
blob: f52745d8c799c3521ddaa4b52e4e2c84e44a62d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module SolidusSubscriptions
  class Dispatcher
    attr_reader :installments, :order

    # Get a new instance of the FailureDispatcher
    #
    # @param installments [Array<SolidusSubscriptions::Installment>] The
    #   installments which have failed to be fulfilled
    #
    # @return [SolidusSubscriptions::FailureDispatcher]
    def initialize(installments, order = nil)
      @installments = installments
      @order = order
    end

    def dispatch
      notify
    end

    private

    def notify
      Rails.logger.tagged('Event') do
        Rails.logger.info message.squish.tr("\n", ' ')
      end
    end

    def message
      raise 'A message should be set in subclasses of Dispatcher'
    end
  end
end