Class: PaymentCalculator::Stripe

Inherits:
Object
  • Object
show all
Defined in:
app/models/piggybak_stripe/payment_calculator/stripe.rb

Constant Summary collapse

KEYS =
['test_secret_key', 
'test_publishable_key', 
'live_secret_key', 
'live_publishable_key']
KLASS =
::Stripe

Instance Method Summary collapse

Constructor Details

#initialize(payment_method) ⇒ Stripe

Returns a new instance of Stripe.



10
11
12
# File 'app/models/piggybak_stripe/payment_calculator/stripe.rb', line 10

def initialize(payment_method)
  @payment_method = payment_method
end

Instance Method Details

#gateway_modeObject



14
15
16
# File 'app/models/piggybak_stripe/payment_calculator/stripe.rb', line 14

def gateway_mode
  Piggybak.config.activemerchant_mode == :test ? "test" : "live" 
end

#publishable_keyObject



22
23
24
# File 'app/models/piggybak_stripe/payment_calculator/stripe.rb', line 22

def publishable_key
  @payment_method.key_values["#{self.gateway_mode}_publishable_key".to_sym]      
end

#secret_keyObject



18
19
20
# File 'app/models/piggybak_stripe/payment_calculator/stripe.rb', line 18

def secret_key      
  @payment_method.key_values["#{self.gateway_mode}_secret_key".to_sym]      
end