Codat.BillPay.Bills (codat v1.0.0)

Copy Markdown View Source

Read supplier bills through the Bill Pay API.

The Bill Pay API enables your customers to manage and pay their suppliers from within your application. Bills represent outstanding payments owed to suppliers.

Example

{:ok, page} = Codat.BillPay.Bills.list(client, company_id,
  query: "status=Open",
  order_by: "-dueDate"
)

# Get a specific bill with full details
{:ok, bill} = Codat.BillPay.Bills.get(client, company_id, bill_id)
bill["dueDate"]         # => "2024-02-01"
bill["amountDue"]       # => 5000.00
bill["supplierRef"]     # => %{"id" => "...", "supplierName" => "ACME Supplies"}

Summary

Functions

create(client_or_company_id, company_or_conn_id, conn_or_body, body_or_opts \\ %{})

@spec create(
  Codat.Client.t() | String.t(),
  String.t(),
  String.t() | map(),
  map() | keyword()
) ::
  {:ok, map()} | {:error, Codat.Error.t()}

Creates a new bills (async). Returns a push operation.

delete(client_or_company_id, company_or_resource_id, resource_id_or_opts \\ [])

@spec delete(Codat.Client.t() | String.t(), String.t(), String.t() | keyword()) ::
  {:ok, nil} | {:error, Codat.Error.t()}

Deletes a bills by ID (async).

fetch_all(client_or_company_id, company_id_or_opts \\ [], opts \\ [])

@spec fetch_all(Codat.Client.t() | String.t(), String.t() | keyword(), keyword()) ::
  {:ok, [map()]} | {:error, Codat.Error.t()}

Fetches all bills across all pages concurrently.

get(client_or_company_id, company_or_resource_id, resource_id_or_opts \\ [])

@spec get(Codat.Client.t() | String.t(), String.t(), String.t() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}

Fetches a single bills by ID.

get_create_model(client_or_company_id, company_or_conn_id, opts \\ [])

@spec get_create_model(Codat.Client.t() | String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}

Returns the push model for creating bills.

get_update_model(client_or_company_id, company_or_conn_id, conn_or_resource_id, resource_id_or_opts \\ [])

@spec get_update_model(
  Codat.Client.t() | String.t(),
  String.t(),
  String.t() | keyword(),
  keyword()
) ::
  {:ok, map()} | {:error, Codat.Error.t()}

Returns the push model for updating a bills record.

list(client_or_company_id, company_id_or_opts \\ [], opts \\ [])

@spec list(Codat.Client.t() | String.t(), String.t() | keyword(), keyword()) ::
  {:ok, Codat.Pagination.t()} | {:error, Codat.Error.t()}

Returns a paginated list of bills.

stream(client_or_company_id, company_id_or_opts \\ [], opts \\ [])

@spec stream(Codat.Client.t() | String.t(), String.t() | keyword(), keyword()) ::
  Enumerable.t()

Returns a lazy Stream of all results.

update(client_or_company_id, company_or_conn_id, conn_or_resource_id, resource_or_body, body_or_opts \\ %{})

@spec update(
  Codat.Client.t() | String.t(),
  String.t(),
  String.t(),
  String.t() | map(),
  map() | keyword()
) :: {:ok, map()} | {:error, Codat.Error.t()}

Updates an existing bills (async).