Sha256: 6c7e049f4a664b2edc0bd61dbe1b5c015174de13e9ae5b36af2c5b906d633037
Contents?: true
Size: 830 Bytes
Versions: 17
Compression:
Stored size: 830 Bytes
Contents
module Pay module Stripe module Webhooks class PaymentActionRequired def call(event) # Event is of type "invoice" see: # https://stripe.com/docs/api/invoices/object object = event.data.object subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription) return if subscription.nil? billable = subscription.customer.owner notify_user(billable, event.data.object.payment_intent, subscription) end def notify_user(billable, payment_intent_id, subscription) if Pay.send_emails Pay::UserMailer.with(billable: billable, payment_intent_id: payment_intent_id, subscription: subscription).payment_action_required.deliver_later end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems