Module: Workarea::Checkoutdotcom
- Defined in:
- lib/workarea/checkoutdotcom.rb,
lib/workarea/checkoutdotcom/engine.rb,
lib/workarea/checkoutdotcom/version.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- VERSION =
"1.2.0"
Class Method Summary collapse
- .auto_initialize_gateway ⇒ Object
-
.credentials ⇒ Hash
Credentials for checkoutdotcom from Rails secrets.
-
.gateway ⇒ ActiveMerchant::Billing::Gateway
Conditionally use the real gateway when secrets are present.
- .gateway=(gateway) ⇒ Object
Class Method Details
.auto_initialize_gateway ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/workarea/checkoutdotcom.rb', line 32 def self.auto_initialize_gateway if credentials.present? if ENV['HTTP_PROXY'].present? uri = URI.parse(ENV['HTTP_PROXY']) ActiveMerchant::Billing::CheckoutV2Gateway.proxy_address = uri.host ActiveMerchant::Billing::CheckoutV2Gateway.proxy_port = uri.port end self.gateway = ActiveMerchant::Billing::CheckoutV2Gateway.new credentials else self.gateway = ActiveMerchant::Billing::BogusCheckoutV2Gateway.new end end |
.credentials ⇒ Hash
Credentials for checkoutdotcom from Rails secrets.
15 16 17 18 |
# File 'lib/workarea/checkoutdotcom.rb', line 15 def self.credentials return {} unless Rails.application.secrets.checkoutdotcom.present? Rails.application.secrets.checkoutdotcom.symbolize_keys end |
.gateway ⇒ ActiveMerchant::Billing::Gateway
Conditionally use the real gateway when secrets are present. Otherwise, use the bogus gateway.
24 25 26 |
# File 'lib/workarea/checkoutdotcom.rb', line 24 def self.gateway Workarea.config.gateways.credit_card end |
.gateway=(gateway) ⇒ Object
28 29 30 |
# File 'lib/workarea/checkoutdotcom.rb', line 28 def self.gateway=(gateway) Workarea.config.gateways.credit_card = gateway end |