Method: Invoicexpress::Client::Clients#client_create_credit_note

Defined in:
lib/invoicexpress/client/clients.rb

#client_create_credit_note(client_id, invoice, options = {}) ⇒ Invoicexpress::Models::CreditNote

This method allows you to create a new Credit Note for a specific client. When creating the invoice:

  • If items do not exist with the given names, new ones will be created.

  • If item name already exists, the item is updated with the new values.

Regarding item taxes, if the tax name is not found, no tax is applied to that item.

Parameters:

  • client_id (String)

    The ID of the client

Returns:

Raises:

  • Invoicexpress::Unauthorized When the client is unauthorized

  • Invoicexpress::UnprocessableEntity When there are errors on the submission

  • Invoicexpress::NotFound When there are no clients with that name



180
181
182
183
184
185
186
187
188
189
# File 'lib/invoicexpress/client/clients.rb', line 180

def client_create_credit_note(client_id, invoice, options={})
  raise(ArgumentError, "credit note has the wrong type") unless invoice.is_a?(Invoicexpress::Models::CreditNote)

  params = {
    :klass => Invoicexpress::Models::CreditNote,
    :body  => invoice
  }

  post("clients/#{client_id}/create/credit-note.xml", params.merge(options))
end