Sha256: 1d571558952d35a12dd3f4033fd4817fdbf3f3e23c1465fd9f556cd768447fa3

Contents?: true

Size: 692 Bytes

Versions: 44

Compression:

Stored size: 692 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.find_by_processor_and_id(:braintree, subscription.id)
          return unless pay_subscription.present?

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

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
pay-6.1.2 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-6.1.1 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-6.1.0 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-6.0.3 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-6.0.2 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-6.0.1 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-6.0.0 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-5.0.4 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-5.0.3 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-5.0.2 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-5.0.1 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-5.0.0 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.2.1 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.2.0 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.1.1 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.1.0 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.0.4 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.0.2 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.0.1 lib/pay/braintree/webhooks/subscription_went_past_due.rb
pay-4.0.0 lib/pay/braintree/webhooks/subscription_went_past_due.rb