Sha256: d15136f6d97d6a1daee1a28ae00a5c86b1a14fc453f5d6d5fa1c856b9541ae83

Contents?: true

Size: 927 Bytes

Versions: 55

Compression:

Stored size: 927 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/cgi-bin/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

55 entries across 55 versions & 2 rubygems

Version Path
activemerchant-1.105.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.104.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.103.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.102.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.101.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.100.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.99.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.98.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
active_accountability_merchant-1.97.1 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.97.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.96.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.95.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.94.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.93.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.92.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.91.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.90.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.89.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.88.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.87.0 lib/active_merchant/billing/gateways/paypal_express_common.rb