5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/pay/stripe/webhooks/payment_action_required.rb', line 5
def call(event)
object = event.data.object
pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
return if pay_subscription.nil? || pay_subscription.status == "incomplete"
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
|