Sha256: 277733ae7a8d86419bd9b6386a40b2ca1d517f1eda2f1b36a046b83b4da834eb

Contents?: true

Size: 768 Bytes

Versions: 51

Compression:

Stored size: 768 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

          pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
          return if pay_subscription.nil?

          if Pay.send_email?(:payment_action_required, pay_subscription)
            Pay.mailer.with(
              pay_customer: pay_subscription.customer,
              payment_intent_id: event.data.object.payment_intent,
              pay_subscription: pay_subscription
            ).payment_action_required.deliver_later
          end
        end
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
pay-8.2.2 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.2.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.2.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.1.3 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.1.2 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.1.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.1.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-8.0.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-7.3.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-7.2.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-7.1.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-7.1.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-7.0.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.8.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.8.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.7.2 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.7.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.7.0 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.6.1 lib/pay/stripe/webhooks/payment_action_required.rb
pay-6.6.0 lib/pay/stripe/webhooks/payment_action_required.rb