class Xeroizer::CannotChangeInvoiceStatus

Public Class Methods

new(invoice, new_status) click to toggle source
# File lib/xeroizer/exceptions.rb, line 142
def initialize(invoice, new_status)
  @invoice = invoice
  @new_status = new_status
end

Public Instance Methods

message() click to toggle source
# File lib/xeroizer/exceptions.rb, line 147
def message
  case @new_status
    when 'DELETED', 'VOIDED'
      unless @invoice.payments.size == 0
        "There must be no payments in this invoice to change to '#{@new_status}'"
      end

  end
end