Apruve v0.1.0 Apruve.Shipment View Source

Module for Apruve shipments.

Link to this section Summary

Link to this section Types

Link to this type shipment_id() View Source
shipment_id() :: String.t()
Link to this type t() View Source
t() :: %Apruve.Shipment{
  amount_cents: term(),
  currency: term(),
  delivered_at: term(),
  id: term(),
  invoice_id: term(),
  merchant_notes: term(),
  merchant_shipment_id: term(),
  shipment_items: term(),
  shipped_at: term(),
  shipper: term(),
  shipping_cents: term(),
  status: term(),
  tax_cents: term(),
  tracking_number: term()
}

Link to this section Functions

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

Create shipment on the Apruve system.

In the Shipment struct:

shipped_at should be set to a DateTime struct or an ISO 8601 string. E.g. “2018-01-27T12:48:34Z”. status should be set to “fulfilled” or “partial”.

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

Shipment struct from JSON string.

Link to this function get_by_invoice_id_and_shipment_id(invoice_id, shipment_id, p_client_config \\ :from_app_config) View Source
get_by_invoice_id_and_shipment_id(
  Apruve.Invoice.invoice_id(),
  shipment_id(),
  Apruve.ClientConfig.t() | :from_app_config
) :: {:ok, t()} | {:error, any()}
Link to this function to_json(shipment) View Source
to_json(%Apruve.Shipment{
  amount_cents: term(),
  currency: term(),
  delivered_at: term(),
  id: term(),
  invoice_id: term(),
  merchant_notes: term(),
  merchant_shipment_id: term(),
  shipment_items: term(),
  shipped_at: term(),
  shipper: term(),
  shipping_cents: term(),
  status: term(),
  tax_cents: term(),
  tracking_number: term()
}) :: {:ok, String.t()} | {:error, any()}

JSON string from Shipment struct.