Sha256: 7e4629205f2272e54c21ae8d5e8b795cd3e21b63ffc830b0d9c302922520c3fa
Contents?: true
Size: 666 Bytes
Versions: 32
Compression:
Stored size: 666 Bytes
Contents
module Pay module Stripe module Webhooks class SubscriptionDeleted def call(event) object = event.data.object subscription = Pay.subscription_model.find_by(processor: :stripe, processor_id: object.id) # We couldn't find the subscription for some reason, maybe it's from another service return if subscription.nil? # User canceled subscriptions have an ends_at # Automatically canceled subscriptions need this value set subscription.update!(ends_at: Time.at(object.ended_at)) if subscription.ends_at.blank? && object.ended_at.present? end end end end end
Version data entries
32 entries across 31 versions & 1 rubygems