Class: MerchantSidekick::ActiveMerchant::Gateways::PaypalGateway
- Defined in:
- lib/merchant_sidekick/active_merchant/gateways/paypal_gateway.rb
Class Method Summary collapse
-
.gateway ⇒ Object
Returns an active merchant paypal gateway instance.
Methods inherited from Base
Methods inherited from Gateway
config, config_path, default_gateway, type
Class Method Details
.gateway ⇒ Object
Returns an active merchant paypal gateway instance
E.g.
# config/active_merchant.yml
development:
api_username: seller_XYZ_biz_api1.example.com
api_password: ABCDEFG123456789
signature: AsPC9BjkCyDFQXbStoZcgqH3hpacAX3IenGazd35.nEnXJKR9nfCmJDu
pem_file_name: config/paypal.pem
mode: test
production:
...
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/merchant_sidekick/active_merchant/gateways/paypal_gateway.rb', line 23 def gateway unless @@gateway = { :login => config[:api_username], :password => config[:api_password] } .merge!({:test => true}) if config[:mode] == "test" .merge!({:signature => config[:signature]}) unless config[:signature].blank? ::ActiveMerchant::Billing::Base.mode = :test if config[:mode] == "test" ::ActiveMerchant::Billing::PaypalGateway.pem_file = File.read(File.(config[:pem_file_name])) if config[:pem_file_name] @@gateway = ::ActiveMerchant::Billing::PaypalGateway.new() end @@gateway end |