summaryrefslogtreecommitdiff
path: root/app/services/solidus_subscriptions/success_dispatcher.rb
blob: ce552662c119d4b4a37be360a11b1664a2ba9855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

# Handles installments that are processed successfully.
module SolidusSubscriptions
  class SuccessDispatcher < Dispatcher
    def dispatch
      installments.each do |installment|
        installment.success!(order)
      end

      ::Spree::Event.fire(
        'solidus_subscriptions.installments_succeeded',
        installments: installments,
        order: order,
      )
    end
  end
end