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
# File 'lib/pay/stripe/webhooks/charge_refunded.rb', line 5

def call(event)
  pay_charge = Pay::Stripe::Charge.sync(event.data.object.id)
  notify_user(pay_charge.owner, pay_charge) if pay_charge
end

#notify_user(billable, charge) ⇒ Object



10
11
12
13
14
# File 'lib/pay/stripe/webhooks/charge_refunded.rb', line 10

def notify_user(billable, charge)
  if Pay.send_emails
    Pay::UserMailer.with(billable: billable, charge: charge).refund.deliver_later
  end
end