Module: Pay::Braintree
- Extended by:
- Env
- Defined in:
- lib/pay/braintree.rb,
app/models/pay/braintree/charge.rb,
app/models/pay/braintree/customer.rb,
app/models/pay/braintree/subscription.rb,
app/models/pay/braintree/payment_method.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, Charge, Customer, Error, PaymentMethod, Subscription
Class Method Summary
collapse
Class Method Details
.enabled? ⇒ Boolean
41
42
43
44
45
|
# File 'lib/pay/braintree.rb', line 41
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
68
69
70
|
# File 'lib/pay/braintree.rb', line 68
def self.environment
find_value_by_name(:braintree, :environment) || "sandbox"
end
|
.merchant_id ⇒ Object
64
65
66
|
# File 'lib/pay/braintree.rb', line 64
def self.merchant_id
find_value_by_name(:braintree, :merchant_id)
end
|
.private_key ⇒ Object
60
61
62
|
# File 'lib/pay/braintree.rb', line 60
def self.private_key
find_value_by_name(:braintree, :private_key)
end
|
.public_key ⇒ Object
56
57
58
|
# File 'lib/pay/braintree.rb', line 56
def self.public_key
find_value_by_name(:braintree, :public_key)
end
|
.setup ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/pay/braintree.rb', line 47
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
|