Class: Pay::Stripe::Webhooks::CustomerDeleted
- Inherits:
-
Object
- Object
- Pay::Stripe::Webhooks::CustomerDeleted
- Defined in:
- lib/pay/stripe/webhooks/customer_deleted.rb
Instance Method Summary collapse
Instance Method Details
#call(event) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pay/stripe/webhooks/customer_deleted.rb', line 5 def call(event) object = event.data.object billable = Pay.find_billable(processor: :stripe, processor_id: object.id) # Couldn't find user, we can skip return unless billable.present? billable.update( processor_id: nil, trial_ends_at: nil, card_type: nil, card_last4: nil, card_exp_month: nil, card_exp_year: nil ) billable.subscriptions.update_all( trial_ends_at: nil, ends_at: Time.zone.now ) end |