Sha256: 112bcf192f6d8c42b5b5a5e44de42d754c3a82ea90275a903daaa1b9e6280f62

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

# A subscription successfully moves to the next billing cycle. This will also occur when either a new transaction is created mid-cycle due to proration on an upgrade or a billing cycle is skipped due to the presence of a negative balance that covers the cost of the subscription.

module Pay
  module Braintree
    module Webhooks
      class SubscriptionChargedUnsuccessfully
        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 = billable.save_braintree_transaction(subscription.transactions.first)

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pay-2.5.0 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb