class Pay::Paddle::Webhooks::SubscriptionPaymentRefunded
Public Instance Methods
call(event)
click to toggle source
# File lib/pay/paddle/webhooks/subscription_payment_refunded.rb, line 5 def call(event) charge = Pay::Charge.find_by_processor_and_id(:paddle, event.subscription_payment_id) return unless charge.present? charge.update(amount_refunded: (event.gross_refund.to_f * 100).to_i) notify_user(charge.customer.owner, charge) end
notify_user(billable, charge)
click to toggle source
# File lib/pay/paddle/webhooks/subscription_payment_refunded.rb, line 13 def notify_user(billable, charge) if Pay.send_emails Pay::UserMailer.with(billable: billable, charge: charge).refund.deliver_later end end