Class: PaymentCalculator::Braintree
- Inherits:
-
Object
- Object
- PaymentCalculator::Braintree
- Defined in:
- app/models/piggybak_braintree/payment_calculator/braintree.rb
Constant Summary collapse
- KEYS =
['private_key', 'public_key', 'merchant_id']
- KLASS =
::Braintree
Instance Method Summary collapse
- #client_token ⇒ Object
- #configure ⇒ Object
- #gateway_mode ⇒ Object
-
#initialize(payment_method) ⇒ Braintree
constructor
A new instance of Braintree.
- #merchant_id ⇒ Object
- #private_key ⇒ Object
- #public_key ⇒ Object
Constructor Details
#initialize(payment_method) ⇒ Braintree
Returns a new instance of Braintree.
6 7 8 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 6 def initialize(payment_method) @payment_method = payment_method end |
Instance Method Details
#client_token ⇒ Object
17 18 19 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 17 def client_token Braintree::ClientToken.generate end |
#configure ⇒ Object
10 11 12 13 14 15 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 10 def configure Braintree::Configuration.environment = gateway_mode Braintree::Configuration.merchant_id = merchant_id Braintree::Configuration.public_key = public_key Braintree::Configuration.private_key = private_key end |
#gateway_mode ⇒ Object
21 22 23 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 21 def gateway_mode Piggybak.config.activemerchant_mode end |
#merchant_id ⇒ Object
33 34 35 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 33 def merchant_id @payment_method.key_values["merchant_id".to_sym] end |
#private_key ⇒ Object
25 26 27 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 25 def private_key @payment_method.key_values["private_key".to_sym] end |
#public_key ⇒ Object
29 30 31 |
# File 'app/models/piggybak_braintree/payment_calculator/braintree.rb', line 29 def public_key @payment_method.key_values["public_key".to_sym] end |