Sha256: 1fdb705e62bf8b1175cd485dda48b13afa141a3c6f2d71757868511fe83c07b5

Contents?: true

Size: 985 Bytes

Versions: 15

Compression:

Stored size: 985 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 = 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
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pay-2.7.2 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.7.1 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.7.0 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.11 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.10 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.9 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.8 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.7 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.6 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.5 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.4 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.3 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.2 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.1 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
pay-2.6.0 lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb