summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2021-01-20 10:50:50 +0100
committerAlessandro Desantis <desa.alessandro@gmail.com>2021-01-30 15:23:41 +0100
commitce4edc06e6079d8c098f1d0754e3c8e31b355e2d (patch)
tree064f3682b13e2a67768314802859f6b2b546abfd /lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb
parent58972478854a4f8f137506591a186a4d528900b9 (diff)
Move all business logic to `lib`
It wasn't clear why certain business logic should live in `app/services` while other should live in `lib`. By unifying everything in one directory, we make it easier for developers to inspect the code and reduce the cognitive load when implementing new classes.
Diffstat (limited to 'lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb')
-rw-r--r--lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb b/lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb
new file mode 100644
index 0000000..54f8f2b
--- /dev/null
+++ b/lib/solidus_subscriptions/dispatcher/failure_dispatcher.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module SolidusSubscriptions
+ module Dispatcher
+ class FailureDispatcher < Base
+ def dispatch
+ order.touch(:completed_at)
+ order.cancel
+ installment.failed!(order)
+ end
+ end
+ end
+end