Methods
Included Modules
Attributes
| [R] | event |
Class Public methods
events() Link
Source: show
# File app/lib/stripe/event_handlers/customer_subscription_deleted.rb, line 9 def events ["customer.subscription.deleted"] end
new(event) Link
Source: show
# File app/lib/stripe/event_handlers/customer_subscription_deleted.rb, line 14 def initialize(event) @event = event end
Instance Public methods
call() Link
Source: show
# File app/lib/stripe/event_handlers/customer_subscription_deleted.rb, line 18 def call return unless self.class.events.include?(event.type) if subscription member = subscription.member manager = Service::SubscriptionManager.new(subscription: subscription) if canceled_reason != subscription.canceled_reason ::Dispatch.track( model: member, action: :plan_removed, title: "Unsubscribed from #{subscription.plan.name}", details: { plan_type: subscription.plan.plan_type, plan_id: subscription.plan.id, reason: canceled_reason, performed_by: "Stripe" } ) end subscription.update(canceled_reason: canceled_reason, status: stripe_subscription.status) if member.site.memberspace? ::TransactionFeeUpdatorJob.perform_later(member_id: member.id) end manager.send_cancelation_emails ::Service::PlanMembershipDeletor.new(subscription.plan, member).fire_events ::Service::Mixpanel.track(:canceled_plan, member: member, plan: subscription.plan, trialing: event.data.object.trial_end.present?) end ::Api::DeletedSubscriptionHandlerJob.perform_later(stripe_subscription:) end