summaryrefslogtreecommitdiff
path: root/app/models/solidus_subscriptions/failure_dispatcher.rb
blob: 13e15b657e3624ec02dd21664821855bba64a6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# A handler for behaviour that should happen after installments are marked as
# failures
module SolidusSubscriptions
  class FailureDispatcher < Dispatcher
    def dispatch
      order.touch :completed_at
      order.cancel!
      installments.each { |i| i.failed!(order) }
      super
    end

    def message
      "
      Something went wrong processing installments: #{installments.map(&:id).join(', ')}.
      They have been marked for reprocessing.
      "
    end
  end
end