Class: Pay::Stripe::Webhooks::ChargeRefunded

Inherits:
Object
  • Object
show all
Defined in:
lib/pay/stripe/webhooks/charge_refunded.rb

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object


5
6
7
8
9
10
11
# File 'lib/pay/stripe/webhooks/charge_refunded.rb', line 5

def call(event)
  pay_charge = Pay::Stripe::Charge.sync(event.data.object.id, stripe_account: event.try(:account))

  if pay_charge && Pay.send_email?(:refund, pay_charge)
    Pay::UserMailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).refund.deliver_later
  end
end