Class: InvoicesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/invoices_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ InvoicesClient

Initialize the InvoicesClient class with an API client instance.

Parameters:

  • connection (LockstepApi)

    The API client object for this connection



22
23
24
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 22

def initialize(connection)
    @connection = connection
end

Instance Method Details

#create_invoices(body:) ⇒ Object

Creates one or more Invoices within this account and returns the records as created.

An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the ‘CompanyId` field, and the recipient of the invoice is identified by the `CustomerId` field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the `TotalAmount` and the `OutstandingBalanceAmount` may be different.

Parameters:

  • body (InvoiceModel)

    The Invoices to create



69
70
71
72
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 69

def create_invoices(body:)
    path = "/api/v1/Invoices"
    @connection.request(:post, path, body, nil)
end

#delete_invoice(id:) ⇒ Object

Deletes the Invoice referred to by this unique identifier. An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the ‘CompanyId` field, and the recipient of the invoice is identified by the `CustomerId` field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the `TotalAmount` and the `OutstandingBalanceAmount` may be different.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the invoice to delete; NOT the customer’s ERP key



58
59
60
61
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 58

def delete_invoice(id:)
    path = "/api/v1/Invoices/#{id}"
    @connection.request(:delete, path, nil, nil)
end

#delete_invoices(body:) ⇒ Object

Delete the Invoices referred to by these unique identifiers.

An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the ‘CompanyId` field, and the recipient of the invoice is identified by the `CustomerId` field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the `TotalAmount` and the `OutstandingBalanceAmount` may be different.

Parameters:

  • body (BulkDeleteRequestModel)

    The unique Lockstep Platform ID numbers of the Invoices to delete; NOT the customer’s ERP keys



80
81
82
83
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 80

def delete_invoices(body:)
    path = "/api/v1/Invoices"
    @connection.request(:delete, path, body, nil)
end

#query_at_risk_view(filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Queries At Risk Invoices for this account using the specified filtering, sorting, nested fetch, and pagination rules requested. Display the results using the At Risk Invoice Summary View format.

More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website.

The At Risk Invoice Summary View represents a slightly different view of the data and includes some extra fields that might be useful. For more information, see the data format of the At Risk Invoice Summary Model.

Parameters:



148
149
150
151
152
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 148

def query_at_risk_view(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Invoices/views/at-risk-summary"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#query_invoice_summary_view(filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Queries Invoices for this account using the specified filtering, sorting, nested fetch, and pagination rules requested. Display the results using the Invoice Summary View format.

More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website.

The Invoice Summary View represents a slightly different view of the data and includes some extra fields that might be useful. For more information, see the data format of the Invoice Summary Model.

Parameters:



130
131
132
133
134
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 130

def query_invoice_summary_view(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Invoices/views/summary"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#query_invoices(filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Queries Invoices for this account using the specified filtering, sorting, nested fetch, and pagination rules requested.

More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website.

An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the ‘CompanyId` field, and the recipient of the invoice is identified by the `CustomerId` field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the `TotalAmount` and the `OutstandingBalanceAmount` may be different.

Parameters:



97
98
99
100
101
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 97

def query_invoices(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Invoices/query"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#retrieve_invoice(id:, include_param:) ⇒ Object

Retrieves the Invoice specified by this unique identifier, optionally including nested data sets.

An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the ‘CompanyId` field, and the recipient of the invoice is identified by the `CustomerId` field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the `TotalAmount` and the `OutstandingBalanceAmount` may be different.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of this invoice; NOT the customer’s ERP key

  • include_param (string)

    To fetch additional data on this object, specify the list of elements to retrieve. Available collections: Addresses, Lines, Payments, Notes, Attachments, Company, Customer, CustomFields, CreditMemos



34
35
36
37
38
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 34

def retrieve_invoice(id:, include_param:)
    path = "/api/v1/Invoices/#{id}"
    params = {:include => include_param}
    @connection.request(:get, path, nil, params)
end

#retrieve_invoice_pdf(id:) ⇒ Object

Retrieves a PDF file for this invoice if it is of one of the supported invoice types and has been synced using an app enrollment to one of the supported apps.

Sage Intacct supports AR Invoices.

Quickbooks Online supports AR Invoices, and AR Credit Memos.

Xero supports AR Invoices, AP Invoices, AR Credit Memos, and AP Credit Memos.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of this invoice; NOT the customer’s ERP key



113
114
115
116
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 113

def retrieve_invoice_pdf(id:)
    path = "/api/v1/Invoices/#{id}/pdf"
    @connection.request(:get, path, nil, nil)
end

#update_invoice(id:, body:) ⇒ Object

Updates an existing Invoice with the information supplied to this PATCH call.

The PATCH method allows you to change specific values on the object while leaving other values alone. As input you should supply a list of field names and new values. If you do not provide the name of a field, that field will remain unchanged. This allows you to ensure that you are only updating the specific fields desired.

An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the ‘CompanyId` field, and the recipient of the invoice is identified by the `CustomerId` field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the `TotalAmount` and the `OutstandingBalanceAmount` may be different.

Parameters:

  • id (uuid)

    The unique Lockstep Platform ID number of the invoice to update; NOT the customer’s ERP key

  • body (object)

    A list of changes to apply to this Invoice



49
50
51
52
# File 'lib/lockstep_sdk/clients/invoices_client.rb', line 49

def update_invoice(id:, body:)
    path = "/api/v1/Invoices/#{id}"
    @connection.request(:patch, path, body.to_camelback_keys.to_json, nil)
end