Sha256: 82115769acc63a6e1bf3139cf6c8784a4f38e51fff033723d7713c208cfa97e4

Contents?: true

Size: 939 Bytes

Versions: 22

Compression:

Stored size: 939 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

22 entries across 21 versions & 4 rubygems

Version Path
activemerchant-1.53.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
start_activemerchant-1.50.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal_express_common.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.52.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.51.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal_express_common.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.44.1/lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.50.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.49.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.48.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.47.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.46.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.45.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
aktivemerchant-2.0.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.44.1 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.44.0 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.43.3 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.43.1 lib/active_merchant/billing/gateways/paypal_express_common.rb
activemerchant-1.43.0 lib/active_merchant/billing/gateways/paypal_express_common.rb