Sha256: fe0f49eec07519486c1aebf3bab2063a936784d1395e1507165ba473fe6653fe

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

class Wepay::AuthorizeController < Wepay::ApplicationController
  def index
    ref_id = session[unique_wepay_auth_token_key]
    if WepayRails::Configuration.settings[:orm] == 'mongoid'
      wepayable = wepayable_class.where(wepayable_column => ref_id)[0]
    else
      wepayable = wepayable_class.all(:conditions => ["#{wepayable_column} = ?", ref_id])[0]
    end
    wepayable.update_attribute(wepayable_column.to_sym, params[:code])
    redirect_to session[:after_authorize_redirect_uri] if session[:after_authorize_redirect_uri]
    redirect_to WepayRails::Configuration.settings[:after_authorize_redirect_uri]
  rescue => e
    raise AuthorizationError.new("WepayRails was unable to find the record to save the auth code to. : #{e.message}") unless wepayable.present?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wepay-rails-1.0.0 app/controllers/wepay/authorize_controller.rb
wepay-rails-0.2.2 app/controllers/wepay/authorize_controller.rb
wepay-rails-0.2.1 app/controllers/wepay/authorize_controller.rb
wepay-rails-0.2.0 app/controllers/wepay/authorize_controller.rb
wepay-rails-0.1.116 app/controllers/wepay/authorize_controller.rb