Adding csv import
This commit is contained in:
28
app/controllers/paypal_csvs_controller.rb
Normal file
28
app/controllers/paypal_csvs_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class PaypalCsvsController < ApplicationController
|
||||
load_and_authorize_resource :paypal_csv
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
PaypalCsv.batch_import_from_csv(params[:file].path)
|
||||
redirect_to paypal_csvs_path, :notice => 'Paypal CSV batch was successfully loaded.'
|
||||
end
|
||||
|
||||
def link
|
||||
result = @paypal_csv.link_payment
|
||||
if result.first
|
||||
redirect_to paypal_csvs_url, :notice => 'Payment was successfully linked.'
|
||||
else
|
||||
redirect_to paypal_csvs_url, :notice => result.last
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user