summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions/processor.rb
blob: 04b84e8e2416b1e828f54f1a2d4435a586662af6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module SolidusSubscriptions
  class Processor
    class << self
      def run
        SolidusSubscriptions::Subscription
          .where(installments: SolidusSubscriptions::Installment.actionable)
          .or(SolidusSubscriptions::Subscription.actionable)
          .distinct
          .find_each do |subscription|
            ProcessSubscriptionJob.perform_later(subscription)
          end
      end
    end
  end
end