Module: Pay::Braintree
- Extended by:
- Env
- Defined in:
- lib/pay/braintree.rb,
lib/pay/braintree/error.rb,
lib/pay/braintree/charge.rb,
lib/pay/braintree/billable.rb,
lib/pay/braintree/subscription.rb,
lib/pay/braintree/payment_method.rb,
lib/pay/braintree/authorization_error.rb,
lib/pay/braintree/webhooks/subscription_expired.rb,
lib/pay/braintree/webhooks/subscription_canceled.rb,
lib/pay/braintree/webhooks/subscription_trial_ended.rb,
lib/pay/braintree/webhooks/subscription_went_active.rb,
lib/pay/braintree/webhooks/subscription_went_past_due.rb,
lib/pay/braintree/webhooks/subscription_charged_successfully.rb,
lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
Defined Under Namespace
Modules: Webhooks
Classes: AuthorizationError, Billable, Charge, Error, PaymentMethod, Subscription
Class Method Summary
collapse
Class Method Details
.enabled? ⇒ Boolean
22
23
24
25
26
|
# File 'lib/pay/braintree.rb', line 22
def self.enabled?
return false unless Pay.enabled_processors.include?(:braintree) && defined?(::Braintree)
Pay::Engine.version_matches?(required: "~> 4", current: ::Braintree::Version::String) || (raise "[Pay] braintree gem must be version ~> 4")
end
|
.environment ⇒ Object
49
50
51
|
# File 'lib/pay/braintree.rb', line 49
def self.environment
find_value_by_name(:braintree, :environment) || "sandbox"
end
|
.merchant_id ⇒ Object
45
46
47
|
# File 'lib/pay/braintree.rb', line 45
def self.merchant_id
find_value_by_name(:braintree, :merchant_id)
end
|
.private_key ⇒ Object
41
42
43
|
# File 'lib/pay/braintree.rb', line 41
def self.private_key
find_value_by_name(:braintree, :private_key)
end
|
.public_key ⇒ Object
37
38
39
|
# File 'lib/pay/braintree.rb', line 37
def self.public_key
find_value_by_name(:braintree, :public_key)
end
|
.setup ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/pay/braintree.rb', line 28
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
)
end
|