Sha256: ebb3a84213d44c4cf79f83b62b76342c39e00aaf25deca4df7423ae18e532189

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

module Braintree
  class WebhookNotification
    include BaseModule

    module Kind
      SubscriptionCanceled = "subscription_canceled"
      SubscriptionChargedSuccessfully = "subscription_charged_successfully"
      SubscriptionChargedUnsuccessfully = "subscription_charged_unsuccessfully"
      SubscriptionExpired = "subscription_expired"
      SubscriptionTrialEnded = "subscription_trial_ended"
      SubscriptionWentActive = "subscription_went_active"
      SubscriptionWentPastDue = "subscription_went_past_due"
    end

    attr_reader :subscription, :kind, :timestamp

    def self.parse(signature, payload)
      Configuration.gateway.webhook_notification.parse(signature, payload)
    end

    def self.verify(challenge)
      Configuration.gateway.webhook_notification.verify(challenge)
    end

    def initialize(gateway, attributes) # :nodoc:
      @gateway = gateway
      set_instance_variables_from_hash(attributes)
      @subscription = Subscription._new(gateway, @subject[:subscription]) if @subject.has_key?(:subscription)
    end

    class << self
      protected :new
      def _new(*args) # :nodoc:
        self.new *args
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
braintree-2.24.0 lib/braintree/webhook_notification.rb
braintree-2.23.0 lib/braintree/webhook_notification.rb
braintree-2.22.0 lib/braintree/webhook_notification.rb
braintree-2.21.0 lib/braintree/webhook_notification.rb
braintree-2.20.0 lib/braintree/webhook_notification.rb
braintree-2.19.0 lib/braintree/webhook_notification.rb
braintree-2.18.0 lib/braintree/webhook_notification.rb
braintree-2.17.0 lib/braintree/webhook_notification.rb
braintree-2.16.0 lib/braintree/webhook_notification.rb