Apruve v0.1.0 Apruve.Invoice View Source

Module for Apruve invoices.

Link to this section Summary

Link to this section Types

Link to this type invoice_id() View Source
invoice_id() :: String.t()
Link to this type t() View Source
t() :: %Apruve.Invoice{
  amount_cents: term(),
  amount_due: term(),
  created_at: term(),
  currency: term(),
  due_at: term(),
  final_state_at: term(),
  id: term(),
  invoice_items: term(),
  issue_on_create: term(),
  issued_at: term(),
  links: term(),
  merchant_invoice_id: term(),
  merchant_notes: term(),
  opened_at: term(),
  order_id: term(),
  payments: term(),
  shipping_cents: term(),
  status: term(),
  tax_cents: term()
}

Link to this section Functions

Link to this function all_by_order_id(order_id, p_client_config \\ :from_app_config) View Source
all_by_order_id(String.t(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, [t()]} | {:error, any()}

Get all invoices belonging to a certain order.

Link to this function cancel(invoice_id, p_client_config \\ :from_app_config) View Source
cancel(invoice_id(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, t()} | {:error, any()}

Cancel an invoice.

Link to this function close(invoice_id, p_client_config \\ :from_app_config) View Source
close(invoice_id(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, t()} | {:error, any()}

Close an invoice.

Link to this function create(invoice, p_client_config \\ :from_app_config) View Source
create(t(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, t()} | {:error, any()}

Create invoice on the Apruve system.

The invoice_items field of the %Apruve.Invoice{} struct should be a list of %Apruve.InvoiceItem{}.

Link to this function from_json(json_string) View Source
from_json(String.t()) ::
  {:ok, Apruve.Invoice.t()} | {:error, :could_not_make_struct_from_json}

Invoice struct from JSON string.

Link to this function get(invoice_id, p_client_config \\ :from_app_config) View Source
get(invoice_id(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, t()} | {:error, any()}
Link to this function issue(invoice_id, p_client_config \\ :from_app_config) View Source
issue(invoice_id(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, t()} | {:error, any()}

Issue an already existing invoice.

Link to this function to_json(invoice) View Source
to_json(%Apruve.Invoice{
  amount_cents: term(),
  amount_due: term(),
  created_at: term(),
  currency: term(),
  due_at: term(),
  final_state_at: term(),
  id: term(),
  invoice_items: term(),
  issue_on_create: term(),
  issued_at: term(),
  links: term(),
  merchant_invoice_id: term(),
  merchant_notes: term(),
  opened_at: term(),
  order_id: term(),
  payments: term(),
  shipping_cents: term(),
  status: term(),
  tax_cents: term()
}) :: {:ok, String.t()} | {:error, any()}

JSON string from Invoice struct.

Link to this function update(invoice, p_client_config \\ :from_app_config) View Source
update(t(), Apruve.ClientConfig.t() | :from_app_config) ::
  {:ok, t()} | {:error, any()}

Update an invoice on the Apruve system.