diff options
author | Brendan Deere <brendan@stembolt.com> | 2016-10-03 11:09:16 -0700 |
---|---|---|
committer | Brendan Deere <brendan@stembolt.com> | 2016-10-04 13:15:14 -0700 |
commit | 16924ab31d2aa6f899b72db887af38e28d47aedf (patch) | |
tree | 487619733e28220188ec7733690e097638b4403e /lib | |
parent | 7bfab225891d513b260d947b0c85afc915102256 (diff) |
Processor advances actionable dates
When an installment is created for a subscrption, the subscription
should have its actionable date advanced.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/solidus_subscriptions/processor.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/solidus_subscriptions/processor.rb b/lib/solidus_subscriptions/processor.rb index 97b39df..f95e16f 100644 --- a/lib/solidus_subscriptions/processor.rb +++ b/lib/solidus_subscriptions/processor.rb @@ -80,7 +80,12 @@ module SolidusSubscriptions end def new_installments(user) - subscriptions_by_id.fetch(user.id, []).map { |sub| sub.installments.create! } + subscriptions_by_id.fetch(user.id, []).map do |sub| + ActiveRecord::Base.transaction do + sub.advance_actionable_date + sub.installments.create! + end + end end def user_ids |