def admin_void
      return if !user_is_allowed('orders', 'edit')
      
      response = Caboose::StdClass.new({
        'refresh' => nil,
        'error' => nil,
        'success' => nil
      })
      
      order = Order.find(params[:id])
      
      if order.financial_status == 'captured'
        response.error = "This order has already been captured, you will need to refund instead"
      else
        if PaymentProcessor.void(order)
          order.update_attributes(
            :financial_status => 'voided',
            :status => 'cancelled'
          )
          
          # Add the variant quantities ordered back
          #order.cancel
          
          response.success = "Order voided successfully"
        else
          response.error = "Error voiding order."
        end
      end
    
      render :json => response
    end
def admin_void
      return if !user_is_allowed('orders', 'edit')
      
      response = Caboose::StdClass.new({
        'refresh' => nil,
        'error' => nil,
        'success' => nil
      })
      
      order = Order.find(params[:id])
      
      if order.financial_status == 'captured'
        response.error = "This order has already been captured, you will need to refund instead"
      else
        if PaymentProcessor.void(order)
          order.update_attributes(
            :financial_status => 'voided',
            :status => 'cancelled'
          )
          
          # Add the variant quantities ordered back
          #order.cancel
          
          response.success = "Order voided successfully"
        else
          response.error = "Error voiding order."
        end
      end
    
      render :json => response
    end
GET /admin/orders/:id/void