Class: Billy::Paddle::Webhooks::SubscriptionPaymentRefunded

Inherits:
Object
  • Object
show all
Defined in:
lib/billy/paddle/webhooks/subscription_payment_refunded.rb

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object



6
7
8
9
10
11
# File 'lib/billy/paddle/webhooks/subscription_payment_refunded.rb', line 6

def call(event)
  billy_charge = Billy::Charge.find_by(processor: "paddle", processor_id: event.subscription_payment_id)
  return unless billy_charge.present?

  billy_charge.update!(amount_refunded: (event.gross_refund.to_f * 100).to_i)          
end