Class: Pay::Stripe::Webhooks::ChargeSucceeded

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

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object


5
6
7
8
9
10
11
# File 'lib/pay/stripe/webhooks/charge_succeeded.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?(:receipt, pay_charge)
    Pay::UserMailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).receipt.deliver_later
  end
end