StarlingBank.Receipts (StarlingBank v1.0.0)

Copy Markdown View Source

Receipts — attach itemized receipts (with optional photo attachments) to feed item transactions.

Required scopes: receipt:read, receipt:write, receipts:read, attachment:read.

Summary

Functions

Attaches an existing (or new) receipt to a specific feed item / transaction.

Creates a standalone receipt (not yet attached to a transaction).

Fetches a receipt by UID.

Downloads a receipt attachment's binary content by UID.

Lists receipts attached to a given feed item.

Uploads a binary attachment (e.g. photo of a receipt) and returns its attachment UID.

Functions

attach_to_transaction(feed_item_uid, attrs, client \\ nil)

@spec attach_to_transaction(
  String.t(),
  map(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, nil} | {:error, StarlingBank.Error.t()}

Attaches an existing (or new) receipt to a specific feed item / transaction.

create(attrs, client \\ nil)

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

Creates a standalone receipt (not yet attached to a transaction).

get(receipt_uid, client \\ nil)

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

Fetches a receipt by UID.

get_attachment(receipt_uid, attachment_uid, client \\ nil)

@spec get_attachment(
  String.t(),
  String.t(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, binary()} | {:error, StarlingBank.Error.t()}

Downloads a receipt attachment's binary content by UID.

list_for_transaction(feed_item_uid, client \\ nil)

@spec list_for_transaction(String.t(), StarlingBank.Client.t() | keyword() | nil) ::
  {:ok, map()} | {:error, StarlingBank.Error.t()}

Lists receipts attached to a given feed item.

upload_attachment(receipt_uid, binary, content_type, client \\ nil)

@spec upload_attachment(
  String.t(),
  binary(),
  String.t(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, map()} | {:error, StarlingBank.Error.t()}

Uploads a binary attachment (e.g. photo of a receipt) and returns its attachment UID.