summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions/testing_support
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-11-19 13:13:46 +0100
committerAlessandro Desantis <desa.alessandro@gmail.com>2021-01-20 10:46:01 +0100
commit5081ffc17562fa90edf0f2a8dfa0d03991480362 (patch)
treec0933ca52e80bf93b73e7387d5eee1b830a8099b /lib/solidus_subscriptions/testing_support
parent69f0ca038b66d0ca36971405e51c0d3aa916cf19 (diff)
Streamline and simplify `SolidusSubscriptions::Processor`
The processor was way too complicated, taking on too many responsibilities. As a result, it was complex to reason about and it was a very brittle part of the extension. The new processor simply does two things: it finds all actionable subscriptions and ensures to take the appropriate action on them (e.g., cancel, deactivate), including creating the new installment for later. Then, it finds all the actionable installments (including the ones that were just created), and schedules them for asynchronous processing. One side effect of this refactoring is that installments are not grouped by address and payment method/source anymore: each installment will always correspond to a new order. Any logistics-related optimizations should be implemented by the individual store.
Diffstat (limited to 'lib/solidus_subscriptions/testing_support')
-rw-r--r--lib/solidus_subscriptions/testing_support/factories/installment_factory.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb b/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb
index 2eb5069..20dcc04 100644
--- a/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb
+++ b/lib/solidus_subscriptions/testing_support/factories/installment_factory.rb
@@ -21,5 +21,9 @@ FactoryBot.define do
[association(:installment_detail, :success, installment: @instance, order: order)]
end
end
+
+ trait :actionable do
+ actionable_date { Time.zone.now }
+ end
end
end