module Pay::Braintree

Public Class Methods

configure_webhooks() click to toggle source
# File lib/pay/braintree.rb, line 49
def self.configure_webhooks
  Pay::Webhooks.configure do |events|
    events.subscribe "braintree.subscription_canceled", Pay::Braintree::Webhooks::SubscriptionCanceled.new
    events.subscribe "braintree.subscription_charged_successfully", Pay::Braintree::Webhooks::SubscriptionChargedSuccessfully.new
    events.subscribe "braintree.subscription_charged_unsuccessfully", Pay::Braintree::Webhooks::SubscriptionChargedUnsuccessfully.new
    events.subscribe "braintree.subscription_expired", Pay::Braintree::Webhooks::SubscriptionExpired.new
    events.subscribe "braintree.subscription_trial_ended", Pay::Braintree::Webhooks::SubscriptionTrialEnded.new
    events.subscribe "braintree.subscription_went_active", Pay::Braintree::Webhooks::SubscriptionWentActive.new
    events.subscribe "braintree.subscription_went_past_due", Pay::Braintree::Webhooks::SubscriptionWentPastDue.new
  end
end
environment() click to toggle source
# File lib/pay/braintree.rb, line 45
def self.environment
  find_value_by_name(:braintree, :environment) || "sandbox"
end
merchant_id() click to toggle source
# File lib/pay/braintree.rb, line 41
def self.merchant_id
  find_value_by_name(:braintree, :merchant_id)
end
private_key() click to toggle source
# File lib/pay/braintree.rb, line 37
def self.private_key
  find_value_by_name(:braintree, :private_key)
end
public_key() click to toggle source
# File lib/pay/braintree.rb, line 33
def self.public_key
  find_value_by_name(:braintree, :public_key)
end
setup() click to toggle source
# File lib/pay/braintree.rb, line 22
def self.setup
  Pay.braintree_gateway = ::Braintree::Gateway.new(
    environment: environment.to_sym,
    merchant_id: merchant_id,
    public_key: public_key,
    private_key: private_key
  )

  configure_webhooks
end