Sha256: d8b5d0fc110f79961338ad2b924411fba8e2f25d25e484db68e118eee8b46258

Contents?: true

Size: 938 Bytes

Versions: 57

Compression:

Stored size: 938 Bytes

Contents

module ActiveMerchant
  module Billing
    module PaypalExpressCommon
      def self.included(base)
        if base.respond_to?(:class_attribute)
          base.class_attribute :test_redirect_url
          base.class_attribute :live_redirect_url
        else
          base.class_inheritable_accessor :test_redirect_url
          base.class_inheritable_accessor :live_redirect_url
        end
        base.live_redirect_url = 'https://www.paypal.com/cgibin/webscr'
      end
      
      def redirect_url
        test? ? test_redirect_url : live_redirect_url
      end
      
      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
    end
  end
end

Version data entries

57 entries across 57 versions & 6 rubygems

Version Path
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/gateways/paypal_express_common.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/gateways/paypal_express_common.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/gateways/paypal_express_common.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/gateways/paypal_express_common.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/gateways/paypal_express_common.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.7 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.6 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.5 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.4 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.3 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.2 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.1 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.42.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.41.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.40.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.39.2 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.39.1 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.39.0 lib/active_merchant/billing/gateways/paypal_express_common.rb