summaryrefslogtreecommitdiff
path: root/app/jobs/solidus_subscriptions/process_installments_job.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/jobs/solidus_subscriptions/process_installments_job.rb')
-rw-r--r--app/jobs/solidus_subscriptions/process_installments_job.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/jobs/solidus_subscriptions/process_installments_job.rb b/app/jobs/solidus_subscriptions/process_installments_job.rb
new file mode 100644
index 0000000..6d4cc8f
--- /dev/null
+++ b/app/jobs/solidus_subscriptions/process_installments_job.rb
@@ -0,0 +1,19 @@
+# This job is responsible for creating a consolidated installment from a
+# list of installments and processing it.
+
+module SolidusSubscriptions
+ class ProcessInstallmentsJob < ActiveJob::Base
+ queue_as Config.processing_queue
+
+ # Process a collection of installments
+ #
+ # @param [Array<SolidusSubscriptions::Installment>] :installments, The
+ # installments to be processed together and fulfilled by the same order
+ #
+ # @return [Spree::Order] The order which fulfills the list of installments
+ def perform(installments)
+ return if installments.empty?
+ ConsolidatedInstallment.new(installments).process
+ end
+ end
+end