summaryrefslogtreecommitdiff
path: root/app/services/solidus_subscriptions/payment_failed_dispatcher.rb
blob: 562992b96e756b1c24214be97fb9bc41a44f3295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

# Handles payment failures for subscription installments.
module SolidusSubscriptions
  class PaymentFailedDispatcher < Dispatcher
    def dispatch
      order.touch(:completed_at)
      order.cancel
      installments.each do |installment|
        installment.payment_failed!(order)
      end
    end
  end
end