Sha256: 2f9295af903f784626d5ecd08f51a4315a2c8c907a4d19dcef52e5ad8b56ae5b

Contents?: true

Size: 709 Bytes

Versions: 7

Compression:

Stored size: 709 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?

          if Pay.send_emails
            Pay::UserMailer.with(
              pay_customer: subscription.customer,
              payment_intent_id: event.data.object.payment_intent,
              subscription: subscription
            ).payment_action_required.deliver_later
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pay-3.0.24 lib/pay/stripe/webhooks/payment_action_required.rb
pay-3.0.23 lib/pay/stripe/webhooks/payment_action_required.rb
pay-3.0.22 lib/pay/stripe/webhooks/payment_action_required.rb
pay-3.0.21 lib/pay/stripe/webhooks/payment_action_required.rb
pay-3.0.20 lib/pay/stripe/webhooks/payment_action_required.rb
pay-3.0.19 lib/pay/stripe/webhooks/payment_action_required.rb
pay-3.0.18 lib/pay/stripe/webhooks/payment_action_required.rb