class Wco::InvoicesController

def create_stripe

def create_stripe
  @invoice = Wco::Invoice.new params[:invoice].permit!
  authorize! :create, @invoice
  if @invoice.save
    flash_notice "Created the invoice."
    if params[:do_send]
      Stripe::Invoice.send_invoice(@invoice[:invoice_id])
    end
    redirect_to action: :show, id: @invoice.id
  else
    flash_alert "Cannot create invoice: #{@invoice.errors.messages}"
    render :new
  end
end