class Pay::Braintree::Webhooks::SubscriptionChargedSuccessfully
Public Instance Methods
call(event)
click to toggle source
# File lib/pay/braintree/webhooks/subscription_charged_successfully.rb, line 7 def call(event) subscription = event.subscription return if subscription.nil? pay_subscription = Pay::Subscription.find_by_processor_and_id(:braintree, subscription.id) return unless pay_subscription.present? pay_customer = pay_subscription.customer charge = Pay::Braintree::Billable.new(pay_customer).save_transaction(subscription.transactions.first) if Pay.send_emails Pay::UserMailer.with(billable: pay_customer.owner, charge: charge).receipt.deliver_later end end