Open-Source-Access-Control-.../app/controllers/ipns_controller.rb

55 lines
1.1 KiB
Ruby
Raw Normal View History

2013-08-24 09:18:37 +00:00
class IpnsController < ApplicationController
2013-08-26 22:34:10 +00:00
load_and_authorize_resource :ipn, :except => [:new, :create]
2013-08-27 05:07:41 +00:00
before_filter :authenticate_user!, :except => [:new, :create]
2013-08-24 09:18:37 +00:00
protect_from_forgery :except => [:create]
def index
@ipns = Ipn.all
end
def show
end
def new
end
def create
@ipn = Ipn.new_from_dynamic_params(params)
@ipn.data = params.to_json
@ipn.save
render :nothing => true
2013-08-27 05:07:41 +00:00
#unless @ipn.validate!
# Rails.logger.error "Unable to validate IPN: #{@ipn.inspect}"
#end
2013-08-24 10:40:34 +00:00
end
2013-08-28 10:18:47 +00:00
def import
@ipn = Ipn.new_from_dynamic_params(params)
@ipn.data = params.to_json
@ipn.save
redirect_to ipn_path(@ipn)
#unless @ipn.validate!
# Rails.logger.error "Unable to validate IPN: #{@ipn.inspect}"
#end
end
2013-08-24 10:40:34 +00:00
def validate
if @ipn.validate!
redirect_to ipns_url, :notice => 'Valid!'
else
redirect_to ipns_url, :notice => 'INVALID'
end
2013-08-24 09:18:37 +00:00
end
def link
result = @ipn.link_payment
if result.first
redirect_to ipns_url, :notice => 'Payment was successfully linked.'
else
redirect_to ipns_url, :notice => result.last
end
end
2013-08-27 05:07:41 +00:00
end