Class: Pay::Braintree::Webhooks::SubscriptionChargedUnsuccessfully

Inherits:
Object
  • Object
show all
Defined in:
lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb', line 7

def call(event)
  subscription = event.subscription
  return if subscription.nil?

  pay_subscription = Pay.subscription_model.find_by(processor: :braintree, processor_id: subscription.id)
  return unless pay_subscription.present?

  # billable = pay_subscription.owner
  # charge = Pay::Braintree::Billable.new(billable).save_transaction(subscription.transactions.first)

  # if Pay.send_emails
  #  Pay::UserMailer.with(billable: billable, charge: charge).receipt.deliver_later
  # end
end