Module: ActiveMerchant::Billing::PaypalExpressCommon

Included in:
PayflowExpressGateway, PaypalExpressGateway
Defined in:
lib/active_merchant/billing/gateways/paypal_express_common.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
# File 'lib/active_merchant/billing/gateways/paypal_express_common.rb', line 4

def self.included(base)
  base.cattr_accessor :test_redirect_url
  base.cattr_accessor :live_redirect_url
  base.live_redirect_url = 'https://www.paypal.com/cgibin/webscr'
end

Instance Method Details

#redirect_urlObject



10
11
12
# File 'lib/active_merchant/billing/gateways/paypal_express_common.rb', line 10

def redirect_url
  test? ? test_redirect_url : live_redirect_url
end

#redirect_url_for(token, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/active_merchant/billing/gateways/paypal_express_common.rb', line 14

def redirect_url_for(token, options = {})
  options = {:review => true, :mobile => false}.update(options)

  cmd  = options[:mobile] ? '_express-checkout-mobile' : '_express-checkout'
  url  = "#{redirect_url}?cmd=#{cmd}&token=#{token}"
  url += '&useraction=commit' unless options[:review]

  url
end