class Pay::Stripe::Webhooks::PaymentActionRequired
Public Instance Methods
call(event)
click to toggle source
# File lib/pay/stripe/webhooks/payment_action_required.rb, line 5 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
notify_user(billable, payment_intent_id, subscription)
click to toggle source
# File lib/pay/stripe/webhooks/payment_action_required.rb, line 18 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