Sha256: 4c7f9a51b6d73b70afc183f62bacaca9842e117fbc8ca536fdcd1457569462ae

Contents?: true

Size: 705 Bytes

Versions: 16

Compression:

Stored size: 705 Bytes

Contents

# A subscription has moved from the Active status to the Past Due status. This will only be triggered when the initial transaction in a billing cycle is declined. Once the status moves to past due, it will not be triggered again in that billing cycle.

module Pay
  module Braintree
    module Webhooks
      class SubscriptionWentPastDue
        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?

          pay_subscription.update!(status: :past_due)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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