5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/ishapi/invoices_controller.rb', line 5
def search
authorize! :open_permission, ::Ishapi
begin
p = IshModels::UserProfile.find_by( :email => params[:email] )
i = Ish::Invoice.find_by( :number => params[:number] )
if i.profile == p && i.amount == params[:amount].to_f && i.payments.count == 0
render :json => { :status => :ok }
else
render :status => 404, :json => {} end
rescue Mongoid::Errors::DocumentNotFound => e
puts! e, 'e'
render :status => 404, :json => {} end
end
|