Class: Payola::SubscriptionDeleted

Inherits:
Object
  • Object
show all
Defined in:
app/services/payola/subscription_deleted.rb

Class Method Summary collapse

Class Method Details

.call(event) ⇒ Object



3
4
5
6
7
8
9
# File 'app/services/payola/subscription_deleted.rb', line 3

def self.call(event)
  stripe_sub = event.data.object

  sub = Payola::Subscription.find_by!(stripe_id: stripe_sub.id)

  sub.cancel! if sub.may_cancel?
end