Sha256: 20368878d8b0961be53cb00c08036e7c4a7f7445e603c2cc426dc0e6fce84587

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

module ActiveMerchant
  module Billing
    module PaypalExpressCommon
      def self.included(base)
        base.class_attribute :test_redirect_url
        base.class_attribute :live_redirect_url
        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

1 entries across 1 versions & 1 rubygems

Version Path
vibedeck-activemerchant-1.18.2 lib/active_merchant/billing/gateways/paypal_express_common.rb