Sha256: fa60c2a14622a8250246bc481e9cc91882765d49591d602f6b4497a2b3ed1b04

Contents?: true

Size: 892 Bytes

Versions: 7

Compression:

Stored size: 892 Bytes

Contents

class Wepay::AuthorizeController < Wepay::ApplicationController

  def index
    wepay_gateway = WepayRails::Payments::Gateway.new

    if params[:code].present?
      access_token = wepay_gateway.get_access_token(params[:code], redirect_uri)
      render :text => "Copy this access token, #{access_token} to the access_token directive in your wepay.yml"
    else
      # For security purposes, stop people from hitting this page and resetting the access_token.
      if wepay_gateway.configuration[:access_token].present?
        render :text => "You have already specified an access token in wepay.yml. If you wish to change it, please delete the current one and try again."
      else
        redirect_to wepay_gateway.auth_code_url redirect_uri
      end
    end
  end

  private
  def redirect_uri
    "#{WepayRails::Configuration.settings[:root_callback_uri]}/wepay/authorize"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wepay-rails-2.2.5 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.2.4 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.2.3 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.2.2 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.2.1 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.2.0 app/controllers/wepay/authorize_controller.rb
wepay-rails-2.1.0 app/controllers/wepay/authorize_controller.rb