summaryrefslogtreecommitdiff
path: root/app/services/solidus_subscriptions/out_of_stock_dispatcher.rb
blob: 811e8ebee27a4d35e91dff040a2e1cad1f6b8746 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# This service class is intended to provide callback behaviour to handle
# the case where an installment cannot be processed due to lack of stock.
module SolidusSubscriptions
  class OutOfStockDispatcher < Dispatcher
    def dispatch
      installments.each(&:out_of_stock)
      super
    end

    private

    def message
      "
      The following installments cannot be fulfilled due to lack of stock:
      #{installments.map(&:id).join(', ')}.
      "
    end
  end
end