Sha256: 710194d9a63d1cd8ed1da07d7624951c5694a3bfc876eaca81c1ae1668e3f046
Contents?: true
Size: 798 Bytes
Versions: 19
Compression:
Stored size: 798 Bytes
Contents
module Pay module Stripe module Webhooks class SubscriptionRenewing def call(event) # Event is of type "invoice" see: # https://stripe.com/docs/api/invoices/object subscription = Pay.subscription_model.find_by( processor: :stripe, processor_id: event.data.object.subscription ) date = Time.zone.at(event.data.object.next_payment_attempt) notify_user(subscription.owner, subscription, date) if subscription.present? end def notify_user(billable, subscription, date) if Pay.send_emails Pay::UserMailer.with(billable: billable, subscription: subscription, date: date).subscription_renewing.deliver_later end end end end end end
Version data entries
19 entries across 18 versions & 1 rubygems