Class: Pay::Paddle::Webhooks::SubscriptionPaymentRefunded
- Inherits:
-
Object
- Object
- Pay::Paddle::Webhooks::SubscriptionPaymentRefunded
- Defined in:
- lib/pay/paddle/webhooks/subscription_payment_refunded.rb
Instance Method Summary collapse
Instance Method Details
#call(event) ⇒ Object
5 6 7 8 9 10 11 |
# 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) ⇒ Object
13 14 15 16 17 |
# 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 |