summaryrefslogtreecommitdiff
path: root/app/subscribers/solidus_subscriptions
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-10-05 16:42:03 +0200
committerGitHub <noreply@github.com>2020-10-05 16:42:03 +0200
commit26c3495544dd8a534bbe410279b70b42dba310c8 (patch)
treee7520929521efc4e93abb42516d504da3d1761d1 /app/subscribers/solidus_subscriptions
parentfa5876cca9cabd3cf78ae16809a19f3ebab4bfb9 (diff)
parent91ab2cc5a068d3dce01ec20b256d9bd540e4d055 (diff)
Merge pull request #156 from solidusio-contrib/aldesantis/additional-events
Track additional events for subscription updates
Diffstat (limited to 'app/subscribers/solidus_subscriptions')
-rw-r--r--app/subscribers/solidus_subscriptions/event_storage_subscriber.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/subscribers/solidus_subscriptions/event_storage_subscriber.rb b/app/subscribers/solidus_subscriptions/event_storage_subscriber.rb
index 1a6ec7c..93b5ba5 100644
--- a/app/subscribers/solidus_subscriptions/event_storage_subscriber.rb
+++ b/app/subscribers/solidus_subscriptions/event_storage_subscriber.rb
@@ -9,6 +9,9 @@ module SolidusSubscriptions
event_action :track_subscription_canceled, event_name: 'solidus_subscriptions.subscription_canceled'
event_action :track_subscription_ended, event_name: 'solidus_subscriptions.subscription_ended'
event_action :track_subscription_repopulated, event_name: 'solidus_subscriptions.subscription_repopulated'
+ event_action :track_subscription_shipping_address_changed, event_name: 'solidus_subscriptions.subscription_shipping_address_changed'
+ event_action :track_subscription_billing_address_changed, event_name: 'solidus_subscriptions.subscription_billing_address_changed'
+ event_action :track_subscription_frequency_changed, event_name: 'solidus_subscriptions.subscription_frequency_changed'
def track_subscription_created(event)
event.payload.fetch(:subscription).events.create!(
@@ -44,5 +47,26 @@ module SolidusSubscriptions
details: event.payload.fetch(:subscription).as_json,
)
end
+
+ def track_subscription_shipping_address_changed(event)
+ event.payload.fetch(:subscription).events.create!(
+ event_type: 'subscription_shipping_address_changed',
+ details: event.payload.fetch(:subscription).as_json,
+ )
+ end
+
+ def track_subscription_billing_address_changed(event)
+ event.payload.fetch(:subscription).events.create!(
+ event_type: 'subscription_billing_address_changed',
+ details: event.payload.fetch(:subscription).as_json,
+ )
+ end
+
+ def track_subscription_frequency_changed(event)
+ event.payload.fetch(:subscription).events.create!(
+ event_type: 'subscription_frequency_changed',
+ details: event.payload.fetch(:subscription).as_json,
+ )
+ end
end
end