summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-10-09 14:04:03 +0200
committerAlessandro Desantis <desa.alessandro@gmail.com>2020-10-09 14:04:15 +0200
commitd0d2abca6c2f3c57ed16087a816d2638134208d8 (patch)
tree6f2136e2c5c2ddce2c4ff2c9a03a4c37aceb1cc2 /app/services
parent3c510ab78a18d9fd747ae0946dfa63807d439e91 (diff)
Fire events for subscription installment processing
Diffstat (limited to 'app/services')
-rw-r--r--app/services/solidus_subscriptions/payment_failed_dispatcher.rb6
-rw-r--r--app/services/solidus_subscriptions/success_dispatcher.rb6
2 files changed, 12 insertions, 0 deletions
diff --git a/app/services/solidus_subscriptions/payment_failed_dispatcher.rb b/app/services/solidus_subscriptions/payment_failed_dispatcher.rb
index 562992b..29eb291 100644
--- a/app/services/solidus_subscriptions/payment_failed_dispatcher.rb
+++ b/app/services/solidus_subscriptions/payment_failed_dispatcher.rb
@@ -9,6 +9,12 @@ module SolidusSubscriptions
installments.each do |installment|
installment.payment_failed!(order)
end
+
+ ::Spree::Event.fire(
+ 'solidus_subscriptions.installments_failed_payment',
+ installments: installments,
+ order: order,
+ )
end
end
end
diff --git a/app/services/solidus_subscriptions/success_dispatcher.rb b/app/services/solidus_subscriptions/success_dispatcher.rb
index 4ac5e94..ce55266 100644
--- a/app/services/solidus_subscriptions/success_dispatcher.rb
+++ b/app/services/solidus_subscriptions/success_dispatcher.rb
@@ -7,6 +7,12 @@ module SolidusSubscriptions
installments.each do |installment|
installment.success!(order)
end
+
+ ::Spree::Event.fire(
+ 'solidus_subscriptions.installments_succeeded',
+ installments: installments,
+ order: order,
+ )
end
end
end