summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions/processor.rb
diff options
context:
space:
mode:
authorBrendan Deere <brendan@stembolt.com>2016-10-03 11:24:10 -0700
committerBrendan Deere <brendan@stembolt.com>2016-10-04 13:15:14 -0700
commite00c9c5ffa8ece1720bd8f8c7b8de8f6322c1388 (patch)
tree781564560a2827011fad67e886acf55ef4e4e3ad /lib/solidus_subscriptions/processor.rb
parent16924ab31d2aa6f899b72db887af38e28d47aedf (diff)
Processor cancels subs
If the processor processed a subscription in the pending_cancellation state, it cancels the subscription after creating one last installment for it
Diffstat (limited to 'lib/solidus_subscriptions/processor.rb')
-rw-r--r--lib/solidus_subscriptions/processor.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/solidus_subscriptions/processor.rb b/lib/solidus_subscriptions/processor.rb
index f95e16f..4c4894e 100644
--- a/lib/solidus_subscriptions/processor.rb
+++ b/lib/solidus_subscriptions/processor.rb
@@ -83,6 +83,7 @@ module SolidusSubscriptions
subscriptions_by_id.fetch(user.id, []).map do |sub|
ActiveRecord::Base.transaction do
sub.advance_actionable_date
+ sub.cancel! if sub.pending_cancellation?
sub.installments.create!
end
end